40 config.checkConfigParameter(
"type",
"PHASE_FIELD");
41 DBUG(
"Create PhaseFieldProcess.");
43 auto const coupling_scheme =
45 config.getConfigParameterOptional<std::string>(
"coupling_scheme");
46 const bool use_monolithic_scheme =
47 !(coupling_scheme && (*coupling_scheme ==
"staggered"));
52 auto const pv_config = config.getConfigSubtree(
"process_variables");
54 ProcessVariable* variable_ph;
55 ProcessVariable* variable_u;
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}'.",
81 variable_u->getName());
83 if (variable_u->getNumberOfGlobalComponents() != DisplacementDim)
86 "Number of components of the process variable '{:s}' is different "
87 "from the displacement dimension: got {:d}, expected {:d}",
88 variable_u->getName(),
89 variable_u->getNumberOfGlobalComponents(),
93 DBUG(
"Associate phase field with process variable '{:s}'.",
94 variable_ph->getName());
95 if (variable_ph->getNumberOfGlobalComponents() != 1)
98 "Phasefield process variable '{:s}' is not a scalar variable but "
99 "has {:d} components.",
100 variable_ph->getName(),
101 variable_ph->getNumberOfGlobalComponents());
104 auto solid_constitutive_relations =
105 MaterialLib::Solids::createConstitutiveRelations<DisplacementDim>(
106 parameters, local_coordinate_system, config);
108 auto const phasefield_parameters_config =
110 config.getConfigSubtree(
"phasefield_parameters");
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 =
145 config.getConfigParameter<std::vector<double>>(
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 =
161 config.getConfigParameterOptional<std::string>(
"hydro_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 =
176 config.getConfigParameter<
double>(
"irreversible_threshold", 0.05);
178 auto const phasefield_model = [&]
180 auto const phasefield_model_string =
182 config.getConfigParameter<std::string>(
"phasefield_model");
184 if (phasefield_model_string ==
"AT1")
186 return PhaseFieldModel::AT1;
188 else if (phasefield_model_string ==
"AT2")
190 return PhaseFieldModel::AT2;
193 "phasefield_model must be 'AT1' or 'AT2' but '{:s}' "
195 phasefield_model_string.c_str());
198 PhaseFieldProcessData<DisplacementDim> process_data{
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,
206 SecondaryVariableCollection secondary_variables;
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);
void DBUG(char const *fmt, Args const &... args)
PropertyVector< int > const * materialIDs(Mesh const &mesh)
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)