27 template <
int DisplacementDim>
31 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
32 std::vector<ProcessVariable>
const& variables,
33 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
34 std::optional<ParameterLib::CoordinateSystem>
const&
35 local_coordinate_system,
36 unsigned const integration_order,
41 DBUG(
"Create PhaseFieldProcess.");
43 auto const coupling_scheme =
46 const bool use_monolithic_scheme =
47 !(coupling_scheme && (*coupling_scheme ==
"staggered"));
56 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
58 if (use_monolithic_scheme)
60 OGS_FATAL(
"Monolithic implementation is not available.");
64 using namespace std::string_literals;
66 auto const& variable_name :
72 auto per_process_variables =
74 process_variables.push_back(std::move(per_process_variables));
76 variable_u = &process_variables[0][0].get();
77 variable_ph = &process_variables[1][0].get();
80 DBUG(
"Associate displacement with process variable '{:s}'.",
86 "Number of components of the process variable '{:s}' is different "
87 "from the displacement dimension: got {:d}, expected {:d}",
93 DBUG(
"Associate phase field with process variable '{:s}'.",
98 "Phasefield process variable '{:s}' is not a scalar variable but "
99 "has {:d} components.",
104 auto solid_constitutive_relations =
105 MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
106 parameters, local_coordinate_system, config);
108 auto const phasefield_parameters_config =
113 auto const& residual_stiffness = ParameterLib::findParameter<double>(
114 phasefield_parameters_config,
116 "residual_stiffness", parameters, 1);
117 DBUG(
"Use '{:s}' as residual stiffness.", residual_stiffness.name);
120 auto const& crack_resistance = ParameterLib::findParameter<double>(
121 phasefield_parameters_config,
123 "crack_resistance", parameters, 1);
124 DBUG(
"Use '{:s}' as crack resistance.", crack_resistance.name);
127 auto const& crack_length_scale = ParameterLib::findParameter<double>(
128 phasefield_parameters_config,
130 "crack_length_scale", parameters, 1);
131 DBUG(
"Use '{:s}' as crack length scale.", crack_length_scale.name);
134 auto const& solid_density = ParameterLib::findParameter<double>(
137 "solid_density", parameters, 1);
138 DBUG(
"Use '{:s}' as solid density parameter.", solid_density.name);
141 Eigen::Matrix<double, DisplacementDim, 1> specific_body_force;
143 std::vector<double>
const b =
146 "specific_body_force");
147 if (b.size() != DisplacementDim)
150 "The size of the specific body force vector does not match the "
151 "displacement dimension. Vector size is {:d}, displacement "
153 b.size(), DisplacementDim);
156 std::copy_n(b.data(), b.size(), specific_body_force.data());
159 auto const crack_scheme =
163 ((*crack_scheme !=
"propagating") && (*crack_scheme !=
"static")))
166 "crack_scheme must be 'propagating' or 'static' but '{:s}' "
168 crack_scheme->c_str());
171 const bool hydro_crack = (crack_scheme && (*crack_scheme ==
"propagating"));
172 const bool crack_pressure = crack_scheme.has_value();
174 auto const irreversible_threshold =
178 auto const phasefield_model = [&]
180 auto const phasefield_model_string =
184 if (phasefield_model_string ==
"AT1")
188 else if (phasefield_model_string ==
"AT2")
193 "phasefield_model must be 'AT1' or 'AT2' but '{:s}' "
195 phasefield_model_string.c_str());
199 materialIDs(mesh), std::move(solid_constitutive_relations),
200 residual_stiffness, crack_resistance,
201 crack_length_scale, solid_density,
202 specific_body_force, hydro_crack,
203 crack_pressure, irreversible_threshold,
210 return std::make_unique<PhaseFieldProcess<DisplacementDim>>(
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 use_monolithic_scheme);
220 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
221 std::vector<ProcessVariable>
const& variables,
222 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
223 std::optional<ParameterLib::CoordinateSystem>
const&
224 local_coordinate_system,
225 unsigned const integration_order,
231 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
232 std::vector<ProcessVariable>
const& variables,
233 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
234 std::optional<ParameterLib::CoordinateSystem>
const&
235 local_coordinate_system,
236 unsigned const integration_order,
void DBUG(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.
PropertyVector< int > const * materialIDs(Mesh const &mesh)
template std::unique_ptr< Process > createPhaseFieldProcess< 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::unique_ptr< Process > createPhaseFieldProcess(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)
template std::unique_ptr< Process > createPhaseFieldProcess< 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::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)