OGS
ProcessLib::LiquidFlow Namespace Reference

Classes

struct  IntegrationPointData
 
struct  LiquidFlowData
 
class  LiquidFlowLocalAssembler
 
class  LiquidFlowLocalAssemblerInterface
 
class  LiquidFlowProcess
 A class to simulate the single phase flow process in porous media described by the governing equation: More...
 

Enumerations

enum class  EquationBalanceType { volume , mass }
 Governing equation balance type. More...
 

Functions

void checkMPLProperties (MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map, bool const is_equation_type_volume)
 
EquationBalanceType covertEquationBalanceTypeFromString (std::string_view const type_in_string)
 
std::unique_ptr< ProcesscreateLiquidFlowProcess (std::string const &name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
 
std::tuple< double, double > getFluidDensityAndViscosity (double const t, double const dt, ParameterLib::SpatialPosition const &pos, MaterialPropertyLib::Phase const &fluid_phase, MaterialPropertyLib::VariableArray &vars)
 

Variables

const unsigned NUM_NODAL_DOF = 1
 

Enumeration Type Documentation

◆ EquationBalanceType

Governing equation balance type.

Enumerator
volume 
mass 

Definition at line 26 of file LiquidFlowData.h.

Function Documentation

◆ checkMPLProperties()

void ProcessLib::LiquidFlow::checkMPLProperties ( MeshLib::Mesh const & mesh,
MaterialPropertyLib::MaterialSpatialDistributionMap const & media_map,
bool const is_equation_type_volume )

Definition at line 32 of file CreateLiquidFlowProcess.cpp.

36{
38
39 std::array const required_medium_properties = {
44
45 std::array const required_liquid_properties = {
48
49 // Check Constant-type density.
50 if (is_equation_type_volume)
51 {
52 for (auto const& medium : media_map.media())
53 {
54 // auto const& medium = *media_map.getMedium(element_id);
55 auto const& fluid_phase_density =
57 if (typeid(fluid_phase_density) !=
59 {
61 "Since `equation_balance_type` is set to `volume`,the "
62 "phase density type must be `Constant`. Note: by "
63 "default, `equation_balance_type` is set to `volume`.");
64 }
65 }
66 }
67
68 for (auto const& medium : media_map.media())
69 {
70 checkRequiredProperties(*medium, required_medium_properties);
72 required_liquid_properties);
73 }
74 DBUG("Media properties verified.");
75}
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void checkMPLPhasesForSinglePhaseFlow(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
void checkRequiredProperties(Component const &c, std::span< PropertyType const > const required_properties)
Definition Component.cpp:60
Phase const & fluidPhase(Medium const &medium)
Returns a gas or aqueous liquid phase of the given medium.
Definition Medium.cpp:100

References MaterialPropertyLib::checkMPLPhasesForSinglePhaseFlow(), DBUG(), MaterialPropertyLib::density, MaterialPropertyLib::MaterialSpatialDistributionMap::media(), OGS_FATAL, MaterialPropertyLib::permeability, MaterialPropertyLib::porosity, MaterialPropertyLib::reference_temperature, MaterialPropertyLib::storage, and MaterialPropertyLib::viscosity.

Referenced by createLiquidFlowProcess().

◆ covertEquationBalanceTypeFromString()

EquationBalanceType ProcessLib::LiquidFlow::covertEquationBalanceTypeFromString ( std::string_view const type_in_string)

Definition at line 77 of file CreateLiquidFlowProcess.cpp.

79{
80 if (type_in_string == "volume")
81 {
82 return EquationBalanceType::volume;
83 }
84 if (type_in_string == "mass")
85 {
86 return EquationBalanceType::mass;
87 }
89 "The value of `equation_balance_type` must be either `volume` or "
90 "`mass`");
91};

References mass, OGS_FATAL, and volume.

Referenced by createLiquidFlowProcess().

◆ createLiquidFlowProcess()

std::unique_ptr< Process > ProcessLib::LiquidFlow::createLiquidFlowProcess ( std::string const & name,
MeshLib::Mesh & mesh,
std::unique_ptr< ProcessLib::AbstractJacobianAssembler > && jacobian_assembler,
std::vector< ProcessVariable > const & variables,
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & parameters,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::vector< std::unique_ptr< MeshLib::Mesh > > const & meshes,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )
Input File Parameter
prj__processes__process__type

Process Variables

Input File Parameter
prj__processes__process__LIQUID_FLOW__process_variables

Primary process variables as they appear in the global component vector:

Input File Parameter
prj__processes__process__LIQUID_FLOW__process_variables__process_variable

Process Parameters

Input File Parameter
prj__processes__process__LIQUID_FLOW__specific_body_force
Input File Parameter
prj__processes__process__calculatesurfaceflux
Input File Parameter
prj__processes__process__LIQUID_FLOW__linear
Input File Parameter
prj__processes__process__LIQUID_FLOW__equation_balance_type
Input File Parameter
prj__processes__process__LIQUID_FLOW__aperture_size
Input File Parameter
prj__processes__process__LIQUID_FLOW__aperture_size__parameter

Definition at line 93 of file CreateLiquidFlowProcess.cpp.

103{
105 config.checkConfigParameter("type", "LIQUID_FLOW");
106
107 DBUG("Create LiquidFlowProcess.");
108
110
112 auto const pv_config = config.getConfigSubtree("process_variables");
113
115 auto per_process_variables = findProcessVariables(
116 variables, pv_config,
117 {
118 "process_variable"});
119 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
120 process_variables;
121 process_variables.push_back(std::move(per_process_variables));
122
123 SecondaryVariableCollection secondary_variables;
124
125 ProcessLib::createSecondaryVariables(config, secondary_variables);
126
128 std::vector<double> const b =
130 config.getConfigParameter<std::vector<double>>("specific_body_force");
131 int const mesh_space_dimension =
133 if (static_cast<int>(b.size()) != mesh_space_dimension)
134 {
135 OGS_FATAL(
136 "specific body force (gravity vector) has {:d} components, but the "
137 "space dimension is {:d}.",
138 b.size(), mesh_space_dimension);
139 }
140
141 Eigen::VectorXd specific_body_force(b.size());
142 bool const has_gravity = MathLib::toVector(b).norm() > 0;
143 if (has_gravity)
144 {
145 std::copy_n(b.data(), b.size(), specific_body_force.data());
146 }
147
148 std::unique_ptr<ProcessLib::SurfaceFluxData> surfaceflux;
149 auto calculatesurfaceflux_config =
151 config.getConfigSubtreeOptional("calculatesurfaceflux");
152 if (calculatesurfaceflux_config)
153 {
155 *calculatesurfaceflux_config, meshes);
156 }
157
158 auto media_map =
160
161 auto const is_linear =
163 config.getConfigParameter<bool>("linear", false);
164 if (is_linear)
165 {
166 INFO("LiquidFlow process is set to be linear.");
167 }
168
169 auto const equation_balance_type_str =
171 config.getConfigParameter<std::string>("equation_balance_type",
172 "volume");
173
174 DBUG("Check the media properties of LiquidFlow process ...");
175 checkMPLProperties(mesh, media_map, equation_balance_type_str == "volume");
176 DBUG("Media properties verified.");
177
178 auto const* aperture_size_parameter = &ParameterLib::findParameter<double>(
180
181 auto const aperture_config =
183 config.getConfigSubtreeOptional("aperture_size");
184 if (aperture_config)
185 {
186 aperture_size_parameter = &ParameterLib::findParameter<double>(
188 *aperture_config, "parameter", parameters, 1);
189 }
190
191 // The uniqueness of phase has already been checked in
192 // `checkMPLProperties`.
193 MaterialPropertyLib::Variable const phase_variable =
194 (*ranges::begin(media_map.media()))->hasPhase("Gas")
197
198 LiquidFlowData process_data{
199 covertEquationBalanceTypeFromString(equation_balance_type_str),
200 std::move(media_map),
202 mesh_space_dimension, mesh.getDimension(), mesh.getElements()),
203 mesh_space_dimension,
204 std::move(specific_body_force),
205 has_gravity,
206 *aperture_size_parameter,
207 NumLib::ShapeMatrixCache{integration_order},
208 phase_variable};
209
210 return std::make_unique<LiquidFlowProcess>(
211 std::move(name), mesh, std::move(jacobian_assembler), parameters,
212 integration_order, std::move(process_variables),
213 std::move(process_data), std::move(secondary_variables),
214 std::move(surfaceflux), is_linear);
215}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:106
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:109
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:88
static PROCESSLIB_EXPORT const std::string constant_one_parameter_name
Definition Process.h:47
Handles configuration of several secondary variables from the project file.
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
std::vector< Eigen::MatrixXd > getElementRotationMatrices(int const space_dimension, int const mesh_dimension, std::vector< Element * > const &elements)
Element rotation matrix computation.
int getSpaceDimension(std::vector< Node * > const &nodes)
Computes dimension of the embedding space containing the set of given points.
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
Definition Utils.h:102
void checkMPLProperties(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map)
EquationBalanceType covertEquationBalanceTypeFromString(std::string_view const type_in_string)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)
static std::unique_ptr< ProcessLib::SurfaceFluxData > createSurfaceFluxData(BaseLib::ConfigTree const &calculatesurfaceflux_config, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes)

References BaseLib::ConfigTree::checkConfigParameter(), checkMPLProperties(), ProcessLib::Process::constant_one_parameter_name, covertEquationBalanceTypeFromString(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), ProcessLib::createSecondaryVariables(), ProcessLib::SurfaceFluxData::createSurfaceFluxData(), DBUG(), ParameterLib::findParameter(), ProcessLib::findProcessVariables(), MaterialPropertyLib::gas_phase_pressure, BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigSubtree(), BaseLib::ConfigTree::getConfigSubtreeOptional(), MeshLib::Mesh::getDimension(), MeshLib::getElementRotationMatrices(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getNodes(), MeshLib::getSpaceDimension(), INFO(), MaterialPropertyLib::liquid_phase_pressure, OGS_FATAL, and MathLib::toVector().

Referenced by ProjectData::parseProcesses().

◆ getFluidDensityAndViscosity()

std::tuple< double, double > ProcessLib::LiquidFlow::getFluidDensityAndViscosity ( double const t,
double const dt,
ParameterLib::SpatialPosition const & pos,
MaterialPropertyLib::Phase const & fluid_phase,
MaterialPropertyLib::VariableArray & vars )

Definition at line 18 of file LiquidFlowLocalAssembler.cpp.

22{
23 // Compute density:
24 // Quick workaround: If fluid density is described as ideal gas, then
25 // the molar mass must be passed to the MPL::IdealGasLaw via the
26 // variable_array and the fluid must have the property
27 // MPL::PropertyType::molar_mass. For other density models (e.g.
28 // Constant), it is not mandatory to specify the molar mass.
29 if (fluid_phase.hasProperty(MaterialPropertyLib::PropertyType::molar_mass))
30 {
31 vars.molar_mass =
33 .template value<double>(vars, pos, t, dt);
34 }
35
36 auto const fluid_density =
38 .template value<double>(vars, pos, t, dt);
39 assert(fluid_density > 0.);
40 vars.density = fluid_density;
41
42 auto const viscosity =
44 .template value<double>(vars, pos, t, dt);
45
46 return {fluid_density, viscosity};
47}

References MaterialPropertyLib::density, MaterialPropertyLib::VariableArray::density, MaterialPropertyLib::Phase::hasProperty(), MaterialPropertyLib::molar_mass, MaterialPropertyLib::VariableArray::molar_mass, MaterialPropertyLib::Phase::property(), and MaterialPropertyLib::viscosity.

Referenced by ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::assembleMatrixAndVector(), and ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::computeProjectedDarcyVelocity().

Variable Documentation

◆ NUM_NODAL_DOF

const unsigned ProcessLib::LiquidFlow::NUM_NODAL_DOF = 1

Definition at line 53 of file LiquidFlowLocalAssembler.h.