66{
68 config.checkConfigParameter("type", "TH2M");
69 DBUG(
"Create TH2M Process.");
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
87 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
88 process_variables;
89 if (use_monolithic_scheme)
90 {
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
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 =
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}'.",
130
132 {
134 "Number of components of the process variable '{:s}' is different "
135 "from the displacement dimension: got {:d}, expected {:d}",
138 DisplacementDim);
139 }
140
141 DBUG(
"Associate gas pressure with process variable '{:s}'.",
142 variable_pGR->getName());
143 if (variable_pGR->getNumberOfGlobalComponents() != 1)
144 {
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}'.",
156 {
158 "Capillary pressure process variable '{:s}' is not a scalar "
159 "variable but has "
160 "{:d} components.",
163 }
164
165 DBUG(
"Associate temperature with process variable '{:s}'.",
168 {
170 "temperature process variable '{:s}' is not a scalar variable but "
171 "has {:d} components.",
174 }
175
177 auto solid_constitutive_relations =
178 MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
179 parameters, local_coordinate_system,
materialIDs(mesh), config);
180
181
183 config,
185 "reference_temperature", parameters, 1, &mesh);
186 DBUG(
"Use '{:s}' as reference temperature parameter.",
188
189
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 {
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
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
220
221 const bool use_TaylorHood_elements =
224 ? true
225 : false;
226
227 TH2MProcessData<DisplacementDim> process_data{
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
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}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
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)
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)