www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RateDepSmearCrackModel Class Reference

RateDepSmearCrackModel is the base class for rate dependent continuum damage model. More...

#include <RateDepSmearCrackModel.h>

Inheritance diagram for RateDepSmearCrackModel:
[legend]

Public Member Functions

 RateDepSmearCrackModel (const InputParameters &parameters)
 
virtual ~RateDepSmearCrackModel ()
 
void setQp (unsigned int qp)
 Sets the value of the variable _qp for inheriting classes. More...
 
virtual bool modifyStrainIncrement (const Elem &, SymmTensor &strain_increment, SymmTensor &d_strain_dT)
 
virtual bool updateElasticityTensor (SymmElasticityTensor &)
 
virtual bool applyThermalStrain (SymmTensor &strain_increment, SymmTensor &d_strain_dT)
 

Protected Member Functions

virtual void computeStress (const Elem &current_elem, const SymmElasticityTensor &elasticity_tensor, const SymmTensor &stress_old, SymmTensor &strain_increment, SymmTensor &stress_new)
 
virtual void initQpStatefulProperties ()
 
virtual void initVariables ()
 
virtual void solve ()
 This function solves the state variables. More...
 
virtual void postSolveVariables ()
 This function updates the internal variables after solve. More...
 
virtual void postSolveStress ()
 This function updates the stress after solve. More...
 
virtual void updateVariables ()
 This function updates variables during solve a(i+1) = a(i) + da(i+1) More...
 
bool getConvergeVar ()
 This function returns true if convergence is not achieved. More...
 
virtual void calcResidual ()
 This function calculates the residual as r = v - v_old - dv. More...
 
virtual void calcStateIncr ()
 This function calculated thw increment of the state variables (dv) used to form the residual. More...
 
virtual void calcJacobian ()
 This function calculates the Jacobian. More...
 
int matrixInversion (std::vector< Real > &A, int n) const
 

Protected Attributes

Real _ref_damage_rate
 
unsigned int _nstate
 reference damage rate More...
 
Real _exponent
 Number of state variables. More...
 
unsigned int _maxiter
 
Real _tol
 Maximum number of Newton Raphson iteration. More...
 
Real _zero_tol
 Relative tolerance factor for convergence of the Newton Raphson solve. More...
 
Real _intvar_incr_tol
 Tolerance for zero. More...
 
bool _input_rndm_scale_var
 Allowable relative increment size of state variables (dv) More...
 
Real _rndm_scale_var
 Flag to specify scaling parameter to generate random stress. More...
 
MaterialProperty< std::vector< Real > > & _intvar
 Variable value. More...
 
const MaterialProperty< std::vector< Real > > & _intvar_old
 
MaterialProperty< SymmTensor > & _stress_undamaged
 
const MaterialProperty< SymmTensor > & _stress_undamaged_old
 
std::vector< Real > _intvar_incr
 
std::vector< Real > _intvar_tmp
 
std::vector< Real > _intvar_old_tmp
 
std::vector< Real > _resid
 
std::vector< Real > _jac
 
std::vector< Real > _dvar
 
SymmElasticityTensor _elasticity
 
SymmTensor _stress_old
 
SymmTensor _dstrain
 
SymmTensor _stress_new
 
SymmTensor _stress0
 
SymmTensor _dstress0
 
bool _nconv
 
bool _err_tol
 Convergence flag. More...
 
const bool _has_temp
 
const VariableValue & _temperature
 
const VariableValue & _temperature_old
 
const Real _alpha
 
Function * _alpha_function
 
bool _has_stress_free_temp
 
Real _stress_free_temp
 
bool _mean_alpha_function
 
Real _ref_temp
 
bool & _step_zero_cm
 Restartable data to check for the zeroth and first time steps. More...
 
bool & _step_one_cm
 

Detailed Description

RateDepSmearCrackModel is the base class for rate dependent continuum damage model.

The model is local and hence mesh sensitive.

Definition at line 30 of file RateDepSmearCrackModel.h.

Constructor & Destructor Documentation

RateDepSmearCrackModel::RateDepSmearCrackModel ( const InputParameters &  parameters)

Definition at line 36 of file RateDepSmearCrackModel.C.

37  : ConstitutiveModel(parameters),
38  _ref_damage_rate(getParam<Real>("ref_damage_rate")),
39  _nstate(getParam<unsigned int>("nstate")),
40  _exponent(getParam<Real>("exponent")),
41  _maxiter(getParam<unsigned int>("maxiter")),
42  _tol(getParam<Real>("tol")),
43  _zero_tol(getParam<Real>("zero_tol")),
44  _intvar_incr_tol(getParam<Real>("intvar_incr_tol")),
45  _input_rndm_scale_var(getParam<bool>("input_random_scaling_var")),
46  _rndm_scale_var(getParam<Real>("random_scaling_var")),
47  _intvar(declareProperty<std::vector<Real>>("intvar")),
48  _intvar_old(getMaterialPropertyOld<std::vector<Real>>("intvar")),
49  _stress_undamaged(declareProperty<SymmTensor>("stress_undamaged")),
50  _stress_undamaged_old(getMaterialPropertyOld<SymmTensor>("stress_undamaged"))
51 {
52 
53  _intvar_incr.resize(_nstate, 0.0);
54  _intvar_tmp.resize(_nstate, 0.0);
55  _intvar_old_tmp.resize(_nstate, 0.0);
56  _resid.resize(_nstate, 0.0);
57  _jac.resize(_nstate * _nstate, 0.0);
58  _dvar.resize(_nstate, 0.0);
59 
61 }
static void initRandom()
Definition: SymmTensor.h:440
Real _tol
Maximum number of Newton Raphson iteration.
Real _rndm_scale_var
Flag to specify scaling parameter to generate random stress.
ConstitutiveModel(const InputParameters &parameters)
std::vector< Real > _intvar_tmp
std::vector< Real > _intvar_incr
Real _exponent
Number of state variables.
const MaterialProperty< SymmTensor > & _stress_undamaged_old
const MaterialProperty< std::vector< Real > > & _intvar_old
MaterialProperty< SymmTensor > & _stress_undamaged
unsigned int _nstate
reference damage rate
bool _input_rndm_scale_var
Allowable relative increment size of state variables (dv)
MaterialProperty< std::vector< Real > > & _intvar
Variable value.
std::vector< Real > _intvar_old_tmp
Real _intvar_incr_tol
Tolerance for zero.
Real _zero_tol
Relative tolerance factor for convergence of the Newton Raphson solve.
RateDepSmearCrackModel::~RateDepSmearCrackModel ( )
virtual

Definition at line 241 of file RateDepSmearCrackModel.C.

241 {}

Member Function Documentation

bool ConstitutiveModel::applyThermalStrain ( SymmTensor strain_increment,
SymmTensor d_strain_dT 
)
virtualinherited

Definition at line 103 of file ConstitutiveModel.C.

Referenced by ConstitutiveModel::modifyStrainIncrement(), and ConstitutiveModel::updateElasticityTensor().

104 {
105  if (_t_step >= 1)
106  _step_zero_cm = false;
107 
108  if (_t_step >= 2)
109  _step_one_cm = false;
110 
111  if (_has_temp && !_step_zero_cm)
112  {
113  Real inc_thermal_strain;
114  Real d_thermal_strain_d_temp;
115 
116  Real old_temp;
118  old_temp = _stress_free_temp;
119  else
120  old_temp = _temperature_old[_qp];
121 
122  Real current_temp = _temperature[_qp];
123 
124  Real delta_t = current_temp - old_temp;
125 
126  Real alpha = _alpha;
127 
128  if (_alpha_function)
129  {
130  Point p;
131  Real alpha_current_temp = _alpha_function->value(current_temp, p);
132  Real alpha_old_temp = _alpha_function->value(old_temp, p);
133  Real alpha_stress_free_temperature = _alpha_function->value(_stress_free_temp, p);
134 
136  {
137  Real small(1e-6);
138 
139  Real numerator = alpha_current_temp * (current_temp - _ref_temp) -
140  alpha_old_temp * (old_temp - _ref_temp);
141  Real denominator = 1.0 + alpha_stress_free_temperature * (_stress_free_temp - _ref_temp);
142  if (denominator < small)
143  mooseError("Denominator too small in thermal strain calculation");
144  inc_thermal_strain = numerator / denominator;
145  d_thermal_strain_d_temp = alpha_current_temp * (current_temp - _ref_temp);
146  }
147  else
148  {
149  inc_thermal_strain = delta_t * 0.5 * (alpha_current_temp + alpha_old_temp);
150  d_thermal_strain_d_temp = alpha_current_temp;
151  }
152  }
153  else
154  {
155  inc_thermal_strain = delta_t * alpha;
156  d_thermal_strain_d_temp = alpha;
157  }
158 
159  strain_increment.addDiag(-inc_thermal_strain);
160  d_strain_dT.addDiag(-d_thermal_strain_d_temp);
161  }
162 
163  bool modified = true;
164  return modified;
165 }
const VariableValue & _temperature
Function * _alpha_function
bool & _step_zero_cm
Restartable data to check for the zeroth and first time steps.
void addDiag(Real value)
Definition: SymmTensor.h:279
const VariableValue & _temperature_old
void RateDepSmearCrackModel::calcJacobian ( )
protectedvirtual

This function calculates the Jacobian.

Reimplemented in RateDepSmearIsoCrackModel.

Definition at line 211 of file RateDepSmearCrackModel.C.

Referenced by solve().

212 {
213 }
void RateDepSmearCrackModel::calcResidual ( )
protectedvirtual

This function calculates the residual as r = v - v_old - dv.

Definition at line 194 of file RateDepSmearCrackModel.C.

Referenced by solve().

195 {
196  calcStateIncr();
197 
198  if (_err_tol)
199  return;
200 
201  for (unsigned int i = 0; i < _nstate; ++i)
203 }
std::vector< Real > _intvar_tmp
std::vector< Real > _intvar_incr
bool _err_tol
Convergence flag.
unsigned int _nstate
reference damage rate
virtual void calcStateIncr()
This function calculated thw increment of the state variables (dv) used to form the residual...
std::vector< Real > _intvar_old_tmp
void RateDepSmearCrackModel::calcStateIncr ( )
protectedvirtual

This function calculated thw increment of the state variables (dv) used to form the residual.

Reimplemented in RateDepSmearIsoCrackModel.

Definition at line 206 of file RateDepSmearCrackModel.C.

Referenced by calcResidual().

207 {
208 }
void RateDepSmearCrackModel::computeStress ( const Elem &  current_elem,
const SymmElasticityTensor elasticity_tensor,
const SymmTensor stress_old,
SymmTensor strain_increment,
SymmTensor stress_new 
)
protectedvirtual

Reimplemented from ConstitutiveModel.

Definition at line 71 of file RateDepSmearCrackModel.C.

76 {
77  _elasticity = elasticityTensor;
78  _stress_old = stress_old;
79  _dstrain = strain_increment;
80 
81  initVariables();
82  solve();
83 
85  _rndm_scale_var = elasticityTensor.valueAtIndex(0);
86 
87  if (_nconv || _err_tol)
88  {
89  mooseWarning("RateDepSmearCrackModel: Constitutive cutback");
91  }
92  else
93  {
96 
97  stress_new = _stress_new;
99  }
100 }
Real _rndm_scale_var
Flag to specify scaling parameter to generate random stress.
static SymmTensor genRandomSymmTensor(Real scalefactor)
Definition: SymmTensor.h:447
virtual void solve()
This function solves the state variables.
bool _err_tol
Convergence flag.
MaterialProperty< SymmTensor > & _stress_undamaged
virtual void postSolveStress()
This function updates the stress after solve.
bool _input_rndm_scale_var
Allowable relative increment size of state variables (dv)
virtual void postSolveVariables()
This function updates the internal variables after solve.
SymmElasticityTensor _elasticity
bool RateDepSmearCrackModel::getConvergeVar ( )
protected

This function returns true if convergence is not achieved.

Definition at line 158 of file RateDepSmearCrackModel.C.

Referenced by solve().

159 {
160  Real vold, r;
161 
162  for (unsigned int i = 0; i < _nstate; i++)
163  {
164  vold = std::abs(_intvar_old_tmp[i]);
165  r = std::abs(_resid[i]);
166 
167  if (vold > _zero_tol)
168  {
169  if (r > _tol * vold)
170  return true;
171  }
172  else
173  {
174  if (r > _zero_tol)
175  return true;
176  }
177  }
178  return false;
179 }
Real _tol
Maximum number of Newton Raphson iteration.
unsigned int _nstate
reference damage rate
std::vector< Real > _intvar_old_tmp
Real _zero_tol
Relative tolerance factor for convergence of the Newton Raphson solve.
void RateDepSmearCrackModel::initQpStatefulProperties ( )
protectedvirtual

Reimplemented in RateDepSmearIsoCrackModel.

Definition at line 64 of file RateDepSmearCrackModel.C.

Referenced by RateDepSmearIsoCrackModel::initQpStatefulProperties().

65 {
66  _intvar[_qp].resize(_nstate, 0.0);
67  const_cast<MaterialProperty<std::vector<Real>> &>(_intvar_old)[_qp].resize(_nstate, 0.0);
68 }
const MaterialProperty< std::vector< Real > > & _intvar_old
unsigned int _nstate
reference damage rate
MaterialProperty< std::vector< Real > > & _intvar
Variable value.
void RateDepSmearCrackModel::initVariables ( )
protectedvirtual

Reimplemented in RateDepSmearIsoCrackModel.

Definition at line 103 of file RateDepSmearCrackModel.C.

Referenced by computeStress(), and RateDepSmearIsoCrackModel::initVariables().

104 {
105 
108 
109  for (unsigned int i = 0; i < _nstate; ++i)
110  {
111  _intvar_tmp[i] = _intvar_old[_qp][i];
112  _intvar_old_tmp[i] = _intvar_old[_qp][i];
113  }
114 }
std::vector< Real > _intvar_tmp
const MaterialProperty< SymmTensor > & _stress_undamaged_old
const MaterialProperty< std::vector< Real > > & _intvar_old
unsigned int _nstate
reference damage rate
std::vector< Real > _intvar_old_tmp
SymmElasticityTensor _elasticity
int RateDepSmearCrackModel::matrixInversion ( std::vector< Real > &  A,
int  n 
) const
protected

Definition at line 216 of file RateDepSmearCrackModel.C.

Referenced by updateVariables().

217 {
218  int return_value, buffer_size = n * 64;
219  std::vector<PetscBLASInt> ipiv(n);
220  std::vector<PetscScalar> buffer(buffer_size);
221 
222  // Following does a LU decomposition of "square matrix A"
223  // upon return "A = P*L*U" if return_value == 0
224  // Here i use quotes because A is actually an array of length n^2, not a matrix of size n-by-n
225  LAPACKgetrf_(&n, &n, &A[0], &n, &ipiv[0], &return_value);
226 
227  if (return_value != 0)
228  // couldn't LU decompose because: illegal value in A; or, A singular
229  return return_value;
230 
231 // get the inverse of A
232 #if PETSC_VERSION_LESS_THAN(3, 5, 0)
233  FORTRAN_CALL(dgetri)(&n, &A[0], &n, &ipiv[0], &buffer[0], &buffer_size, &return_value);
234 #else
235  LAPACKgetri_(&n, &A[0], &n, &ipiv[0], &buffer[0], &buffer_size, &return_value);
236 #endif
237 
238  return return_value;
239 }
void FORTRAN_CALL() dgetri(...)
virtual bool ConstitutiveModel::modifyStrainIncrement ( const Elem &  ,
SymmTensor strain_increment,
SymmTensor d_strain_dT 
)
inlinevirtualinherited

Reimplemented in CombinedCreepPlasticity.

Definition at line 34 of file ConstitutiveModel.h.

37  {
38  return applyThermalStrain(strain_increment, d_strain_dT);
39  }
virtual bool applyThermalStrain(SymmTensor &strain_increment, SymmTensor &d_strain_dT)
void RateDepSmearCrackModel::postSolveStress ( )
protectedvirtual

This function updates the stress after solve.

In the base class it is defined as s = exp ( -d) * s0.

Reimplemented in RateDepSmearIsoCrackModel.

Definition at line 189 of file RateDepSmearCrackModel.C.

Referenced by computeStress().

190 {
191 }
void RateDepSmearCrackModel::postSolveVariables ( )
protectedvirtual

This function updates the internal variables after solve.

Definition at line 182 of file RateDepSmearCrackModel.C.

Referenced by computeStress().

183 {
184  for (unsigned int i = 0; i < _nstate; ++i)
185  _intvar[_qp][i] = _intvar_tmp[i];
186 }
std::vector< Real > _intvar_tmp
unsigned int _nstate
reference damage rate
MaterialProperty< std::vector< Real > > & _intvar
Variable value.
void ConstitutiveModel::setQp ( unsigned int  qp)
inherited

Sets the value of the variable _qp for inheriting classes.

Definition at line 86 of file ConstitutiveModel.C.

Referenced by CombinedCreepPlasticity::computeStress(), and ConstitutiveModel::~ConstitutiveModel().

87 {
88  _qp = qp;
89 }
void RateDepSmearCrackModel::solve ( )
protectedvirtual

This function solves the state variables.

In the present formulation the damaged stress (s) is related to the undamaged stress (s0) as s = exp(-d) * s0 where d is a state variable describing damage. d can be scalar or vector depending on the model A Newton-Raphson is used.

Definition at line 117 of file RateDepSmearCrackModel.C.

Referenced by computeStress().

118 {
119 
120  unsigned int iter = 0;
121  _err_tol = false;
122 
123  calcResidual();
124 
126 
127  while (_nconv && iter < _maxiter && !_err_tol)
128  {
129  calcJacobian();
130  updateVariables();
131  calcResidual();
132 
134 
135  iter++;
136  }
137 }
virtual void updateVariables()
This function updates variables during solve a(i+1) = a(i) + da(i+1)
bool _err_tol
Convergence flag.
virtual void calcResidual()
This function calculates the residual as r = v - v_old - dv.
virtual void calcJacobian()
This function calculates the Jacobian.
bool getConvergeVar()
This function returns true if convergence is not achieved.
virtual bool ConstitutiveModel::updateElasticityTensor ( SymmElasticityTensor )
inlinevirtualinherited

Definition at line 40 of file ConstitutiveModel.h.

40 { return false; }
void RateDepSmearCrackModel::updateVariables ( )
protectedvirtual

This function updates variables during solve a(i+1) = a(i) + da(i+1)

Definition at line 140 of file RateDepSmearCrackModel.C.

Referenced by solve().

141 {
142  int error = matrixInversion(_jac, _nstate);
143  if (error != 0)
144  mooseError("Error in Matrix Inversion in RankFourTensor");
145 
146  for (unsigned int i = 0; i < _nstate; i++)
147  {
148  _dvar[i] = 0.0;
149  for (unsigned int j = 0; j < _nstate; j++)
150  _dvar[i] += _jac[i * _nstate + j] * _resid[j];
151  }
152 
153  for (unsigned int i = 0; i < _nstate; i++)
154  _intvar_tmp[i] -= _dvar[i];
155 }
std::vector< Real > _intvar_tmp
int matrixInversion(std::vector< Real > &A, int n) const
unsigned int _nstate
reference damage rate

Member Data Documentation

const Real ConstitutiveModel::_alpha
protectedinherited

Definition at line 48 of file ConstitutiveModel.h.

Referenced by ConstitutiveModel::applyThermalStrain().

Function* ConstitutiveModel::_alpha_function
protectedinherited
SymmTensor RateDepSmearCrackModel::_dstrain
protected
SymmTensor RateDepSmearCrackModel::_dstress0
protected

Definition at line 120 of file RateDepSmearCrackModel.h.

Referenced by initVariables().

std::vector<Real> RateDepSmearCrackModel::_dvar
protected

Definition at line 116 of file RateDepSmearCrackModel.h.

Referenced by RateDepSmearCrackModel(), and updateVariables().

SymmElasticityTensor RateDepSmearCrackModel::_elasticity
protected

Definition at line 118 of file RateDepSmearCrackModel.h.

Referenced by computeStress(), and initVariables().

bool RateDepSmearCrackModel::_err_tol
protected

Convergence flag.

Definition at line 122 of file RateDepSmearCrackModel.h.

Referenced by calcResidual(), RateDepSmearIsoCrackModel::calcStateIncr(), computeStress(), and solve().

Real RateDepSmearCrackModel::_exponent
protected

Number of state variables.

Definition at line 98 of file RateDepSmearCrackModel.h.

Referenced by RateDepSmearIsoCrackModel::damageRate().

bool ConstitutiveModel::_has_stress_free_temp
protectedinherited

Definition at line 50 of file ConstitutiveModel.h.

Referenced by ConstitutiveModel::applyThermalStrain().

const bool ConstitutiveModel::_has_temp
protectedinherited
bool RateDepSmearCrackModel::_input_rndm_scale_var
protected

Allowable relative increment size of state variables (dv)

Definition at line 103 of file RateDepSmearCrackModel.h.

Referenced by computeStress().

MaterialProperty<std::vector<Real> >& RateDepSmearCrackModel::_intvar
protected
std::vector<Real> RateDepSmearCrackModel::_intvar_incr
protected
Real RateDepSmearCrackModel::_intvar_incr_tol
protected

Tolerance for zero.

Definition at line 102 of file RateDepSmearCrackModel.h.

Referenced by RateDepSmearIsoCrackModel::calcStateIncr().

const MaterialProperty<std::vector<Real> >& RateDepSmearCrackModel::_intvar_old
protected
std::vector<Real> RateDepSmearCrackModel::_intvar_old_tmp
protected
std::vector<Real> RateDepSmearCrackModel::_intvar_tmp
protected
std::vector<Real> RateDepSmearCrackModel::_jac
protected
unsigned int RateDepSmearCrackModel::_maxiter
protected

Definition at line 99 of file RateDepSmearCrackModel.h.

Referenced by solve().

bool ConstitutiveModel::_mean_alpha_function
protectedinherited
bool RateDepSmearCrackModel::_nconv
protected

Definition at line 121 of file RateDepSmearCrackModel.h.

Referenced by computeStress(), and solve().

unsigned int RateDepSmearCrackModel::_nstate
protected
Real RateDepSmearCrackModel::_ref_damage_rate
protected

Definition at line 96 of file RateDepSmearCrackModel.h.

Referenced by RateDepSmearIsoCrackModel::damageRate().

Real ConstitutiveModel::_ref_temp
protectedinherited
std::vector<Real> RateDepSmearCrackModel::_resid
protected
Real RateDepSmearCrackModel::_rndm_scale_var
protected

Flag to specify scaling parameter to generate random stress.

Definition at line 104 of file RateDepSmearCrackModel.h.

Referenced by computeStress().

bool& ConstitutiveModel::_step_one_cm
protectedinherited

Definition at line 57 of file ConstitutiveModel.h.

Referenced by ConstitutiveModel::applyThermalStrain().

bool& ConstitutiveModel::_step_zero_cm
protectedinherited

Restartable data to check for the zeroth and first time steps.

Definition at line 56 of file ConstitutiveModel.h.

Referenced by ConstitutiveModel::applyThermalStrain().

SymmTensor RateDepSmearCrackModel::_stress0
protected
Real ConstitutiveModel::_stress_free_temp
protectedinherited

Definition at line 51 of file ConstitutiveModel.h.

Referenced by ConstitutiveModel::applyThermalStrain().

SymmTensor RateDepSmearCrackModel::_stress_new
protected
SymmTensor RateDepSmearCrackModel::_stress_old
protected

Definition at line 119 of file RateDepSmearCrackModel.h.

Referenced by computeStress().

MaterialProperty<SymmTensor>& RateDepSmearCrackModel::_stress_undamaged
protected

Definition at line 109 of file RateDepSmearCrackModel.h.

Referenced by computeStress().

const MaterialProperty<SymmTensor>& RateDepSmearCrackModel::_stress_undamaged_old
protected

Definition at line 110 of file RateDepSmearCrackModel.h.

Referenced by initVariables().

const VariableValue& ConstitutiveModel::_temperature
protectedinherited
const VariableValue& ConstitutiveModel::_temperature_old
protectedinherited

Definition at line 47 of file ConstitutiveModel.h.

Referenced by ConstitutiveModel::applyThermalStrain().

Real RateDepSmearCrackModel::_tol
protected

Maximum number of Newton Raphson iteration.

Definition at line 100 of file RateDepSmearCrackModel.h.

Referenced by getConvergeVar().

Real RateDepSmearCrackModel::_zero_tol
protected

Relative tolerance factor for convergence of the Newton Raphson solve.

Definition at line 101 of file RateDepSmearCrackModel.h.

Referenced by RateDepSmearIsoCrackModel::calcStateIncr(), and getConvergeVar().


The documentation for this class was generated from the following files: