-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Staggered thermo-mechanical phase-field #2102
Staggered thermo-mechanical phase-field #2102
Conversation
d48f361
to
1c44568
Compare
@xingyuanmiao You can merge my PR to your branch for this PR. |
int mechanics_related_process_id = 0; | ||
int phase_field_process_id = 0; | ||
int heat_conduction_process_id = 0; | ||
if (use_monolithic_scheme) // monolithic scheme. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you did not implement the monolithic scheme, I'd replace these code parts with OGS_FATAL
calls with explanatory messages.
Update: Since you actually have implemented the monolithic scheme, it might be worth keep it, but you have to add ctests for that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An OGS_FATAL is already in line 43 for the monolithic scheme. If the monolithic scheme is not interesting for solving of coupled TMPh problems , all monolithic scheme related stuff in this PR can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Wenqing, judging by my experience on testing specific cases for model verification and applications, the monolithic scheme is not an efficient method for solving complex cases.
MathLib::KelvinVector::KelvinVectorDimensions< | ||
DisplacementDim>::value; | ||
ip_data.eps.setZero(kelvin_vector_size); | ||
ip_data.eps_prev.setZero(kelvin_vector_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialization of the _prev
quantities is not necessary. Better to use resize
like it is done in PhaseFieldProcess. Initialization of these quantities conseils improper "push_back_state" implementation or other initial conditions implementation. ✔️
typename BMatricesType::KelvinVectorType eps_m, eps_m_prev; | ||
|
||
typename BMatricesType::KelvinVectorType sigma_tensile, sigma_compressive, | ||
sigma_real_prev, sigma_real; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see where the sigma_real_prev
is used; could you show me its usage, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question, just for understanding: What does the _real
postfix mean? Probably it is not about complex numbers, but then there might be a better (more descriptive) name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the _real need to be changed, then it should also be renamed in the PhaseField process for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2103 ✔️
typename BMatricesType::KelvinVectorType sigma_tensile, sigma_compressive, | ||
sigma_real_prev, sigma_real; | ||
double strain_energy_tensile, elastic_energy; | ||
typename ShapeMatrixType::GlobalDimVectorType heatflux, heatflux_prev; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also could not find the usage of heatflux_prev
. Am I missing something obvious?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the pushBackState.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen, that there is an assignment to that variable, but where is it read?
Same question goes on for the history_variable_prev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The history_variable_prev question is not addressed. ✔️
{ | ||
if (history_variable_prev < history_variable) | ||
{ | ||
history_variable_prev = history_variable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: could also be
history_variable_prev = std::max(history_variable_prev, history_variable);
For the curious minds, this indeed produces no branches and one less assembly instruction, compared to the if-clause implementation. ✔️
using Invariants = MathLib::KelvinVector::Invariants< | ||
MathLib::KelvinVector::KelvinVectorDimensions< | ||
DisplacementDim>::value>; | ||
double const epsm_trace = Invariants::trace(eps_m); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eps_m_trace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name has been changed.
typename ShapeMatrixType::GlobalDimNodalMatrixType dNdx; | ||
|
||
typename BMatricesType::KelvinVectorType eps, eps_prev; | ||
typename BMatricesType::KelvinVectorType eps_m, eps_m_prev; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I don't see usage of eps_m_prev aside of copying and initialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the unused parameters are removed. BTW: it was used for updating the mechanical strain.
|
||
#include "CreateThermoMechanicalPhaseFieldProcess.h" | ||
|
||
#include <cassert> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check, which includes are needed (in all files), and remove the unnecessary ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you have found some other includes, but missed this cassert
include..... ✔️
|
||
auto const& sigma_real = _ip_data[ip].sigma_real; | ||
|
||
// auto const [&](member){ return _process_data.member(t, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all commented code parts or add a debugging description if something is needed for such a case. ✔️
adb9d1e
to
b916c7b
Compare
|
||
if (history_variable_prev < strain_energy_tensile) | ||
{ | ||
// INFO("History variable %g:", history_variable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these two INFOs are not needed, please remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed unnecessary INFOs.
|
||
// | ||
// temperature equation, temperature part; | ||
// temperature equation, phasefield part; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these comments needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments are used to distinguish the components of matrix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed unnecessary comments.
double const T_ip = N.dot(T); | ||
double const delta_T = T_ip - T0; | ||
// calculate real density | ||
double const rho_s = rho_sr * (1 - 3 * alpha * delta_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this density formula come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rho_s * (V_0 + dV) = rho_sr * V_0; dV = 3 * alpha * dT * V_0; rho_s = rho_sr / (1 + 3 * alpha * dT )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can either use this corrected formula by adding the above description as comment, or use rho_sr as rho_s directly.
|
||
#include "ThermoMechanicalPhaseFieldFEM.h" | ||
#include "ThermoMechanicalPhaseFieldProcessData.h" | ||
#include "ThermoMechanicalPhaseFieldProcess.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it to the line before #include <cassert>
. In other words, it should be the first include.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
*/ | ||
|
||
#include "ThermoMechanicalPhaseFieldProcess-impl.h" | ||
#include "ThermoMechanicalPhaseFieldProcess.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move #include "ThermoMechanicalPhaseFieldProcess.h"
to the line before #include "ThermoMechanicalPhaseFieldProcess-impl.h"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
std::vector<double>& local_Jac_data) | ||
{ | ||
using RhsVector = | ||
typename ShapeMatricesType::template VectorType<phasefield_size + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this function is for the monolithic scheme of phase-field thermomechanics, the size of RhsVector or JacobianMatrix should be temperature_size + phasefield_size + displacement_size
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only the staggered scheme is needed, you can remove this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is removed as well as the monolithic scheme.
|
||
double const d_dot_ip = N.dot(d_dot); | ||
|
||
local_rhs.template block<phasefield_size, 1>(phasefield_index, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
block
s with 1 columns are usually created using segment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
i, i * displacement_size / DisplacementDim) | ||
.noalias() = N; | ||
|
||
using Invariants = MathLib::KelvinVector::Invariants< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused typedef.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed all unused functions and definitions.
int DisplacementDim> | ||
void ThermoMechanicalPhaseFieldLocalAssembler<ShapeFunction, IntegrationMethod, | ||
DisplacementDim>:: | ||
assembleWithJacobian(double const t, std::vector<double> const& local_x, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not tested with the ctest, but should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the monolithic scheme is removed in current process.
There also are some doxygen warnings. see Parameter QA page https://jenkins.opengeosys.org/job/ufz/job/ogs/job/PR-2102/12/Doxygen/ |
@@ -0,0 +1,27 @@ | |||
AddTest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the PR description you mention four tests, but there are only two ctests: 3D_non-isothermal and 3D_beam_LARGE. Something is missing....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other two tests including the IGLU TES and thermal shock slab are added in ctests.
* the latest published benchmark book | ||
* "Thermo-Hydro-Mechanical-Chemical Processes in Fractured Porous Media: | ||
* Modelling and Benchmarking" | ||
* (Chapter 9.7 -- A Phase-Field Model for Brittle Fracturing of Thermo-Elastic Solids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a proper bibtex reference into Documentation/bibliography.bib
and \cite
it here. ✔️
@@ -439,7 +439,7 @@ void ThermoMechanicalPhaseFieldLocalAssembler<ShapeFunction, IntegrationMethod, | |||
double const T_ip = N.dot(T); | |||
double const delta_T = T_ip - T0; | |||
// calculate real density | |||
double const rho_s = rho_sr * (1 - 3 * alpha * delta_T); | |||
double const rho_s = rho_sr / (1 + 3 * alpha * delta_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change not reflected in the ctests? There must be a significant difference, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- body force is not considered in current testing cases.
- under the present values of parameters, the density does not have large changes.
@@ -0,0 +1 @@ | |||
An optional input to select the coupling scheme. The monolithic scheme is currently not verified for THERMO_MECHANICAL_PHASE_FIELD. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The monolithic scheme must be validated and verified in this PR. Then the second comment can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the monolithic scheme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the monolithic scheme is removed, this is then also obsolete...
Update: Maybe not clear; by "this" I mean the tag <coupling_scheme>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the coupling_scheme option is removed.
@@ -0,0 +1 @@ | |||
Residual thermal conductivity represents the property of left medium in cracked region. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably "left" is not right, but "remaining".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was rephrased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this PR as long as my last four comments are addressed.
DIFF_DATA | ||
expected_beam3d_pcs_2_ts_1_t_10.000000.vtu beam3d_pcs_2_ts_1_t_10.000000.vtu displacement displacement 1e-5 0 | ||
expected_beam3d_pcs_2_ts_1_t_10.000000.vtu beam3d_pcs_2_ts_1_t_10.000000.vtu phasefield phasefield 1e-6 0 | ||
expected_beam3d_pcs_2_ts_1_t_10.000000.vtu beam3d_pcs_2_ts_1_t_10.000000.vtu temperature temperature 1e-6 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heat flux is output but its components are all zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be nice to take one benchmark from PhaseField and test it with homogeneous temperature field by this implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the benchmark for comparison of pure mechanical phasefield is added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you tell the name of the benchmark, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ThermoMechanicalPhaseField_3D_non-isothermal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ThermoMechanicalPhaseField_3D_non-isothermal --> ThermoMechanicalPhaseField_3D_isothermal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
double const T_ip = N.dot(T); | ||
double const delta_T = T_ip - T0; | ||
// calculate real density | ||
double const rho_s = rho_sr / (1 + 3 * alpha * delta_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment for another rho_s
double const T_dot_ip = N.dot(T_dot); | ||
double const delta_T = T_ip - T0; | ||
// calculate real density | ||
double const rho_s = rho_sr * (1 - 3 * alpha * delta_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct it or use rho_sr as rho_s directly. For solid of geomaterials or metal, the factor 1 / (1 +3 * alpha * dT) to their density are tiny.
f71feac
to
c332b0a
Compare
fbdfc94
to
e56c47e
Compare
Technically the PR is OK. All code parts are exercised by the tests and the complex tests look reasonable. |
OpenGeoSys development has been moved to GitLab. |
The thermo-mechanical phase-field process is implemented. The implementation includes the following tests: a 3D beam undergoing thermal shrinkage, a 3D cube for homogeneous damage; two large tests, one for iglu project, one for thermal shock testing.