31 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
40 const bool evaporation =
41 media.begin()->second->phase(
"Gas").numberOfComponents() > 1;
43 const bool dissolution =
44 media.begin()->second->phase(
"AqueousLiquid").numberOfComponents() > 1;
46 if (evaporation && dissolution)
48 return std::make_unique<PhaseTransitionFull>(media);
51 if (evaporation && !dissolution)
53 return std::make_unique<PhaseTransitionEvaporation>(media);
56 if (!evaporation && dissolution)
58 return std::make_unique<PhaseTransitionDissolution>(media);
61 return std::make_unique<PhaseTransitionNone>(media);
64 template <
int DisplacementDim>
67 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
68 std::vector<ProcessVariable>
const& variables,
69 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
70 std::optional<ParameterLib::CoordinateSystem>
const&
71 local_coordinate_system,
73 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
77 DBUG(
"Create TH2M Process.");
79 WARN(
"Attention! TH2M process has not yet been fully tested!");
80 WARN(
"Check its results critically and report any bugs to");
81 WARN(
" https://gitlab.opengeosys.org/ogs/ogs/-/issues ");
84 auto const coupling_scheme =
87 const bool use_monolithic_scheme =
88 !(coupling_scheme && (*coupling_scheme ==
"staggered"));
98 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
100 if (use_monolithic_scheme)
103 variables, pv_config,
107 "capillary_pressure",
112 variable_pGR = &per_process_variables[0].get();
113 variable_pCap = &per_process_variables[1].get();
114 variable_T = &per_process_variables[2].get();
115 variable_u = &per_process_variables[3].get();
116 process_variables.push_back(std::move(per_process_variables));
120 OGS_FATAL(
"A Staggered version of TH2M is not implemented.");
122 using namespace std::string_literals;
123 for (
auto const& variable_name :
124 {
"gas_pressure"s,
"capillary_pressure"s,
"temperature"s,
127 auto per_process_variables =
129 process_variables.push_back(std::move(per_process_variables));
131 variable_pGR = &process_variables[0][0].get();
132 variable_pCap = &process_variables[1][0].get();
133 variable_T = &process_variables[2][0].get();
134 variable_u = &process_variables[3][0].get();
137 DBUG(
"Associate displacement with process variable '{:s}'.",
143 "Number of components of the process variable '{:s}' is different "
144 "from the displacement dimension: got {:d}, expected {:d}",
150 DBUG(
"Associate gas pressure with process variable '{:s}'.",
155 "Gas pressure process variable '{:s}' is not a scalar variable but "
162 DBUG(
"Associate capillary pressure with process variable '{:s}'.",
167 "Capillary pressure process variable '{:s}' is not a scalar "
174 DBUG(
"Associate temperature with process variable '{:s}'.",
179 "temperature process variable '{:s}' is not a scalar variable but "
180 "has {:d} components.",
185 auto solid_constitutive_relations =
186 MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
187 parameters, local_coordinate_system, config);
193 "reference_temperature", parameters, 1, &mesh);
194 DBUG(
"Use '{:s}' as reference temperature parameter.",
198 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
200 std::vector<double>
const b =
203 "specific_body_force");
204 if (b.size() != DisplacementDim)
207 "The size of the specific body force vector does not match the "
208 "displacement dimension. Vector size is {:d}, displacement "
210 b.size(), DisplacementDim);
213 std::copy_n(b.data(), b.size(), specific_body_force.data());
217 auto const initial_stress = ParameterLib::findOptionalTagParameter<double>(
219 config,
"initial_stress", parameters,
224 auto const mass_lumping =
234 std::move(media_map),
235 std::move(solid_constitutive_relations),
236 std::move(phase_transition_model),
246 return std::make_unique<TH2MProcess<DisplacementDim>>(
247 std::move(
name), mesh, std::move(jacobian_assembler), parameters,
248 integration_order, std::move(process_variables),
249 std::move(process_data), std::move(secondary_variables),
250 use_monolithic_scheme);
256 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
257 std::vector<ProcessVariable>
const& variables,
258 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
259 std::optional<ParameterLib::CoordinateSystem>
const&
260 local_coordinate_system,
261 unsigned const integration_order,
263 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media);
268 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
269 std::vector<ProcessVariable>
const& variables,
270 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
271 std::optional<ParameterLib::CoordinateSystem>
const&
272 local_coordinate_system,
273 unsigned const integration_order,
275 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media);
void DBUG(char const *fmt, Args const &... args)
void WARN(char const *fmt, Args const &... args)
void checkConfigParameter(std::string const ¶m, T const &value) const
std::optional< T > getConfigParameterOptional(std::string const ¶m) const
T getConfigParameter(std::string const ¶m) const
ConfigTree getConfigSubtree(std::string const &root) const
std::string const & getName() const
int getNumberOfGlobalComponents() const
Returns the number of components of the process variable.
Handles configuration of several secondary variables from the project file.
std::unique_ptr< MaterialSpatialDistributionMap > createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium >> const &media, MeshLib::Mesh const &mesh)
constexpr int kelvin_vector_dimensions(int const displacement_dim)
Kelvin vector dimensions for given displacement dimension.
PropertyVector< int > const * materialIDs(Mesh const &mesh)
std::unique_ptr< PhaseTransitionModel > createPhaseTransitionModel(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media)
template std::unique_ptr< Process > createTH2MProcess< 3 >(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, 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< Process > createTH2MProcess< 2 >(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, 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)
std::unique_ptr< Process > createTH2MProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, 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)
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)