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