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 "CauchyStressFromNEML2Receiver.h" 11 : #include "NEML2Utils.h" 12 : 13 : registerMooseObject("TensorMechanicsApp", CauchyStressFromNEML2Receiver); 14 : 15 : InputParameters 16 0 : CauchyStressFromNEML2Receiver::validParams() 17 : { 18 0 : InputParameters params = ComputeLagrangianObjectiveStress::validParams(); 19 0 : NEML2Utils::addClassDescription( 20 : params, 21 : "Retrieve the batched output vector from a NEML2 material model and use the output variables " 22 : "to perform the objective stress integration"); 23 0 : params.addRequiredParam<UserObjectName>( 24 : "neml2_uo", "The NEML2 user object that performs the batched computation"); 25 0 : return params; 26 0 : } 27 : 28 : #ifndef NEML2_ENABLED 29 : 30 0 : CauchyStressFromNEML2Receiver::CauchyStressFromNEML2Receiver(const InputParameters & parameters) 31 0 : : ComputeLagrangianObjectiveStress(parameters) 32 : { 33 0 : NEML2Utils::libraryNotEnabledError(parameters); 34 0 : } 35 : 36 : #else 37 : 38 : CauchyStressFromNEML2Receiver::CauchyStressFromNEML2Receiver(const InputParameters & parameters) 39 : : ComputeLagrangianObjectiveStress(parameters), 40 : _neml2_uo(getUserObject<CauchyStressFromNEML2UO>("neml2_uo")), 41 : _output(_neml2_uo.getOutputData()) 42 : { 43 : } 44 : 45 : void 46 : CauchyStressFromNEML2Receiver::computeQpSmallStress() 47 : { 48 : if (!_neml2_uo.outputReady()) 49 : return; 50 : 51 : const auto index = _neml2_uo.getIndex(_current_elem->id()); 52 : _small_stress[_qp] = std::get<0>(_output[index + _qp]); 53 : _small_jacobian[_qp] = std::get<1>(_output[index + _qp]); 54 : } 55 : 56 : #endif // NEML2_ENABLED