# ConstitutiveLaw

## Functions

The following functions are available in the constitutive law base class. For any implementation of a constitutive model in Kratos, these functions have to be properly implemented.

**virtual ConstitutiveLaw::Pointer Clone() const:** Clone function. This has to be implemented by any derived class. The function returns a pointer to a new new instance of the constitutive law. The Clone() function throws an error in the base class since an instance of a generic constitutive law is not possible. The implementation in a derived class would look like this:

ConstitutiveLaw::Pointer p_clone(new YourConstitutiveLaw()); return p_clone;

**virtual SizeType WorkingSpaceDimension():** returns the working space dimension of the current constitutive law. This function has to be implemented by any derived class.

**virtual SizeType GetStrainSize():** returns the number of independent components of the strain tensor in the constitutive law (e.g. six for a 3D model). This function has to be implemented by any derived class.

**virtual bool Has( const Variable< double > &rThisVariable ):** returns whether the specified variable is defined in the constitutive law. In the base class, this always returns false. If a variable is to be considered, this function needs to be overridden by the derived class.

**virtual bool Has( const Variable< Vector > &rThisVariable ):** returns whether the specified variable is defined in the constitutive law. In the base class, this always returns false. If a variable is to be considered, this function needs to be overridden by the derived class.

**virtual bool Has( const Variable< Matrix > &rThisVariable ):** returns whether the specified variable is defined in the constitutive law. In the base class, this always returns false. If a variable is to be considered, this function needs to be overridden by the derived class.

**virtual bool Has( const Variable< array_1d< double, 3 > > &rThisVariable ):** returns whether the specified variable is defined in the constitutive law. In the base class, this always returns false. If a variable is to be considered, this function needs to be overridden by the derived class.

**virtual bool Has( const Variable< array_1d< double, 6 > > &rThisVariable ):** returns whether the specified variable is defined in the constitutive law. In the base class, this always returns false. If a variable is to be considered, this function needs to be overridden by the derived class.

**virtual double& GetValue( const Variable< double > &rThisVariable, double& rValue ):** returns the value of the specified variable. Unless specified otherwise, this simply returns the unchanged parameter rValue.

**virtual Vector& GetValue( const Variable< Vector > &rThisVariable, Vector& rValue ):** returns the value of the specified variable. Unless specified otherwise, this simply returns the unchanged parameter rValue.

**virtual Matrix& GetValue( const Variable< Matrix > &rThisVariable, Matrix& rValue ):** returns the value of the specified variable. Unless specified otherwise, this simply returns the unchanged parameter rValue.

**virtual array_1d< double, 3> >& GetValue( const Variable< array_1d< double, 3> > &rThisVariable, double &array_1d< double, 3> > ):** returns the value of the specified variable. Unless specified otherwise, this simply returns the unchanged parameter rValue.

**virtual array_1d< double, 6> >& GetValue( const Variable< array_1d< double, 6> > &rThisVariable, double &array_1d< double, 6> > ):** returns the value of the specified variable. Unless specified in derived class, this simply returns the unchanged parameter rValue.

**virtual void SetValue( const Variable< double >& rVariable, const double& Value, const ProcessInfo& rCurrentProcessInfo )**: can be used to set variables. Unless specified in derived class, this funciton does nothing.

**virtual void SetValue( const Variable< Vector >& rVariable, const Vector& Value, const ProcessInfo& rCurrentProcessInfo )**: can be used to set variables. Unless specified in derived class, this funciton does nothing.

**virtual void SetValue( const Variable< Matrix >& rVariable, const Matrix& Value, const ProcessInfo& rCurrentProcessInfo )**: can be used to set variables. Unless specified in derived class, this funciton does nothing.

**virtual void SetValue( const Variable< array_1d< double, 3 > >& rVariable, const array_1d< double, 3 >& Value, const ProcessInfo& rCurrentProcessInfo )**: can be used to set variables. Unless specified in derived class, this funciton does nothing.

**virtual void SetValue( const Variable< array_1d< double, 6 > >& rVariable, const array_1d< double, 6 >& Value, const ProcessInfo& rCurrentProcessInfo )**: can be used to set variables. Unless specified in derived class, this funciton does nothing.

**virtual bool ValidateInput( const Properties &props ):** This function is required to check is the input provided to the constitutive law is valid. Unless specified in the derived class, this returns always false. The derived class is required to assure that the respective Properties object that is associated with the constitutive law contains all required data.

**virtual StrainMeasure GetStrainMeasure():** returns the strain measure that is expected by the constitutive law. Unless specified in the derived class, this returns the default strain measure (linear strain measure).

**virtual StressMeasure GetStressMeasure():** returns the stress measure the constitutive law is formulated in. Unless specified in the derived class, this returns the default stress measure (First Piola-Kirchhoff stress tensor in Voigt notation)

**virtual bool IsIncremental():** returns whether the constitutive law is formulated in incremental or total strains. By default, this returns false (meaning that the constitutive law is formulated in total strains). This needs to be defined in the derived class only if incremental strains are to be used.

**virtual void InitializeMaterial( const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues ):** This function is called during the initialization of the elements. If the derived constitutive model requires any initialization, this function has to be implemented.

**virtual void InitializeSolutionStep( const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues, const ProcessInfo &CurrentProcessInfo ):** This function is called prior to each solution step. If any solution step initialization is required, this function has to be implemented by the derived class.

**virtual void FinalizeSolutionStep( const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues, const ProcessInfo &CurrentProcessInfo ):** This function is called to finalize a solution step after the iteration has been completed. If any finalizing steps are required, this function has to be implemented by the derived class.

**virtual void InitializeNonLinearIteration( const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues, const ProcessInfo &CurrentProcessInfo ):** This function is called prior to each iteration step. If any iteration step initialization is required, this function has to be implemented by the derived class.

**virtual void CalculateMaterialResponse( const Vector &StrainVector, const Matrix &DeformationGradient, Vector &StressVector, Matrix &AlgorithmicTangent, const ProcessInfo &CurrentProcessInfo, const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues, bool CalculateStresses=true, int CalculateTangent=true, bool SaveInternalVariables=true ):** This is the basic function for the computation of the material response. This function has to be implemented by each derived class. In the base class, the function throws an error.

**virtual void CalculateVolumetricResponse( const double VolumetricStrain, const Matrix &DeformationGradient, double &VolumetricStress, double &AlgorithmicBulk, const ProcessInfo &CurrentProcessInfo, const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues, bool CalculateStresses=true, int CalculateTangent=true, bool SaveInternalVariables=true):** This function is intended for the computation of the material response in terms of purely volumetric formulations. In the base class, the function throws an error.

**virtual void CalculateDeviatoricResponse( const Vector &StrainVector, const Matrix &DeformationGradient, Vector &StressVector, Matrix &AlgorithmicTangent, const ProcessInfo &CurrentProcessInfo, const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues, bool CalculateStresses=true, int CalculateTangent=true, bool SaveInternalVariables=true ):** This function is intended for the computation of the material response in terms of purely deviatoric formulations. In the base class, the function throws an error.

**virtual void ResetMaterial( const Properties &props, const GeometryType &geom, const Vector &ShapeFunctionsValues ):** This function is called to reset all internal variables in the constitutive law and to re-initialize the material. To avoid unexpected behavior, the function throws an error if not implemented in the derived class. In the case of constitutive laws that do not store any state variables, however, this function can be implemented as an empty function.