TFEL, MFront and MTestMFront
MTest
python bindingsThe page describes the new functionalities of Version 3.4.2 of the
TFEL project.
This version was released This version was released on September 21,
2021 along with Versions 3.0.9, 3.1.9,
3.2.6 an 3.3.2 and inherits from the issues
solved in those versions.
MFrontThis development was made to solve Issue #267 (see Section 3.8).
MFront has extensive support for the definition of
single crystal as documented here: <singlecrystal.html>.
If the slip systems are defined (using for example the
@SlipSystem keyword) , the class describing the slip system
now has a buildInteractionMatrix which is meant to work as
follows:
@Parameters real im_coefficients[7];
im_coefficients.setEntryName("InteractionMatrixCoefficients");
....
@Integrator{
const auto& ss = FCCSingleCrystalSlipSystems<real>::getSlipSystems();
const auto m = ss.buildInteractionMatrix(im_coefficients);
....
}MTestThis development was made to solve Issue #273 (see Section 3.3).
An abstract class named MaterialProperty has been added
as an equivalent for material properties of the Behaviour
class. This class has the following interface:
getVariablesNames, which returns the names of the
arguments of material property.setVariableValue which allows to set the value of an
argument of the material property.getValue which evaluates the material property for the
values of the arguments set by the setVariableValue
method.getParametersNames, which returns the names of the
parameters of material property.setParameter which allows to change the value of a
parameter.The CastemMaterialProperty and
CyranoMaterialProperty classes are two concrete
implementation of the class for material properties generated
respectively using the Cast3M and Cyrano
interfaces respectively.
In C++, the MaterialProperty class exposes
a static method called getMaterialProperty which acts as an
abstract factory.
This class and associated method are also available in the
python bindings. The getMaterialProperty
method is used in python to build a custom constructor as
illustrated in the following example.
Here is an example of the usage of the MaterialProperty
class in python.
import mtest
young_modulus = mtest.MaterialProperty(
'src/libCastemVanadium.so', 'VanadiumAlloy_YoungModulus_SRMA')
young_modulus.setVariableValue('Temperature', 562)
E = young_modulus.getValue()Note that the MaterialProperty constructor automatically
detects the interface used to generate the material property and
instantiates the proper concrete implementation internally which is
obsviously the CastemMaterialProperty class in this
case.
Setting the variables’ values and evaluating the material property
can be tedious. To avoid this, overloaded versions of the
getValue are available:
# using a dictionary
E = young_modulus.getValue({'Temperature': 562})
# for material properties with only one argument
E = young_modulus.getValue(562)To make the code even more explicit, the call operator can also be used, as follows:
# using a dictionary
E = young_modulus({'Temperature': 562})
# for material properties with only one argument
E = young_modulus(562)For more details, see: https://github.com/thelfer/tfel/issues/8
The output, inputs and parameters of a material property can now be
declared with any scalar type supported by the
SupportedTypes class.
For more details, see: https://sourceforge.net/p/tfel/tickets/274/
The developments associated with this issue are described in Section 2.1.
For more details, see: https://sourceforge.net/p/tfel/tickets/273/
The list of parameters is now exported by interfaces of material
properties which provides a setParameter method (namely the
Cast3M and Cyrano interfaces).
The ExternalLibraryManager now have an
getMaterialPropertyParameters method which allows to
retrieve this list of parameters. This method is also available in the
python bindings.
The ExternalMaterialPropertyDescription class which can
gathers all the informations exported by a material property new have a
parameters data member with the list of the parameters of
the material property. This data member is also accessible in the
python bindings.
For more details, see: https://sourceforge.net/p/tfel/tickets/272/
The getDSL method now returns an object of the
MaterialPropertyDSL type which derives from the
AbstractDSL class. It exposes a method called
getMaterialPropertyDescription which returns information
about the material property.
The MaterialPropertyDescription exposes the following
methods:
getInputs which returns the inputs of the material
property.getParameters which returns the parameters of the
material property.getOutput which returns the output of the material
property.getLawName which returns the name of material
property.getMaterialName which returns the name of material
described by this material property.getClassName which returns a class name combining the
name of the material property and the name of the material.For more details, see: https://sourceforge.net/p/tfel/tickets/271/
python bindingsWhen the evolution of the outer radius is imposed, the inner pressure evolution can now be retrieved using the following code:
p = s.getEvolutionValue("InnerPressure", t)where s is an object of type
StudyCurrentState and t the considered
time.
This syntax can also be used to retrieve the “AxialForce” when the axial growth is imposed, as follows:
f = s.getEvolutionValue("AxialForce", t)For more details, see: https://sourceforge.net/p/tfel/tickets/269/
The MTest executable allows to compare the tangent
operator returned by the behaviour to a numerical approximation. To be
able to do the same using the python interface, the
following methods have been added:
setCompareToNumericalTangentOperator: set if a
comparison of the tangent operator returned by the behaviour to a
numerical approximation.setTangentOperatorComparisonCriterion: set the
criterion used to compare the tangent operator returned by the behaviour
and its numerical approximation.setNumericalTangentOperatorPerturbationValue: set the
perburtation of the gradient used to compute a numerical approximation
of the tangent operator.For more details, see: https://sourceforge.net/p/tfel/tickets/268/
The developments associated with this issue are described in Section 1.1.
For more details, see : https://sourceforge.net/p/tfel/tickets/267/