Commit 1053a16c authored by Antoine Jacquey's avatar Antoine Jacquey

Created a base class for deformation.

parent 89da1ea4
......@@ -28,7 +28,7 @@ class LynxDamageDeformation;
template <>
InputParameters validParams<LynxDamageDeformation>();
class LynxDamageDeformation : public LynxDeformation
class LynxDamageDeformation : public LynxDeformationBase
{
public:
LynxDamageDeformation(const InputParameters & parameters);
......@@ -36,18 +36,23 @@ public:
protected:
virtual void initQpStatefulProperties() override;
virtual void computeQpDeformation() override;
virtual void elasticModuli() override;
virtual void plasticCorrection(Real & pressure, RankTwoTensor & stress_dev) override;
virtual void convexPlasticCorrection(Real & pressure, RankTwoTensor & stress_dev);
virtual Real convexReferencePressure(const Real & p_tr, const Real & q_tr);
virtual Real convexPlasticYield2(const Real & rho);
virtual Real computePlasticityYield(const Real & pressure, const Real & eqv_stress);
virtual Real plasticIncrement(const Real & /*pressure*/, const Real & eqv_stress);
virtual Real computeConvexPlasticityYield2(const Real & pressure, const Real & eqv_stress);
virtual Real computeConvexPlasticityYield2(const Real & rho);
virtual Real convexPlasticIncrement(Real & vol_plastic_incr, Real & eqv_plastic_incr);
virtual void computeDamageProperties(const Real & pressure, const Real & eqv_stress);
virtual void updateDamageParameters();
virtual void updateDamageConvexParameters(const Real & pressure, const Real & eqv_stress);
virtual Real convexReferencePressure();
virtual Real dConvexPlasticYield2(const Real & rho);
virtual Real convexPlasticYield2(const Real & pressure, const Real & eqv_stress);
virtual Real dConvexPlasticYield2_dp(const Real & pressure, const Real & eqv_stress);
virtual Real dConvexPlasticYield2_dq(const Real & pressure, const Real & eqv_stress);
virtual Real getConvexProjection(const Real & x1, const Real & x2);
virtual Real strainRatio(const RankTwoTensor & elastic_strain);
// Coupled variables
bool _coupled_dam;
const VariableValue & _damage;
......@@ -55,39 +60,22 @@ protected:
bool _coupled_phi;
const VariableValue & _porosity;
// Strain parameters
// Elastic moduli parameters
const std::vector<Real> _damage_modulus;
// Creep parameters
// Plastic parameters
const std::vector<Real> _critical_pressure;
const std::vector<Real> _friction_angle;
const std::vector<Real> _porous_coeff;
const std::vector<Real> _porous_coeff_linear;
std::vector<Real> _one_on_plastic_eta;
std::vector<Real> _one_on_damage_eta;
// Convex yield parameters
Real _p_cr;
Real _xi0;
Real _p_r;
Real _q_r;
Real _dp_r_dp_tr;
Real _dp_r_dq_tr;
Real _p_tr;
Real _q_tr;
Real _rho_tr;
Real _rp;
Real _rq;
Real _p_k;
// Damage-Plasticity structure
damage_plasticity * _damage_plasticity;
// Strain properties
MaterialProperty<RankTwoTensor> & _elastic_strain;
const MaterialProperty<RankTwoTensor> & _elastic_strain_old;
// Viscous properties
// Plastic properties
// Stress properties
};
#endif // LYNXDAMAGEDEFORMATION_H
......@@ -21,105 +21,28 @@
#ifndef LYNXDEFORMATION_H
#define LYNXDEFORMATION_H
#include "LynxMaterialBase.h"
#include "LynxRheologyStructures.h"
#include "RankTwoTensor.h"
#include "RankFourTensor.h"
#include "LynxDeformationBase.h"
class LynxDeformation;
template <>
InputParameters validParams<LynxDeformation>();
class LynxDeformation : public LynxMaterialBase
class LynxDeformation : public LynxDeformationBase
{
public:
LynxDeformation(const InputParameters & parameters);
virtual ~LynxDeformation() {}
static MooseEnum strainModel();
static MooseEnum viscousUpdate();
protected:
virtual void initQpStatefulProperties() override;
virtual void computeProperties() override;
virtual void computeQpProperties() override;
virtual void computeStrainIncrement();
virtual void calculateSmallStrain(const RankTwoTensor & grad_tensor,
const RankTwoTensor & grad_tensor_old);
virtual void calculateFiniteStrain(const RankTwoTensor & grad_tensor,
const RankTwoTensor & grad_tensor_old);
virtual void computeQpDeformation();
virtual void elasticModuli();
virtual void volumetricDeformation(Real & pressure);
virtual void deviatoricDeformation(const Real & pressure, RankTwoTensor & stress_dev);
virtual void plasticCorrection(Real & pressure, RankTwoTensor & stress_dev);
virtual void tangentOperator();
virtual void finiteTangentOperator();
virtual Real computeStokeEffectiveViscosity(const Real & pressure);
virtual RankTwoTensor computeStokeEffectiveViscosityDerivative();
virtual Real computeEffectiveViscosity(const Real & pressure, const Real & eqv_stress);
virtual Real computeCreepRate(const Real A, const Real n, const Real eqv_stress);
virtual Real viscousIncrement(const Real & pressure, const Real & eqv_stress);
virtual void plasticCorrection(Real & pressure, RankTwoTensor & stress_dev) override;
virtual Real computePlasticityYield(const Real & pressure, const Real & eqv_stress);
virtual Real plasticIncrement(const Real & pressure, const Real & eqv_stress);
virtual RankTwoTensor spinRotation(const RankTwoTensor & tensor);
virtual void updateSpinTangentModulus();
virtual void computeCreepProperties(const Real & pressure);
virtual void updateCreepParameters();
virtual Real plasticIncrement(const Real & /*pressure*/, const Real & eqv_stress);
virtual void computePlasticityProperties(const Real & pressure);
virtual void updatePlasticityParameters();
virtual Real rootBrent(iterative_viscous & viscous_model, const Real x1, const Real x2);
virtual Real rootNewtonSafe(iterative_viscous & viscous_model, const Real x1, const Real x2);
void computeQpThermalSources();
// Coupled variables
unsigned int _ndisp;
std::vector<const VariableGradient *> _grad_disp;
std::vector<const VariableGradient *> _grad_disp_old;
bool _coupled_temp;
const VariableValue & _temp;
bool _coupled_plith;
const VariableValue & _plith;
const VariableValue & _plith_old;
bool _coupled_pdyn;
const VariableValue & _pdyn;
// Strain parameters
const MooseEnum _strain_model;
bool _vol_locking_correction;
std::vector<RankTwoTensor> _deformation_gradient;
std::vector<RankTwoTensor> _deformation_gradient_old;
const Real & _current_elem_volume;
// Elastic moduli parameters
const bool _has_bulk_modulus;
const bool _has_shear_modulus;
const std::vector<Real> _bulk_modulus;
const std::vector<Real> _shear_modulus;
// Creep parameters
const bool _has_diffusion_creep;
const std::vector<Real> _A_diffusion;
const std::vector<Real> _E_diffusion;
const std::vector<Real> _V_diffusion;
const bool _has_dislocation_creep;
const std::vector<Real> _A_dislocation;
const std::vector<Real> _E_dislocation;
const std::vector<Real> _V_dislocation;
const std::vector<Real> _n_dislocation;
const Real _gas_constant;
const MooseEnum _viscous_update;
const Real _tol;
const unsigned int _itmax;
const bool _has_background_strain_rate;
bool _has_initial_viscosity;
const std::vector<Real> _initial_viscosity;
const Real _background_strain_rate;
const std::vector<Real> _eta_min;
const std::vector<Real> _eta_max;
// Plastic parameters
const bool _has_plasticity;
const std::vector<Real> _friction_angle_0;
const std::vector<Real> _cohesion_0;
const std::vector<Real> _friction_angle_res;
......@@ -130,52 +53,12 @@ protected:
std::vector<Real> _one_on_plastic_eta;
const bool _has_hardening;
// Rheology boolean
const bool _has_elastic;
const bool _has_viscous;
// Creep structures
diffusion_creep * _diffusion_creep;
dislocation_creep * _dislocation_creep;
iterative_viscous * _iterative_viscous;
// Plasticity structure
plasticity * _plasticity;
// Viscous scalars for tangent modulus
Real _stress_corr_v;
Real _dq_dq_tr_v;
// Plastic scalars for tangent modulus
Real _stress_corr_p;
Real _dp_dp_tr_p;
Real _dp_dq_tr_p;
Real _dq_dp_tr_p;
Real _dq_dq_tr_p;
// Strain properties
MaterialProperty<RankTwoTensor> & _strain_increment;
MaterialProperty<RankTwoTensor> & _spin_tensor;
const MaterialProperty<RankTwoTensor> & _thermal_strain_incr;
// Viscous properties
MaterialProperty<RankTwoTensor> & _viscous_strain_incr;
MaterialProperty<Real> & _eta_eff;
// Plastic properties
MaterialProperty<RankTwoTensor> & _plastic_strain_incr;
MaterialProperty<Real> & _plastic_yield_function;
MaterialProperty<Real> * _intnl;
const MaterialProperty<Real> * _intnl_old;
// Stress properties
MaterialProperty<RankTwoTensor> & _stress;
const MaterialProperty<RankTwoTensor> & _stress_old;
MaterialProperty<Real> & _K;
MaterialProperty<Real> & _G;
MaterialProperty<RankFourTensor> & _tangent_modulus;
MaterialProperty<Real> & _inelastic_heat;
MaterialProperty<RankTwoTensor> & _dinelastic_heat_dstrain;
};
#endif // LYNXDEFORMATION_H
/******************************************************************************/
/* LYNX, a MOOSE-based application */
/* */
/* Copyright (C) 2017 by Antoine B. Jacquey and Mauro Cacace */
/* GFZ Potsdam, German Research Centre for Geosciences */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/> */
/******************************************************************************/
#ifndef LYNXDEFORMATIONBASE_H
#define LYNXDEFORMATIONBASE_H
#include "LynxMaterialBase.h"
#include "LynxRheologyStructures.h"
#include "RankTwoTensor.h"
#include "RankFourTensor.h"
class LynxDeformationBase;
template <>
InputParameters validParams<LynxDeformationBase>();
class LynxDeformationBase : public LynxMaterialBase
{
public:
LynxDeformationBase(const InputParameters & parameters);
virtual ~LynxDeformationBase() {}
static MooseEnum strainModel();
static MooseEnum viscousUpdate();
protected:
virtual void initQpStatefulProperties() override;
virtual void computeProperties() override;
virtual void computeQpProperties() override;
virtual void computeStrainIncrement();
virtual void calculateSmallStrain(const RankTwoTensor & grad_tensor,
const RankTwoTensor & grad_tensor_old);
virtual void calculateFiniteStrain(const RankTwoTensor & grad_tensor,
const RankTwoTensor & grad_tensor_old);
virtual void computeQpDeformation();
virtual void initializeQpDeformation();
virtual void elasticModuli();
virtual void volumetricDeformation(Real & pressure);
virtual void deviatoricDeformation(const Real & pressure, RankTwoTensor & stress_dev);
virtual void reformStressTensor(const Real & pressure, const RankTwoTensor & stress_dev);
virtual void plasticCorrection(Real & pressure, RankTwoTensor & stress_dev) = 0;
virtual void tangentOperator();
virtual void plasticTangentOperator(const RankTwoTensor & flow_direction,
const RankFourTensor & flow_direction_dyad);
virtual void finiteTangentOperator();
virtual Real computeStokeEffectiveViscosity(const Real & pressure);
virtual RankTwoTensor computeStokeEffectiveViscosityDerivative();
virtual Real computeEffectiveViscosity(const Real & pressure, const Real & eqv_stress);
virtual Real computeCreepRate(const Real A, const Real n, const Real eqv_stress);
virtual Real viscousIncrement(const Real & pressure, const Real & eqv_stress);
virtual RankTwoTensor spinRotation(const RankTwoTensor & tensor);
virtual void updateSpinTangentModulus();
virtual void computeCreepProperties(const Real & pressure);
virtual void updateCreepParameters();
virtual Real rootBrent(iterative_viscous & viscous_model, const Real x1, const Real x2);
virtual Real rootNewtonSafe(iterative_viscous & viscous_model, const Real x1, const Real x2);
void computeQpThermalSources();
// Coupled variables
unsigned int _ndisp;
std::vector<const VariableGradient *> _grad_disp;
std::vector<const VariableGradient *> _grad_disp_old;
bool _coupled_temp;
const VariableValue & _temp;
bool _coupled_plith;
const VariableValue & _plith;
const VariableValue & _plith_old;
bool _coupled_pdyn;
const VariableValue & _pdyn;
// Strain parameters
const MooseEnum _strain_model;
bool _vol_locking_correction;
std::vector<RankTwoTensor> _deformation_gradient;
std::vector<RankTwoTensor> _deformation_gradient_old;
const Real & _current_elem_volume;
// Elastic moduli parameters
const bool _has_bulk_modulus;
const bool _has_shear_modulus;
const std::vector<Real> _bulk_modulus;
const std::vector<Real> _shear_modulus;
// Creep parameters
const bool _has_diffusion_creep;
const std::vector<Real> _A_diffusion;
const std::vector<Real> _E_diffusion;
const std::vector<Real> _V_diffusion;
const bool _has_dislocation_creep;
const std::vector<Real> _A_dislocation;
const std::vector<Real> _E_dislocation;
const std::vector<Real> _V_dislocation;
const std::vector<Real> _n_dislocation;
const Real _gas_constant;
const MooseEnum _viscous_update;
const Real _tol;
const unsigned int _itmax;
const bool _has_background_strain_rate;
bool _has_initial_viscosity;
const std::vector<Real> _initial_viscosity;
const Real _background_strain_rate;
const std::vector<Real> _eta_min;
const std::vector<Real> _eta_max;
// Rheology boolean
const bool _has_elastic;
const bool _has_viscous;
bool _has_plasticity;
// Creep structures
diffusion_creep * _diffusion_creep;
dislocation_creep * _dislocation_creep;
iterative_viscous * _iterative_viscous;
// RankFourTensor utilities
RankTwoTensor _identity_two;
RankFourTensor _volumetric_four;
RankFourTensor _identity_four;
RankFourTensor _deviatoric_four;
// Viscous scalars for tangent modulus
Real _stress_corr_v;
Real _dq_dq_tr_v;
// Plastic scalars for tangent modulus
Real _stress_corr_p;
Real _dp_dp_tr_p;
Real _dp_dq_tr_p;
Real _dq_dp_tr_p;
Real _dq_dq_tr_p;
// Strain properties
MaterialProperty<RankTwoTensor> & _strain_increment;
MaterialProperty<RankTwoTensor> & _spin_tensor;
const MaterialProperty<RankTwoTensor> & _thermal_strain_incr;
// Viscous properties
MaterialProperty<RankTwoTensor> & _viscous_strain_incr;
MaterialProperty<Real> & _eta_eff;
// Plastic properties
MaterialProperty<RankTwoTensor> & _plastic_strain_incr;
MaterialProperty<Real> & _plastic_yield_function;
// Stress properties
MaterialProperty<RankTwoTensor> & _stress;
const MaterialProperty<RankTwoTensor> & _stress_old;
MaterialProperty<Real> & _K;
MaterialProperty<Real> & _G;
MaterialProperty<RankFourTensor> & _tangent_modulus;
MaterialProperty<Real> & _inelastic_heat;
MaterialProperty<RankTwoTensor> & _dinelastic_heat_dstrain;
};
#endif // LYNXDEFORMATIONBASE_H
......@@ -206,4 +206,55 @@ struct plasticity
}
};
#endif // LYNXRHEOLOGYSTRUCTURES_H
\ No newline at end of file
struct damage_plasticity
{
Real _xi0;
Real _gamma;
Real _p_cr;
Real _eta_p; // actually one on eta
Real _eta_d; // actually one on eta
Real _alpha0;
Real _p_tr; // trial pressure
Real _q_tr; // trial eqv_stress
Real _p_r; // reference pressure for convex yield
Real _q_r; // reference eqv_stress for convex yield
Real _rho_tr; // trial distance to reference point
Real _rp; // direction for projection
Real _rq; // direction for projection
Real _xi_cr; // critical strain ratio for capped yield
Real _alpha2; // square of alpha parameter for capped yield
Real _dxi_cr_dp; // derivative wrt pressure of the critical strain ratio
Real _dxi_cr_dq; // derivative wrt eqv_stress of the critical strain ratio
Real _dmu2_dxi_cr; // derivative wrt the critical strain ratio of the square of alpha parameter
damage_plasticity()
: _xi0(-std::sqrt(3.0)),
_gamma(0.0),
_p_cr(0.0),
_eta_p(0.0),
_eta_d(0.0),
_alpha0(0.0),
_p_tr(0.0),
_q_tr(0.0),
_p_r(0.0),
_q_r(0.0),
_rho_tr(0.0),
_rp(0.0),
_rq(0.0),
_xi_cr(-std::sqrt(3.0)),
_alpha2(0.0),
_dxi_cr_dp(0.0),
_dxi_cr_dq(0.0),
_dmu2_dxi_cr(0.0)
{
}
void fill(const Real xi0, const Real gamma, const Real p_cr, const Real eta_p, const Real eta_d)
{
_xi0 = xi0;
_gamma = gamma;
_p_cr = p_cr;
_eta_p = eta_p;
_eta_d = eta_d;
}
};
#endif // LYNXRHEOLOGYSTRUCTURES_H
......@@ -27,274 +27,367 @@ template <>
InputParameters
validParams<LynxDamageDeformation>()
{
InputParameters params = validParams<LynxDeformation>();
InputParameters params = validParams<LynxDeformationBase>();
params.addClassDescription("Class calculating the deformation of a material following a "
"damage viscoelasto-(visco)plastic rheology.");
// Coupled variables
params.addCoupledVar("damage", "The damage variable.");
params.addCoupledVar("porosity", "The porosity variable.");
// Strain parameters
// Elastic moduli parameters
params.addParam<std::vector<Real>>("damage_modulus",
"The third elastic damage modulus for the damage heology.");
// Creep parameters
// Plastic parameters
params.addParam<std::vector<Real>>("critical_pressure",
"The critical pressure for capped plastic models.");
"The third elastic damage modulus for the damage rheology.");
// Damage-Plasticity parameters
params.addParam<std::vector<Real>>(
"friction_angle",
"The friction angle of the material for the pressure-dependant part of the yield stress.");
params.addParam<std::vector<Real>>(
"porous_coeff",
"The porous coefficient controlling the capped yield in the damage rheology.");
params.addParam<std::vector<Real>>(
"porous_coeff_linear", "The linear dependency of the porous coefficient to porosity.");
params.addParam<std::vector<Real>>(
"plastic_viscosity",
"The reference viscosity in the generalized Duvaut-Lions viscoplastic formulation.");
params.addParam<std::vector<Real>>("damage_viscosity",
"The reference viscosity in the damage rheology.");
return params;
}
LynxDamageDeformation::LynxDamageDeformation(const InputParameters & parameters)
: LynxDeformation(parameters),
: LynxDeformationBase(parameters),
// Coupled variables
_coupled_dam(isCoupled("damage")),
_damage(_coupled_dam ? coupledValue("damage") : _zero),
_damage_old(_coupled_dam ? coupledValueOld("damage") : _zero),
_coupled_phi(isCoupled("porosity")),
_porosity(_coupled_phi ? coupledValue("porosity") : _zero),
// Strain parameters
// Elastic moduli parameters
_damage_modulus(isParamValid("damage_modulus") ? getLynxParam<Real>("damage_modulus")
: std::vector<Real>(_n_composition, 0.0)),
// Creep parameters
// Plastic parameters
_critical_pressure((_has_plasticity && isParamValid("critical_pressure"))
? getLynxParam<Real>("critical_pressure")
: std::vector<Real>(_n_composition, 0.0)),
// Rheology boolean
// Damage-Plasticity parameters
_friction_angle(isParamValid("friction_angle") ? getLynxParam<Real>("friction_angle")
: std::vector<Real>(_n_composition, 0.0)),
_porous_coeff(isParamValid("porous_coeff") ? getLynxParam<Real>("porous_coeff")
: std::vector<Real>(_n_composition, 0.0)),
_porous_coeff_linear(isParamValid("porous_coeff_linear")
? getLynxParam<Real>("porous_coeff_linear")
: std::vector<Real>(_n_composition, 0.0)),
_one_on_plastic_eta(isParamValid("plastic_viscosity") ? getLynxParam<Real>("plastic_viscosity")
: std::vector<Real>(_n_composition, 0.0)),
_one_on_damage_eta(isParamValid("damage_viscosity") ? getLynxParam<Real>("damage_viscosity")
: std::vector<Real>(_n_composition, 0.0)),
// Strain properties
_elastic_strain(declareProperty<RankTwoTensor>("elastic_strain")),
_elastic_strain_old(getMaterialPropertyOld<RankTwoTensor>("elastic_strain"))
// Viscous properties
// Plastic properties
// Stress properties
{
_has_plasticity = isParamValid("friction_angle");
// Grabing the inverse of plastic and damage viscosities
for (unsigned int i = 0; i < _n_composition; ++i)
{
if (_one_on_plastic_eta[i] < 0.0)
mooseError("LynxDamageDeformation: 'plastic_viscosity' cannot be negative!");
else if (_one_on_plastic_eta[i] > 0.0)
_one_on_plastic_eta[i] = 1.0 / _one_on_plastic_eta[i];
if (_one_on_damage_eta[i] < 0.0)
mooseError("LynxDamageDeformation: 'damage_viscosity' cannot be negative!");
else if (_one_on_damage_eta[i] > 0.0)
_one_on_damage_eta[i] = 1.0 / _one_on_damage_eta[i];
}
// Damage-Plasticity structure
if (_has_plasticity)
_damage_plasticity = new damage_plasticity();
}
void
LynxDamageDeformation::initQpStatefulProperties()
{
_elastic_strain[_qp].zero();
LynxDeformation::initQpStatefulProperties();
}
void
LynxDamageDeformation::computeQpDeformation()
{
// Update elastic moduli
elasticModuli();
// Update the volumetric part of the deformation
Real pressure = -_stress_old[_qp].trace() / 3.0;
volumetricDeformation(pressure);
// Update the deviatoric part of the deformation
RankTwoTensor stress_dev = spinRotation(_stress_old[_qp].deviatoric());
deviatoricDeformation(pressure, stress_dev);
// Plastic correction
if (_has_plasticity && _G[_qp] != 0.0)
plasticCorrection(pressure, stress_dev);
// Form the total stress tensor
_stress[_qp] = stress_dev;
_stress[_qp].addIa(-pressure);
// Update tangent operator modulus
if (_fe_problem.currentlyComputingJacobian())
tangentOperator();
LynxDeformationBase::initQpStatefulProperties();
}
void
LynxDamageDeformation::elasticModuli()
{
// Elastic strain ratio
const Real xi_old = strainRatio(_elastic_strain_old[_qp]);
// Critical strain strain ratio
_xi0 =
// Bulk modulus
_K[_qp] = _has_bulk_modulus ? averageProperty(_bulk_modulus) : 0.0;
// Shear modulus
_G[_qp] = _has_shear_modulus ? averageProperty(_shear_modulus) : 0.0;