www.mooseframework.org
LinearViscoelasticityManager.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 #include "libmesh/quadrature.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<ElementUserObject>();
15  params.addRequiredParam<std::string>("viscoelastic_model",
16  "name of the LinearViscoelasticityBase object to manage");
17  params.addParam<std::string>(
18  "stress_name", "stress", "name of the stress tensor used for the viscoelastic update");
19  params.addParam<std::string>("creep_strain_name",
20  "creep_strain",
21  "name of the creep strain tensor used for the viscoelastic update");
22  params.addParam<std::string>(
23  "elastic_strain_name",
24  "elastic_strain",
25  "name of the elastic strain tensor used for the viscoelastic update");
26  params.set<MultiMooseEnum>("execute_on") = "timestep_begin timestep_end";
27  params.suppressParameter<MultiMooseEnum>("execute_on");
28  return params;
29 }
30 
32  : ElementUserObject(parameters),
33  _stress_name(getParam<std::string>("stress_name")),
34  _stress(getMaterialPropertyByName<RankTwoTensor>(_stress_name)),
35  _creep_strain_name(getParam<std::string>("creep_strain_name")),
36  _creep_strain(getMaterialPropertyByName<RankTwoTensor>(_creep_strain_name)),
37  _elastic_strain_name(getParam<std::string>("elastic_strain_name")),
38  _elastic_strain(getMaterialPropertyByName<RankTwoTensor>(_elastic_strain_name)),
39  _viscoelastic_model_name(getParam<std::string>("viscoelastic_model")),
40  _viscoelastic_model(nullptr)
41 {
42 }
43 
44 void
46 {
47  if (_mi_feproblem.getCurrentExecuteOnFlag() == EXEC_TIMESTEP_BEGIN)
48  {
49  for (unsigned int _qp = 0; _qp < _qrule->n_points(); ++_qp)
50  _viscoelastic_model->recomputeQpApparentProperties(_qp);
51  }
52 }
53 
54 void
56 {
57  std::shared_ptr<Material> test =
58  _mi_feproblem.getMaterial(_viscoelastic_model_name, _material_data_type, _mi_tid, true);
59 
60  if (!test)
61  mooseError(_viscoelastic_model_name + " does not exist");
62 
63  _viscoelastic_model = std::dynamic_pointer_cast<LinearViscoelasticityBase>(test);
64 
66  mooseError(_viscoelastic_model_name + " is not a LinearViscoelasticityBase object");
67 }
std::shared_ptr< LinearViscoelasticityBase > _viscoelastic_model
Pointer to the viscoelastic model to update.
InputParameters validParams< LinearViscoelasticityManager >()
std::string _viscoelastic_model_name
Name of the viscoelastic model to update.
This class is a base class for materials consisting of an assembly of linear springs and dashpots...
LinearViscoelasticityManager(const InputParameters &parameters)