OGS
ProcessLib::TH2M Namespace Reference

Namespaces

namespace  ConstitutiveRelations
 

Classes

struct  IntegrationPointData
 
struct  LocalAssemblerInterface
 
struct  SecondaryData
 
class  TH2MLocalAssembler
 
class  TH2MProcess
 
struct  TH2MProcessData
 

Functions

template<int DisplacementDim>
void createLocalAssemblers (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface< DisplacementDim > > > &local_assemblers, NumLib::IntegrationOrder const integration_order, bool const is_axially_symmetric, TH2MProcessData< DisplacementDim > &process_data)
 
template void createLocalAssemblers< 2 > (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface< 2 > > > &local_assemblers, NumLib::IntegrationOrder const integration_order, bool const is_axially_symmetric, TH2MProcessData< 2 > &process_data)
 
template void createLocalAssemblers< 3 > (std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface< 3 > > > &local_assemblers, NumLib::IntegrationOrder const integration_order, bool const is_axially_symmetric, TH2MProcessData< 3 > &process_data)
 
std::unique_ptr< ConstitutiveRelations::PhaseTransitionModelcreatePhaseTransitionModel (std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
 
template<int DisplacementDim>
std::unique_ptr< ProcesscreateTH2MProcess (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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
 
template std::unique_ptr< ProcesscreateTH2MProcess< 2 > (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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
 
template std::unique_ptr< ProcesscreateTH2MProcess< 3 > (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, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
 

Function Documentation

◆ createLocalAssemblers()

template<int DisplacementDim>
void ProcessLib::TH2M::createLocalAssemblers ( std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface< DisplacementDim > > > & local_assemblers,
NumLib::IntegrationOrder const integration_order,
bool const is_axially_symmetric,
TH2MProcessData< DisplacementDim > & process_data )

Definition at line 19 of file CreateTH2MLocalAssemblers.cpp.

27{
28 createLocalAssemblersHM<DisplacementDim, TH2MLocalAssembler>(
29 mesh_elements, dof_table, local_assemblers, integration_order,
30 is_axially_symmetric, process_data);
31}

◆ createLocalAssemblers< 2 >()

template void ProcessLib::TH2M::createLocalAssemblers< 2 > ( std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface< 2 > > > & local_assemblers,
NumLib::IntegrationOrder const integration_order,
bool const is_axially_symmetric,
TH2MProcessData< 2 > & process_data )

◆ createLocalAssemblers< 3 >()

template void ProcessLib::TH2M::createLocalAssemblers< 3 > ( std::vector< MeshLib::Element * > const & mesh_elements,
NumLib::LocalToGlobalIndexMap const & dof_table,
std::vector< std::unique_ptr< LocalAssemblerInterface< 3 > > > & local_assemblers,
NumLib::IntegrationOrder const integration_order,
bool const is_axially_symmetric,
TH2MProcessData< 3 > & process_data )

◆ createPhaseTransitionModel()

std::unique_ptr< ConstitutiveRelations::PhaseTransitionModel > ProcessLib::TH2M::createPhaseTransitionModel ( std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media)

Definition at line 33 of file CreateTH2MProcess.cpp.

35{
36 // the approach here is that the number of phase components determines the
37 // nature of the phase transition: If the gas phase consists of two or more
38 // components, evaporation is involved; if the water phase consists of at
39 // least two components, gas can be dissolved in water.
40
41 // Fluid phases are always defined in the first medium of the media vector,
42 // thus media.begin() points to the right medium.
43 const bool phase_transition =
44 (media.begin()->second->phase("Gas").numberOfComponents() > 1) &&
45 (media.begin()->second->phase("AqueousLiquid").numberOfComponents() >
46 1);
47 // Only if both fluids consist of more than one component, the model
48 // phase_transition is returned.
49 if (phase_transition)
50 {
51 return std::make_unique<ConstitutiveRelations::PhaseTransition>(media);
52 }
53 return std::make_unique<ConstitutiveRelations::NoPhaseTransition>(media);
54}

Referenced by createTH2MProcess().

◆ createTH2MProcess()

template<int DisplacementDim>
std::unique_ptr< Process > ProcessLib::TH2M::createTH2MProcess ( 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,
std::optional< ParameterLib::CoordinateSystem > const & local_coordinate_system,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )
Input File Parameter
prj__processes__process__type
Input File Parameter
prj__processes__process__TH2M__coupling_scheme

Process Variables

Input File Parameter
prj__processes__process__TH2M__process_variables

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

Input File Parameter
prj__processes__process__TH2M__process_variables__gas_pressure
Input File Parameter
prj__processes__process__TH2M__process_variables__capillary_pressure
Input File Parameter
prj__processes__process__TH2M__process_variables__temperature
Input File Parameter
prj__processes__process__TH2M__process_variables__displacement

Process Parameters

Input File Parameter
prj__processes__process__TH2M__reference_temperature
Input File Parameter
prj__processes__process__TH2M__specific_body_force
Input File Parameter
prj__processes__process__TH2M__mass_lumping

Definition at line 57 of file CreateTH2MProcess.cpp.

66{
68 config.checkConfigParameter("type", "TH2M");
69 DBUG("Create TH2M Process.");
70 DBUG(" ");
71
72 auto const coupling_scheme =
74 config.getConfigParameterOptional<std::string>("coupling_scheme");
75 const bool use_monolithic_scheme =
76 !(coupling_scheme && (*coupling_scheme == "staggered"));
77
79
81 auto const pv_config = config.getConfigSubtree("process_variables");
82
83 ProcessVariable* variable_pGR;
84 ProcessVariable* variable_pCap;
85 ProcessVariable* variable_T;
86 ProcessVariable* variable_u;
87 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
88 process_variables;
89 if (use_monolithic_scheme) // monolithic scheme.
90 {
93 auto per_process_variables = findProcessVariables(
94 variables, pv_config,
95 {
96 "gas_pressure",
98 "capillary_pressure",
100 "temperature",
102 "displacement"});
103 variable_pGR = &per_process_variables[0].get();
104 variable_pCap = &per_process_variables[1].get();
105 variable_T = &per_process_variables[2].get();
106 variable_u = &per_process_variables[3].get();
107 process_variables.push_back(std::move(per_process_variables));
108 }
109 else // staggered scheme.
110 {
111 OGS_FATAL("A Staggered version of TH2M is not implemented.");
112
113 using namespace std::string_literals;
114 for (auto const& variable_name :
115 {"gas_pressure"s, "capillary_pressure"s, "temperature"s,
116 "displacement"s})
117 {
118 auto per_process_variables =
119 findProcessVariables(variables, pv_config, {variable_name});
120 process_variables.push_back(std::move(per_process_variables));
121 }
122 variable_pGR = &process_variables[0][0].get();
123 variable_pCap = &process_variables[1][0].get();
124 variable_T = &process_variables[2][0].get();
125 variable_u = &process_variables[3][0].get();
126 }
127
128 DBUG("Associate displacement with process variable '{:s}'.",
129 variable_u->getName());
130
131 if (variable_u->getNumberOfGlobalComponents() != DisplacementDim)
132 {
133 OGS_FATAL(
134 "Number of components of the process variable '{:s}' is different "
135 "from the displacement dimension: got {:d}, expected {:d}",
136 variable_u->getName(),
137 variable_u->getNumberOfGlobalComponents(),
138 DisplacementDim);
139 }
140
141 DBUG("Associate gas pressure with process variable '{:s}'.",
142 variable_pGR->getName());
143 if (variable_pGR->getNumberOfGlobalComponents() != 1)
144 {
145 OGS_FATAL(
146 "Gas pressure process variable '{:s}' is not a scalar variable but "
147 "has "
148 "{:d} components.",
149 variable_pGR->getName(),
150 variable_pGR->getNumberOfGlobalComponents());
151 }
152
153 DBUG("Associate capillary pressure with process variable '{:s}'.",
154 variable_pCap->getName());
155 if (variable_pCap->getNumberOfGlobalComponents() != 1)
156 {
157 OGS_FATAL(
158 "Capillary pressure process variable '{:s}' is not a scalar "
159 "variable but has "
160 "{:d} components.",
161 variable_pCap->getName(),
162 variable_pCap->getNumberOfGlobalComponents());
163 }
164
165 DBUG("Associate temperature with process variable '{:s}'.",
166 variable_T->getName());
167 if (variable_T->getNumberOfGlobalComponents() != 1)
168 {
169 OGS_FATAL(
170 "temperature process variable '{:s}' is not a scalar variable but "
171 "has {:d} components.",
172 variable_T->getName(),
173 variable_T->getNumberOfGlobalComponents());
174 }
175
177 auto solid_constitutive_relations =
178 MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
179 parameters, local_coordinate_system, config);
180
181 // reference temperature
182 const auto& reference_temperature = ParameterLib::findParameter<double>(
183 config,
185 "reference_temperature", parameters, 1, &mesh);
186 DBUG("Use '{:s}' as reference temperature parameter.",
188
189 // Specific body force
190 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
191 {
192 std::vector<double> const b =
194 config.getConfigParameter<std::vector<double>>(
195 "specific_body_force");
196 if (b.size() != DisplacementDim)
197 {
198 OGS_FATAL(
199 "The size of the specific body force vector does not match the "
200 "displacement dimension. Vector size is {:d}, displacement "
201 "dimension is {:d}",
202 b.size(), DisplacementDim);
203 }
204
205 std::copy_n(b.data(), b.size(), specific_body_force.data());
206 }
207
208 // Initial stress conditions
209 auto initial_stress = ProcessLib::createInitialStress<DisplacementDim>(
210 config, parameters, mesh);
211
212 auto const mass_lumping =
214 config.getConfigParameter<bool>("mass_lumping", false);
215
216 auto media_map =
218
219 auto phase_transition_model = createPhaseTransitionModel(media);
220
221 const bool use_TaylorHood_elements =
222 variable_pCap->getShapeFunctionOrder() !=
223 variable_u->getShapeFunctionOrder()
224 ? true
225 : false;
226
227 TH2MProcessData<DisplacementDim> process_data{
228 materialIDs(mesh),
229 std::move(media_map),
230 std::move(solid_constitutive_relations),
231 std::move(phase_transition_model),
233 std::move(initial_stress),
234 specific_body_force,
235 mass_lumping,
236 use_TaylorHood_elements};
237
238 SecondaryVariableCollection secondary_variables;
239
240 ProcessLib::createSecondaryVariables(config, secondary_variables);
241
242 return std::make_unique<TH2MProcess<DisplacementDim>>(
243 std::move(name), mesh, std::move(jacobian_assembler), parameters,
244 integration_order, std::move(process_variables),
245 std::move(process_data), std::move(secondary_variables),
246 use_monolithic_scheme);
247}
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
unsigned getShapeFunctionOrder() const
std::string const & getName() const
int getNumberOfGlobalComponents() const
Returns the number of components of the process variable.
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition Mesh.cpp:268
std::unique_ptr< ConstitutiveRelations::PhaseTransitionModel > createPhaseTransitionModel(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
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)

References BaseLib::ConfigTree::checkConfigParameter(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), createPhaseTransitionModel(), ProcessLib::createSecondaryVariables(), DBUG(), ProcessLib::findProcessVariables(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigParameterOptional(), BaseLib::ConfigTree::getConfigSubtree(), ProcessLib::ProcessVariable::getName(), ProcessLib::ProcessVariable::getNumberOfGlobalComponents(), ProcessLib::ProcessVariable::getShapeFunctionOrder(), and OGS_FATAL.

◆ createTH2MProcess< 2 >()

template std::unique_ptr< Process > ProcessLib::TH2M::createTH2MProcess< 2 > ( 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,
std::optional< ParameterLib::CoordinateSystem > const & local_coordinate_system,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )

◆ createTH2MProcess< 3 >()

template std::unique_ptr< Process > ProcessLib::TH2M::createTH2MProcess< 3 > ( 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,
std::optional< ParameterLib::CoordinateSystem > const & local_coordinate_system,
unsigned const integration_order,
BaseLib::ConfigTree const & config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & media )