https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SCZMComputeDisplacementJumpBase.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
13
14template <bool is_ad>
17{
20 "Base class used to compute the shifted displacement jump across a czm "
21 "interface in local coordinates");
22
23 // no shifted testing
24 params.addParam<bool>(
25 "no_shifted",
26 false,
27 "Disable shifted integration corrections to provide a non-shifted baseline for verification "
28 "and comparison.");
29
30 params.addParam<UserObjectName>(
31 "sbm_distance_uo",
32 "UserObject that provides signed distance and normal vector calculations.");
33
34 return params;
35}
36
37template <bool is_ad>
39 const InputParameters & parameters)
40 : CZMComputeDisplacementJumpBase<is_ad>(parameters),
41 _grad_disp(3),
42 _grad_disp_neighbor(3),
43 _shifted(!this->template getParam<bool>("no_shifted")),
44 _sbm_distance_uo(nullptr)
45{
46 for (const auto i : make_range(_ndisp))
47 {
48 _grad_disp[i] = &this->template coupledGenericGradient<is_ad>("displacements", i);
50 &this->template coupledGenericNeighborGradient<is_ad>("displacements", i);
51 }
52
53 for (const auto i : make_range(_ndisp, 3u))
54 if constexpr (is_ad)
55 {
56 _grad_disp[i] = &this->_ad_grad_zero;
58 }
59 else
60 {
61 _grad_disp[i] = &this->_grad_zero;
63 }
64}
65
66template <bool is_ad>
67void
69{
70 if (_shifted)
71 {
72 if (!this->isParamSetByUser("sbm_distance_uo"))
73 mooseError("Please provide 'sbm_distance_uo' when using shifted terms.");
74 _sbm_distance_uo =
75 &this->template getUserObject<BoundaryShortestDistanceToSurface>("sbm_distance_uo");
76 }
77}
78
79template <bool is_ad>
80void
82{
84
85 if (_shifted)
86 {
87 const auto d = _sbm_distance_uo->surrogateDistance(
88 std::make_pair(this->_current_elem->id(), this->_current_side), _qp);
89 for (const auto i : make_range(_ndisp))
90 _displacement_jump_global[_qp](i) +=
91 ((*_grad_disp_neighbor[i])[_qp] - (*_grad_disp[i])[_qp]) * d;
92 }
93}
94
95template <bool is_ad>
96void
98{
99 const auto true_normal =
100 _shifted ? RealVectorValue(_sbm_distance_uo->trueNormal(
101 std::make_pair(this->_current_elem->id(), this->_current_side), _qp))
102 : RealVectorValue(this->_normals[_qp]);
103
104 _czm_total_rotation[_qp] =
105 CohesiveZoneModelTools::computeReferenceRotation<is_ad>(true_normal, _mesh.dimension());
106}
107
void mooseError(Args &&... args)
This interface material class computes the displacement jump in the interface natural coordinate syst...
const unsigned int _ndisp
number of displacement components
virtual void computeGlobalDisplacementJump()
method used to compute the displacement jump in global coordinates
const VariableGradient & _grad_zero
const MooseArray< ADRealVectorValue > & _ad_grad_zero
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)
This interface material class computes the displacement jump in the interface natural coordinate syst...
SCZMComputeDisplacementJumpBase(const InputParameters &parameters)
std::vector< const GenericVariableGradient< is_ad > * > _grad_disp
the coupled displacement gradients
void computeRotationMatrices() override
Computes the rotation using the true-interface normal.
std::vector< const GenericVariableGradient< is_ad > * > _grad_disp_neighbor
void computeGlobalDisplacementJump() override
Computes the jump at the true interface using displacement gradients.