-
8000
-
Notifications
You must be signed in to change notification settings - Fork 239
TH monolithic process #1534
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
TH monolithic process #1534
Conversation
372322b
to
be12ae1
Compare
thermal_conductivity_fluid.name.c_str()); | ||
|
||
// Parameter for the thermal expansion coefficient. | ||
auto& thermal_expansion_coefficient = findParameter<double>( |
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.
of solid or fluid?
double density_water_T = density_fluid * (1 - beta * delta_T); | ||
// TODO include viscosity computations via material lib | ||
// double const viscosity = viscosity0 * std::exp(- delta_T/75.0); | ||
double hydraulic_conductivity = intrinsic_permeability / viscosity0; |
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 not hydraulic conductivity. K=rho*g*k/mu
// Process variable. | ||
auto process_variables = findProcessVariables( | ||
variables, config, | ||
{"temperature_variable", "pressure_variable"}); // configure two Pcs |
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: can be shortly "temperature" and "pressure"
intrinsic_permeability.name.c_str()); | ||
|
||
// Parameter for the storage. | ||
auto& storage = findParameter<double>( |
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: HM process uses "sepcific_storage" for this
DBUG("Use \'%s\' as storage parameter.", storage.name.c_str()); | ||
|
||
// Parameter for the reference_temperature. | ||
auto& reference_temperature = findParameter<double>( |
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: the name can be more specific, since it will be used in the fluid density model.
* | ||
*/ | ||
|
||
#ifndef PROCESS_LIB_CREATE_DensityDrivenFlowPROCESS_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.
why not all upper case characters?
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 an appropriate process name is choosen I'll will update the guards using upper case characters.
@@ -338,6 +339,13 @@ void ProjectData::parseProcesses(BaseLib::ConfigTree const& processes_config, | |||
"dimension"); | |||
} | |||
} | |||
else if (type == "DensityDrivenFlow") |
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: It might be better to make the process name more specific. In general, density driven flow occurs due to solute concentration gradient or temperature gradient. So far this process targets only the temperature gradient.
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.
Is the name ThermalConvection
better suited? If so, I'll rename the process at the end of the review.
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.
ThermalConvection
is ok. alternative is ThermohalineFlow
. @fabienma how do you think?
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.
Just discussed with Fabien: Thermohaline would be fine if we had mass transport included. At this stage we should first decide how to handle the processes. Should we implement one process with the possibility to switch between thermal convection and thermaohaline convection or should there be two implementations?
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 talked with Fabien. this should be discussed with @WaltherM. If there is no specific plan to implement thermaohaline convection including mass transport, I would suggest name it as thermal convection at the moment.
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 think Thermohaline will eventually be implemented. Let us decide together with @WaltherM
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.
Hi all, I just discussed with @TomFischer and think, that we should call its something like HT, HC, or HTC. ´´´DensityDrivenFlow´´´ is not complete in its description, as we may have additional variables to change, like viscosity. Also, the processes may simply be used with constant variables for "simple" solute/heat transport.
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.
yes, this settles any confusion. Will it be then HTC with the option to switch from HTC to HC / HT or we keep 3 separates implementations?
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.
@TomFischer said, that theoretically, you could run an HTC implementation as a purely HT setup, but this would not be as high-performing as an HT implementation. So he suggested to have several implementation. This would also fit into our development schedule, ie to build upon successive work any next step of complexity (eg HT -> HC -> HTC -> H_unsatTC).
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.
Nice and clean. see you later.
// double const viscosity = viscosity0 * std::exp(- delta_T/75.0); | ||
double hydraulic_conductivity = intrinsic_permeability / viscosity0; | ||
|
||
auto p_nodal_values = Eigen::Map<const Eigen::VectorXd>( |
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: this line should be done before the integration point loop.
No critical points in the code. Some parameter/variable names should be corrected because they are unspecific or wrong. Minor comments can be ignored if you don't like. |
BTW current implementation doesn't get benefit of monolithic coupling because there is no coupling term in the equations, i.e. same as partitioned coupling. But I guess you will introduce some coupling terms later on. |
last thing and this is also minor comment: I think you can remove all |
/* with Oberbeck-Boussing assumption density difference only exists | ||
* in buoyancy effects */ | ||
|
||
// velocity computed for output. |
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 velocity for output have been calculated again in computeSecondaryVariableConcrete. Otherwise, the output velocity is from the previous nonlinear iteration or from the previous time step. Therefore following loop has be move to computeSecondaryVariableConcrete too.
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 will be done in a subsequent PR which also uses the implementations of the material properties stuff from MaterialLib
.
sm.dNdx; | ||
Mtt.noalias() += | ||
integral_term * sm.N.transpose() * heat_capacity * sm.N; | ||
Mpp.noalias() += integral_term * sm.N.transpose() * storage * sm.N; |
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.
Fluid thermal expansion term (related to drho_l/dT) in fluid flow equation is missing. Of course, it can be added easily later.
auto const beta = | ||
_process_data.thermal_expansion_coefficient(t, pos)[0]; | ||
|
||
auto const body_force = _process_data.specific_body_force(t, pos); |
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 can be moved outside the integration loop. Also, it is not body force, it is for the gravitational term of the Darcy velocity and it is homogeneous constant. I suggest to introduce two constants as that in LiquidFlow
https://github.com/ufz/ogs/blob/master/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler.h#L188.
The input syntax for the two constants are
https://github.com/ufz/ogs-data/blob/9f817e0221d4b19de2e053898c4cec5c50c0d98c/Parabolic/LiquidFlow/GravityDriven/gravity_driven.prj#L12
Then the computation for this term in the current implementation is simplified as
if (_process_data.has_gravity)
+ velocity[_gravitational_axis_id] += hydraulic_conductivity * density_water_T * _gravitational_acceleration ;
Also the anisotropicity of the permeability can be handled easily with the two constants.
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, it is not body force, it is for the gravitational term of the Darcy velocity and it is homogeneous constant.
A body force is a force that acts throughout a volume. In my opinion gravity is a body force. I am unsure what do you mean by homogeneous constant. Here the body_force
it is not a scalar, it is a vector.
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 mean a constant vector. I think it is the gravity vector, since the density is not included in the input. If it is called body_force, one may make a mistake by inputting (0, 0, rho*g) for it.
Since rho can vary, that type of input for LiuidFlowProcess just means 'gravity vector component in i direction'.
specific_heat_capacity_fluid.name.c_str()); | ||
|
||
// Parameter for the thermal conductivity of the solid. | ||
auto& thermal_conductivity_solid = findParameter<double>( |
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.
Add a comment that only isotropic thermal conductivity is considered.
DBUG("Use \'%s\' as porosity parameter.", porosity.name.c_str()); | ||
|
||
// Parameter for the intrinsic permeability. | ||
auto& intrinsic_permeability = findParameter<double>( |
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.
Add a comment that only isotropic permeability is considered.
be12ae1
to
ec925d0
Compare
Yes, I know that the coupling terms are missing. As far as I understand, Tianyuan started with the Overbeck-Boussinesq approximation where it is assumed that the density difference is only in buoyancy effect. |
I think the CMakeLists.txt in ProcessLib/DensityDrivenFlow is not needed. ✅ |
DBUG("Use \'%s\' as thermal expansion coefficient of the fluid parameter.", | ||
thermal_expansion_coefficient_fluid.name.c_str()); | ||
|
||
// Specific body force parameter. |
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.
There is a more correct version of reading this; see HM process creation
Was my mistake to make body forces a parameter in the first place.
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 creation of the HM process there is an dimension information via template parameter used to create the Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
. To implement the creation of specific_body_force
analogous here would require an compile time (since template argument) mechanism to find out the dimension. This is possible but would need larger changes. If this is desired, I would change this in a subsequent PR.
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 don't mind if you change it in another PR. FYI, an easy solution without using template parameter could be to declare specific_body_force
as Eigen::Vector3d
and access it with specific_body_force.head(mesh.getDimension())
or specific_body_force.head<GlobalDim>()
.
using LocalAssemblerTraits = | ||
ProcessLib::LocalAssemblerTraits<ShapeMatricesType, | ||
ShapeFunction::NPOINTS, NUM_NODAL_DOF, | ||
/* number of pcs vars */ GlobalDim>; |
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 comment might be superfluous
_process_data.thermal_conductivity_solid(t, pos)[0]; | ||
auto const thermal_conductivity_fluid = | ||
_process_data.thermal_conductivity_fluid(t, pos)[0]; | ||
double thermal_conductivity = |
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.
const?
|
||
auto velocity = (- perm_visc * | ||
(sm.dNdx * p_nodal_values - density_water_T * b)) | ||
.eval(); |
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 please give the concrete type for velocity (also const) and drop the eval?
density_fluid * specific_heat_capacity_fluid); | ||
Kpp.noalias() += | ||
integral_term * sm.dNdx.transpose() * | ||
/* Real_hydraulic_conductivity */ perm_visc * |
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 comment is probably no longer needed.
(sm.dNdx * p_nodal_values - density_water_T * b)) | ||
.eval(); | ||
|
||
auto const integral_term = sm.detJ * wp.getWeight(); |
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.
integral measure for axialsymmetric case is missing; See GWF FEM
pv.getShapeFunctionOrder(), _local_assemblers, | ||
mesh.isAxiallySymmetric(), integration_order, _process_data); | ||
|
||
/* _secondary_variables.addSecondaryVariable( |
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 explain in a comment why we need this to be commented out. Potentially add a todo if this is needed in later improvements.
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 comments only.
ec925d0
to
6e68769
Compare
Jenkins: OGS-6/Linux-PRs-dynamic failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs-dynamic/1724/ |
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.
only the name of body force. You can keep it if you think it is Ok.
Thanks for the comments and discussions. I rebased, cleaned up the history and renamed the process to HT. |
6e68769
to
3f4bad2
Compare
👍 if tests are working |
3f4bad2
to
9f1bbf7
Compare
Jenkins: OGS-6/Linux-PRs-dynamic failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs-dynamic/1748/ |
Forgot to update the data repo. Jenkins test this please. |
9f1bbf7
to
1ca329b
Compare
OpenGeoSys development has been moved to GitLab. |
Tianyuan and I implemented the TH process. The implementation has at the moment one test for constant viscosity case. Next step will be including the laws from material lib and at least one benchmarks for variable viscosity will be prepared.