tfel
Loading...
Searching...
No Matches
mtest::MTest Struct Reference

MTest is a simple class to test mfront behaviours. More...

#include </home/runner/work/tfel/tfel/mtest/include/MTest/MTest.hxx>

Inheritance diagram for mtest::MTest:
mtest::SingleStructureScheme mtest::SchemeBase mtest::Scheme mtest::Study tfel::tests::Test tfel::utilities::MTestDocParser

Classes

struct  UTest
 base class for testing the behaviour outputs More...

Public Member Functions

 MTest ()
std::string name () const override
std::string classname () const override
virtual void readInputFile (const std::string &, const std::vector< std::string > &, const std::map< std::string, std::string > &)
void completeInitialisation () override
void initializeCurrentState (StudyCurrentState &) const override
 initialize the current state
void initializeWorkSpace (SolverWorkSpace &) const override
 initialize the workspace
virtual tfel::tests::TestResult execute (const bool)
 integrate the behaviour along the loading path
tfel::tests::TestResult execute () override
 execute test
std::pair< bool, real > prepare (StudyCurrentState &, const real, const real) const override
 update current state at the beginning of a new time step:
void makeLinearPrediction (StudyCurrentState &, const real) const override
 make a linear prediction of the unknows and state
std::pair< bool, real > computePredictionStiffnessAndResidual (StudyCurrentState &, tfel::math::matrix< real > &, tfel::math::vector< real > &, const real &, const real &, const StiffnessMatrixType) const override
 compute the stiffness matrix and the residual
std::pair< bool, real > computeStiffnessMatrixAndResidual (StudyCurrentState &, tfel::math::matrix< real > &, tfel::math::vector< real > &, const real, const real, const StiffnessMatrixType) const override
 compute the stiffness matrix and the residual
real getErrorNorm (const tfel::math::vector< real > &) const override
bool checkConvergence (StudyCurrentState &, const tfel::math::vector< real > &, const tfel::math::vector< real > &, const SolverOptions &, const unsigned int, const real, const real) const override
std::vector< std::string > getFailedCriteriaDiagnostic (const StudyCurrentState &, const tfel::math::vector< real > &, const tfel::math::vector< real > &, const SolverOptions &, const real, const real) const override
void computeLoadingCorrection (StudyCurrentState &, SolverWorkSpace &, const SolverOptions &, const real, const real) const override
bool postConvergence (StudyCurrentState &, const real, const real, const unsigned int) const override
virtual void execute (StudyCurrentState &, SolverWorkSpace &, const real, const real)
virtual void setCompareToNumericalTangentOperator (const bool)
 ask the comparison to the numerical tangent operator
virtual void setTangentOperatorComparisonCriterion (const real)
 set the value used to compare the tangent operator given by the behaviour to the numerical tangent operator
virtual void setNumericalTangentOperatorPerturbationValue (const real)
 set the value used to build the numerical tangent operator
virtual void setRotationMatrix (const tfel::math::tmatrix< 3u, 3u, real > &, const bool=false)
 set the rotation matrix
virtual void setGradientEpsilon (const real)
 set criterium value for the convergence test on the on the driving variable
virtual void setThermodynamicForceEpsilon (const real)
 set criterium value for the convergence test on the thermodynamic forces
virtual void addTest (std::shared_ptr< UTest >)
 add a new test
virtual void setGradientsInitialValues (const std::vector< real > &)
 set the inital values of the driving variable
virtual void setThermodynamicForcesInitialValues (const std::vector< real > &)
 set the inital values of the thermodynamic forces
virtual void printLagrangeMultipliers (const bool)
 set if the lagrange multipliers must be printed in the output file
virtual void addConstraint (const std::shared_ptr< Constraint >)
 add a new constraint
void printOutput (const real, const StudyCurrentState &, const bool) const override
 print usefull information in the output file
void addEvent (const std::string &, const std::vector< double > &)
 add a new event
void addUserDefinedPostProcessing (const std::string &, const std::vector< std::string > &)
 add a user defined PostProcessing
 ~MTest () override
 destructor
Public Member Functions inherited from mtest::SingleStructureScheme
 SingleStructureScheme ()
 default constructor
virtual void setBehaviour (const std::string &, const std::string &, const std::string &, const Parameters &=Parameters())
 set the behaviour
virtual void setBehaviour (const std::string &, const std::string &, const std::string &, const std::string &, const Parameters &=Parameters())
 set the behaviour
virtual void setMaterialProperty (const std::string &, const EvolutionPtr, const bool)
 define a material property
virtual void setExternalStateVariable (const std::string &, const EvolutionPtr, const bool)
 define an external state variable
virtual BehaviourType getBehaviourType () const
virtual Kinematic getBehaviourKinematic () const
virtual std::shared_ptr< Behaviour > getBehaviour ()
virtual std::shared_ptr< const Behaviour > getBehaviour () const
virtual void setHandleThermalExpansion (const bool)
 set if mtest shall handle thermal expansion coefficient If true, the thermal expansion will be handled if the thermal expansion coefficients are defined.
bool doPackagingStep (StudyCurrentState &) const override
 perform the computation of the packaging step
std::pair< bool, real > prepare (StudyCurrentState &, const real, const real) const override
 update current state at the beginning of a new time step:
virtual void setParameter (const std::string &, const double)
virtual void setIntegerParameter (const std::string &, const int)
virtual void setUnsignedIntegerParameter (const std::string &, const unsigned int)
virtual void setInternalStateVariableInitialValue (const std::string &, const real)
 set the inital value of a scalar variable
virtual void setInternalStateVariableInitialValue (const std::string &, const std::vector< real > &)
 set the inital values of an internal state variable
virtual void setScalarInternalStateVariableInitialValue (const std::string &, const real)
 set the inital value of a scalar variable
virtual void setStensorInternalStateVariableInitialValues (const std::string &, const std::vector< real > &)
 set the inital values of a symetric tensor variable
virtual void setTensorInternalStateVariableInitialValues (const std::string &, const std::vector< real > &)
 set the inital values of a tensor variable
virtual void setOutOfBoundsPolicy (const tfel::material::OutOfBoundsPolicy)
 set the out of bounds policy
void completeInitialisation () override
 ~SingleStructureScheme () override
 destructor
Public Member Functions inherited from mtest::SchemeBase
 SchemeBase ()
 constructor
 SchemeBase (SchemeBase &&)=delete
 move constructor
 SchemeBase (const SchemeBase &)=delete
 copy constructor
SchemeBase & operator= (SchemeBase &&)=delete
 move assignement
SchemeBase & operator= (const SchemeBase &)=delete
 standard assignement
void setModellingHypothesis (const std::string &) override
virtual void setTimes (const std::vector< real > &)
virtual void setOutputFileName (const std::string &)
 set the output file
virtual bool isOutputFileNameDefined () const
virtual void setOutputFilePrecision (const unsigned int)
 set the output file precision
virtual void setResidualFileName (const std::string &)
 set the residual file
virtual bool isResidualFileNameDefined () const
virtual void setXMLOutputFileName (const std::string &)
 set the residual file
virtual bool isXMLOutputFileNameDefined () const
virtual std::string getXMLOutputFileName () const
virtual void setResidualFilePrecision (const unsigned int)
 set the residual file precision
const EvolutionManager & getEvolutions () const
virtual void addEvolution (const std::string &, const EvolutionPtr, const bool, const bool)
 add a new evolution
virtual void setEvolutionValue (const std::string &, const real, const real)
 set evolution value for a given time
virtual void setDescription (const std::string &)
 set the description
virtual void setAuthor (const std::string &)
 set the author
virtual void setDate (const std::string &)
 set the date
virtual void setOutputFrequency (const OutputFrequency)
 set the output frequency
virtual void setDynamicTimeStepScaling (const bool)
 set the maximal time step
virtual void setMaximalTimeStep (const real)
 set the maximal time step
virtual void setMinimalTimeStep (const real)
 set the minimal time step
virtual void setMaximalTimeStepScalingFactor (const real)
 set the maximal time step scaling factor
virtual void setMinimalTimeStepScalingFactor (const real)
 set the minimal time step scaling factor
virtual void setMaximumNumberOfIterations (const unsigned int)
virtual void setMaximumNumberOfSubSteps (const unsigned int)
virtual unsigned short getDimension () const
virtual ModellingHypothesis::Hypothesis getModellingHypothesis () const
virtual void setStiffnessUpdatingPolicy (const StiffnessUpdatingPolicy)
 set the stiffness updating policy
virtual void setPredictionPolicy (const PredictionPolicy)
 set the prediction policy
virtual void setStiffnessMatrixType (const StiffnessMatrixType)
 set the stiffness matrix type
virtual void setUseCastemAccelerationAlgorithm (const bool)
 set the use of the castem acceleration algorithm
virtual void setAccelerationAlgorithm (const std::string &)
 set the acceleration algorithm to be used
virtual void setAccelerationAlgorithmParameter (const std::string &, const std::string &)
 set a parameter of the acceleration algorithm
virtual void setCastemAccelerationTrigger (const int)
 set at which iteration the use of the castem acceleration algorithm will begin
virtual void setCastemAccelerationPeriod (const int)
 set at which period the use of the castem acceleration algorithm will take place
virtual void resetOutputFile ()
 close and reopen the output files
 ~SchemeBase () override
 destructor
Public Member Functions inherited from mtest::Scheme
 ~Scheme () override
 desctructor
Public Member Functions inherited from tfel::tests::Test
virtual ~Test ()
 destructor
Public Member Functions inherited from mtest::Study
virtual ~Study ()
 destructor

Protected Member Functions

void setDefaultModellingHypothesis () override
 set the modelling hypothesis to the default one
void setGaussPointPositionForEvolutionsEvaluation (const CurrentState &) const override
 set the position of the Gauss point in the evolution manager
size_t getNumberOfUnknowns () const override
Protected Member Functions inherited from mtest::SingleStructureScheme
virtual void checkBehaviourConsistency (const std::shared_ptr< Behaviour > &)
 check that the behaviour is consistent with the modelling hypothesis
virtual void setBehaviour (const std::shared_ptr< Behaviour > &)
 set the behaviour
StiffnessMatrixType getDefaultStiffnessMatrixType () const override
Protected Member Functions inherited from mtest::SchemeBase
void declareVariable (const std::string &, const bool)
 declare a new variable
void declareVariables (const std::vector< std::string > &, const bool)
 declare a list of new variables

Protected Attributes

std::map< double, std::vector< std::string > > events
 list of events
std::vector< std::shared_ptr< UTest > > tests
 list of tests
std::vector< std::shared_ptr< Constraint > > constraints
 constraints
std::vector< std::shared_ptr< UserDefinedPostProcessing > > upostprocessings
 user defined post-processings
tfel::math::tmatrix< 3u, 3u, real > rm
 rotation matrix
bool isRmDefined = false
 boolean, true if the rotation matrix has been defined by the user
std::vector< real > e_t0
std::vector< real > s_t0
real toeps = -1
 tangent operator comparison criterium
real pv = -1
 perturbation value
bool cto = false
 compare to numerical jacobian
bool shallPrintLagrangeMultipliers = false
 print lagrange multpliers
Protected Attributes inherited from mtest::SingleStructureScheme
std::vector< std::string > ivfullnames
 list of internal variable names, including their suffixes
std::shared_ptr< Behaviour > b
 the mechanical behaviour
std::shared_ptr< EvolutionManager > dmpv
 default values for material properties as given by the behaviour
std::vector< real > iv_t0
bool handleThermalExpansion = true
 handle the computation of thermal expansion
Protected Attributes inherited from mtest::SchemeBase
std::vector< std::string > vnames
 declared variable names
bool initialisationFinished = false
 initilisation stage
SolverOptions options
 solver options
std::vector< real > times
 times
std::string description
 description of the test
std::string author
 author
std::string date
 date
ModellingHypothesis::Hypothesis hypothesis
 modelling hypothesis
std::shared_ptr< EvolutionManager > evm
 list of evolutions
std::string output
 output file name
std::ofstream out
 output file
std::string residualFileName
 residual file name
std::string xmlFileName
 xml file name
std::ofstream residual
OutputFrequency output_frequency = USERDEFINEDTIMES
 output frequency
int oprec = -1
 output file precision
int rprec = -1
 residual file precision

Additional Inherited Members

Public Types inherited from mtest::SingleStructureScheme
using Parameters = tfel::utilities::Data
 a simple alias
Public Types inherited from mtest::SchemeBase
enum  OutputFrequency { USERDEFINEDTIMES , EVERYPERIOD }
using ModellingHypothesis = tfel::material::ModellingHypothesis
 a simple alias
using Hypothesis = ModellingHypothesis::Hypothesis
 a simple alias
using EvolutionPtr = std::shared_ptr<Evolution>
 a simple alias
using BehaviourType
 a simple alias
using Kinematic = tfel::material::MechanicalBehaviourBase::Kinematic
 a simple alias
Public Types inherited from mtest::Study
using size_type = tfel::math::vector<real>::size_type
 a simple alias

Detailed Description

MTest is a simple class to test mfront behaviours.

The unknowns are made of the driving variables stensor (for small strain behaviours) followed by a number of lagrange multiplier.

Constructor & Destructor Documentation

◆ MTest()

mtest::MTest::MTest ( )

default constructor

Member Function Documentation

◆ addConstraint()

virtual void mtest::MTest::addConstraint ( const std::shared_ptr< Constraint > )
virtual

add a new constraint

Parameters
[in]c: constraint

◆ addEvent()

void mtest::MTest::addEvent ( const std::string & ,
const std::vector< double > &  )

add a new event

Parameters
[in]eevent name
[in]evtimestimes

◆ addTest()

virtual void mtest::MTest::addTest ( std::shared_ptr< UTest > )
virtual

add a new test

Parameters
[in]t: test to be added

◆ addUserDefinedPostProcessing()

void mtest::MTest::addUserDefinedPostProcessing ( const std::string & ,
const std::vector< std::string > &  )

add a user defined PostProcessing

Parameters
[in]ffilename
[in]plist of PostProcessings

◆ checkConvergence()

bool mtest::MTest::checkConvergence ( StudyCurrentState & ,
const tfel::math::vector< real > & ,
const tfel::math::vector< real > & ,
const SolverOptions & ,
const unsigned int ,
const real ,
const real  ) const
nodiscardoverridevirtual
Parameters
[in]scurrent structure state
[in]duunknows increment estimation
[in]rresidual
[in]osolver options
[in]iiteration number
[in]tcurrent time
[in]dttime increment
Returns
a boolean saying if all convergence criteria are met

Implements mtest::Study.

◆ classname()

std::string mtest::MTest::classname ( ) const
nodiscardoverridevirtual
Returns
the group of the test

Implements tfel::tests::Test.

◆ completeInitialisation()

void mtest::MTest::completeInitialisation ( )
overridevirtual

complete the initialisation. This method must be called once.

Note
this method must be called by the derived class.

Reimplemented from mtest::SchemeBase.

◆ computeLoadingCorrection()

void mtest::MTest::computeLoadingCorrection ( StudyCurrentState & ,
SolverWorkSpace & ,
const SolverOptions & ,
const real ,
const real  ) const
overridevirtual
Parameters
[out]scurrent structure state
[in]wksolver workspace
[in]osolver options
[in]tcurrent time
[in]dttime increment

Implements mtest::Study.

◆ computePredictionStiffnessAndResidual()

std::pair< bool, real > mtest::MTest::computePredictionStiffnessAndResidual ( StudyCurrentState & ,
tfel::math::matrix< real > & ,
tfel::math::vector< real > & ,
const real & ,
const real & ,
const StiffnessMatrixType  ) const
nodiscardoverridevirtual

compute the stiffness matrix and the residual

Returns
a pair containing:
  • a boolean syaing if the behaviour integration shall be performed
  • a scaling factor that can be used to:
    • increase the time step if the integration was successfull
    • decrease the time step if the integration failed or if the results were not reliable (time step too large).
Parameters
[out]scurrent structure state
[out]Ktangent operator
[out]rresidual
[in]tcurrent time
[in]dttime increment
[in]smttype of tangent operator
Note
the memory has already been allocated

Implements mtest::Study.

◆ computeStiffnessMatrixAndResidual()

std::pair< bool, real > mtest::MTest::computeStiffnessMatrixAndResidual ( StudyCurrentState & ,
tfel::math::matrix< real > & ,
tfel::math::vector< real > & ,
const real ,
const real ,
const StiffnessMatrixType  ) const
nodiscardoverridevirtual

compute the stiffness matrix and the residual

Returns
a pair containing:
  • a boolean syaing if the behaviour integration shall be performed
  • a scaling factor that can be used to:
    • increase the time step if the integration was successfull
    • decrease the time step if the integration failed or if the results were not reliable (time step too large).
Parameters
[out]scurrent structure state
[out]Ktangent operator
[out]rresidual
[in]tcurrent time
[in]dttime increment
[in]smttype of tangent operator
Note
the memory has already been allocated

Implements mtest::Study.

◆ execute() [1/3]

tfel::tests::TestResult mtest::MTest::execute ( )
nodiscardoverridevirtual

execute test

Returns
the results of the test

Implements tfel::tests::Test.

◆ execute() [2/3]

virtual tfel::tests::TestResult mtest::MTest::execute ( const bool )
nodiscardvirtual

integrate the behaviour along the loading path

Parameters
[in]bInitif true, call the completeInitialisationMethod

◆ execute() [3/3]

virtual void mtest::MTest::execute ( StudyCurrentState & ,
SolverWorkSpace & ,
const real ,
const real  )
virtual

integrate the behaviour over one step

Parameters
[out]scurrent structure state
[out]wkworkspace
[in]tcurrent time
[in]dttime increment

◆ getErrorNorm()

real mtest::MTest::getErrorNorm ( const tfel::math::vector< real > & ) const
nodiscardoverridevirtual
Parameters
[in]du unknows increment difference between two iterations

Implements mtest::Study.

◆ getFailedCriteriaDiagnostic()

std::vector< std::string > mtest::MTest::getFailedCriteriaDiagnostic ( const StudyCurrentState & ,
const tfel::math::vector< real > & ,
const tfel::math::vector< real > & ,
const SolverOptions & ,
const real ,
const real  ) const
nodiscardoverridevirtual
Parameters
[in]scurrent structure state
[in]duunknows increment estimation
[in]rresidual
[in]osolver options
[in]tcurrent time
[in]dttime increment
Returns
a description of all the criteria that were not met.

Implements mtest::Study.

◆ getNumberOfUnknowns()

size_t mtest::MTest::getNumberOfUnknowns ( ) const
overrideprotectedvirtual
Returns
the number of unknowns (size of driving variables plus the number of lagrangian multipliers)

Implements mtest::Study.

◆ initializeCurrentState()

void mtest::MTest::initializeCurrentState ( StudyCurrentState & ) const
overridevirtual

initialize the current state

Parameters
[in]s: current state

Implements mtest::Study.

◆ initializeWorkSpace()

void mtest::MTest::initializeWorkSpace ( SolverWorkSpace & ) const
overridevirtual

initialize the workspace

Parameters
[in]wk: workspace

Implements mtest::Study.

◆ makeLinearPrediction()

void mtest::MTest::makeLinearPrediction ( StudyCurrentState & ,
const real  ) const
overridevirtual

make a linear prediction of the unknows and state

Parameters
[out]scurrent structure state
[in]dttime increment

Implements mtest::Study.

◆ name()

std::string mtest::MTest::name ( ) const
nodiscardoverridevirtual
Returns
the name of the test

Implements tfel::tests::Test.

◆ postConvergence()

bool mtest::MTest::postConvergence ( StudyCurrentState & ,
const real ,
const real ,
const unsigned int  ) const
nodiscardoverridevirtual
Parameters
[out]scurrent structure state
[in]tcurrent time
[in]dttime increment
[in]pperiod

Implements mtest::Study.

◆ prepare()

std::pair< bool, real > mtest::MTest::prepare ( StudyCurrentState & ,
const real ,
const real  ) const
nodiscardoverridevirtual

update current state at the beginning of a new time step:

  • update the material properties
  • update the external state variables
  • compute the thermal expansion if mandatory
    Parameters
    [out]scurrent structure state
    [in]tcurrent time
    [in]dttime increment

Implements mtest::Study.

◆ printLagrangeMultipliers()

virtual void mtest::MTest::printLagrangeMultipliers ( const bool )
virtual

set if the lagrange multipliers must be printed in the output file

Parameters
[in]b: boolean

◆ printOutput()

void mtest::MTest::printOutput ( const real ,
const StudyCurrentState & ,
const bool  ) const
overridevirtual

print usefull information in the output file

Parameters
[in]ttime
[in]scurrent state
[in]oif true, this time has been specified by the user. Otherwise, it has been reached due to sub-stepping.

Implements mtest::Study.

◆ readInputFile()

virtual void mtest::MTest::readInputFile ( const std::string & ,
const std::vector< std::string > & ,
const std::map< std::string, std::string > &  )
virtual
Parameters
[in]f: file to be read
[in]ecmdsexternal commands
[in]s: substitutions patterns inserted (those substitutions are given through command-line options such as --@YYY@=XXX)

◆ setCompareToNumericalTangentOperator()

virtual void mtest::MTest::setCompareToNumericalTangentOperator ( const bool )
virtual

ask the comparison to the numerical tangent operator

Parameters
[in]bo: boolean

◆ setDefaultModellingHypothesis()

void mtest::MTest::setDefaultModellingHypothesis ( )
overrideprotectedvirtual

set the modelling hypothesis to the default one

Implements mtest::Study.

◆ setGaussPointPositionForEvolutionsEvaluation()

void mtest::MTest::setGaussPointPositionForEvolutionsEvaluation ( const CurrentState & ) const
overrideprotectedvirtual

set the position of the Gauss point in the evolution manager

Parameters
[in]scurrent state

Implements mtest::Study.

◆ setGradientEpsilon()

virtual void mtest::MTest::setGradientEpsilon ( const real )
virtual

set criterium value for the convergence test on the on the driving variable

Parameters
[in]e: criterium

◆ setGradientsInitialValues()

virtual void mtest::MTest::setGradientsInitialValues ( const std::vector< real > & )
virtual

set the inital values of the driving variable

Parameters
[in]v: values

◆ setNumericalTangentOperatorPerturbationValue()

virtual void mtest::MTest::setNumericalTangentOperatorPerturbationValue ( const real )
virtual

set the value used to build the numerical tangent operator

Parameters
[in]v: perturbation value

◆ setRotationMatrix()

virtual void mtest::MTest::setRotationMatrix ( const tfel::math::tmatrix< 3u, 3u, real > & ,
const bool = false )
virtual

set the rotation matrix

Parameters
[in]r: rotation matrix
[in]b: allow redefining the rotation matrix

◆ setTangentOperatorComparisonCriterion()

virtual void mtest::MTest::setTangentOperatorComparisonCriterion ( const real )
virtual

set the value used to compare the tangent operator given by the behaviour to the numerical tangent operator

Parameters
[in]v: value

◆ setThermodynamicForceEpsilon()

virtual void mtest::MTest::setThermodynamicForceEpsilon ( const real )
virtual

set criterium value for the convergence test on the thermodynamic forces

Parameters
[in]e: criterium

◆ setThermodynamicForcesInitialValues()

virtual void mtest::MTest::setThermodynamicForcesInitialValues ( const std::vector< real > & )
virtual

set the inital values of the thermodynamic forces

Parameters
[in]v: values

The documentation for this struct was generated from the following file: