MFront
Being able to modify some coefficients of a behaviour without recompiling is a very handy feature for the end user and is mandatory for parametric studies.
To achieve this, most mechanical solvers have introduced material
properties, declared with the @MaterialProperty
keyword in
MFront
, which are evaluated by the calling solver and then
passed to the behaviour. The main idea behind material properties is to
write generic behaviours that can be used to describe a wide range of
materials.
There are a important shortcomings associated with the use of material properties:
MFront
implementation. This can not be achieved with
material properties since their is no easy cross-solver way to define
their default values from the behaviour implementation.Parameters, defined through the @Parameter
keyword, are
meant to be an alternative solution: parameters are internal
coefficients that can be modified by the end user at (almost) no cost.
A parameter must have a default value which must be
considered as the reference value.
Parameters are global values shared by all instances of the
behaviour. Parameters are thus associated to the behaviour and not to a
material (or model in the Cast3M
wording). Parameters thus
have a few shortcomings (compared to material properties).
Parameters are defined with the @Parameter
keyword. The
following syntax are allowed:
@Parameter real dmax1 = 0.98; // initialisation by assignment syntax
@Parameter real dmax2(0.98); // constructor syntax
@Parameter real dmax3{0.98}; // uniform initialisation syntax
@Parameter real dmax4; // only syntax valid for tfel < 2.0
.setDefaultValue(0.98); dmax4
A glossary name or an entry name can be associated to a parameter
through the setGlossaryName
or the
setEntryName
method.
Note
Historically, the type of the parameter was not required and was implicitly assumed to be of the
real
type. Although deprecated, the following syntax is still valid:@Parameter dmax1 = 0.98; // initialisation by assignment syntax
There are two ways to modify a parameter at runtime:
From our point of view, the first method is preferable but is not always available. Some examples are provided below.
MTest
The keyword @Parameter
is available in MTest
.
Code-Aster
Zebulon
The ***parameter
section can be used to define
parameters from the input file.
Let us take an example of a behaviour named Mazars
(the
behaviour name is defined by the value given to the
@Behaviour
keyword and prefixed by the material name, given
by @Material
keyword (if any)). We suppose that this
behaviour defines a parameter whose entry name is
DamageThreshold
(entry names are defined through the
setEntryName
method).
If a file named Mazars-parameters.txt
is in the current
directory, it is automatically read at the first behaviour call. This
file must contain lines beginning with a parameter name and its value.
No comments are allowed.
If our case, this file may contain the following line:
DamageThreshold 0.95
If a parameter is not defined in this file, it will have its default value.
This functionality is illustrated below:
mfront-query
The list of parameters in an mfront
file can be
retrieved as follows:
$ mfront-query --parameters Rousselier.mfront
...
- safety_factor_for_the_upper_bound_of_the_porosity: a safety factor for the porosity upper bound
- safety_factor_for_the_upper_bound_of_the_porosity_for_fracture_detection: a safety factor for the porosity upper bound
- staggered_scheme_porosity_criterion: stopping criterion value of the staggered scheme
- staggered_scheme_maximum_number_of_iterations: maximum number of iterations of the staggered scheme allowed
- minimal_time_step_scaling_factor: minimal value for the time step scaling factor
- maximal_time_step_scaling_factor: maximal value for the time step scaling factor
- numerical_jacobian_epsilon: perturbation value used to compute a numerical approximation of the jacobian
- iterMax: maximum number of iterations allowed
The default value of a parameter can be retrieved using the
--parameter-default-value
query, as follows:
$ mfront-query --parameter-default-value=epsilon Rousselier.mfront
1.e-14
$ mfront-query --parameter-default-value=iterMax Rousselier.mfront
100
The type of a parameter can be retrieved through the
--parameter-type
query, as follows:
$ mfront-query --parameter-type=iterMax Rousselier.mfront
ushort
Here ushort
means that the iterMax
parameter is stored as unsigned short integer.
mfront-query
The name of the file which can be used to modify the parameters’
values (see Section 3.2) can be retrieved with the
--parameters-file
query:
$ mfront-query --parameters-file Rousselier.mfront
Rousseliertest-parameters.txt