13 #define registerNEML2ToMOOSEMaterialProperty(alias) \ 14 registerMooseObject("MooseApp", NEML2ToMOOSE##alias##MaterialProperty) 28 params.addClassDescription(
30 "material property of type " +
33 params.addRequiredParam<UserObjectName>(
36 params.addRequiredParam<MaterialPropertyName>(
39 "MOOSE material property used to store the NEML2 output variable (or its derivative)"));
40 params.addRequiredParam<std::string>(
"from_neml2",
42 params.addParam<std::string>(
43 "neml2_input_derivative",
45 "If supplied return the derivative of the NEML2 output variable with respect to this"));
46 params.addParam<std::string>(
47 "neml2_parameter_derivative",
49 "If supplied return the derivative of neml2_variable with respect to this"));
53 params.addParam<MaterialPropertyName>(
54 "moose_material_property_init",
66 _prop(declareProperty<T>(getParam<MaterialPropertyName>(
"to_moose"))),
67 _prop0(isParamValid(
"moose_material_property_init")
68 ? &getMaterialProperty<T>(
"moose_material_property_init")
71 !isParamValid(
"neml2_input_derivative")
72 ? (!isParamValid(
"neml2_parameter_derivative")
73 ? _execute_neml2_model.getOutput(
75 : _execute_neml2_model.getOutputParameterDerivative(
77 getParam<
std::string>(
"neml2_parameter_derivative")))
78 : _execute_neml2_model.getOutputDerivative(
93 if (_t_step == 0 && _prop0)
95 _prop.set() = _prop0->get();
99 if (!_execute_neml2_model.outputReady())
103 const auto i = _execute_neml2_model.getBatchIndex(_current_elem->id());
104 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
109 #define instantiateNEML2ToMOOSEMaterialProperty(T) template class NEML2ToMOOSEMaterialProperty<T> std::string name(const ElemQuality q)
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
static InputParameters validParams()
void computeProperties() override
Performs the quadrature point loop, calling computeQpProperties.
NEML2ToMOOSEMaterialProperty(const InputParameters ¶ms)
instantiateNEML2ToMOOSEMaterialProperty(Real)
static InputParameters validParams()
SymmetricRankTwoTensorTempl is designed to handle the Stress or Strain Tensor for an anisotropic mate...
void copyTensorToMOOSEData(const at::Tensor &src, T &dest)
Directly copy a contiguous chunk of memory of a at::Tensor to a MOOSE data of type T...
std::string docstring(const std::string &desc)
Augment docstring if NEML2 is not enabled.
std::string demangle(const char *name)
Materials compute MaterialProperties.
void assertNEML2Enabled()
Assert that NEML2 is enabled.
NEML2ModelExecutor executes a NEML2 model.
registerNEML2ToMOOSEMaterialProperty(Real)
RankTwoTensorTempl is designed to handle the Stress or Strain Tensor for a fully anisotropic material...
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
neml2::VariableName parseVariableName(const std::string &)
Parse a raw string into NEML2 variable name.