https://mooseframework.inl.gov
ComputeAxisymmetric1DSmallStrain.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 "UserObject.h"
12 
14 
17 {
19  params.addClassDescription("Compute a small strain in an Axisymmetric 1D problem");
20  params.addParam<UserObjectName>("subblock_index_provider",
21  "SubblockIndexProvider user object name");
22  params.addCoupledVar("scalar_out_of_plane_strain", "Scalar variable for axisymmetric 1D problem");
23  params.addCoupledVar("out_of_plane_strain", "Nonlinear variable for axisymmetric 1D problem");
24 
25  return params;
26 }
27 
29  const InputParameters & parameters)
30  : Compute1DSmallStrain(parameters),
31  _subblock_id_provider(isParamValid("subblock_index_provider")
32  ? &getUserObject<SubblockIndexProvider>("subblock_index_provider")
33  : nullptr),
34  _has_out_of_plane_strain(isCoupled("out_of_plane_strain")),
35  _out_of_plane_strain(_has_out_of_plane_strain ? coupledValue("out_of_plane_strain") : _zero),
36  _has_scalar_out_of_plane_strain(isCoupledScalar("scalar_out_of_plane_strain"))
37 {
39  mooseError("Must define only one of out_of_plane_strain or scalar_out_of_plane_strain");
40 
42  {
43  const auto nscalar_strains = coupledScalarComponents("scalar_out_of_plane_strain");
44  _scalar_out_of_plane_strain.resize(nscalar_strains);
45  for (unsigned int i = 0; i < nscalar_strains; ++i)
46  _scalar_out_of_plane_strain[i] = &coupledScalarValue("scalar_out_of_plane_strain", i);
47  }
48 }
49 
50 void
52 {
54 
56  mooseError("The coordinate system must be set to RZ for Axisymmetric geometries.");
57 }
58 
59 Real
61 {
64  else
65  return _out_of_plane_strain[_qp];
66 }
67 
68 Real
70 {
72  return (*_disp[0])[_qp] / _q_point[_qp](0);
73  else
74  return 0.0;
75 }
const MooseArray< Point > & _q_point
Real computeStrainZZ() override
Computes the strain_zz for axisymmetric problems, where .
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const bool _has_scalar_out_of_plane_strain
Whether out-of-plane strain scalar variables are coupled.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
ComputeAxisymmetric1DSmallStrain(const InputParameters &parameters)
Moose::CoordinateSystemType getBlockCoordSystem()
const bool _has_out_of_plane_strain
Whether an out-of-plane strain variable is coupled.
Abstract base class for user objects that provide an index for a given element that is independent of...
std::vector< const VariableValue * > _disp
Displacement variables.
const VariableValue & _out_of_plane_strain
The out-of-plane strain variable.
unsigned int getCurrentSubblockIndex() const
gets its subblock index for current element
Real computeStrainYY() override
Computes the strain_yy for axisymmetric problems.
std::vector< const VariableValue * > _scalar_out_of_plane_strain
The out-of-plane strain scalar variables.
const VariableValue & coupledScalarValue(const std::string &var_name, unsigned int comp=0) const
registerMooseObject("SolidMechanicsApp", ComputeAxisymmetric1DSmallStrain)
void initialSetup() override
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int coupledScalarComponents(const std::string &var_name) const
static InputParameters validParams()
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
Compute1DSmallStrain defines a strain tensor, assuming small strains, in 1D problems, handling strains in other two directions.
ComputeAxisymmetric1DSmallStrain defines small strains in an Axisymmetric 1D problem.