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