Line data Source code
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 : 15 : InputParameters 16 1064 : CZMRealVectorScalar::validParams() 17 : { 18 1064 : InputParameters params = InterfaceMaterial::validParams(); 19 1064 : params.addClassDescription("Compute the normal or tangent component of a vector quantity defined " 20 : "on a cohesive interface."); 21 2128 : params.addRequiredParam<std::string>("real_vector_value", "The vector material name"); 22 2128 : params.addRequiredParam<MaterialPropertyName>( 23 : "property_name", "Name of the material property computed by this model"); 24 2128 : MooseEnum directionType("Normal Tangent"); 25 2128 : params.addRequiredParam<MooseEnum>("direction", directionType, "the direction: Normal, Tangent"); 26 2128 : params.addParam<std::string>("base_name", "Material property base name"); 27 1064 : return params; 28 1064 : } 29 : 30 532 : CZMRealVectorScalar::CZMRealVectorScalar(const InputParameters & parameters) 31 : : InterfaceMaterial(parameters), 32 1764 : _base_name(isParamValid("base_name") && !getParam<std::string>("base_name").empty() 33 532 : ? getParam<std::string>("base_name") + "_" 34 : : ""), 35 1064 : _direction(getParam<MooseEnum>("direction").getEnum<DirectionType>()), 36 1064 : _property(declarePropertyByName<Real>(getParam<MaterialPropertyName>("property_name"))), 37 1596 : _vector(getMaterialPropertyByName<RealVectorValue>(_base_name + 38 : getParam<std::string>("real_vector_value"))), 39 1596 : _czm_rotation(getMaterialPropertyByName<RankTwoTensor>(_base_name + "czm_total_rotation")) 40 : { 41 532 : } 42 : 43 : void 44 233920 : CZMRealVectorScalar::computeQpProperties() 45 : { 46 233920 : const RealVectorValue normal = _czm_rotation[_qp] * RealVectorValue(1.0, 0.0, 0.0); 47 233920 : switch (_direction) 48 : { 49 116960 : case DirectionType::Normal: 50 116960 : _property[_qp] = 51 116960 : CohesiveZoneModelTools::computeNormalComponents(normal, _vector[_qp]) * normal; 52 116960 : break; 53 116960 : case DirectionType::Tangent: 54 116960 : _property[_qp] = 55 116960 : CohesiveZoneModelTools::computeTangentComponents(normal, _vector[_qp]).norm(); 56 116960 : break; 57 0 : default: 58 0 : mooseError("ScalarType type not recognized"); 59 : break; 60 : } 61 233920 : }