23 std::vector<mgis::behaviour::Variable>
const& vars,
24 mgis::behaviour::Hypothesis hypothesis)
26 INFO(
"#{:s}: {:d} (array size {:d}).",
29 mgis::behaviour::getArraySize(vars, hypothesis));
30 for (
auto& var : vars)
32 INFO(
" --> type `{:s}' with name `{:s}', size {:d}, offset {:d}.",
35 mgis::behaviour::getVariableSize(var, hypothesis),
36 mgis::behaviour::getVariableOffset(vars, var.name, hypothesis));
41 void varInfo(std::string
const& msg, std::vector<std::string>
const& parameters)
43 INFO(
"#{:s}: {:d}.", msg, parameters.size());
45 for (
auto const& parameter : parameters)
47 INFO(
" --> with name `{:s}'.", parameter);
58 template <
int DisplacementDim>
60 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
61 std::optional<ParameterLib::CoordinateSystem>
const&
62 local_coordinate_system,
65 INFO(
"### MFRONT ########################################################");
70 auto const library_name =
76 :
"libOgsMFrontBehaviour";
78 auto const behaviour_name =
82 static_assert(DisplacementDim == 2 || DisplacementDim == 3,
83 "Given DisplacementDim not supported.");
85 mgis::behaviour::Hypothesis hypothesis;
86 if (DisplacementDim == 2)
90 "The model is defined in 2D. On the material level currently a "
91 "plane strain setting is used. In particular it is not checked if "
92 "axial symmetry or plane stress are assumed. Special material "
93 "behaviour for these settings is currently not supported.");
94 hypothesis = mgis::behaviour::Hypothesis::PLANESTRAIN;
96 else if (DisplacementDim == 3)
98 hypothesis = mgis::behaviour::Hypothesis::TRIDIMENSIONAL;
104 dlopen(
"libTFELNUMODIS.so", RTLD_NOW);
105 dlopen(
"libTFELUtilities.so", RTLD_NOW);
106 dlopen(
"libTFELException.so", RTLD_NOW);
110 mgis::behaviour::load(lib_path, behaviour_name, hypothesis);
112 INFO(
"Behaviour: `{:s}'.", behaviour.behaviour);
114 INFO(
"Source: `{:s}'.", behaviour.source);
115 INFO(
"TFEL version: `{:s}'.", behaviour.tfel_version);
117 INFO(
"Kinematic: `{:s}'.",
toString(behaviour.kinematic));
118 INFO(
"Symmetry: `{:s}'.",
toString(behaviour.symmetry));
120 varInfo(
"Mat. props.", behaviour.mps, hypothesis);
121 varInfo(
"Gradients", behaviour.gradients, hypothesis);
122 varInfo(
"Thdyn. forces", behaviour.thermodynamic_forces, hypothesis);
123 varInfo(
"Int. StVars.", behaviour.isvs, hypothesis);
124 varInfo(
"Ext. StVars.", behaviour.esvs, hypothesis);
128 varInfo(
"Real-valued parameters", behaviour.params);
129 varInfo(
"Integer parameters", behaviour.iparams);
130 varInfo(
"Unsigned parameters", behaviour.usparams);
132 std::vector<ParameterLib::Parameter<double>
const*> material_properties;
134 if (!behaviour.mps.empty())
136 std::map<std::string, std::string> map_name_to_param;
142 auto const mp_config :
144 mps_config.getConfigParameterList(
"material_property"))
147 auto name = mp_config.getConfigAttribute<std::string>(
"name");
148 auto const param_name =
150 mp_config.getConfigAttribute<std::string>(
"parameter");
152 map_name_to_param.emplace(std::move(
name), std::move(param_name));
155 for (
auto& mp : behaviour.mps)
157 auto const it = map_name_to_param.find(mp.name);
158 if (it == map_name_to_param.end())
160 "Material Property `{:s}' has not been configured in the "
164 auto const param_name = it->second;
165 auto const num_comp =
166 mgis::behaviour::getVariableSize(mp, hypothesis);
167 auto const* param = &ParameterLib::findParameter<double>(
168 param_name, parameters, num_comp);
170 INFO(
"Using OGS parameter `{:s}' for material property `{:s}'.",
171 param_name, mp.name);
174 if (mp.type == V::STENSOR || mp.type == V::TENSOR)
177 "Material property `{:s}' is a tensorial quantity. You, "
179 "user, have to make sure that the component order of "
180 "parameter `{:s}' matches the one required by MFront!",
181 mp.name, param_name);
184 material_properties.push_back(param);
185 map_name_to_param.erase(it);
188 if (!map_name_to_param.empty())
190 ERR(
"Some material parameters that were configured are not used by "
191 "the material model.");
192 ERR(
"These parameters are:");
194 for (
auto& e : map_name_to_param)
196 ERR(
" name: `{:s}', parameter: `{:s}'.", e.first, e.second);
200 "Configuration errors occurred. Please fix the project file.");
204 INFO(
"### MFRONT END ####################################################");
206 return std::make_unique<MFront<DisplacementDim>>(
207 std::move(behaviour), std::move(material_properties),
208 local_coordinate_system);
221 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
222 std::optional<ParameterLib::CoordinateSystem>
const&
223 local_coordinate_system,
226 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
227 std::optional<ParameterLib::CoordinateSystem>
const&
228 local_coordinate_system,
void INFO(char const *fmt, Args const &... args)
void ERR(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 & getProjectDirectory()
Returns the directory where the prj file resides.
std::string joinPaths(std::string const &pathA, std::string const &pathB)
const char * btypeToString(int btype)
Converts MGIS behaviour type to a string representation.
template std::unique_ptr< MechanicsBase< 3 > > createMFront< 3 >(std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
const char * toString(mgis::behaviour::Behaviour::Kinematic kin)
Converts MGIS kinematic to a string representation.
const char * varTypeToString(int v)
Converts MGIS variable type to a string representation.
template std::unique_ptr< MechanicsBase< 2 > > createMFront< 2 >(std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
std::unique_ptr< MechanicsBase< DisplacementDim > > createMFront(std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const ¶meters, std::optional< ParameterLib::CoordinateSystem > const &local_coordinate_system, BaseLib::ConfigTree const &config)
void varInfo(std::string const &msg, std::vector< std::string > const ¶meters)
Prints info about MFront parameters.