https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearViscoelasticityBase.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
15{
16 MooseEnum integration("backward-euler mid-point newmark zienkiewicz", "backward-euler");
17
19 params.addParam<MooseEnum>("integration_rule",
20 integration,
21 "describes how the viscoelastic behavior is integrated through time");
22 params.addRangeCheckedParam<Real>("theta",
23 1,
24 "theta > 0 & theta <= 1",
25 "coefficient for Newmark integration rule (between 0 and 1)");
26 params.addParam<std::string>("driving_eigenstrain",
27 "name of the eigenstrain that increases the creep strains");
28 params.addParam<std::string>(
29 "elastic_strain_name", "elastic_strain", "name of the true elastic strain of the material");
30 params.addParam<std::string>("creep_strain_name",
31 "creep_strain",
32 "name of the true creep strain of the material"
33 "(computed by LinearViscoelasticStressUpdate or"
34 "ComputeLinearViscoelasticStress)");
35 params.addParam<bool>("force_recompute_properties",
36 false,
37 "forces the computation of the viscoelastic properties at each step of"
38 "the solver (default: false)");
39 params.addParam<bool>(
40 "need_viscoelastic_properties_inverse",
41 false,
42 "checks whether the model requires the computation of the inverse viscoelastic"
43 "properties (default: false)");
44 params.suppressParameter<FunctionName>("elasticity_tensor_prefactor");
45 return params;
46}
47
49 : ComputeElasticityTensorBase(parameters),
50 _integration_rule(getParam<MooseEnum>("integration_rule").getEnum<IntegrationRule>()),
51 _theta(getParam<Real>("theta")),
52 _apparent_elasticity_tensor(
53 declareProperty<RankFourTensor>(_base_name + "apparent_elasticity_tensor")),
54 _apparent_elasticity_tensor_inv(
55 declareProperty<RankFourTensor>(_base_name + "apparent_elasticity_tensor_inv")),
56 _elasticity_tensor_inv(declareProperty<RankFourTensor>(_elasticity_tensor_name + "_inv")),
57 _need_viscoelastic_properties_inverse(getParam<bool>("need_viscoelastic_properties_inverse")),
58 _has_longterm_dashpot(false),
59 _components(0),
60 _first_elasticity_tensor(
61 declareProperty<RankFourTensor>(_base_name + "spring_elasticity_tensor_0")),
62 _first_elasticity_tensor_inv(
63 _need_viscoelastic_properties_inverse
64 ? &declareProperty<RankFourTensor>(_base_name + "spring_elasticity_tensor_0_inv")
65 : nullptr),
66 _longterm_elasticity_tensor(nullptr),
67 _longterm_elasticity_tensor_inv(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
101void
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 {
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
134 {
136 &declareProperty<RankFourTensor>(_base_name + "longterm_elasticity_tensor");
139 &declareProperty<RankFourTensor>(_base_name + "longterm_elasticity_tensor_inv");
140 }
141}
142
143void
145{
146 if (_components != _viscous_strains.size())
148 "inconsistent numbers of dashpots and viscous strains in LinearViscoelasticityBase;"
149 " Make sure declareViscoelasticProperties has been called in the viscoelastic model");
150
151 _apparent_creep_strain[_qp].zero();
152 _apparent_elasticity_tensor[_qp].zero();
154 _elasticity_tensor_inv[_qp].zero();
155 _first_elasticity_tensor[_qp].zero();
157 (*_longterm_elasticity_tensor)[_qp].zero();
159 (*_first_elasticity_tensor_inv)[_qp].zero();
161 (*_longterm_elasticity_tensor_inv)[_qp].zero();
162
163 for (unsigned int i = 0; i < _components; ++i)
164 {
165 if (!_has_longterm_dashpot || (_components > 0 && i < _components - 1))
166 {
167 (*_springs_elasticity_tensors[i])[_qp].zero();
169 (*_springs_elasticity_tensors_inv[i])[_qp].zero();
170 }
171
172 (*_dashpot_viscosities[i])[_qp] = 0.0;
173 (*_viscous_strains[i])[_qp].zero();
174 }
175}
176
177void
179{
180 unsigned int qp_prev = _qp;
181 _qp = qp;
182
183 if (_t_step >= 1)
184 _step_zero = false;
185
186 // 1. we get the viscoelastic properties and their inverse if needed
188
191
192 // 2. we update the internal viscous strains from the previous time step
194
195 // 3. we compute the apparent elasticity tensor
197
198 // 4. we transform the internal viscous strains in an apparent creep strain
199 if (!_step_zero)
201
202 _qp = qp_prev;
203}
204
205void
211
212void
214{
215 mooseAssert(_first_elasticity_tensor_inv, "_first_elasticity_tensor_inv is null");
216 if (MooseUtils::absoluteFuzzyEqual(_first_elasticity_tensor[_qp].L2norm(), 0.0))
217 (*_first_elasticity_tensor_inv)[_qp].zero();
218 else
220
221 for (unsigned int i = 0; i < _springs_elasticity_tensors.size(); ++i)
222 {
223 mooseAssert(_springs_elasticity_tensors_inv[i], "_springs_elasticity_tensors_inv[i] is null");
224 if (MooseUtils::absoluteFuzzyEqual((*_springs_elasticity_tensors[i])[_qp].L2norm(), 0.0))
225 (*_springs_elasticity_tensors_inv[i])[_qp].zero();
226 else
227 (*_springs_elasticity_tensors_inv[i])[_qp] = (*_springs_elasticity_tensors[i])[_qp].invSymm();
228 }
229
231 {
232 mooseAssert(_longterm_elasticity_tensor_inv, "_longterm_elasticity_tensor_inv is null");
233 if (MooseUtils::absoluteFuzzyEqual((*_longterm_elasticity_tensor)[_qp].L2norm(), 0.0))
234 (*_longterm_elasticity_tensor_inv)[_qp].zero();
235 else
236 (*_longterm_elasticity_tensor_inv)[_qp] = (*_longterm_elasticity_tensor)[_qp].invSymm();
237 }
238}
239
240Real
241LinearViscoelasticityBase::computeTheta(Real dt, Real viscosity) const
242{
243 if (MooseUtils::absoluteFuzzyEqual(dt, 0.0))
244 mooseError("linear viscoelasticity cannot be integrated over a dt of ", dt);
245
246 switch (_integration_rule)
247 {
249 return 1.;
251 return 0.5;
253 return _theta;
255 return 1. / (1. - std::exp(-dt / viscosity)) - viscosity / dt;
256 default:
257 return 1.;
258 }
259 return 1.;
260}
void mooseWarning(Args &&... args)
void mooseError(Args &&... args)
ComputeElasticityTensorBase the base class for computing elasticity tensors.
static InputParameters validParams()
const std::string _base_name
Base name of the material system.
void suppressParameter(const std::string &name)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
std::vector< MaterialProperty< RankFourTensor > * > _springs_elasticity_tensors
List of elasticity tensor of each subsequent spring in the chain.
Real _theta
User-defined value for theta.
static InputParameters validParams()
std::vector< MaterialProperty< RankTwoTensor > * > _viscous_strains
void recomputeQpApparentProperties(unsigned int qp)
Compute the apparent properties at a quadrature point.
virtual void computeQpViscoelasticPropertiesInv()
This method computes the inverse elasticity tensor of each spring in the system (if required).
MaterialProperty< RankFourTensor > & _apparent_elasticity_tensor
Apparent elasticity tensor. This is NOT the elasticity tensor of the material.
IntegrationRule
Determines how theta is calculated for the time-integration system.
@ Zienkiewicz
theta automatically adjusted as a function of the time step and the viscosity
@ Newmark
theta defined by the user
MaterialProperty< RankTwoTensor > & _apparent_creep_strain
The apparent creep strain resulting from the internal viscous strains.
bool _has_longterm_dashpot
Indicates if the spring-dashpot assembly has a single dashpot not associated with a spring.
std::vector< MaterialProperty< RankFourTensor > * > _springs_elasticity_tensors_inv
virtual void declareViscoelasticProperties()
Declare all necessary MaterialProperties for the model.
Real computeTheta(Real dt, Real viscosity) const
Provides theta as a function of the time step and a viscosity.
std::vector< MaterialProperty< Real > * > _dashpot_viscosities
List of viscosities of each subsequent dashpot in the chain.
LinearViscoelasticityBase(const InputParameters &parameters)
bool _need_viscoelastic_properties_inverse
If active, indicates that we need to call computeQpViscoelasticPropertiesInv()
virtual void computeQpElasticityTensor() final
Inherited from ComputeElasticityTensorBase.
std::vector< const MaterialProperty< Real > * > _dashpot_viscosities_old
MaterialProperty< RankFourTensor > & _apparent_elasticity_tensor_inv
Inverse of the apparent elasticity tensor.
std::vector< const MaterialProperty< RankTwoTensor > * > _viscous_strains_old
std::vector< const MaterialProperty< RankFourTensor > * > _springs_elasticity_tensors_inv_old
bool _force_recompute_properties
If activated, the time-stepping scheme will be re-initialized at each step of the solver.
virtual void updateQpViscousStrains()=0
Update the internal viscous strains at a quadrature point.
virtual void initQpStatefulProperties() override
unsigned int _components
This is the number of internal variables required by the model.
bool & _step_zero
checks whether we are at the first time step
MaterialProperty< RankFourTensor > & _elasticity_tensor_inv
Instantaneous elasticity tensor. This IS the real elasticity tensor of the material.
IntegrationRule _integration_rule
Determines how theta is computed.
virtual void computeQpApparentCreepStrain()=0
This method computes the apparent creep strain corresponding to the current viscous_strain of each da...
MaterialProperty< RankFourTensor > & _first_elasticity_tensor
Elasticity tensor of a stand-alone elastic spring in the chain.
MaterialProperty< RankFourTensor > * _first_elasticity_tensor_inv
MaterialProperty< RankFourTensor > * _longterm_elasticity_tensor
Elasticity tensor corresponding to the long-term dashpot.
virtual void computeQpViscoelasticProperties()=0
This method assigns the mechanical properties of each spring and dashpot in the system.
virtual void computeQpApparentElasticityTensors()=0
This method computes the apparent elasticity tensor used in the internal time-stepping scheme.
MaterialProperty< RankFourTensor > * _longterm_elasticity_tensor_inv
std::string stringify(const T &t)