https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADComputeAxisymmetric1DSmallStrain.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 : ADCompute1DSmallStrain(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 ? adCoupledValue("out_of_plane_strain")
36 : _ad_zero),
37 _has_scalar_out_of_plane_strain(isCoupledScalar("scalar_out_of_plane_strain"))
38{
40 mooseError("Must define only one of out_of_plane_strain or scalar_out_of_plane_strain");
41
43 {
44 const auto nscalar_strains = coupledScalarComponents("scalar_out_of_plane_strain");
45 _scalar_out_of_plane_strain.resize(nscalar_strains);
46 for (unsigned int i = 0; i < nscalar_strains; ++i)
47 _scalar_out_of_plane_strain[i] = &adCoupledScalarValue("scalar_out_of_plane_strain", i);
48 }
49}
50
51void
53{
55
57 mooseError("The coordinate system must be set to RZ for Axisymmetric geometries.");
58}
59
60unsigned int
65
74
77{
78 if (!MooseUtils::absoluteFuzzyEqual(_q_point[_qp](0), 0.0))
79 return (*_disp[0])[_qp] / _q_point[_qp](0);
80 else
81 return 0.0;
82}
registerMooseObject("SolidMechanicsApp", ADComputeAxisymmetric1DSmallStrain)
DualNumber< Real, DNDerivativeType, true > ADReal
ADCompute1DSmallStrain defines a strain tensor, assuming small strains, in 1D problems,...
static InputParameters validParams()
ADComputeAxisymmetric1DSmallStrain defines small strains in an Axisymmetric 1D problem.
std::vector< const ADVariableValue * > _scalar_out_of_plane_strain
The out-of-plane strain scalar variables.
const ADVariableValue & _out_of_plane_strain
The out-of-plane strain variable.
const SubblockIndexProvider *const _subblock_id_provider
A UserObject that carries the subblock ID for all elements.
const bool _has_out_of_plane_strain
Whether an out-of-plane strain variable is coupled.
const bool _has_scalar_out_of_plane_strain
Whether out-of-plane strain scalar variables are coupled.
unsigned int getCurrentSubblockIndex() const
Gets the subblock index for the current element.
ADReal computeStrainYY() override
Computes the strain_yy for axisymmetric problems.
ADComputeAxisymmetric1DSmallStrain(const InputParameters &parameters)
ADReal computeStrainZZ() override
Computes the strain_zz for axisymmetric problems, where .
std::vector< const ADVariableValue * > _disp
Displacement variables.
Moose::CoordinateSystemType getBlockCoordSystem()
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)
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _qp
const Elem *const & _current_elem
const MooseArray< Point > & _q_point
void mooseError(Args &&... args) const
unsigned int coupledScalarComponents(const std::string &var_name) const
const ADVariableValue & adCoupledScalarValue(const std::string &var_name, unsigned int comp=0) const
Abstract base class for user objects that provide an index for a given element that is independent of...
virtual unsigned int getSubblockIndex(const Elem &) const =0
The index of subblock this element is on.