https://mooseframework.inl.gov
NEML2ActionCommon.C
Go to the documentation of this file.
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 "NEML2ActionCommon.h"
11 #include "NEML2Action.h"
12 #include "NEML2Utils.h"
13 #include "NEML2ModelExecutor.h"
14 
15 registerMooseAction("MooseApp", NEML2ActionCommon, "parse_neml2");
16 
19 {
22 
23  MultiMooseEnum moose_types("TIME SCALAR FUNCTION VARIABLE MATERIAL");
24 
25  // Inputs
26  params.addParam<MultiMooseEnum>(
27  "input_types", moose_types, "Type of each MOOSE data to be used as NEML2 input variable");
28  params.addParam<std::vector<std::string>>(
29  "inputs", {}, "List of NEML2 input variables corresponding to each MOOSE data.");
30  params.addParam<std::vector<std::string>>(
31  "input_kernels",
32  {},
33  "NEML2 kernels defined in MOOSE that provides input data. The object name must match the "
34  "input variable name.");
35 
36  // Model parameters
37  params.addParam<MultiMooseEnum>("parameter_types",
38  moose_types,
39  "Type of each MOOSE data to be used as NEML2 model parameter");
40  params.addParam<std::vector<std::string>>(
41  "parameters", {}, "List of NEML2 model parameters corresponding to each MOOSE data.");
42 
43  // Output
44  params.addParam<bool>("auto_output",
45  true,
46  "Whether to automatically retrieve all NEML2 output variables as MOOSE "
47  "material properties.");
48 
49  // Derivatives
50  params.addParam<std::vector<std::vector<std::string>>>(
51  "derivatives",
52  {},
53  "List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the "
54  "second in the pair).");
55 
56  // Parameter derivatives
57  params.addParam<std::vector<std::vector<std::string>>>(
58  "parameter_derivatives",
59  {},
60  "List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the "
61  "second in the pair).");
62 
63  // Error checking, logging, etc
64  params.addParam<std::vector<std::string>>(
65  "skip_input_variables",
66  {},
67  "List of NEML2 variables to skip when setting up the model input. If an input variable is "
68  "skipped, its value will stay zero. If a required input variable is skipped, an error "
69  "will be raised.");
70  params.addParam<bool>("verbose",
71  true,
72  "Whether to print additional information about the NEML2 model at the "
73  "beginning of the simulation");
74 
75  params.addParam<std::vector<MaterialPropertyName>>(
76  "initialize_outputs",
77  {},
78  "List of MOOSE material properties to be initialized. Each these properties must correspond "
79  "to a stateful NEML2 variable (which appears on both the input old state sub-axis and the "
80  "output state sub-axis). These MOOSE material properties will be initialized with the values "
81  "of properties specified in the initialize_output_values list.");
82  params.addParam<std::vector<MaterialPropertyName>>(
83  "initialize_output_values",
84  {},
85  "List of MOOSE material properties whose initial values (evaluated at the 0th time step) "
86  "will be used to initialize stateful properties. See the description of initialize_outputs "
87  "for more details.");
88 
89  params.addParam<std::vector<MaterialPropertyName>>(
90  "export_outputs",
91  {},
92  "List of MOOSE material properties to export which correspond to NEML2 output variables or "
93  "output derivatives. Each material property's export targets can be specified by "
94  "export_output_targets. The default export target is 'none'.");
95  params.addParam<std::vector<std::vector<OutputName>>>(
96  "export_output_targets",
97  {},
98  "The export targets corresponding to each MOOSE material property specified in "
99  "export_outputs.");
100 
101  return params;
102 }
103 
106 {
107  auto params = NEML2ActionCommon::commonParams();
108  params.addClassDescription("Parse a NEML2 input file");
109  return params;
110 }
111 
113 {
115 }
static InputParameters validParams()
static InputParameters validParams()
Parameters that can ONLY be specified under the common area.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Input parameters common to all block-restricted NEML2Actions.
Base class for actions.
Definition: Action.h:34
registerMooseAction("MooseApp", NEML2ActionCommon, "parse_neml2")
static InputParameters actionParams()
Parameters that can be specified under the NEML2Action common area.
void assertNEML2Enabled()
Assert that NEML2 is enabled.
Definition: NEML2Utils.C:81
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
NEML2ActionCommon(const InputParameters &)
static InputParameters commonParams()
Parameters that can be specified EITHER under the common area OR under sub-blocks.