OGS
GetFluidDensityAndViscosity.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
9
10namespace MaterialPropertyLib
11{
12
13double getFluidDensity(double const t, double const dt,
15 Phase const& fluid_phase, VariableArray& vars)
16{
17 // Compute density:
18 // Quick workaround: If fluid density is described as ideal gas, then
19 // the molar mass must be passed to the MPL::IdealGasLaw via the
20 // variable_array and the fluid must have the property
21 // MPL::PropertyType::molar_mass. For other density models (e.g.
22 // Constant), it is not mandatory to specify the molar mass.
24 {
25 vars.molar_mass =
27 .template value<double>(vars, pos, t, dt);
28 }
29
31 .template value<double>(vars, pos, t, dt);
32}
33
34std::tuple<double, double> getFluidDensityAndViscosity(
35 double const t, double const dt, ParameterLib::SpatialPosition const& pos,
36 MaterialPropertyLib::Phase const& fluid_phase,
38{
39 auto const fluid_density = getFluidDensity(t, dt, pos, fluid_phase, vars);
40
41 assert(fluid_density > 0.);
42 vars.density = fluid_density;
43
44 auto const viscosity =
46 .template value<double>(vars, pos, t, dt);
47
48 return {fluid_density, viscosity};
49}
50
51} // namespace MaterialPropertyLib
Property const & property(PropertyType const &p) const
Definition Phase.cpp:44
bool hasProperty(PropertyType const &p) const
Definition Phase.cpp:60
std::tuple< double, double > getFluidDensityAndViscosity(double const t, double const dt, ParameterLib::SpatialPosition const &pos, MaterialPropertyLib::Phase const &fluid_phase, MaterialPropertyLib::VariableArray &vars)
It computes fluid density and viscosity for single phase flow model.
double getFluidDensity(double const t, double const dt, ParameterLib::SpatialPosition const &pos, Phase const &fluid_phase, VariableArray &vars)
It computes fluid density for single phase flow model.