https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CZMComputeDisplacementJumpBase.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
12
13template <bool is_ad>
16{
18 params.addClassDescription("Base class used to compute the displacement jump across a czm "
19 "interface in local coordinates");
20 params.addRequiredCoupledVar("displacements",
21 "The string of displacements suitable for the problem statement");
22 params.suppressParameter<bool>("use_displaced_mesh");
23 params.addParam<std::string>("base_name", "Material property base name");
24
25 return params;
26}
27
28template <bool is_ad>
30 const InputParameters & parameters)
31 : InterfaceMaterial(parameters),
32 _base_name(isParamValid("base_name") && !getParam<std::string>("base_name").empty()
33 ? getParam<std::string>("base_name") + "_"
34 : ""),
35 _ndisp(coupledComponents("displacements")),
36 _disp(3),
37 _disp_neighbor(3),
38 _displacement_jump_global(declareGenericPropertyByName<RealVectorValue, is_ad>(
39 _base_name + "displacement_jump_global")),
40 _interface_displacement_jump(declareGenericPropertyByName<RealVectorValue, is_ad>(
41 _base_name + "interface_displacement_jump")),
42 _czm_total_rotation(
43 declareGenericPropertyByName<RankTwoTensor, is_ad>(_base_name + "czm_total_rotation"))
44{
45 // Enforce consistency
46 if (_ndisp != _mesh.dimension())
47 paramError("displacements", "Number of displacements must match problem dimension.");
48
49 if (_ndisp > 3 || _ndisp < 1)
50 mooseError("the CZM material requires 1, 2 or 3 displacement variables");
51
52 // initializing the displacement vectors
53 for (unsigned int i = 0; i < _ndisp; ++i)
54 {
55 _disp[i] = &coupledGenericValue<is_ad>("displacements", i);
56 _disp_neighbor[i] = &coupledGenericNeighborValue<is_ad>("displacements", i);
57 }
58
59 // All others zero (so this will work naturally for 2D and 1D problems)
60 for (unsigned int i = _ndisp; i < 3; i++)
61 {
62 if constexpr (is_ad)
63 {
64 _disp[i] = &_ad_zero;
66 }
67 else
68 {
69 _disp[i] = &_zero;
71 }
72 }
73}
74
75template <bool is_ad>
76void
78{
79 // requried to promote _interface_displacement_jump to stateful in case someone needs it
80 _interface_displacement_jump[_qp] = 0;
81}
82
83template <bool is_ad>
84void
86{
87 // computing the displacement jump
88 for (unsigned int i = 0; i < _ndisp; i++)
89 _displacement_jump_global[_qp](i) = (*_disp_neighbor[i])[_qp] - (*_disp[i])[_qp];
90 for (unsigned int i = _ndisp; i < 3; i++)
91 _displacement_jump_global[_qp](i) = 0;
92
93 computeRotationMatrices();
94 computeLocalDisplacementJump();
95}
96
97template <bool is_ad>
98void
100{
101 _czm_total_rotation[_qp] =
102 CohesiveZoneModelTools::computeReferenceRotation<is_ad>(_normals[_qp], _mesh.dimension());
103}
104
This interface material class computes the displacement jump in the interface natural coordinate syst...
std::vector< const GenericVariableValue< is_ad > * > _disp_neighbor
virtual void computeRotationMatrices()
method computing the required rotation matrices
const unsigned int _ndisp
number of displacement components
CZMComputeDisplacementJumpBase(const InputParameters &parameters)
std::vector< const GenericVariableValue< is_ad > * > _disp
the coupled displacement and neighbor displacement values
const VariableValue & _zero
const MooseArray< ADReal > & _ad_zero
void suppressParameter(const std::string &name)
void addRequiredCoupledVar(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)
static InputParameters validParams()
MooseMesh & _mesh
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
virtual unsigned int dimension() const