https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADGeneralizedPlaneStrain.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
12#include "Function.h"
13#include "RankTwoTensor.h"
14
16
19{
21 params.addClassDescription("Assembles the integrated out-of-plane stress to the scalar residual "
22 "for generalized plane strain using automatic differentiation.");
23 params.renameCoupledVar("scalar_variable",
24 "scalar_out_of_plane_strain",
25 "Scalar variable for generalized plane strain");
26 params.makeParamRequired<std::vector<VariableName>>("scalar_out_of_plane_strain");
27 params.addParam<FunctionName>("out_of_plane_pressure_function",
28 "Function used to prescribe pressure (applied toward the body) in "
29 "the out-of-plane direction");
30 params.addParam<MaterialPropertyName>("out_of_plane_pressure_material",
31 "0",
32 "Material used to prescribe pressure (applied toward the "
33 "body) in the out-of-plane direction");
34 MooseEnum out_of_plane_direction("x y z", "z");
35 params.addParam<MooseEnum>(
36 "out_of_plane_direction", out_of_plane_direction, "The direction of the out-of-plane strain");
37 params.addParam<Real>(
38 "pressure_factor",
39 1.0,
40 "Scale factor applied to prescribed out-of-plane pressure (both material and function)");
41 params.addParam<std::string>("base_name", "Material property base name");
42 params.set<bool>("compute_field_residuals") = false;
43 params.suppressParameter<bool>("compute_field_residuals");
44
45 return params;
46}
47
49 : ADKernelScalarBase(parameters),
50 _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
51 _stress(getADMaterialProperty<RankTwoTensor>(_base_name + "stress")),
52 _out_of_plane_pressure_function(parameters.isParamSetByUser("out_of_plane_pressure_function")
53 ? &getFunction("out_of_plane_pressure_function")
54 : nullptr),
55 _out_of_plane_pressure_material(getMaterialProperty<Real>("out_of_plane_pressure_material")),
56 _pressure_factor(getParam<Real>("pressure_factor")),
57 _out_of_plane_direction(getParam<MooseEnum>("out_of_plane_direction"))
58{
59}
60
61void
63{
67 paramError("out_of_plane_direction",
68 "Generalized plane strain supports only Cartesian and axisymmetric coordinate "
69 "systems");
70}
71
77
registerMooseObject("SolidMechanicsApp", ADGeneralizedPlaneStrain)
DualNumber< Real, DNDerivativeType, true > ADReal
Assembles the contributions of the area integral performed over the elements to the residual for the ...
static InputParameters validParams()
ADGeneralizedPlaneStrain(const InputParameters &parameters)
ADReal computeScalarQpResidual() override
const Real _pressure_factor
Factor applied to the out-of-plane pressure.
const ADMaterialProperty< RankTwoTensor > & _stress
The stress tensor.
unsigned int _out_of_plane_direction
Direction of the out-of-plane strain scalar variable.
const MaterialProperty< Real > & _out_of_plane_pressure_material
Material property defining the applied out-of-plane pressure.
const Function *const _out_of_plane_pressure_function
Function defining the applied out-of-plane pressure.
static InputParameters validParams()
Moose::CoordinateSystemType getBlockCoordSystem()
virtual Real value(Real t, const Point &p) const
void suppressParameter(const std::string &name)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void renameCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &new_docstring)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void makeParamRequired(const std::string &name)
unsigned int _qp
const MooseArray< Point > & _q_point
void paramError(const std::string &param, Args... args) const