-
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
Balance for HT process #2132
Balance for HT process #2132
Conversation
829473b
to
100c15f
Compare
3ab0a3c
to
d64bad6
Compare
ProcessLib/HT/HTFEM.h
Outdated
fe.computeShapeFunctions(pnt_local_coords.getCoords(), shape_matrices, | ||
GlobalDim, false); | ||
std::vector<double> flux; | ||
flux.resize(3); |
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.
One could move it down to near the return statement.
I'd say, that returning a Eigen::Vector3d is safer, then the std::vector...
ProcessLib/HT/HTFEM.h
Outdated
NumLib::shapeFunctionInterpolate(local_x, shape_matrices.N, T_int_pt, p_int_pt); | ||
|
||
// set the values into array vars | ||
vars[static_cast<int>(MaterialLib::Fluid::PropertyVariableType::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.
Would it make sense to pass the vars[T] directly to shapeFunctionInterpolate call?
NumLib::shapeFunctionInterpolate(local_x, shape_matrices.N,
vars[static_cast<int>(MaterialLib::Fluid::PropertyVariableType::T)],
vars[static_cast<int>(MaterialLib::Fluid::PropertyVariableType::p)]);
ProcessLib/HT/HTFEM.h
Outdated
MaterialLib::Fluid::FluidPropertyType::Density, vars); | ||
auto const b = this->_material_properties.specific_body_force; | ||
// here it is assumed that the vector b is directed 'downwards' | ||
q += K_over_mu * rho_w * b; |
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'm not getting the intentions of the comment. What is 'downwards'? Maybe it's copied from some other context...
ProcessLib/HT/HTProcess.cpp
Outdated
DBUG("This is the thermal part of the staggered HTProcess."); | ||
return; | ||
} | ||
if (_balance_mesh) // computing the balance is optional |
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 (!_balance_mesh)
{
return;
}
ProcessLib/HT/HTProcess.cpp
Outdated
auto* const balance_pv = MeshLib::getOrCreateMeshProperty<double>( | ||
*_balance_mesh, _balance_pv_name, MeshLib::MeshItemType::Cell, 1); | ||
// initialise the PropertyVector pv with zero values | ||
std::fill(balance_pv->begin(), balance_pv->end(), 0.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.
Not sure here;
If the properties are set, then use NaN for initialization. If the properties are '+='-ed, then setting them 0 is of course necessary.
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 properties are '+='-ed.
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.
Smaller comments, mostly for discussion.
Didn't look into the ctests.
Needed for the description of the balance data.
59a9966
to
3901500
Compare
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.
Two small comments and two bigger ones:
- time dependence?
- mass vs. heat flux?
@@ -105,7 +105,7 @@ class LocalAssemblerData : public GroundwaterFlowLocalAssemblerInterface | |||
/// Computes the flux in the point \c p_local_coords that is given in local | |||
/// coordinates using the values from \c local_x. | |||
// TODO add time dependency | |||
std::vector<double> getFlux( |
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.
Isn't the flux 2D in two dimentsions?
ProcessLib/HT/HTFEM.h
Outdated
@@ -88,6 +88,73 @@ class HTFEM : public HTLocalAssemblerInterface | |||
return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size()); | |||
} | |||
|
|||
/// Computes the flux in the point \c pnt_local_coords that is given in | |||
/// local coordinates using the values from \c local_x. | |||
// TODO add time dependency |
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.
Yep, that would be nice (for the sake of completeness). Could you please add it now?
ProcessLib/HT/HTFEM.h
Outdated
auto const K = | ||
this->_material_properties.porous_media_properties | ||
.getIntrinsicPermeability(t, pos) | ||
.getValue(t, pos, 0.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.
Is the 0.0
correct here?
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, I think so.
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.
OK, class Permeability
says that this can have an arbitrary value.
ProcessLib/HT/HTFEM.h
Outdated
} | ||
|
||
Eigen::Vector3d flux; | ||
flux.head(GlobalDim) = q; |
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.
Maybe here the templated version head>GlobalDim>()
would be a tiny bit better.
And I see: That's why flux is always 3D.
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.
Regarding the flux being 3D always: I thought it would be easier in general to be it of constant size, like the node coordinates.
flux.head<GlobalDim>()
would be better, that's true!
ProcessLib/HT/HTFEM.h
Outdated
/// Computes the flux in the point \c pnt_local_coords that is given in | ||
/// local coordinates using the values from \c local_x. | ||
// TODO add time dependency | ||
Eigen::Vector3d getFlux( |
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.
For the HT process the problem is that there are potentially two different interesting fluxes:
The mass/volume flux and the heat flux.
Maybe there should be different names for them?
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.
Or one could pass the variable_id to getFlux?
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 are right, there are potentially two different interesting fluxes. Maybe other processes have also interesting quantities fluxes. For this reason we would need rather general names. I opened an issue for discussion and for the time being I would keep the implementation of this PR. Is this okay for you?
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.
OK.
3901500
to
a823565
Compare
Added the time to all getFlux and the balance functions, see commit a823565. For the second bigger comment I added the issue https://github.com/ufz/ogs/issues/2134 for discussion. |
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.
👍 thanks for the changes.
a823565
to
dd8c5ca
Compare
OpenGeoSys development has been moved to GitLab. |
PR implements getFlux in the in the class HTProcess and the local assembler for the HT process. The new feature is checked by two new test cases.