https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComputeGlobalStrain.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
10#include "ComputeGlobalStrain.h"
12
13// MOOSE includes
14#include "RankTwoTensor.h"
15
17
20{
23 "Material for storing the global strain values from the scalar variable");
24 params.addParam<std::string>("base_name",
25 "Optional parameter that allows the user to define "
26 "multiple mechanics material systems on the same "
27 "block, i.e. for multiple phases");
28 params.addCoupledVar("scalar_global_strain", "Scalar variable for global strain");
29 params.addCoupledVar("displacements", "The name of the displacement variables");
30 params.addRequiredParam<UserObjectName>("global_strain_uo",
31 "The name of the GlobalStrainUserObject");
32
33 params.set<MooseEnum>("constant_on") = "SUBDOMAIN";
34 return params;
35}
36
38 : Material(parameters),
39 _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
40 _scalar_global_strain(coupledScalarValue("scalar_global_strain")),
41 _global_strain(declareProperty<RankTwoTensor>(_base_name + "global_strain")),
42 _pst(getUserObject<GlobalStrainUserObjectInterface>("global_strain_uo")),
43 _periodic_dir(_pst.getPeriodicDirections()),
44 _dim(_mesh.dimension()),
45 _ndisp(coupledComponents("displacements"))
46{
47}
48
49void
54
55void
57{
60
61 for (unsigned int dir = 0; dir < _dim; ++dir)
62 if (!_periodic_dir(dir))
63 for (unsigned int var = 0; var < _ndisp; ++var)
64 strain(dir, var) = 0.0;
65}
registerMooseObject("SolidMechanicsApp", ComputeGlobalStrain)
ComputeGlobalStrain calculates the global strain tensor from the scalar variables.
const unsigned int _ndisp
Number of displacement variables.
MaterialProperty< RankTwoTensor > & _global_strain
const unsigned int _dim
ComputeGlobalStrain(const InputParameters &parameters)
const VectorValue< bool > & _periodic_dir
virtual void initQpStatefulProperties() override
const VariableValue & _scalar_global_strain
static InputParameters validParams()
virtual void computeQpProperties() override
This class provides interface for extracting the periodic directions, residual, and jacobian values f...
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _qp
static InputParameters validParams()
void fillFromScalarVariable(const VariableValue &scalar_variable)