www.mooseframework.org
TensorMechanicsActionBase.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 /****************************************************************/
9 #include "ActionWarehouse.h"
10 #include "ComputeFiniteStrain.h"
11 
12 // map tensor name shortcuts to tensor material property names
13 const std::map<std::string, std::string> TensorMechanicsActionBase::_ranktwoaux_table = {
14  {"strain", "total_strain"},
15  {"stress", "stress"},
16  {"elastic_strain", "elastic_strain"},
17  {"plastic_strain", "plastic_strain"},
18  {"creep_strain", "creep_strain"}};
19 const std::vector<char> TensorMechanicsActionBase::_component_table = {'x', 'y', 'z'};
20 // map aux variable name prefixes to RanTwoScalarAux option and list of permitted tensor name
21 // shortcuts
22 const std::map<std::string, std::pair<std::string, std::vector<std::string>>>
24  {"vonmises", {"VonMisesStress", {"stress"}}},
25  {"hydrostatic", {"Hydrostatic", {"stress"}}},
26  {"max_principal", {"MaxPrincipal", {"stress"}}},
27  {"mid_principal", {"MidPrincipal", {"stress"}}},
28  {"min_principal", {"MinPrincipal", {"stress"}}},
29  {"effective", {"EffectiveStrain", {"plastic_strain", "creep_strain"}}},
30  {"firstinv", {"FirstInvariant", {"stress", "strain"}}},
31  {"secondinv", {"SecondInvariant", {"stress", "strain"}}},
32  {"thirdinv", {"ThirdInvariant", {"stress", "strain"}}}};
33 
34 template <>
35 InputParameters
37 {
38  InputParameters params = validParams<Action>();
39 
40  params.addRequiredParam<std::vector<NonlinearVariableName>>(
41  "displacements", "The nonlinear displacement variables for the problem");
42  params.addParam<NonlinearVariableName>("temperature", "The temperature");
43 
44  MooseEnum strainType("SMALL FINITE", "SMALL");
45  params.addParam<MooseEnum>("strain", strainType, "Strain formulation");
46  params.addParam<bool>("incremental", "Use incremental or total strain");
47 
48  params.addParam<std::string>("base_name", "Material property base name");
49  params.addParam<bool>(
50  "volumetric_locking_correction", false, "Flag to correct volumetric locking");
51  params.addParam<bool>(
52  "use_finite_deform_jacobian", false, "Jacobian for corrotational finite strain");
53  params.addParam<bool>(
54  "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
55  params.addParam<bool>("add_variables", false, "Add the displacement variables");
56  params.addParam<std::vector<MaterialPropertyName>>(
57  "eigenstrain_names", "List of eigenstrains to be applied in this strain calculation");
58 
59  // Advanced
60  params.addParam<std::vector<AuxVariableName>>("save_in", "The displacement residuals");
61  params.addParam<std::vector<AuxVariableName>>("diag_save_in",
62  "The displacement diagonal preconditioner terms");
63  params.addParam<MooseEnum>("decomposition_method",
65  "Methods to calculate the finite strain and rotation increments");
66  params.addParamNamesToGroup("save_in diag_save_in", "Advanced");
67 
68  // Planar Formulation
69  MooseEnum planarFormulationType("NONE PLANE_STRAIN GENERALIZED_PLANE_STRAIN",
70  "NONE"); // PLANE_STRESS
71  params.addParam<MooseEnum>(
72  "planar_formulation", planarFormulationType, "Out-of-plane stress/strain formulation");
73  params.addParam<NonlinearVariableName>("scalar_out_of_plane_strain",
74  "Scalar variable for the out-of-plane strain (in y "
75  "direction for 1D Axisymmetric or in z direction for 2D "
76  "Cartesian problems)");
77  params.addParam<FunctionName>("out_of_plane_pressure",
78  "0",
79  "Function used to prescribe pressure in the out-of-plane direction "
80  "(y for 1D Axisymmetric or z for 2D Cartesian problems)");
81  params.addParam<Real>("pressure_factor", 1.0, "Scale factor applied to prescribed pressure");
82  params.addParamNamesToGroup(
83  "planar_formulation scalar_out_of_plane_strain out_of_plane_pressure pressure_factor",
84  "Out-of-plane stress/strain");
85 
86  // Output
87  params.addParam<MultiMooseEnum>("generate_output",
89  "Add scalar quantity output for stress and/or strain");
90  params.addParamNamesToGroup("generate_output", "Output");
91 
92  return params;
93 }
94 
95 TensorMechanicsActionBase::TensorMechanicsActionBase(const InputParameters & parameters)
96  : Action(parameters)
97 {
98  // check if a container block with common parameters is found
99  auto action = _awh.getActions<CommonTensorMechanicsAction>();
100  if (action.size() == 1)
101  _pars.applyParameters(action[0]->parameters());
102 
103  // append additional_generate_output
104  if (isParamValid("additional_generate_output"))
105  {
106  MultiMooseEnum generate_output = getParam<MultiMooseEnum>("generate_output");
107  MultiMooseEnum additional_generate_output =
108  getParam<MultiMooseEnum>("additional_generate_output");
109  for (auto & output : additional_generate_output)
110  generate_output.push_back(output);
111 
112  _pars.set<MultiMooseEnum>("generate_output") = generate_output;
113  }
114 }
115 
116 MultiMooseEnum
118 {
119  std::string options = "";
120  for (auto & r2a : _ranktwoaux_table)
121  for (unsigned int a = 0; a < 3; ++a)
122  for (unsigned int b = 0; b < 3; ++b)
123  options += (options == "" ? "" : " ") + r2a.first + '_' + _component_table[a] +
124  _component_table[b];
125 
126  for (auto & r2sa : _ranktwoscalaraux_table)
127  for (auto & t : r2sa.second.second)
128  options += " " + r2sa.first + "_" + t;
129 
130  return MultiMooseEnum(options);
131 }
static const std::vector< char > _component_table
static const std::map< std::string, std::pair< std::string, std::vector< std::string > > > _ranktwoscalaraux_table
InputParameters validParams< TensorMechanicsActionBase >()
static MultiMooseEnum outputPropertiesType()
static const std::map< std::string, std::string > _ranktwoaux_table
table data for output generation
static MooseEnum decompositionType()
Store common tensor mechanics parameters.
TensorMechanicsActionBase(const InputParameters &params)