https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
MOOSEToNEML2 Class Referenceabstract

Common interface for inserting gathered MOOSE data into the NEML2 material model. More...

#include <MOOSEToNEML2.h>

Inheritance diagram for MOOSEToNEML2:
[legend]

Public Types

enum  Mode { Mode::VARIABLE, Mode::OLD_VARIABLE, Mode::PARAMETER, Mode::UNDEFINED }
 

Public Member Functions

 MOOSEToNEML2 (const InputParameters &params)
 
void setMode (Mode) const
 Change the mode of operation. More...
 
Mode getMode () const
 Get the current mode of operation. More...
 
virtual void checkMode () const
 Perform error checking after _mode has been set. More...
 
const std::string & NEML2Name () const
 Raw name of the NEML2 variable/parameter. More...
 
const neml2::VariableName & NEML2VariableName () const
 Name of the NEML2 input variable (only meaningful when _mode == VARIABLE) More...
 
const std::string & NEML2ParameterName () const
 Name of the NEML2 parameter (only meaningful when _mode == PARAMETER) More...
 
virtual neml2::Tensor gatheredData () const =0
 Convert data gathered from MOOSE into neml2::Tensor. More...
 
void insertInto (neml2::ValueMap &, std::map< std::string, neml2::Tensor > &) const
 Insert the gathered data into the NEML2 material model. More...
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

Mode _mode
 Whether we should insert into NEML2 input variable or NEML2 model parameter. More...
 
neml2::VariableName _neml2_variable
 NEML2 input variable to transfer data to. More...
 
std::string _neml2_parameter
 NEML2 parameter to transfer data to. More...
 

Private Attributes

const std::string _raw_name
 Raw name of the input variable or model parameter. More...
 

Detailed Description

Common interface for inserting gathered MOOSE data into the NEML2 material model.

This interface handles the insertion into both NEML2 input variable and NEML2 model parameter.

Users are only required to provide the name of the variable/parameter, and we perform a run-time introspection of the NEML2 model to determine if the supplied name is for a NEML2 variable or for a NEML2 model parameter.

Definition at line 28 of file MOOSEToNEML2.h.

Member Enumeration Documentation

◆ Mode

enum MOOSEToNEML2::Mode
strong
Enumerator
VARIABLE 
OLD_VARIABLE 
PARAMETER 
UNDEFINED 

Definition at line 36 of file MOOSEToNEML2.h.

37  {
38  VARIABLE,
39  OLD_VARIABLE,
40  PARAMETER,
41  UNDEFINED
42  };

Constructor & Destructor Documentation

◆ MOOSEToNEML2()

MOOSEToNEML2::MOOSEToNEML2 ( const InputParameters params)

Definition at line 23 of file MOOSEToNEML2.C.

23 {}

Member Function Documentation

◆ checkMode()

void MOOSEToNEML2::checkMode ( ) const
virtual

Perform error checking after _mode has been set.

Definition at line 49 of file MOOSEToNEML2.C.

Referenced by setMode().

50 {
51  if (_mode == Mode::VARIABLE)
55 }
neml2::VariableName _neml2_variable
NEML2 input variable to transfer data to.
Definition: MOOSEToNEML2.h:79
void assertOldVariable(const neml2::VariableName &)
Assert that the NEML2 variable name sits on either the old_forces or the old_state subaxis...
Definition: NEML2Utils.C:39
Mode _mode
Whether we should insert into NEML2 input variable or NEML2 model parameter.
Definition: MOOSEToNEML2.h:76
void assertVariable(const neml2::VariableName &)
Assert that the NEML2 variable name sits on either the forces or the state subaxis.
Definition: NEML2Utils.C:29

◆ gatheredData()

virtual neml2::Tensor MOOSEToNEML2::gatheredData ( ) const
pure virtual

Convert data gathered from MOOSE into neml2::Tensor.

Implemented in MOOSEToNEML2Batched< T >, MOOSEToNEML2Batched< Real >, and MOOSEPostprocessorToNEML2Templ< state >.

Referenced by insertInto().

◆ getMode()

Mode MOOSEToNEML2::getMode ( ) const
inline

Get the current mode of operation.

Definition at line 54 of file MOOSEToNEML2.h.

54 { return _mode; }
Mode _mode
Whether we should insert into NEML2 input variable or NEML2 model parameter.
Definition: MOOSEToNEML2.h:76

◆ insertInto()

void MOOSEToNEML2::insertInto ( neml2::ValueMap &  input,
std::map< std::string, neml2::Tensor > &  params 
) const

Insert the gathered data into the NEML2 material model.

Definition at line 73 of file MOOSEToNEML2.C.

75 {
77  input[_neml2_variable] = gatheredData();
78  else if (_mode == Mode::PARAMETER)
79  params[_neml2_parameter] = gatheredData();
80  else
81  mooseError("Encountered invalid Mode in MOOSEToNEML2::insertInto");
82 }
neml2::VariableName _neml2_variable
NEML2 input variable to transfer data to.
Definition: MOOSEToNEML2.h:79
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Mode _mode
Whether we should insert into NEML2 input variable or NEML2 model parameter.
Definition: MOOSEToNEML2.h:76
virtual neml2::Tensor gatheredData() const =0
Convert data gathered from MOOSE into neml2::Tensor.
std::string _neml2_parameter
NEML2 parameter to transfer data to.
Definition: MOOSEToNEML2.h:82

◆ NEML2Name()

const std::string& MOOSEToNEML2::NEML2Name ( ) const
inline

Raw name of the NEML2 variable/parameter.

Definition at line 60 of file MOOSEToNEML2.h.

60 { return _raw_name; }
const std::string _raw_name
Raw name of the input variable or model parameter.
Definition: MOOSEToNEML2.h:86

◆ NEML2ParameterName()

const std::string & MOOSEToNEML2::NEML2ParameterName ( ) const

Name of the NEML2 parameter (only meaningful when _mode == PARAMETER)

Definition at line 66 of file MOOSEToNEML2.C.

67 {
68  mooseAssert(_mode == Mode::PARAMETER, "Mode must be PARAMETER when calling NEML2Parameter");
69  return _neml2_parameter;
70 }
Mode _mode
Whether we should insert into NEML2 input variable or NEML2 model parameter.
Definition: MOOSEToNEML2.h:76
std::string _neml2_parameter
NEML2 parameter to transfer data to.
Definition: MOOSEToNEML2.h:82

◆ NEML2VariableName()

const neml2::VariableName & MOOSEToNEML2::NEML2VariableName ( ) const

Name of the NEML2 input variable (only meaningful when _mode == VARIABLE)

Definition at line 58 of file MOOSEToNEML2.C.

59 {
60  mooseAssert(_mode == Mode::VARIABLE || _mode == Mode::OLD_VARIABLE,
61  "Mode must be VARIABLE or OLD_VARIABLE when calling NEML2Variable");
62  return _neml2_variable;
63 }
neml2::VariableName _neml2_variable
NEML2 input variable to transfer data to.
Definition: MOOSEToNEML2.h:79
Mode _mode
Whether we should insert into NEML2 input variable or NEML2 model parameter.
Definition: MOOSEToNEML2.h:76

◆ setMode()

void MOOSEToNEML2::setMode ( MOOSEToNEML2::Mode  m) const

Change the mode of operation.

The NEML2ModelExecutor user object performs run-time introspection of the NEML2 model to determine if the supplied name is for a NEML2 variable or for a NEML2 model parameter. It then uses this method to change the mode of operation of the MOOSEToNEML2 gatherer.

Definition at line 34 of file MOOSEToNEML2.C.

35 {
36  _mode = m;
37 
40  else if (_mode == Mode::PARAMETER)
42  else
43  mooseError("Encountered invalid Mode in MOOSEToNEML2::setMode");
44 
45  checkMode();
46 }
neml2::VariableName _neml2_variable
NEML2 input variable to transfer data to.
Definition: MOOSEToNEML2.h:79
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Mode _mode
Whether we should insert into NEML2 input variable or NEML2 model parameter.
Definition: MOOSEToNEML2.h:76
virtual void checkMode() const
Perform error checking after _mode has been set.
Definition: MOOSEToNEML2.C:49
std::string _neml2_parameter
NEML2 parameter to transfer data to.
Definition: MOOSEToNEML2.h:82
neml2::VariableName parseVariableName(const std::string &)
Parse a raw string into NEML2 variable name.
Definition: NEML2Utils.C:49
const std::string _raw_name
Raw name of the input variable or model parameter.
Definition: MOOSEToNEML2.h:86

◆ validParams()

InputParameters MOOSEToNEML2::validParams ( )
static

Definition at line 13 of file MOOSEToNEML2.C.

Referenced by MOOSEToNEML2Unbatched::validParams(), and MOOSEToNEML2Batched< Real >::validParams().

14 {
15  auto params = emptyInputParameters();
16  params.addRequiredParam<std::string>(
17  "to_neml2", NEML2Utils::docstring("Name of the NEML2 variable or parameter to write to"));
18  return params;
19 }
InputParameters emptyInputParameters()
std::string docstring(const std::string &desc)
Augment docstring if NEML2 is not enabled.
Definition: NEML2Utils.C:77

Member Data Documentation

◆ _mode

Mode MOOSEToNEML2::_mode
mutableprotected

Whether we should insert into NEML2 input variable or NEML2 model parameter.

Definition at line 76 of file MOOSEToNEML2.h.

Referenced by checkMode(), getMode(), insertInto(), NEML2ParameterName(), NEML2VariableName(), and setMode().

◆ _neml2_parameter

std::string MOOSEToNEML2::_neml2_parameter
mutableprotected

NEML2 parameter to transfer data to.

Definition at line 82 of file MOOSEToNEML2.h.

Referenced by insertInto(), NEML2ParameterName(), and setMode().

◆ _neml2_variable

neml2::VariableName MOOSEToNEML2::_neml2_variable
mutableprotected

NEML2 input variable to transfer data to.

Definition at line 79 of file MOOSEToNEML2.h.

Referenced by checkMode(), insertInto(), NEML2VariableName(), and setMode().

◆ _raw_name

const std::string MOOSEToNEML2::_raw_name
private

Raw name of the input variable or model parameter.

Definition at line 86 of file MOOSEToNEML2.h.

Referenced by NEML2Name(), and setMode().


The documentation for this class was generated from the following files: