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 : #pragma once 11 : 12 : #include "NEML2Utils.h" 13 : #include "Material.h" 14 : #include "SymmetricRankTwoTensor.h" 15 : #include "SymmetricRankFourTensor.h" 16 : 17 : #ifdef NEML2_ENABLED 18 : #include "neml2/tensors/TensorBase.h" 19 : #endif 20 : 21 : class NEML2ModelExecutor; 22 : 23 : template <typename T> 24 : class NEML2ToMOOSEMaterialProperty : public Material 25 : { 26 : public: 27 : static InputParameters validParams(); 28 : 29 : NEML2ToMOOSEMaterialProperty(const InputParameters & params); 30 : 31 : #ifdef NEML2_ENABLED 32 : void computeProperties() override; 33 : 34 : protected: 35 0 : void initQpStatefulProperties() override {} 36 : 37 : /// User object managing the execution of the NEML2 model 38 : const NEML2ModelExecutor & _execute_neml2_model; 39 : 40 : /// Emitted material property 41 : MaterialProperty<T> & _prop; 42 : 43 : /// Initial condition 44 : const MaterialProperty<T> * _prop0; 45 : 46 : /// Reference to the requested output (or its derivative) value 47 : const neml2::Tensor & _value; 48 : #endif 49 : }; 50 : 51 : #define DefineNEML2ToMOOSEMaterialPropertyAlias(T, alias) \ 52 : using NEML2ToMOOSE##alias##MaterialProperty = NEML2ToMOOSEMaterialProperty<T> 53 : 54 : DefineNEML2ToMOOSEMaterialPropertyAlias(Real, Real); 55 : DefineNEML2ToMOOSEMaterialPropertyAlias(SymmetricRankTwoTensor, SymmetricRankTwoTensor); 56 : DefineNEML2ToMOOSEMaterialPropertyAlias(SymmetricRankFourTensor, SymmetricRankFourTensor); 57 : DefineNEML2ToMOOSEMaterialPropertyAlias(RealVectorValue, RealVectorValue); 58 : DefineNEML2ToMOOSEMaterialPropertyAlias(RankTwoTensor, RankTwoTensor); 59 : DefineNEML2ToMOOSEMaterialPropertyAlias(RankFourTensor, RankFourTensor);