www.mooseframework.org
LinearViscoelasticityManager.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 "libmesh/quadrature.h"
12 
14 
16 
17 InputParameters
19 {
20  InputParameters params = ElementUserObject::validParams();
21  params.addClassDescription("Manages the updating of the semi-implicit "
22  "single-step first-order finite difference "
23  "time-stepping scheme");
24  params.addRequiredParam<std::string>("viscoelastic_model",
25  "name of the LinearViscoelasticityBase object to manage");
26  params.addParam<std::string>(
27  "stress_name", "stress", "name of the stress tensor used for the viscoelastic update");
28  params.addParam<std::string>("creep_strain_name",
29  "creep_strain",
30  "name of the creep strain tensor used for the viscoelastic update");
31  params.addParam<std::string>(
32  "elastic_strain_name",
33  "elastic_strain",
34  "name of the elastic strain tensor used for the viscoelastic update");
35  params.set<ExecFlagEnum>("execute_on") = {EXEC_TIMESTEP_BEGIN, EXEC_TIMESTEP_END};
36  params.suppressParameter<ExecFlagEnum>("execute_on");
37  return params;
38 }
39 
41  : ElementUserObject(parameters),
42  _stress_name(getParam<std::string>("stress_name")),
43  _stress(getMaterialPropertyByName<RankTwoTensor>(_stress_name)),
44  _creep_strain_name(getParam<std::string>("creep_strain_name")),
45  _creep_strain(getMaterialPropertyByName<RankTwoTensor>(_creep_strain_name)),
46  _elastic_strain_name(getParam<std::string>("elastic_strain_name")),
47  _elastic_strain(getMaterialPropertyByName<RankTwoTensor>(_elastic_strain_name)),
48  _viscoelastic_model_name(getParam<std::string>("viscoelastic_model")),
49  _viscoelastic_model(nullptr)
50 {
51 }
52 
53 void
55 {
56  if (_mi_feproblem.getCurrentExecuteOnFlag() == EXEC_TIMESTEP_BEGIN)
57  {
58  for (unsigned int _qp = 0; _qp < _qrule->n_points(); ++_qp)
59  _viscoelastic_model->recomputeQpApparentProperties(_qp);
60  }
61 }
62 
63 void
65 {
66  std::shared_ptr<MaterialBase> test =
67  _mi_feproblem.getMaterial(_viscoelastic_model_name, _material_data_type, _mi_tid, true);
68 
69  if (!test)
70  mooseError(_viscoelastic_model_name + " does not exist");
71 
72  _viscoelastic_model = std::dynamic_pointer_cast<LinearViscoelasticityBase>(test);
73 
75  mooseError(_viscoelastic_model_name + " is not a LinearViscoelasticityBase object");
76 }
LinearViscoelasticityManager::_viscoelastic_model_name
std::string _viscoelastic_model_name
Name of the viscoelastic model to update.
Definition: LinearViscoelasticityManager.h:62
LinearViscoelasticityManager::initialize
virtual void initialize() override
Definition: LinearViscoelasticityManager.C:64
LinearViscoelasticityManager.h
defineLegacyParams
defineLegacyParams(LinearViscoelasticityManager)
LinearViscoelasticityManager::LinearViscoelasticityManager
LinearViscoelasticityManager(const InputParameters &parameters)
Definition: LinearViscoelasticityManager.C:40
LinearViscoelasticityManager
This class manages a LinearViscoelasticityBase object.
Definition: LinearViscoelasticityManager.h:33
registerMooseObject
registerMooseObject("TensorMechanicsApp", LinearViscoelasticityManager)
validParams
InputParameters validParams()
LinearViscoelasticityManager::_viscoelastic_model
std::shared_ptr< LinearViscoelasticityBase > _viscoelastic_model
Pointer to the viscoelastic model to update.
Definition: LinearViscoelasticityManager.h:64
LinearViscoelasticityManager::validParams
static InputParameters validParams()
Definition: LinearViscoelasticityManager.C:18
RankTwoTensorTempl< Real >
LinearViscoelasticityManager::execute
virtual void execute() override
Definition: LinearViscoelasticityManager.C:54