https://mooseframework.inl.gov
CZMRealVectorScalar.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 
10 #include "CZMRealVectorScalar.h"
11 #include "CohesiveZoneModelTools.h"
12 
13 registerMooseObject("SolidMechanicsApp", CZMRealVectorScalar);
14 
17 {
19  params.addClassDescription("Compute the normal or tangent component of a vector quantity defined "
20  "on a cohesive interface.");
21  params.addRequiredParam<std::string>("real_vector_value", "The vector material name");
22  params.addRequiredParam<MaterialPropertyName>(
23  "property_name", "Name of the material property computed by this model");
24  MooseEnum directionType("Normal Tangent");
25  params.addRequiredParam<MooseEnum>("direction", directionType, "the direction: Normal, Tangent");
26  params.addParam<std::string>("base_name", "Material property base name");
27  return params;
28 }
29 
31  : InterfaceMaterial(parameters),
32  _base_name(isParamValid("base_name") && !getParam<std::string>("base_name").empty()
33  ? getParam<std::string>("base_name") + "_"
34  : ""),
35  _direction(getParam<MooseEnum>("direction").getEnum<DirectionType>()),
36  _property(declarePropertyByName<Real>(getParam<MaterialPropertyName>("property_name"))),
37  _vector(getMaterialPropertyByName<RealVectorValue>(_base_name +
38  getParam<std::string>("real_vector_value"))),
39  _czm_rotation(getMaterialPropertyByName<RankTwoTensor>(_base_name + "czm_total_rotation"))
40 {
41 }
42 
43 void
45 {
46  const RealVectorValue normal = _czm_rotation[_qp] * RealVectorValue(1.0, 0.0, 0.0);
47  switch (_direction)
48  {
50  _property[_qp] =
52  break;
54  _property[_qp] =
56  break;
57  default:
58  mooseError("ScalarType type not recognized");
59  break;
60  }
61 }
DirectionType
scalar options
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
enum CZMRealVectorScalar::DirectionType _direction
This interface material class extract a cartesiona component from a vector materail property defined ...
GenericRealVectorValue< is_ad > computeTangentComponents(const GenericRealVectorValue< is_ad > &normal, const GenericRealVectorValue< is_ad > &vector)
compute the tangent componets of a vector
MaterialProperty< Real > & _property
the property created by this material
void addRequiredParam(const std::string &name, const std::string &doc_string)
GenericRealVectorValue< is_ad > computeNormalComponents(const GenericRealVectorValue< is_ad > &normal, const GenericRealVectorValue< is_ad > &vector)
compute the normal componets of a vector
unsigned int _qp
static InputParameters validParams()
void computeQpProperties() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
CZMRealVectorScalar(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
const MaterialProperty< RealVectorValue > & _vector
the vector material property
registerMooseObject("SolidMechanicsApp", CZMRealVectorScalar)
const MaterialProperty< RankTwoTensor > & _czm_rotation
the material property defining the czm normal