10 #if !defined(KRATOS_DAMAGE_MODEL_H_INCLUDED )
11 #define KRATOS_DAMAGE_MODEL_H_INCLUDED
48 template<
class TElasticityModel,
class TYieldSurface>
102 ConstitutiveModel::Pointer
Clone()
const override
104 return Kratos::make_shared<DamageModel>(*
this);
127 double& rDamageThreshold =
mInternal.Variables[0];
130 rDamageThreshold = rProperties[DAMAGE_THRESHOLD];
171 if( rValues.
State.
Is(ConstitutiveModelData::UPDATE_INTERNAL_VARIABLES ) )
186 rConstitutiveMatrix.
clear();
206 this->
mElasticityModel.CalculateConstitutiveTensor(rValues,rConstitutiveMatrix);
209 if( Variables.State().Is(ConstitutiveModelData::PLASTIC_REGION) )
212 Variables.State().Set(ConstitutiveModelData::CONSTITUTIVE_MATRIX_COMPUTED,
true);
241 this->
mElasticityModel.CalculateConstitutiveTensor(rValues,rConstitutiveMatrix);
244 if( Variables.State().Is(ConstitutiveModelData::PLASTIC_REGION) ){
251 Variables.State().Set(ConstitutiveModelData::CONSTITUTIVE_MATRIX_COMPUTED,
true);
253 if( rValues.
State.
Is(ConstitutiveModelData::UPDATE_INTERNAL_VARIABLES ) )
272 const double& rValue,
273 const ProcessInfo& rCurrentProcessInfo)
override {}
290 std::string
Info()
const override
292 std::stringstream buffer;
293 buffer <<
"DamageModel" ;
300 rOStream <<
"DamageModel";
306 rOStream <<
"DamageModel Data";
344 double& rDamageThreshold = rVariables.Internal.Variables[0];
350 rVariables.TrialStateFunction = this->
mYieldSurface.CalculateYieldCondition(rVariables, rVariables.TrialStateFunction);
352 if( rVariables.TrialStateFunction < rDamageThreshold )
354 rVariables.State().Set(ConstitutiveModelData::PLASTIC_REGION,
false);
363 std::cout<<
" ConstitutiveLaw did not converge "<<std::endl;
369 rVariables.State().Set(ConstitutiveModelData::PLASTIC_REGION,
true);
373 rVariables.State().Set(ConstitutiveModelData::RETURN_MAPPING_COMPUTED,
true);
386 if( rVariables.State().IsNot(ConstitutiveModelData::RETURN_MAPPING_COMPUTED) )
387 KRATOS_ERROR <<
"ReturnMapping has to be computed to perform the calculation" << std::endl;
389 const SizeType& VoigtSize = rVariables.GetModelData().GetVoigtSize();
396 double DeltaStateFunction = 0;
397 DeltaStateFunction = this->
mYieldSurface.CalculateDeltaStateFunction( rVariables, DeltaStateFunction );
419 Vector EffectiveStressVector(VoigtSize);
422 Vector EquivalentStrainVector(VoigtSize);
425 rVariables.State().Set(ConstitutiveModelData::CONSTITUTIVE_MATRIX_COMPUTED,
true);
438 double& rDamageThreshold = rVariables.Internal.Variables[0];
439 double& rDamage = rVariables.Internal.Variables[1];
441 double StateFunction = rVariables.TrialStateFunction;
443 if ( StateFunction >= rDamageThreshold )
445 rDamageThreshold = StateFunction;
448 StateFunction = this->
mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
450 rDamage = StateFunction;
469 rVariables.SetModelData(rValues);
471 rValues.
State.
Set(ConstitutiveModelData::PLASTIC_REGION,
false);
473 rVariables.SetState(rValues.
State);
476 rVariables.RateFactor = 0;
482 rVariables.TrialStateFunction = 0;
483 rVariables.StressNorm = 0;
495 double& rDamage = rVariables.Internal.Variables[1];
498 rStressMatrix *= (1.0-rDamage);
520 rVariables.RateFactor = 0.0;
522 const SizeType& VoigtSize = rVariables.GetModelData().GetVoigtSize();
525 if( VoigtSize == 3 ){
528 sqrt(0.25*(rStressMatrix(0,0)-rStressMatrix(1,1))*(rStressMatrix(0,0)-rStressMatrix(1,1)) +
529 rStressMatrix(0,1)*rStressMatrix(0,1));
531 sqrt(0.25*(rStressMatrix(0,0)-rStressMatrix(1,1))*(rStressMatrix(0,0)-rStressMatrix(1,1)) +
532 rStressMatrix(0,1)*rStressMatrix(0,1));
539 double Macaulay_PrincipalStress = 0.0;
540 double Absolute_PrincipalStress = 0.0;
555 if(Absolute_PrincipalStress > 1.0e-20)
557 rVariables.RateFactor = Macaulay_PrincipalStress/Absolute_PrincipalStress;
561 rVariables.RateFactor = 0.5;
565 const Matrix& rStrainMatrix = rVariables.GetStrainMatrix();
567 noalias(Auxiliar) =
prod(rStrainMatrix,rStressMatrix);
569 rVariables.StressNorm = 0.0;
571 for(
unsigned int i=0;
i<3;
i++)
573 rVariables.StressNorm += Auxiliar(
i,
i);
590 const SizeType& VoigtSize = rVariables.GetModelData().GetVoigtSize();
592 Vector StressVector(VoigtSize);
594 double EquivalentStrainForward = 0.0;
595 double EquivalentStrainBackward = 0.0;
598 const MatrixType& rStrainMatrix = rVariables.GetStrainMatrix();
599 Vector StrainVector(VoigtSize);
601 Vector PerturbatedStrainVector;
604 for(
unsigned int i = 0;
i < VoigtSize;
i++)
607 StrainVector[
i] += PerturbatedStrainVector[
i];
610 noalias(StressVector) =
prod(rConstitutiveMatrix, StrainVector);
614 EquivalentStrainForward = this->
mYieldSurface.CalculateYieldCondition(rVariables, EquivalentStrainForward);
616 StrainVector[
i] -= PerturbatedStrainVector[
i];
619 StrainVector[
i] -= PerturbatedStrainVector[
i];
622 noalias(StressVector) =
prod(rConstitutiveMatrix, StrainVector);
626 EquivalentStrainBackward = this->
mYieldSurface.CalculateYieldCondition(rVariables, EquivalentStrainBackward);
628 StrainVector[
i] += PerturbatedStrainVector[
i];
630 rEquivalentStrainDerivative[
i] = (EquivalentStrainForward - EquivalentStrainBackward) / (2.0 * PerturbatedStrainVector[
i]);
633 return rEquivalentStrainDerivative;
697 void save(
Serializer& rSerializer)
const override
StressMeasureType
Definition: constitutive_model_data.hpp:83
StrainMeasureType
Definition: constitutive_model_data.hpp:75
ConstitutiveModelData::SizeType SizeType
Definition: constitutive_model.hpp:66
static Vector EigenValuesDirectMethod(const Matrix &A)
Definition: constitutive_model_utilities.hpp:983
static void ComputePerturbationVector(Vector &rPerturbationVector, const Vector &InputVector)
Definition: constitutive_model_utilities.hpp:926
static void StrainTensorToVector(const MatrixType &rMatrix, array_1d< double, 6 > &rVector)
Definition: constitutive_model_utilities.hpp:646
static Vector & StressTensorToVector(const MatrixType &rStressTensor, Vector &rStressVector)
Definition: constitutive_model_utilities.hpp:843
static MatrixType & StressVectorToTensor(const Vector &rStressVector, MatrixType &rStressTensor)
Definition: constitutive_model_utilities.hpp:779
static MatrixType & StrainVectorToTensor(const array_1d< double, 6 > &rVector, MatrixType &rMatrix)
Definition: constitutive_model_utilities.hpp:619
Short class definition.
Definition: damage_model.hpp:50
bool Has(const Variable< double > &rThisVariable) override
Definition: damage_model.hpp:266
PlasticityModel< ElasticityModelType, YieldSurfaceType > BaseType
Definition: damage_model.hpp:63
~DamageModel() override
Destructor.
Definition: damage_model.hpp:108
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: damage_model.hpp:298
KRATOS_CLASS_POINTER_DEFINITION(DamageModel)
Pointer definition of DamageModel.
BaseType::Pointer BaseTypePointer
Definition: damage_model.hpp:66
void SetInternalVariables(ModelDataType &rValues, PlasticDataType &rVariables) override
Definition: damage_model.hpp:640
void InitializeModel(ModelDataType &rValues) override
Definition: damage_model.hpp:139
void CalculateConstitutiveTensor(ModelDataType &rValues, Matrix &rConstitutiveMatrix) override
Definition: damage_model.hpp:181
void SetValue(const Variable< double > &rVariable, const double &rValue, const ProcessInfo &rCurrentProcessInfo) override
Definition: damage_model.hpp:271
Vector & CalculateEquivalentStrainDerivative(PlasticDataType &rVariables, const Matrix &rConstitutiveMatrix, Vector &rEquivalentStrainDerivative)
Definition: damage_model.hpp:584
virtual bool CalculateReturnMapping(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: damage_model.hpp:434
BaseType::VectorType VectorType
Definition: damage_model.hpp:69
void CalculateStressTensor(ModelDataType &rValues, MatrixType &rStressMatrix) override
Definition: damage_model.hpp:153
InternalVariablesType mInternal
Definition: damage_model.hpp:326
std::string Info() const override
Turn back information as a string.
Definition: damage_model.hpp:290
BaseType::ModelDataType ModelDataType
Definition: damage_model.hpp:71
DamageModel & operator=(DamageModel const &rOther)
Assignment operator.
Definition: damage_model.hpp:94
BaseType::MaterialDataType MaterialDataType
Definition: damage_model.hpp:72
BaseType::PlasticDataType PlasticDataType
Definition: damage_model.hpp:73
BaseType::InternalVariablesType InternalVariablesType
Definition: damage_model.hpp:74
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: damage_model.hpp:304
TElasticityModel ElasticityModelType
Definition: damage_model.hpp:57
BaseType::SizeType SizeType
Definition: damage_model.hpp:67
virtual void CalculateAndAddStressTensor(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: damage_model.hpp:340
double & GetValue(const Variable< double > &rThisVariable, double &rValue) override
Definition: damage_model.hpp:277
DamageModel()
Default constructor.
Definition: damage_model.hpp:88
virtual void UpdateInternalVariables(ModelDataType &rValues, PlasticDataType &rVariables, const MatrixType &rStressMatrix)
Definition: damage_model.hpp:503
ConstitutiveModel::Pointer Clone() const override
Clone.
Definition: damage_model.hpp:102
void CalculateStressNorm(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: damage_model.hpp:515
BaseType::VoigtIndexType VoigtIndexType
Definition: damage_model.hpp:68
ConstitutiveModelData::StrainMeasureType StrainMeasureType
Definition: damage_model.hpp:76
TYieldSurface YieldSurfaceType
Definition: damage_model.hpp:60
void InitializeMaterial(const Properties &rProperties) override
Definition: damage_model.hpp:123
virtual void UpdateStressConfiguration(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: damage_model.hpp:491
virtual void CalculateAndAddPlasticConstitutiveTensor(PlasticDataType &rVariables, Matrix &rConstitutiveMatrix)
Definition: damage_model.hpp:381
DamageModel(DamageModel const &rOther)
Copy constructor.
Definition: damage_model.hpp:91
void CalculateStressAndConstitutiveTensors(ModelDataType &rValues, MatrixType &rStressMatrix, Matrix &rConstitutiveMatrix) override
Definition: damage_model.hpp:220
BaseType::MatrixType MatrixType
Definition: damage_model.hpp:70
virtual void InitializeVariables(ModelDataType &rValues, PlasticDataType &rVariables)
Definition: damage_model.hpp:464
ConstitutiveModelData::StressMeasureType StressMeasureType
Definition: damage_model.hpp:77
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool Is(Flags const &rOther) const
Definition: flags.h:274
Definition: amatrix_interface.h:41
void clear()
Definition: amatrix_interface.h:284
Short class definition.
Definition: plasticity_model.hpp:50
YieldSurfaceType mYieldSurface
Definition: plasticity_model.hpp:336
ElasticityModelType mElasticityModel
Definition: plasticity_model.hpp:335
TYieldSurface::InternalVariablesType InternalVariablesType
Definition: plasticity_model.hpp:69
ConstitutiveModelData::SizeType SizeType
Definition: plasticity_model.hpp:63
ConstitutiveModelData::VoigtIndexType VoigtIndexType
Definition: plasticity_model.hpp:64
void InitializeModel(ModelDataType &rValues) override
Definition: plasticity_model.hpp:127
PlasticityModel & operator=(PlasticityModel const &rOther)
Assignment operator.
Definition: plasticity_model.hpp:85
TYieldSurface::PlasticDataType PlasticDataType
Definition: plasticity_model.hpp:68
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
PrincipalStresses
Definition: isotropic_damage_automatic_differentiation.py:221
def load(f)
Definition: ode_solve.py:307
integer i
Definition: TensorModule.f:17
Definition: constitutive_model_data.hpp:92
Definition: constitutive_model_data.hpp:383
VariableValueData InternalVariable
Definition: constitutive_model_data.hpp:405
MatrixType StressMatrix
Definition: constitutive_model_data.hpp:401
Flags State
Definition: constitutive_model_data.hpp:399
MatrixType StrainMatrix
Definition: constitutive_model_data.hpp:402
const MatrixType & GetStressMatrix() const
Definition: constitutive_model_data.hpp:461
void SetValue(const Variable< int > &rVariable, int &rValue)
Definition: constitutive_model_data.hpp:313