Skip to content
Snippets Groups Projects
Commit 85b8d0c6 authored by Van Dung NGUYEN's avatar Van Dung NGUYEN
Browse files

local IP

parent a7ef3d8c
No related branches found
No related tags found
1 merge request!27Update from Master
......@@ -28,7 +28,7 @@ class materialLaw{
transverseIsoYarnB, Anisotropic, AnisotropicStoch, nonLocalDamage, vumat,
FSElastic, FSElastoPlastic, numeric, secondOrderElastic, j2smallstrain,nonLocalDamageGurson,nonLocalDamageJ2Hyper, nonLocalDamageIsotropicElasticity,LinearThermoMechanics,J2ThermoMechanics,SMP,LinearElecTherMech,
AnIsotropicElecTherMech, hyperelastic, quadYieldHyper, powerYieldLaw, powerYieldLawWithFailure, nonLocalDamageQuadYieldHyper,nonLocalDamagePowerYieldHyper,
nonLocalDamagePowerYieldHyperWithFailure,ElecSMP,ThermalConducter,AnIsotropicTherMech, localDamageJ2Hyper,linearElastic};
localDamagePowerYieldHyperWithFailure,nonLocalDamagePowerYieldHyperWithFailure,ElecSMP,ThermalConducter,AnIsotropicTherMech, localDamageJ2Hyper,linearElastic};
protected :
......
......@@ -152,6 +152,202 @@ void mlawNonLocalDamagePowerYieldHyper::constitutive(
}
mlawNonLocalDamagePowerYieldHyperWithFailure::mlawNonLocalDamagePowerYieldHyperWithFailure(const int num,const double E,const double nu, const double rho,
const double tol, const bool matrixbyPerturbation , const double pert):
mlawPowerYieldHyperWithFailure(num,E,nu,rho,tol,matrixbyPerturbation,pert), _saturated(false){};
void mlawNonLocalDamagePowerYieldHyperWithFailure::clearAllCLengthLaw(){
for (int i=0; i< cLLaw.size(); i++){
if (cLLaw[i]!= NULL) delete cLLaw[i];
}
cLLaw.clear();
};
void mlawNonLocalDamagePowerYieldHyperWithFailure::clearAllDamageLaw(){
for (int i=0; i< damLaw.size(); i++){
if (damLaw[i]!= NULL) delete damLaw[i];
}
damLaw.clear();
};
void mlawNonLocalDamagePowerYieldHyperWithFailure::setCLengthLaw(const CLengthLaw &_cLLaw){
cLLaw.push_back(_cLLaw.clone());
};
void mlawNonLocalDamagePowerYieldHyperWithFailure::setDamageLaw(const DamageLaw &_damLaw){
damLaw.push_back(_damLaw.clone());
};
mlawNonLocalDamagePowerYieldHyperWithFailure::mlawNonLocalDamagePowerYieldHyperWithFailure(const mlawNonLocalDamagePowerYieldHyperWithFailure &source):
mlawPowerYieldHyperWithFailure(source),_saturated(source._saturated){
cLLaw.clear();
damLaw.clear();
for (int i=0; i< source.cLLaw.size(); i++){
if(source.cLLaw[i] != NULL)
{
cLLaw.push_back(source.cLLaw[i]->clone());
}
if(source.damLaw[i] != NULL)
{
damLaw.push_back(source.damLaw[i]->clone());
};
}
}
mlawNonLocalDamagePowerYieldHyperWithFailure::~mlawNonLocalDamagePowerYieldHyperWithFailure(){
for (int i=0; i< cLLaw.size(); i++){
if (cLLaw[i]!= NULL) delete cLLaw[i];
if (damLaw[i]!= NULL) delete damLaw[i];
}
cLLaw.clear();
damLaw.clear();
};
void mlawNonLocalDamagePowerYieldHyperWithFailure::createIPState(IPStateBase* &ips,const bool* state_,const MElement *ele, const int nbFF_, const IntPt *GP, const int gpt) const
{
IPVariable* ipvi = new IPHyperViscoElastoPlasticMultipleNonLocalDamage(_compression,_traction,_shear,_kinematic,_N,cLLaw,damLaw);
IPVariable* ipv1 = new IPHyperViscoElastoPlasticMultipleNonLocalDamage(_compression,_traction,_shear,_kinematic,_N,cLLaw,damLaw);
IPVariable* ipv2 = new IPHyperViscoElastoPlasticMultipleNonLocalDamage(_compression,_traction,_shear,_kinematic,_N,cLLaw,damLaw);
if(ips != NULL) delete ips;
ips = new IP3State(state_,ipvi,ipv1,ipv2);
}
void mlawNonLocalDamagePowerYieldHyperWithFailure::createIPState(IPHyperViscoElastoPlasticMultipleNonLocalDamage *ivi, IPHyperViscoElastoPlasticMultipleNonLocalDamage *iv1, IPHyperViscoElastoPlasticMultipleNonLocalDamage *iv2) const
{
}
void mlawNonLocalDamagePowerYieldHyperWithFailure::createIPVariable(IPHyperViscoElastoPlasticMultipleNonLocalDamage *&ipv,const MElement *ele,const int nbFF,const IntPt *GP, const int gpt) const
{
}
double mlawNonLocalDamagePowerYieldHyperWithFailure::soundSpeed() const
{
return mlawPowerYieldHyperWithFailure::soundSpeed();
}
void mlawNonLocalDamagePowerYieldHyperWithFailure::constitutive(const STensor3& F0,const STensor3& Fn,STensor3 &P,const IPHyperViscoElastoPlasticMultipleNonLocalDamage *q0,
IPHyperViscoElastoPlasticMultipleNonLocalDamage *q1,STensor43 &Tangent,
const bool stiff) const
{
mlawPowerYieldHyperWithFailure::constitutive(F0,Fn,P,q0,q1,Tangent,stiff);
}
void mlawNonLocalDamagePowerYieldHyperWithFailure::constitutive(
const STensor3& F0, // initial deformation gradient (input @ time n)
const STensor3& Fn, // updated deformation gradient (input @ time n+1)
STensor3 &P, // updated 1st Piola-Kirchhoff stress tensor (output)
const IPHyperViscoElastoPlasticMultipleNonLocalDamage *ipvprev, // array of initial internal variable
IPHyperViscoElastoPlasticMultipleNonLocalDamage *ipvcur, // updated array of internal variable (in ipvcur on output),
STensor43 &Tangent, // constitutive tangents (output)
std::vector<STensor3> &dLocalVariableDStrain,
std::vector<STensor3> &dStressDNonLocalVariable,
fullMatrix<double> &dLocalVariableDNonLocalVariable,
const bool stiff // if true compute the tangents
) const
{
double p0 = ipvprev->getCurrentPlasticStrain();
// compute non-local length scales for first and second damage variable
cLLaw[0]->computeCL(p0, ipvcur->getRefToIPCLength(0));
cLLaw[1]->computeCL(p0, ipvcur->getRefToIPCLength(1));
if (isSaturatedHardening()){
// saturate when defined critical for damage law
if (ipvprev->getDamage(1) >= damLaw[1]->getCriticalDamage()){
ipvcur->saturateHardening(ipvprev);
}
}
static STensor43 dFedF, dFpdF;
static STensor3 Peff;
mlawPowerYieldHyperWithFailure::predictorCorrector(Fn,ipvprev,ipvcur,Peff,stiff,Tangent,dFedF,dFpdF);
// get result from effective law
const STensor3& Fe = ipvcur->_Fe;
const STensor3& dgammadF = ipvcur->_DgammaDF;
const STensor3 &Fp = ipvcur->getConstRefToFp();
const STensor3& dgFdF = ipvcur->getConstRefToDFailurePlasticityDF();
double ene = ipvcur->defoEnergy();
//Msg::Info("enery = %e",ene);
// saturation damage always develops
damLaw[0]->computeDamage(ipvcur->getEffectivePlasticStrain(),
ipvprev->getEffectivePlasticStrain(),
ene, Fe, Fp, Peff, Cel,
ipvprev->getConstRefToIPDamage(0),ipvcur->getRefToIPDamage(0));
if (ipvprev->getDamage(1) < ipvcur->getCriticalDamage()){
// set for current critical damage
ipvcur->setCriticalDamage(ipvcur->getCriticalDamage());
// damage evolution
damLaw[1]->computeDamage(ipvcur->getNonLocalFailurePlasticity(),
ipvprev->getNonLocalFailurePlasticity(),
ene, Fe, Fp, Peff, Cel,
ipvprev->getConstRefToIPDamage(1),ipvcur->getRefToIPDamage(1));
}
else{
// damage stop increasing
STensor3 dDDFe(0.);
IPDamage& curDama1 = ipvcur->getRefToIPDamage(1);
curDama1.setValues(ipvprev->getDamage(1),ipvcur->getMaximalP(1),0.,0.,dDDFe);
}
// computue total softening
double D1 = ipvcur->getDamage(0);
double D2 = ipvcur->getDamage(1);
double D = 1. - (1.- D1)*(1.-D2);
P = Peff;
P*= (1.- D);
if(stiff)
{
// we need to correct partial P/partial F: (1-D) partial P/partial F - Peff otimes partial D partial F
Tangent*=(1.-D);
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
for(int k=0;k<3;k++)
{
for(int l=0;l<3;l++)
{
for(int m=0; m<3; m++)
{
for(int n=0; n<3; n++)
{
Tangent(i,j,k,l)-=Peff(i,j)*((1.-D2)*ipvcur->getConstRefToDDamageDFe(0)(m,n) +(1.-D1)*ipvcur->getConstRefToDDamageDFe(1)(m,n)) *dFedF(m,n,k,l);
}
}
}
}
}
}
// -hat{P} partial D/partial tilde p
for (int i=0; i<3; i++){
for (int j=0; j<3; j++){
// partial p/partial F
dLocalVariableDStrain[0](i,j) = dgammadF(i,j);
dLocalVariableDStrain[1](i,j) = dgFdF(i,j);
dStressDNonLocalVariable[0](i,j) = -1.*Peff(i,j)*ipvcur->getDDamageDp(0)*(1.- D2);
dStressDNonLocalVariable[1](i,j) = -1.*Peff(i,j)*(1.-D1)*ipvcur->getDDamageDp(1);
}
}
// partial p partial tilde p (0 if no MFH)
dLocalVariableDNonLocalVariable.setAll(0.);
}
}
mlawNonLocalDamagePowerYieldHyperWithFailure::mlawNonLocalDamagePowerYieldHyperWithFailure(const int num,const double E,const double nu, const double rho,
......
......@@ -77,6 +77,67 @@ class mlawNonLocalDamagePowerYieldHyper : public mlawPowerYieldHyper{
#endif // SWIG
};
class mlawLocalDamagePowerYieldHyperWithFailure : public mlawPowerYieldHyperWithFailure{
protected:
std::vector<DamageLaw*> damLaw;
bool _saturated; // saturate after reaching critical state
public:
mlawLocalDamagePowerYieldHyperWithFailure(const int num,const double E,const double nu, const double rho,
const double tol=1.e-6, const bool matrixbyPerturbation = false, const double pert = 1e-8);
void clearAllDamageLaw();
void setDamageLaw(const DamageLaw &_damLaw);
#ifndef SWIG
mlawLocalDamagePowerYieldHyperWithFailure(const mlawLocalDamagePowerYieldHyperWithFailure &source);
virtual ~mlawLocalDamagePowerYieldHyperWithFailure();
virtual materialLaw* clone() const { return new mlawLocalDamagePowerYieldHyperWithFailure(*this);}
bool isSaturatedHardening() const {return _saturated;};
void saturatedHardening(const bool falg) {_saturated = falg;};
// function of materialLaw
virtual matname getType() const{return materialLaw::localDamagePowerYieldHyperWithFailure;}
virtual bool withDamage() const {return true;};
virtual void createIPState(IPHyperViscoElastoPlasticMultipleLocalDamage *ivi, IPHyperViscoElastoPlasticMultipleLocalDamage *iv1, IPHyperViscoElastoPlasticMultipleLocalDamage *iv2) const;
virtual void createIPState(IPStateBase* &ips,const bool* state_=NULL,const MElement *ele=NULL, const int nbFF_=0, const IntPt *GP=NULL, const int gpt = 0) const;
virtual void createIPVariable(IPHyperViscoElastoPlasticMultipleLocalDamage *&ipv,const MElement *ele,const int nbFF,const IntPt *GP, const int gpt) const;
virtual void initLaws(const std::map<int,materialLaw*> &maplaw){}; // this law is initialized so nothing to do
virtual double soundSpeed() const; // default but you can redefine it for your case
virtual const std::vector<CLengthLaw*>& getCLengthLaw() const {return cLLaw; };
virtual const std::vector<DamageLaw*>& getDamageLaw() const {return damLaw; };
// specific function
public:
virtual void constitutive(
const STensor3& F0, // initial deformation gradient (input @ time n)
const STensor3& Fn, // updated deformation gradient (input @ time n+1)
STensor3 &P, // updated 1st Piola-Kirchhoff stress tensor (output)
const IPHyperViscoElastoPlasticMultipleLocalDamage *q0, // array of initial internal variable
IPHyperViscoElastoPlasticMultipleLocalDamage *q1, // updated array of internal variable (in ipvcur on output),
STensor43 &Tangent, // constitutive tangents (output)
const bool stiff // if true compute the tangents
) const;
virtual void constitutive(
const STensor3& F0, // initial deformation gradient (input @ time n)
const STensor3& Fn, // updated deformation gradient (input @ time n+1)
STensor3 &P, // updated 1st Piola-Kirchhoff stress tensor (output)
const IPHyperViscoElastoPlasticMultipleLocalDamage *q0, // array of initial internal variable
IPHyperViscoElastoPlasticMultipleLocalDamage *q1, // updated array of internal variable (in ipvcur on output),
STensor43 &Tangent, // constitutive tangents (output)
std::vector<STensor3> &dLocalVariableDStrain,
std::vector<STensor3> &dStressDNonLocalVariable,
fullMatrix<double> &dLocalVariableDNonLocalVariable,
const bool stiff // if true compute the tangents
) const;
#endif // SWIG
};
class mlawNonLocalDamagePowerYieldHyperWithFailure : public mlawPowerYieldHyperWithFailure{
protected:
std::vector<CLengthLaw*> cLLaw;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment