128 const bool has_contact = args.value(
"/contact/enabled"_json_pointer,
false);
129 const bool has_pressure = has_entries(args,
"/boundary_conditions/pressure_boundary"_json_pointer)
130 || has_entries(args,
"/boundary_conditions/pressure_cavity"_json_pointer);
131 const bool has_file_constraints =
132 has_entries(args,
"/constraints/hard"_json_pointer)
133 || has_entries(args,
"/constraints/soft"_json_pointer);
134 const bool has_periodic_constraints =
135 has_entries(args,
"/boundary_conditions/periodic"_json_pointer);
136 const json zero_mean = args.contains(
"/constraints/zero_mean"_json_pointer)
137 ? args.at(
"/constraints/zero_mean"_json_pointer)
139 const bool has_zero_mean_constraints =
140 (zero_mean.is_boolean() && zero_mean.get<
bool>())
141 || (zero_mean.is_array() && !zero_mean.empty());
142 const bool has_constraints =
143 has_file_constraints || has_periodic_constraints || has_zero_mean_constraints;
145 if (formulation ==
"ThermoElasticity")
146 return (!has_pressure && !has_constraints) ? std::make_shared<ThermoElasticVarForm>() :
nullptr;
150 if (formulation ==
"Stokes")
151 return (!has_contact && !has_constraints) ? std::make_shared<StokesVarForm>() :
nullptr;
152 if (formulation ==
"NavierStokes")
153 return (!has_contact && !has_constraints) ? std::make_shared<NavierStokesVarForm>() :
nullptr;
154 if (formulation ==
"NavierStokesFSI")
155 return ((!has_contact || has_two_mesh_fsi_material(args)) && !has_constraints)
156 ? std::make_shared<NavierStokesFSIVarForm>()
158 if (formulation ==
"OperatorSplitting")
159 return (!has_contact && !has_constraints) ? std::make_shared<OperatorSplittingVarForm>() :
nullptr;
160 if (formulation ==
"IncompressibleLinearElasticity")
161 return (!has_contact && !has_pressure && !has_constraints) ? std::make_shared<IncompressibleElasticVarForm>() :
nullptr;
162 if (formulation ==
"Bilaplacian")
163 return (!has_contact && !has_constraints) ? std::make_shared<BilaplacianVarForm>() :
nullptr;
165 if (!assembler->is_tensor())
166 return (!has_contact && !has_pressure && !has_file_constraints) ? std::make_shared<ScalarVarForm>() :
nullptr;
168 if (assembler->is_linear() && !has_contact && !has_pressure && !has_constraints)
169 return std::make_shared<LinearElasticVarForm>();
171 if (args.contains(
"time") && !args[
"time"].is_null())
172 return std::make_shared<NonlinearElasticTransientVarForm>();
174 return std::make_shared<NonlinearElasticStaticVarForm>();