8000 TH monolithic process by TomFischer · Pull Request #1534 · ufz/ogs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 7 commits into from
Nov 18, 2016
Merged

TH monolithic process #1534

merged 7 commits into from
Nov 18, 2016

Conversation

TomFischer
Copy link
Member

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.

@TomFischer TomFischer force-pushed the TH-monolithic branch 2 times, most recently from 372322b to be12ae1 Compare November 11, 2016 07:36
thermal_conductivity_fluid.name.c_str());

// Parameter for the thermal expansion coefficient.
auto& thermal_expansion_coefficient = findParameter<double>(
Copy link
Collaborator

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;
Copy link
Collaborator

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
Copy link
Collaborator

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>(
Copy link
Collaborator

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>(
Copy link
Collaborator

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_
Copy link
Collaborator

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?

Copy link
Member Author

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")
Copy link
Collaborator
@norihiro-w norihiro-w Nov 11, 2016

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.

Copy link
Member Author

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.

Copy link
Collaborator

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?

Copy link
Member Author

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?

Copy link
Collaborator

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.

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

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.

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?

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).

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>(
Copy link
Collaborator
@norihiro-w norihiro-w Nov 11, 2016

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.

@norihiro-w
Copy link
Collaborator

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.

@norihiro-w
Copy link
Collaborator

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.

@norihiro-w
Copy link
Collaborator
norihiro-w commented Nov 11, 2016

last thing and this is also minor comment: I think you can remove all hasGravity checks. You cann't make density driven flow without gravity effects. ✅

/* with Oberbeck-Boussing assumption density difference only exists
* in buoyancy effects */

// velocity computed for output.
Copy link
Member

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.

Copy link
Member Author

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;
Copy link
Member

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);
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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>(
Copy link
Member

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>(
Copy link
Member

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.

@TomFischer
Copy link
Member Author

@norihiro-w

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.

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.

@endJunction endJunction mentioned this pull request Nov 15, 2016
@endJunction
Copy link
Member
endJunction commented Nov 15, 2016

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.
Copy link
Member
@endJunction endJunction Nov 15, 2016

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.

Copy link
Member Author

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.

Copy link
Collaborator

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>().

F438
using LocalAssemblerTraits =
ProcessLib::LocalAssemblerTraits<ShapeMatricesType,
ShapeFunction::NPOINTS, NUM_NODAL_DOF,
/* number of pcs vars */ GlobalDim>;
Copy link
Member

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 =
Copy link
Member

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();
Copy link
Member

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 *
Copy link
Member

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();
Copy link
Member

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(
Copy link
Member

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.

Copy link
Member
@endJunction endJunction left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments only.

@ogsbot
Copy link
Member
ogsbot commented Nov 17, 2016

Jenkins: OGS-6/Linux-PRs-dynamic failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs-dynamic/1724/

Copy link
Member
@wenqing wenqing left a 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.

@TomFischer
Copy link
Member Author

Thanks for the comments and discussions. I rebased, cleaned up the history and renamed the process to HT.

@norihiro-w
Copy link
Collaborator

👍 if tests are working

@ogsbot
Copy link
Member
ogsbot commented Nov 18, 2016

Jenkins: OGS-6/Linux-PRs-dynamic failed: https://svn.ufz.de:8443/job/OGS-6/job/Linux-PRs-dynamic/1748/

@TomFischer
Copy link
Member Author

Forgot to update the data repo. Jenkins test this please.

@TomFischer TomFischer merged commit 6556c59 into ufz:master Nov 18, 2016
@TomFischer TomFischer deleted the TH-monolithic branch November 18, 2016 08:09
@ogsbot
Copy link
Member
ogsbot commented Jun 19, 2020

OpenGeoSys development has been moved to GitLab.

See this pull request on GitLab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0