Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
Dmitri Naumov
ogs
Commits
213fff3c
Commit
213fff3c
authored
5 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[MatL] CreepBGRa; Faster residual/jac computation.
Also simplify the logic by removing the side effects.
parent
272e8bcb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MaterialLib/SolidModels/CreepBGRa.cpp
+14
-19
14 additions, 19 deletions
MaterialLib/SolidModels/CreepBGRa.cpp
with
14 additions
and
19 deletions
MaterialLib/SolidModels/CreepBGRa.cpp
+
14
−
19
View file @
213fff3c
...
@@ -74,31 +74,26 @@ CreepBGRa<DisplacementDim>::integrateStress(
...
@@ -74,31 +74,26 @@ CreepBGRa<DisplacementDim>::integrateStress(
dt
*
constant_coefficient
*
dt
*
constant_coefficient
*
std
::
exp
(
-
Q
/
(
MaterialLib
::
PhysicalConstant
::
IdealGasConstant
*
T
));
std
::
exp
(
-
Q
/
(
MaterialLib
::
PhysicalConstant
::
IdealGasConstant
*
T
));
// In newton_solver.solve(), the Jacobian is calculated first, and then
double
const
G2b
=
2.0
*
b
*
this
->
_mp
.
mu
(
t
,
x
);
// then comes the assembly of the residue vector. In order to save
// computation time, the following two variables are set visible in this
auto
const
update_jacobian
=
[
&
solution
,
&
G2b
,
&
n
](
JacobianMatrix
&
jacobian
)
{
// function. The two variables keep the computation results of the
auto
const
&
D
=
Invariants
::
deviatoric_projection
;
// norm of the deviatoric stress and 2bG||s_{n+1}||^{n-1} in
KelvinVector
const
s_n1
=
D
*
solution
;
// update_jacobian, and then they are directly used in update_residual
// without repeating the computation. Of course, update_jacobian is not a
// pure function anymore, but has side effects.
double
pow_norm_s_n1_n_minus_one_2b_G
=
0.
;
KelvinVector
s_n1
;
auto
const
update_jacobian
=
[
&
](
JacobianMatrix
&
jacobian
)
{
// side effect
s_n1
=
deviatoric_matrix
*
solution
;
double
const
norm_s_n1
=
Invariants
::
FrobeniusNorm
(
s_n1
);
double
const
norm_s_n1
=
Invariants
::
FrobeniusNorm
(
s_n1
);
double
const
G2b
=
2.0
*
b
*
this
->
_mp
.
mu
(
t
,
x
);
double
const
pow_norm_s_n1_n_minus_one_2b_G
=
// side effect
G2b
*
std
::
pow
(
norm_s_n1
,
n
-
1
);
pow_norm_s_n1_n_minus_one_2b_G
=
G2b
*
std
::
pow
(
norm_s_n1
,
n
-
1
);
jacobian
=
KelvinMatrix
::
Identity
()
+
jacobian
=
KelvinMatrix
::
Identity
()
+
(
pow_norm_s_n1_n_minus_one_2b_G
*
deviatoric_matrix
+
(
pow_norm_s_n1_n_minus_one_2b_G
*
D
+
(
n
-
1
)
*
G2b
*
std
::
pow
(
norm_s_n1
,
n
-
3
)
*
s_n1
*
(
n
-
1
)
*
G2b
*
std
::
pow
(
norm_s_n1
,
n
-
3
)
*
s_n1
*
s_n1
.
transpose
());
s_n1
.
transpose
());
};
};
auto
const
update_residual
=
[
&
](
ResidualVectorType
&
r
)
{
auto
const
update_residual
=
[
&
solution
,
&
G2b
,
&
n
,
&
sigma_try
](
ResidualVectorType
&
r
)
{
KelvinVector
const
s_n1
=
Invariants
::
deviatoric_projection
*
solution
;
double
const
norm_s_n1
=
Invariants
::
FrobeniusNorm
(
s_n1
);
double
const
pow_norm_s_n1_n_minus_one_2b_G
=
G2b
*
std
::
pow
(
norm_s_n1
,
n
-
1
);
r
=
solution
-
sigma_try
+
pow_norm_s_n1_n_minus_one_2b_G
*
s_n1
;
r
=
solution
-
sigma_try
+
pow_norm_s_n1_n_minus_one_2b_G
*
s_n1
;
};
};
...
...
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