Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
amfe
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aerospace and Mechanical Engineering
amfe
Commits
6da14526
Commit
6da14526
authored
3 years ago
by
Adrien Crovato
Browse files
Options
Downloads
Patches
Plain Diff
Add verbosity level
parent
0ec92c71
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!6
amfe v1.0.5
Pipeline
#6200
passed
3 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tbox/src/wLinesearch.cpp
+13
-13
13 additions, 13 deletions
tbox/src/wLinesearch.cpp
tbox/src/wMshDeform.cpp
+18
-12
18 additions, 12 deletions
tbox/src/wMshDeform.cpp
tbox/src/wMshDeform.h
+2
-1
2 additions, 1 deletion
tbox/src/wMshDeform.h
with
33 additions
and
26 deletions
tbox/src/wLinesearch.cpp
+
13
−
13
View file @
6da14526
...
...
@@ -111,7 +111,7 @@ double FleuryLS::run()
double
phit
=
fct
.
eval
(
h
);
fevalIt
=
2
;
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Starting Backeting
\n
"
;
std
::
cout
<<
"
\t
"
<<
std
::
setprecision
(
16
)
<<
"phi1("
<<
0
<<
") = "
<<
phi1
<<
'\n'
;
...
...
@@ -128,14 +128,14 @@ double FleuryLS::run()
{
if
(
h
>
hU
)
{
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Positive slope detected (in ascending bracketing #1)!
\n
"
;
}
if
(
revAllowed
)
{
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Reverse Direction of Line Search (in ascending bracketing #1)!"
<<
"
\n
"
;
...
...
@@ -146,7 +146,7 @@ double FleuryLS::run()
}
else
{
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Error in ascending bracketing #1:
\n
"
<<
std
::
setprecision
(
16
)
<<
"a1="
<<
0
<<
" a2="
<<
h
<<
" a3 ="
<<
2.0
*
h
<<
'\n'
...
...
@@ -164,7 +164,7 @@ double FleuryLS::run()
phit
=
fct
.
eval
(
2
*
h
);
fevalIt
++
;
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Ascending bracketing iteration # "
<<
nB
<<
":
\n
"
;
std
::
cout
<<
"
\t
"
...
...
@@ -185,14 +185,14 @@ double FleuryLS::run()
{
if
(
h
<
hL
)
{
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Positive slope detected (in descending bracketing #2)!
\n
"
;
}
if
(
revAllowed
)
{
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Reverse Direction of Line Search (in descending bracketing #2) !"
<<
"
\n
"
;
...
...
@@ -203,7 +203,7 @@ double FleuryLS::run()
}
else
{
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Error in descending bracketing #2:
\n
"
<<
std
::
setprecision
(
16
)
<<
"a1="
<<
0
<<
" a2="
<<
h
<<
" a3 ="
<<
2.0
*
h
<<
'\n'
...
...
@@ -220,7 +220,7 @@ double FleuryLS::run()
phi3
=
phit
;
phit
=
fct
.
eval
(
h
/
2
);
fevalIt
++
;
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Descending bracketing iteration # "
<<
nB
<<
":
\n
"
;
std
::
cout
<<
"
\t
"
...
...
@@ -241,7 +241,7 @@ double FleuryLS::run()
double
a3
=
2
*
h
;
double
a4
=
h
*
(
4
*
phi2
-
3
*
phi1
-
phi3
)
/
(
4
*
phi2
-
2
*
phi1
-
2
*
phi3
);
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Backeting succeeds in "
<<
nB
<<
" iterations :
\n
"
;
std
::
cout
<<
"
\t
"
<<
std
::
setprecision
(
16
)
<<
"phi1("
<<
a1
<<
") = "
<<
phi1
<<
'\n'
;
...
...
@@ -276,7 +276,7 @@ double FleuryLS::run()
throw
std
::
runtime_error
(
msg
.
str
());
}
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Line search iteration # "
<<
nLS
<<
":
\n
"
;
std
::
cout
<<
"
\t
"
<<
std
::
setprecision
(
16
)
<<
"phi1("
<<
a1
<<
") = "
<<
phi1
<<
'\n'
;
...
...
@@ -319,7 +319,7 @@ double FleuryLS::run()
A
=
(
a2
-
a3
)
*
phi1
+
(
a3
-
a1
)
*
phi2
+
(
a1
-
a2
)
*
phi3
;
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"
\t
"
<<
std
::
setprecision
(
16
)
<<
"|A| = "
<<
fabs
(
A
)
<<
"><"
<<
tol
<<
'\n'
;
}
...
...
@@ -337,7 +337,7 @@ double FleuryLS::run()
(
A
);
}
if
(
verbose
>
2
)
if
(
verbose
>
3
)
{
std
::
cout
<<
"Line search succeeds in "
<<
nLS
<<
" iterations :
\n
"
;
std
::
cout
<<
"
\t
"
<<
std
::
setprecision
(
16
)
<<
"|A| = "
<<
fabs
(
A
)
<<
'\n'
;
...
...
This diff is collapsed.
Click to expand it.
tbox/src/wMshDeform.cpp
+
18
−
12
View file @
6da14526
...
...
@@ -32,10 +32,10 @@ using namespace tbox;
MshDeform
::
MshDeform
(
std
::
shared_ptr
<
MshData
>
_msh
,
std
::
shared_ptr
<
tbox
::
LinearSolver
>
_linsol
,
int
_nDim
,
int
nthrds
)
:
wSharedObject
(),
nDim
(
_nDim
),
nthreads
(
nthrds
),
field
(
false
),
fixed
(
false
),
moving
(
false
),
msh
(
_msh
),
linsol
(
_linsol
)
int
_nDim
,
int
nthrds
,
int
vrb
)
:
wSharedObject
(),
nDim
(
_nDim
),
nthreads
(
nthrds
),
verbose
(
vrb
),
field
(
false
),
fixed
(
false
),
moving
(
false
),
msh
(
_msh
),
linsol
(
_linsol
)
{
// Check problem dimension
if
(
nDim
!=
2
&&
nDim
!=
3
)
...
...
@@ -453,19 +453,24 @@ void MshDeform::deform()
Eigen
::
VectorXd
f
=
Eigen
::
VectorXd
::
Zero
(
nDim
*
mshSize
),
q
=
Eigen
::
VectorXd
::
Zero
(
nDim
*
mshSize
);
// Build stiffness matrix and RHS
std
::
cout
<<
"- Deforming mesh:
\n
"
<<
"assembling matrices... "
<<
std
::
flush
;
if
(
verbose
>
0
)
std
::
cout
<<
"- Deforming mesh:
\n
"
<<
"assembling matrices... "
<<
std
::
flush
;
this
->
build
(
K
);
this
->
build
(
f
);
std
::
cout
<<
"done"
<<
std
::
endl
;
if
(
verbose
>
0
)
std
::
cout
<<
"done"
<<
std
::
endl
;
// Solve the SoE
std
::
cout
<<
"solving equations... "
<<
std
::
flush
;
if
(
verbose
>
0
)
std
::
cout
<<
"solving equations... "
<<
std
::
flush
;
Eigen
::
Map
<
Eigen
::
VectorXd
>
f_
(
f
.
data
(),
f
.
size
()),
q_
(
q
.
data
(),
q
.
size
());
linsol
->
compute
(
K
,
f_
,
q_
);
std
::
cout
<<
"done (#it: "
<<
linsol
->
getIterations
()
<<
", error: "
<<
std
::
scientific
<<
linsol
->
getError
()
<<
std
::
fixed
<<
")"
<<
std
::
endl
;
if
(
verbose
>
0
)
std
::
cout
<<
"done (#it: "
<<
linsol
->
getIterations
()
<<
", error: "
<<
std
::
scientific
<<
linsol
->
getError
()
<<
std
::
fixed
<<
")"
<<
std
::
endl
;
// Update position
std
::
cout
<<
"updating mesh... "
<<
std
::
flush
;
if
(
verbose
>
0
)
std
::
cout
<<
"updating mesh... "
<<
std
::
flush
;
for
(
auto
n
:
msh
->
nodes
)
{
for
(
int
m
=
0
;
m
<
nDim
;
m
++
)
...
...
@@ -486,8 +491,9 @@ void MshDeform::deform()
e
->
update
();
for
(
auto
e
:
intBndElems
)
e
->
update
();
std
::
cout
<<
"done
\n
"
<<
std
::
endl
;
if
(
verbose
>
0
)
std
::
cout
<<
"done
\n
"
<<
std
::
endl
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
tbox/src/wMshDeform.h
+
2
−
1
View file @
6da14526
...
...
@@ -37,6 +37,7 @@ private:
size_t
mshSize
;
///< number of nodes in the mesh
int
nDim
;
///< dimension of the problem (2 or 3)
int
nthreads
;
///< number of threads
int
verbose
;
///< verbosity level
std
::
vector
<
int
>
rows
;
///< unknown local index
bool
field
;
///< flag to check if field has been added
bool
fixed
;
///< flag to check if at least one fixed boundary has been added
...
...
@@ -64,7 +65,7 @@ public:
std
::
shared_ptr
<
MshData
>
msh
;
///< mesh
std
::
shared_ptr
<
tbox
::
LinearSolver
>
linsol
;
///< linear (inner) solver
MshDeform
(
std
::
shared_ptr
<
MshData
>
_msh
,
std
::
shared_ptr
<
tbox
::
LinearSolver
>
_linsol
,
int
_nDim
,
int
nthrds
=
1
);
MshDeform
(
std
::
shared_ptr
<
MshData
>
_msh
,
std
::
shared_ptr
<
tbox
::
LinearSolver
>
_linsol
,
int
_nDim
,
int
nthrds
=
1
,
int
vrb
=
1
);
virtual
~
MshDeform
()
{
std
::
cout
<<
"~MshDeform()
\n
"
;
}
void
setField
(
std
::
string
const
&
fldName
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment