Skip to content
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

Merged
merged 13 commits into from
May 31, 2018
Merged

Balance for HT process #2132

merged 13 commits into from
May 31, 2018

Conversation

TomFischer
Copy link
Member

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.

@TomFischer TomFischer force-pushed the BalanceForHTProcess branch from 829473b to 100c15f Compare May 28, 2018 05:50
@TomFischer TomFischer force-pushed the BalanceForHTProcess branch 2 times, most recently from 3ab0a3c to d64bad6 Compare May 28, 2018 09:42
fe.computeShapeFunctions(pnt_local_coords.getCoords(), shape_matrices,
GlobalDim, false);
std::vector<double> flux;
flux.resize(3);
Copy link
Member

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

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

@endJunction endJunction May 29, 2018

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)]);

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

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

DBUG("This is the thermal part of the staggered HTProcess.");
return;
}
if (_balance_mesh) // computing the balance is optional
Copy link
Member

Choose a reason for hiding this comment

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

if (!_balance_mesh)
{
    return;
}

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

The properties are '+='-ed.

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.

Smaller comments, mostly for discussion.
Didn't look into the ctests.

@TomFischer TomFischer force-pushed the BalanceForHTProcess branch from 59a9966 to 3901500 Compare May 30, 2018 10:23
Copy link
Collaborator

@chleh chleh left a 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(
Copy link
Collaborator

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?

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

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?

auto const K =
this->_material_properties.porous_media_properties
.getIntrinsicPermeability(t, pos)
.getValue(t, pos, 0.0,
Copy link
Collaborator

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think so.

Copy link
Collaborator

@chleh chleh May 30, 2018

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.

}

Eigen::Vector3d flux;
flux.head(GlobalDim) = q;
Copy link
Collaborator

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.

Copy link
Member

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!

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

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?

Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK.

@TomFischer TomFischer force-pushed the BalanceForHTProcess branch from 3901500 to a823565 Compare May 30, 2018 13:09
@TomFischer
Copy link
Member Author

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.

Copy link
Collaborator

@chleh chleh left a 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.

@TomFischer TomFischer force-pushed the BalanceForHTProcess branch from a823565 to dd8c5ca Compare May 31, 2018 03:54
@TomFischer TomFischer merged commit f2c767a into ufz:master May 31, 2018
@TomFischer TomFischer deleted the BalanceForHTProcess branch May 31, 2018 04:36
@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.

4 participants