www.mooseframework.org
LinearViscoelasticityBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "Conversion.h"
12 
14 
15 InputParameters
17 {
18  MooseEnum integration("backward-euler mid-point newmark zienkiewicz", "backward-euler");
19 
20  InputParameters params = ComputeElasticityTensorBase::validParams();
21  params.addParam<MooseEnum>("integration_rule",
22  integration,
23  "describes how the viscoelastic behavior is integrated through time");
24  params.addRangeCheckedParam<Real>("theta",
25  1,
26  "theta > 0 & theta <= 1",
27  "coefficient for Newmark integration rule (between 0 and 1)");
28  params.addParam<std::string>("driving_eigenstrain",
29  "name of the eigenstrain that increases the creep strains");
30  params.addParam<std::string>(
31  "elastic_strain_name", "elastic_strain", "name of the true elastic strain of the material");
32  params.addParam<std::string>("creep_strain_name",
33  "creep_strain",
34  "name of the true creep strain of the material"
35  "(computed by LinearViscoelasticStressUpdate or"
36  "ComputeLinearViscoelasticStress)");
37  params.addParam<bool>("force_recompute_properties",
38  false,
39  "forces the computation of the viscoelastic properties at each step of"
40  "the solver (default: false)");
41  params.addParam<bool>(
42  "need_viscoelastic_properties_inverse",
43  false,
44  "checks whether the model requires the computation of the inverse viscoelastic"
45  "properties (default: false)");
46  params.suppressParameter<FunctionName>("elasticity_tensor_prefactor");
47  return params;
48 }
49 
50 LinearViscoelasticityBase::LinearViscoelasticityBase(const InputParameters & parameters)
51  : ComputeElasticityTensorBase(parameters),
52  _integration_rule(getParam<MooseEnum>("integration_rule").getEnum<IntegrationRule>()),
53  _theta(getParam<Real>("theta")),
54  _apparent_elasticity_tensor(
55  declareProperty<RankFourTensor>(_base_name + "apparent_elasticity_tensor")),
56  _apparent_elasticity_tensor_inv(
57  declareProperty<RankFourTensor>(_base_name + "apparent_elasticity_tensor_inv")),
58  _elasticity_tensor_inv(declareProperty<RankFourTensor>(_elasticity_tensor_name + "_inv")),
59  _need_viscoelastic_properties_inverse(getParam<bool>("need_viscoelastic_properties_inverse")),
60  _has_longterm_dashpot(false),
61  _components(0),
62  _first_elasticity_tensor(
63  declareProperty<RankFourTensor>(_base_name + "spring_elasticity_tensor_0")),
64  _first_elasticity_tensor_inv(
65  _need_viscoelastic_properties_inverse
66  ? &declareProperty<RankFourTensor>(_base_name + "spring_elasticity_tensor_0_inv")
67  : nullptr),
68  _apparent_creep_strain(declareProperty<RankTwoTensor>(_base_name + "apparent_creep_strain")),
69  _apparent_creep_strain_old(
70  getMaterialPropertyOld<RankTwoTensor>(_base_name + "apparent_creep_strain")),
71  _elastic_strain_old(
72  getMaterialPropertyOld<RankTwoTensor>(getParam<std::string>("elastic_strain_name"))),
73  _creep_strain_old(
74  getMaterialPropertyOld<RankTwoTensor>(getParam<std::string>("creep_strain_name"))),
75  _has_driving_eigenstrain(isParamValid("driving_eigenstrain")),
76  _driving_eigenstrain_name(
77  _has_driving_eigenstrain ? getParam<std::string>("driving_eigenstrain") : ""),
78  _driving_eigenstrain(_has_driving_eigenstrain
79  ? &getMaterialPropertyByName<RankTwoTensor>(_driving_eigenstrain_name)
80  : nullptr),
81  _driving_eigenstrain_old(_has_driving_eigenstrain
82  ? &getMaterialPropertyOld<RankTwoTensor>(_driving_eigenstrain_name)
83  : nullptr),
84  _force_recompute_properties(getParam<bool>("force_recompute_properties")),
85  _step_zero(declareRestartableData<bool>("step_zero", true))
86 {
87  if (_theta < 0.5)
88  mooseWarning("theta parameter for LinearViscoelasticityBase is below 0.5; time integration may "
89  "not converge!");
90 
91  // force material properties to be considered stateful
92  getMaterialPropertyOld<RankFourTensor>(_base_name + "apparent_elasticity_tensor");
93  getMaterialPropertyOld<RankFourTensor>(_base_name + "apparent_elasticity_tensor_inv");
94  getMaterialPropertyOld<RankFourTensor>(_elasticity_tensor_name);
95  getMaterialPropertyOld<RankFourTensor>(_elasticity_tensor_name + "_inv");
96  getMaterialPropertyOld<RankFourTensor>(_base_name + "spring_elasticity_tensor_0");
98  getMaterialPropertyOld<RankFourTensor>(_base_name + "spring_elasticity_tensor_0_inv");
99 }
100 
101 void
103 {
104  for (unsigned int i = 0; i < _components; ++i)
105  {
106  std::string ith = Moose::stringify(i + 1);
107 
108  if (!_has_longterm_dashpot || (_components > 0 && i < _components - 1))
109  {
110  _springs_elasticity_tensors.push_back(
111  &declareProperty<RankFourTensor>(_base_name + "spring_elasticity_tensor_" + ith));
112  getMaterialPropertyOld<RankFourTensor>(_base_name + "spring_elasticity_tensor_" + ith);
113  }
114 
115  _dashpot_viscosities.push_back(&declareProperty<Real>(_base_name + "dashpot_viscosity_" + ith));
116  _dashpot_viscosities_old.push_back(
117  &getMaterialPropertyOld<Real>(_base_name + "dashpot_viscosity_" + ith));
118 
119  _viscous_strains.push_back(
120  &declareProperty<RankTwoTensor>(_base_name + "viscous_strain_" + ith));
121  _viscous_strains_old.push_back(
122  &getMaterialPropertyOld<RankTwoTensor>(_base_name + "viscous_strain_" + ith));
123 
125  {
126  _springs_elasticity_tensors_inv.push_back(&declareProperty<RankFourTensor>(
127  _base_name + "spring_elasticity_tensor_" + ith + "_inv"));
128  _springs_elasticity_tensors_inv_old.push_back(&getMaterialPropertyOld<RankFourTensor>(
129  _base_name + "spring_elasticity_tensor_" + ith + "_inv"));
130  }
131  }
132 }
133 
134 void
136 {
137  if (_components != _viscous_strains.size())
138  mooseError(
139  "inconsistent numbers of dashpots and viscous strains in LinearViscoelasticityBase;"
140  " Make sure declareViscoelasticProperties has been called in the viscoelastic model");
141 
142  _apparent_creep_strain[_qp].zero();
143  _apparent_elasticity_tensor[_qp].zero();
145  _elasticity_tensor_inv[_qp].zero();
146  _first_elasticity_tensor[_qp].zero();
148  (*_first_elasticity_tensor_inv)[_qp].zero();
149 
150  for (unsigned int i = 0; i < _components; ++i)
151  {
152  if (!_has_longterm_dashpot || (_components > 0 && i < _components - 1))
153  {
154  (*_springs_elasticity_tensors[i])[_qp].zero();
156  (*_springs_elasticity_tensors_inv[i])[_qp].zero();
157  }
158 
159  (*_dashpot_viscosities[i])[_qp] = 0.0;
160  (*_viscous_strains[i])[_qp].zero();
161  }
162 }
163 
164 void
166 {
167  unsigned int qp_prev = _qp;
168  _qp = qp;
169 
170  if (_t_step >= 1)
171  _step_zero = false;
172 
173  // 1. we get the viscoelastic properties and their inverse if needed
177 
178  // 2. we update the internal viscous strains from the previous time step
180 
181  // 3. we compute the apparent elasticity tensor
183 
184  // 4. we transform the internal viscous strains in an apparent creep strain
185  if (!_step_zero)
187 
188  _qp = qp_prev;
189 }
190 
191 void
193 {
196 }
197 
198 void
200 {
201  if (MooseUtils::absoluteFuzzyEqual(_first_elasticity_tensor[_qp].L2norm(), 0.0))
202  (*_first_elasticity_tensor_inv)[_qp].zero();
203  else
205 
206  for (unsigned int i = 0; i < _springs_elasticity_tensors.size(); ++i)
207  {
208  if (MooseUtils::absoluteFuzzyEqual((*_springs_elasticity_tensors[i])[_qp].L2norm(), 0.0))
209  (*_springs_elasticity_tensors_inv[i])[_qp].zero();
210  else
211  (*_springs_elasticity_tensors_inv[i])[_qp] = (*_springs_elasticity_tensors[i])[_qp].invSymm();
212  }
213 }
214 
215 Real
216 LinearViscoelasticityBase::computeTheta(Real dt, Real viscosity) const
217 {
218  if (MooseUtils::absoluteFuzzyEqual(dt, 0.0))
219  mooseError("linear viscoelasticity cannot be integrated over a dt of ", dt);
220 
221  switch (_integration_rule)
222  {
224  return 1.;
226  return 0.5;
228  return _theta;
230  return 1. / (1. - std::exp(-dt / viscosity)) - viscosity / dt;
231  default:
232  return 1.;
233  }
234  return 1.;
235 }
LinearViscoelasticityBase::_first_elasticity_tensor
MaterialProperty< RankFourTensor > & _first_elasticity_tensor
Elasticity tensor of a stand-alone elastic spring in the chain.
Definition: LinearViscoelasticityBase.h:217
LinearViscoelasticityBase::_first_elasticity_tensor_inv
MaterialProperty< RankFourTensor > * _first_elasticity_tensor_inv
Definition: LinearViscoelasticityBase.h:218
LinearViscoelasticityBase::computeQpElasticityTensor
virtual void computeQpElasticityTensor() final
Inherited from ComputeElasticityTensorBase.
Definition: LinearViscoelasticityBase.C:192
LinearViscoelasticityBase::_apparent_creep_strain
MaterialProperty< RankTwoTensor > & _apparent_creep_strain
The apparent creep strain resulting from the internal viscous strains.
Definition: LinearViscoelasticityBase.h:241
LinearViscoelasticityBase::_apparent_elasticity_tensor
MaterialProperty< RankFourTensor > & _apparent_elasticity_tensor
Apparent elasticity tensor. This is NOT the elasticity tensor of the material.
Definition: LinearViscoelasticityBase.h:197
LinearViscoelasticityBase::IntegrationRule::BackwardEuler
theta = 1
LinearViscoelasticityBase::_integration_rule
IntegrationRule _integration_rule
Determines how theta is computed.
Definition: LinearViscoelasticityBase.h:192
LinearViscoelasticityBase::_springs_elasticity_tensors_inv
std::vector< MaterialProperty< RankFourTensor > * > _springs_elasticity_tensors_inv
Definition: LinearViscoelasticityBase.h:223
LinearViscoelasticityBase::_dashpot_viscosities
std::vector< MaterialProperty< Real > * > _dashpot_viscosities
List of viscosities of each subsequent dashpot in the chain.
Definition: LinearViscoelasticityBase.h:228
LinearViscoelasticityBase::declareViscoelasticProperties
void declareViscoelasticProperties()
Declare all necessary MaterialProperties for the model.
Definition: LinearViscoelasticityBase.C:102
LinearViscoelasticityBase::_dashpot_viscosities_old
std::vector< const MaterialProperty< Real > * > _dashpot_viscosities_old
Definition: LinearViscoelasticityBase.h:229
LinearViscoelasticityBase::computeQpViscoelasticPropertiesInv
virtual void computeQpViscoelasticPropertiesInv()
This method computes the inverse elasticity tensor of each spring in the system (if required).
Definition: LinearViscoelasticityBase.C:199
LinearViscoelasticityBase::updateQpViscousStrains
virtual void updateQpViscousStrains()=0
Update the internal viscous strains at a quadrature point.
LinearViscoelasticityBase::computeQpApparentCreepStrain
virtual void computeQpApparentCreepStrain()=0
This method computes the apparent creep strain corresponding to the current viscous_strain of each da...
LinearViscoelasticityBase.h
LinearViscoelasticityBase::recomputeQpApparentProperties
void recomputeQpApparentProperties(unsigned int qp)
Compute the apparent properties at a quadrature point.
Definition: LinearViscoelasticityBase.C:165
LinearViscoelasticityBase::computeTheta
Real computeTheta(Real dt, Real viscosity) const
Provides theta as a function of the time step and a viscosity.
Definition: LinearViscoelasticityBase.C:216
LinearViscoelasticityBase::validParams
static InputParameters validParams()
Definition: LinearViscoelasticityBase.C:16
ComputeElasticityTensorBase
ComputeElasticityTensorBase the base class for computing elasticity tensors.
Definition: ComputeElasticityTensorBase.h:25
LinearViscoelasticityBase::_has_longterm_dashpot
bool _has_longterm_dashpot
Indicates if the spring-dashpot assembly has a single dashpot not associated with a spring.
Definition: LinearViscoelasticityBase.h:209
LinearViscoelasticityBase::_theta
Real _theta
User-defined value for theta.
Definition: LinearViscoelasticityBase.h:194
LinearViscoelasticityBase::_viscous_strains
std::vector< MaterialProperty< RankTwoTensor > * > _viscous_strains
Definition: LinearViscoelasticityBase.h:236
LinearViscoelasticityBase::_apparent_elasticity_tensor_inv
MaterialProperty< RankFourTensor > & _apparent_elasticity_tensor_inv
Inverse of the apparent elasticity tensor.
Definition: LinearViscoelasticityBase.h:199
LinearViscoelasticityBase::_springs_elasticity_tensors_inv_old
std::vector< const MaterialProperty< RankFourTensor > * > _springs_elasticity_tensors_inv_old
Definition: LinearViscoelasticityBase.h:224
LinearViscoelasticityBase::_need_viscoelastic_properties_inverse
bool _need_viscoelastic_properties_inverse
If active, indicates that we need to call computeQpViscoelasticPropertiesInv()
Definition: LinearViscoelasticityBase.h:207
LinearViscoelasticityBase::computeQpApparentElasticityTensors
virtual void computeQpApparentElasticityTensors()=0
This method computes the apparent elasticity tensor used in the internal time-stepping scheme.
LinearViscoelasticityBase::IntegrationRule::MidPoint
theta = 0.5
LinearViscoelasticityBase::computeQpViscoelasticProperties
virtual void computeQpViscoelasticProperties()=0
This method assigns the mechanical properties of each spring and dashpot in the system.
LinearViscoelasticityBase::_viscous_strains_old
std::vector< const MaterialProperty< RankTwoTensor > * > _viscous_strains_old
Definition: LinearViscoelasticityBase.h:237
RankFourTensorTempl< Real >
LinearViscoelasticityBase::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: LinearViscoelasticityBase.C:135
ComputeElasticityTensorBase::validParams
static InputParameters validParams()
Definition: ComputeElasticityTensorBase.C:16
ComputeElasticityTensorBase::_elasticity_tensor_name
std::string _elasticity_tensor_name
Definition: ComputeElasticityTensorBase.h:38
RankTwoTensorTempl
Definition: ACGrGrElasticDrivingForce.h:17
LinearViscoelasticityBase::IntegrationRule::Newmark
theta defined by the user
LinearViscoelasticityBase::_force_recompute_properties
bool _force_recompute_properties
If activated, the time-stepping scheme will be re-initialized at each step of the solver.
Definition: LinearViscoelasticityBase.h:268
LinearViscoelasticityBase::LinearViscoelasticityBase
LinearViscoelasticityBase(const InputParameters &parameters)
Definition: LinearViscoelasticityBase.C:50
LinearViscoelasticityBase::_elasticity_tensor_inv
MaterialProperty< RankFourTensor > & _elasticity_tensor_inv
Instantaneous elasticity tensor. This IS the real elasticity tensor of the material.
Definition: LinearViscoelasticityBase.h:204
defineLegacyParams
defineLegacyParams(LinearViscoelasticityBase)
ComputeElasticityTensorBase::_base_name
const std::string _base_name
Definition: ComputeElasticityTensorBase.h:37
LinearViscoelasticityBase::_step_zero
bool & _step_zero
checks whether we are at the first time step
Definition: LinearViscoelasticityBase.h:271
LinearViscoelasticityBase::_springs_elasticity_tensors
std::vector< MaterialProperty< RankFourTensor > * > _springs_elasticity_tensors
List of elasticity tensor of each subsequent spring in the chain.
Definition: LinearViscoelasticityBase.h:222
RankTwoScalarTools::L2norm
T L2norm(const RankTwoTensorTempl< T > &r2tensor)
Definition: RankTwoScalarTools.h:98
LinearViscoelasticityBase::IntegrationRule::Zienkiewicz
theta automatically adjusted as a function of the time step and the viscosity
LinearViscoelasticityBase::IntegrationRule
IntegrationRule
Determines how theta is calculated for the time-integration system.
Definition: LinearViscoelasticityBase.h:87
LinearViscoelasticityBase::_components
unsigned int _components
This is the number of internal variables required by the model.
Definition: LinearViscoelasticityBase.h:214
LinearViscoelasticityBase
This class is a base class for materials consisting of an assembly of linear springs and dashpots.
Definition: LinearViscoelasticityBase.h:81