- active__all__ If specified only the blocks named will be visited and made active
Default:__all__
C++ Type:std::vector<std::string>
Controllable:No
Description:If specified only the blocks named will be visited and made active
- async_dispatchTrueWhether to use asynchronous dispatch.
Default:True
C++ Type:bool
Controllable:No
Description:Whether to use asynchronous dispatch.
- auto_outputTrueWhether to automatically retrieve all NEML2 output variables as MOOSE material properties.
Default:True
C++ Type:bool
Controllable:No
Description:Whether to automatically retrieve all NEML2 output variables as MOOSE material properties.
- cli_argsAdditional command line arguments to use when parsing the NEML2 input file.
C++ Type:std::vector<std::string>
Controllable:No
Description:Additional command line arguments to use when parsing the NEML2 input file.
- debug_inputs_on_failureFalseWhen a NEML2 solve fails, append a detailed dump of input tensors (defined/missing, shapes, and devices) to the error message.
Default:False
C++ Type:bool
Controllable:No
Description:When a NEML2 solve fails, append a detailed dump of input tensors (defined/missing, shapes, and devices) to the error message.
- derivativesList of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
C++ Type:std::vector<std::vector<std::string>>
Controllable:No
Description:List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
- deviceDevice on which to evaluate the NEML2 model. The string supplied must follow the following schema: (cpu|cuda)[:
] where cpu or cuda specifies the device type, and : optionally specifies a device index. For example, device='cpu' sets the target compute device to be CPU, and device='cuda:1' sets the target compute device to be CUDA with device ID 1. If not specified, default to the compute device specified via the command line argument --compute-device. C++ Type:std::string
Controllable:No
Description:Device on which to evaluate the NEML2 model. The string supplied must follow the following schema: (cpu|cuda)[:
] where cpu or cuda specifies the device type, and : optionally specifies a device index. For example, device='cpu' sets the target compute device to be CPU, and device='cuda:1' sets the target compute device to be CUDA with device ID 1. If not specified, default to the compute device specified via the command line argument --compute-device. - export_output_targetsThe export targets corresponding to each MOOSE material property specified in export_outputs.
C++ Type:std::vector<std::vector<OutputName>>
Controllable:No
Description:The export targets corresponding to each MOOSE material property specified in export_outputs.
- export_outputsList of MOOSE material properties to export which correspond to NEML2 output variables or output derivatives. Each material property's export targets can be specified by export_output_targets. The default export target is 'none'.
C++ Type:std::vector<MaterialPropertyName>
Unit:(no unit assumed)
Controllable:No
Description:List of MOOSE material properties to export which correspond to NEML2 output variables or output derivatives. Each material property's export targets can be specified by export_output_targets. The default export target is 'none'.
- inactiveIf specified blocks matching these identifiers will be skipped.
C++ Type:std::vector<std::string>
Controllable:No
Description:If specified blocks matching these identifiers will be skipped.
- initialize_output_valuesList of MOOSE material properties whose initial values (evaluated at the 0th time step) will be used to initialize stateful properties. See the description of initialize_outputs for more details.
C++ Type:std::vector<MaterialPropertyName>
Unit:(no unit assumed)
Controllable:No
Description:List of MOOSE material properties whose initial values (evaluated at the 0th time step) will be used to initialize stateful properties. See the description of initialize_outputs for more details.
- initialize_outputsList of MOOSE material properties to be initialized. Each these properties must correspond to a stateful NEML2 variable (which appears on both the input old state sub-axis and the output state sub-axis). These MOOSE material properties will be initialized with the values of properties specified in the initialize_output_values list.
C++ Type:std::vector<MaterialPropertyName>
Unit:(no unit assumed)
Controllable:No
Description:List of MOOSE material properties to be initialized. Each these properties must correspond to a stateful NEML2 variable (which appears on both the input old state sub-axis and the output state sub-axis). These MOOSE material properties will be initialized with the values of properties specified in the initialize_output_values list.
- inputPath to the NEML2 input file containing the NEML2 model(s).
C++ Type:DataFileName
Controllable:No
Description:Path to the NEML2 input file containing the NEML2 model(s).
- input_kernelsNEML2 kernels defined in MOOSE that provides input data. The object name must match the input variable name.
C++ Type:std::vector<std::string>
Controllable:No
Description:NEML2 kernels defined in MOOSE that provides input data. The object name must match the input variable name.
- input_typesType of each MOOSE data to be used as NEML2 input variable
C++ Type:MultiMooseEnum
Controllable:No
Description:Type of each MOOSE data to be used as NEML2 input variable
- inputsList of NEML2 input variables corresponding to each MOOSE data.
C++ Type:std::vector<std::string>
Controllable:No
Description:List of NEML2 input variables corresponding to each MOOSE data.
- manage_state_advanceFalseKeep state and forces on the device and advance it to old_state and old_forces without a roundtrip through MOOSE materials. This is only recommended for explicit time integration or when absolutely no restepping occurs (e.g. failed timesteps).
Default:False
C++ Type:bool
Controllable:No
Description:Keep state and forces on the device and advance it to old_state and old_forces without a roundtrip through MOOSE materials. This is only recommended for explicit time integration or when absolutely no restepping occurs (e.g. failed timesteps).
- modelName of the NEML2 model, i.e., the string inside the brackets [] in the NEML2 input file that corresponds to the model you want to use.
C++ Type:std::string
Controllable:No
Description:Name of the NEML2 model, i.e., the string inside the brackets [] in the NEML2 input file that corresponds to the model you want to use.
- output_deviceSimilar to the 'device' parameter, this parameter specifies the device on which to store the outputs. Default to be the same as 'device'.
C++ Type:std::string
Controllable:No
Description:Similar to the 'device' parameter, this parameter specifies the device on which to store the outputs. Default to be the same as 'device'.
- parameter_derivativesList of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
C++ Type:std::vector<std::vector<std::string>>
Controllable:No
Description:List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
- parameter_typesType of each MOOSE data to be used as NEML2 model parameter
C++ Type:MultiMooseEnum
Controllable:No
Description:Type of each MOOSE data to be used as NEML2 model parameter
- parametersList of NEML2 model parameters corresponding to each MOOSE data.
C++ Type:std::vector<std::string>
Controllable:No
Description:List of NEML2 model parameters corresponding to each MOOSE data.
- schedulerNEML2 scheduler to use to run the model. If not specified no scheduler is used and MOOSE will pass all the constitutive updates to the provided device at once.
C++ Type:std::string
Controllable:No
Description:NEML2 scheduler to use to run the model. If not specified no scheduler is used and MOOSE will pass all the constitutive updates to the provided device at once.
- skip_input_variablesList of NEML2 variables to skip when setting up the model input. If an input variable is skipped, its value will stay zero. If a required input variable is skipped, an error will be raised.
C++ Type:std::vector<std::string>
Controllable:No
Description:List of NEML2 variables to skip when setting up the model input. If an input variable is skipped, its value will stay zero. If a required input variable is skipped, an error will be raised.
- verboseTrueWhether to print additional information about the NEML2 model at the beginning of the simulation
Default:True
C++ Type:bool
Controllable:No
Description:Whether to print additional information about the NEML2 model at the beginning of the simulation
NEML2 syntax
The [NEML2] block in the MOOSE input file is the entry point for defining NEML2 material model(s). All parameters are listed at the bottom of the page.
This page is user-facing, i.e., the Input file syntax section explains how to write the MOOSE input file in order to connect MOOSE to NEML2 for material modeling. For developers, please refer to the NEML2Action and NEML2ActionCommon pages regarding what objects are constructed by the underlying Action.
Input File Syntax
The basic structure of the [NEML2] block is shown below.
[NEML2<<<{"href": "index.html"}>>>]
input<<<{"description": "Path to the NEML2 input file containing the NEML2 model(s)."}>>> = 'models/custom_model.i'
[all]
model<<<{"description": "Name of the NEML2 model, i.e., the string inside the brackets [] in the NEML2 input file that corresponds to the model you want to use."}>>> = 'model'
verbose<<<{"description": "Whether to print additional information about the NEML2 model at the beginning of the simulation"}>>> = true
device<<<{"description": "Device on which to evaluate the NEML2 model. The string supplied must follow the following schema: (cpu|cuda)[:<device-index>] where cpu or cuda specifies the device type, and :<device-index> optionally specifies a device index. For example, device='cpu' sets the target compute device to be CPU, and device='cuda:1' sets the target compute device to be CUDA with device ID 1. If not specified, default to the compute device specified via the command line argument --compute-device."}>>> = 'cpu'
# request derivatives (must be pairs of two)
# derivative name follow moose convention, e.g., 'doutput/dinput'
derivatives<<<{"description": "List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair)."}>>> = 'product A'
# output to exodus
export_outputs<<<{"description": "List of MOOSE material properties to export which correspond to NEML2 output variables or output derivatives. Each material property's export targets can be specified by export_output_targets. The default export target is 'none'."}>>> = 'sum product dproduct/dA'
export_output_targets<<<{"description": "The export targets corresponding to each MOOSE material property specified in export_outputs."}>>> = 'exodus; exodus; exodus'
[]
[](test/tests/neml2/custom_model.i)The [NEML2] block has two parts:
A common area directly underneath the
[NEML2]block.Nested sub-blocks.
In the above example, there is only one sub-block named [all]. However, there can be as many sub-blocks as appropriate. Most of the parameters specified in the common area are also applied to each sub-block. In the case where a parameter is defined both in the common area and under a sub-block, the parameter defined under the sub-block takes precedence.
Sub-blocks are used to specify multiple NEML2 material models used in the same simulation. The following example demonstrates the use of sub-blocks to specify two NEML2 material models on two different subdomains.
[NEML2<<<{"href": "index.html"}>>>]
input<<<{"description": "Path to the NEML2 input file containing the NEML2 model(s)."}>>> = 'models/custom_model.i'
verbose<<<{"description": "Whether to print additional information about the NEML2 model at the beginning of the simulation"}>>> = true
device<<<{"description": "Device on which to evaluate the NEML2 model. The string supplied must follow the following schema: (cpu|cuda)[:<device-index>] where cpu or cuda specifies the device type, and :<device-index> optionally specifies a device index. For example, device='cpu' sets the target compute device to be CPU, and device='cuda:1' sets the target compute device to be CUDA with device ID 1. If not specified, default to the compute device specified via the command line argument --compute-device."}>>> = 'cpu'
# request derivatives (must be pairs of two)
# derivative name follow moose convention, e.g., 'doutput/dinput'
derivatives<<<{"description": "List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair)."}>>> = 'product A'
# output to exodus
export_outputs<<<{"description": "List of MOOSE material properties to export which correspond to NEML2 output variables or output derivatives. Each material property's export targets can be specified by export_output_targets. The default export target is 'none'."}>>> = 'sum product dproduct/dA'
export_output_targets<<<{"description": "The export targets corresponding to each MOOSE material property specified in export_outputs."}>>> = 'exodus; exodus; exodus'
[A]
model<<<{"description": "Name of the NEML2 model, i.e., the string inside the brackets [] in the NEML2 input file that corresponds to the model you want to use."}>>> = 'model_A'
block<<<{"description": "List of blocks (subdomains) where the material model is defined"}>>> = 'A'
[]
[B]
model<<<{"description": "Name of the NEML2 model, i.e., the string inside the brackets [] in the NEML2 input file that corresponds to the model you want to use."}>>> = 'model_B'
block<<<{"description": "List of blocks (subdomains) where the material model is defined"}>>> = 'B'
[]
[](test/tests/neml2/blocks_different_model.i)In each sub-block, there are a total of 6 groups of parameters that can be specified:
Configuration of the model
Transfer of input variables
Transfer of model parameters
Transfer of output variables
Transfer of derivatives (of output variables w.r.t. input variables)
Transfer of derivatives (of output variables w.r.t. model parameters)
The configuration of model is controlled by parameters such as "model", "verbose", "device", etc., each of which is explained in the syntax documentation at the bottom of the page.
"input_types" is a list of enums denoting the type of the MOOSE data structure used to hold the input variables. The following enums are supported
TIME: Simulation time.SCALAR: The input variables are retrieved from a scalar variable and broadcast to all quadrature points.FUNCTION: The input variables are retrieved from a function evaluated at each quadrature points.VARIABLE: The input variables are retrieved from (auxiliary) variables interpolated at each quadrature point.MATERIAL: The input variables are retrieved from material properties stored at each quadrature point.
All NEML2 input variables are automatically retrieved from the host MOOSE simulation. Quantities with the same name as each input variable are retrieved. An error is raised if ambiguity exists, in which case "input_types" and "inputs" can be used to explicitly specify the type of quantities to be retrieved.
All NEML2 output variables are retrieved and stored as MOOSE material properties after each evaluation, unless "auto_output" is set to false.
For stateful variables, i.e., input variables needing values from previous time steps (usually with suffix ~N with N being the number of steps backward in time), the corresponding MOOSE quantities from previous time steps are automatically retrieved. The advance of stateful variables is managed by the MOOSE native material system, unless "manage_state_advance" is set to true, in which case NEML2 handles the storage and advance of stateful variables. Note that currently manage_state_advance = true is not compatible with mesh change events.
It is worth noting that for "derivatives" and "parameter_derivatives", a pair of names must be specified for each entry. The first name in the pair denotes the quantity (NEML2 output variable) to take derivative of, and the second name in the pair denotes the quantity (NEML2 input variable or model parameter) to take derivative with respect to. Pairs are delimited by ;.
Inspect NEML2 information
The command-line option --parse-neml2-only can be used to inspect the NEML2 material model without running the entire simulation, i.e.
my-app-opt -i input.i --parse-neml2-only
Work scheduling and dispatching
When the number of material updates (i.e., number of quadrature points) gets large, it is ideal to utilize and coordinate work among multiple devices, e.g., CPUs, GPUs, etc. in a heterogeneous computing environment. This can be achieved using NEML2's work schedulers.
NEML2 offers a variety of different work scheduling strategies, the two most commonly used strategies are defined by - SimpleScheduler: Dispatch work to a single device. - StaticHybridScheduler: Coordinate work scheduling and dispatching among multiple devices.
For more information on various types of schedulers and dispatchers, please refer to the NEML2 documentation.
The schedulers are defined in the NEML2 input file, and can be selected using the "scheduler" parameter. On top of that, the boolean parameter "async_dispatch" can be used to control whether work is dispatched asynchronously.
Common parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
Advanced Parameters
Sub-block parameters
- active__all__ If specified only the blocks named will be visited and made active
Default:__all__
C++ Type:std::vector<std::string>
Controllable:No
Description:If specified only the blocks named will be visited and made active
- async_dispatchTrueWhether to use asynchronous dispatch.
Default:True
C++ Type:bool
Controllable:No
Description:Whether to use asynchronous dispatch.
- auto_outputTrueWhether to automatically retrieve all NEML2 output variables as MOOSE material properties.
Default:True
C++ Type:bool
Controllable:No
Description:Whether to automatically retrieve all NEML2 output variables as MOOSE material properties.
- batch_index_generator_nameName of the NEML2BatchIndexGenerator user object. The default name is 'neml2_index_
_ ' where is the NEML2 model's name, and is this action sub-block's name. C++ Type:std::string
Controllable:No
Description:Name of the NEML2BatchIndexGenerator user object. The default name is 'neml2_index_
_ ' where is the NEML2 model's name, and is this action sub-block's name. - blockList of blocks (subdomains) where the material model is defined
C++ Type:std::vector<SubdomainName>
Controllable:No
Description:List of blocks (subdomains) where the material model is defined
- cli_argsAdditional command line arguments to use when parsing the NEML2 input file.
C++ Type:std::vector<std::string>
Controllable:No
Description:Additional command line arguments to use when parsing the NEML2 input file.
- debug_inputs_on_failureFalseWhen a NEML2 solve fails, append a detailed dump of input tensors (defined/missing, shapes, and devices) to the error message.
Default:False
C++ Type:bool
Controllable:No
Description:When a NEML2 solve fails, append a detailed dump of input tensors (defined/missing, shapes, and devices) to the error message.
- derivativesList of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
C++ Type:std::vector<std::vector<std::string>>
Controllable:No
Description:List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
- deviceDevice on which to evaluate the NEML2 model. The string supplied must follow the following schema: (cpu|cuda)[:
] where cpu or cuda specifies the device type, and : optionally specifies a device index. For example, device='cpu' sets the target compute device to be CPU, and device='cuda:1' sets the target compute device to be CUDA with device ID 1. If not specified, default to the compute device specified via the command line argument --compute-device. C++ Type:std::string
Controllable:No
Description:Device on which to evaluate the NEML2 model. The string supplied must follow the following schema: (cpu|cuda)[:
] where cpu or cuda specifies the device type, and : optionally specifies a device index. For example, device='cpu' sets the target compute device to be CPU, and device='cuda:1' sets the target compute device to be CUDA with device ID 1. If not specified, default to the compute device specified via the command line argument --compute-device. - executor_nameName of the NEML2ModelExecutor user object. The default name is 'neml2_
_ ' where is the NEML2 model's name, and is this action sub-block's name. C++ Type:std::string
Controllable:No
Description:Name of the NEML2ModelExecutor user object. The default name is 'neml2_
_ ' where is the NEML2 model's name, and is this action sub-block's name. - export_output_targetsThe export targets corresponding to each MOOSE material property specified in export_outputs.
C++ Type:std::vector<std::vector<OutputName>>
Controllable:No
Description:The export targets corresponding to each MOOSE material property specified in export_outputs.
- export_outputsList of MOOSE material properties to export which correspond to NEML2 output variables or output derivatives. Each material property's export targets can be specified by export_output_targets. The default export target is 'none'.
C++ Type:std::vector<MaterialPropertyName>
Unit:(no unit assumed)
Controllable:No
Description:List of MOOSE material properties to export which correspond to NEML2 output variables or output derivatives. Each material property's export targets can be specified by export_output_targets. The default export target is 'none'.
- inactiveIf specified blocks matching these identifiers will be skipped.
C++ Type:std::vector<std::string>
Controllable:No
Description:If specified blocks matching these identifiers will be skipped.
- initialize_output_valuesList of MOOSE material properties whose initial values (evaluated at the 0th time step) will be used to initialize stateful properties. See the description of initialize_outputs for more details.
C++ Type:std::vector<MaterialPropertyName>
Unit:(no unit assumed)
Controllable:No
Description:List of MOOSE material properties whose initial values (evaluated at the 0th time step) will be used to initialize stateful properties. See the description of initialize_outputs for more details.
- initialize_outputsList of MOOSE material properties to be initialized. Each these properties must correspond to a stateful NEML2 variable (which appears on both the input old state sub-axis and the output state sub-axis). These MOOSE material properties will be initialized with the values of properties specified in the initialize_output_values list.
C++ Type:std::vector<MaterialPropertyName>
Unit:(no unit assumed)
Controllable:No
Description:List of MOOSE material properties to be initialized. Each these properties must correspond to a stateful NEML2 variable (which appears on both the input old state sub-axis and the output state sub-axis). These MOOSE material properties will be initialized with the values of properties specified in the initialize_output_values list.
- inputPath to the NEML2 input file containing the NEML2 model(s).
C++ Type:DataFileName
Controllable:No
Description:Path to the NEML2 input file containing the NEML2 model(s).
- input_kernelsNEML2 kernels defined in MOOSE that provides input data. The object name must match the input variable name.
C++ Type:std::vector<std::string>
Controllable:No
Description:NEML2 kernels defined in MOOSE that provides input data. The object name must match the input variable name.
- input_typesType of each MOOSE data to be used as NEML2 input variable
C++ Type:MultiMooseEnum
Controllable:No
Description:Type of each MOOSE data to be used as NEML2 input variable
- inputsList of NEML2 input variables corresponding to each MOOSE data.
C++ Type:std::vector<std::string>
Controllable:No
Description:List of NEML2 input variables corresponding to each MOOSE data.
- manage_state_advanceFalseKeep state and forces on the device and advance it to old_state and old_forces without a roundtrip through MOOSE materials. This is only recommended for explicit time integration or when absolutely no restepping occurs (e.g. failed timesteps).
Default:False
C++ Type:bool
Controllable:No
Description:Keep state and forces on the device and advance it to old_state and old_forces without a roundtrip through MOOSE materials. This is only recommended for explicit time integration or when absolutely no restepping occurs (e.g. failed timesteps).
- modelName of the NEML2 model, i.e., the string inside the brackets [] in the NEML2 input file that corresponds to the model you want to use.
C++ Type:std::string
Controllable:No
Description:Name of the NEML2 model, i.e., the string inside the brackets [] in the NEML2 input file that corresponds to the model you want to use.
- output_deviceSimilar to the 'device' parameter, this parameter specifies the device on which to store the outputs. Default to be the same as 'device'.
C++ Type:std::string
Controllable:No
Description:Similar to the 'device' parameter, this parameter specifies the device on which to store the outputs. Default to be the same as 'device'.
- parameter_derivativesList of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
C++ Type:std::vector<std::vector<std::string>>
Controllable:No
Description:List of pairs of NEML2 variables to take derivatives (i.e., first in the pair w.r.t. the second in the pair).
- parameter_typesType of each MOOSE data to be used as NEML2 model parameter
C++ Type:MultiMooseEnum
Controllable:No
Description:Type of each MOOSE data to be used as NEML2 model parameter
- parametersList of NEML2 model parameters corresponding to each MOOSE data.
C++ Type:std::vector<std::string>
Controllable:No
Description:List of NEML2 model parameters corresponding to each MOOSE data.
- schedulerNEML2 scheduler to use to run the model. If not specified no scheduler is used and MOOSE will pass all the constitutive updates to the provided device at once.
C++ Type:std::string
Controllable:No
Description:NEML2 scheduler to use to run the model. If not specified no scheduler is used and MOOSE will pass all the constitutive updates to the provided device at once.
- skip_input_variablesList of NEML2 variables to skip when setting up the model input. If an input variable is skipped, its value will stay zero. If a required input variable is skipped, an error will be raised.
C++ Type:std::vector<std::string>
Controllable:No
Description:List of NEML2 variables to skip when setting up the model input. If an input variable is skipped, its value will stay zero. If a required input variable is skipped, an error will be raised.
- verboseTrueWhether to print additional information about the NEML2 model at the beginning of the simulation
Default:True
C++ Type:bool
Controllable:No
Description:Whether to print additional information about the NEML2 model at the beginning of the simulation
Optional Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
The detailed documentation of this object/syntax is only available when MOOSE is compiled with NEML2. To enable NEML2, please follow the NEML2 installation guide.