NEML2 1.4.0
|
The driver for a transient initial-value problem. More...
The driver for a transient initial-value problem.
#include <TransientDriver.h>
Public Member Functions | |
TransientDriver (const OptionSet &options) | |
Construct a new TransientDriver object. | |
virtual void | diagnose (std::vector< Diagnosis > &) const override |
Check for common problems. | |
bool | run () override |
Let the driver run, return true upon successful completion, and return false otherwise. | |
const Model & | model () const |
virtual std::string | save_as_path () const |
The destination file/path to save the results. | |
virtual torch::nn::ModuleDict | result () const |
The results (input and output) from all time steps. | |
Public Member Functions inherited from Driver | |
Driver (const OptionSet &options) | |
Construct a new Driver object. | |
Public Member Functions inherited from NEML2Object | |
NEML2Object (const OptionSet &options) | |
Construct a new NEML2Object object. | |
virtual | ~NEML2Object ()=default |
const OptionSet & | input_options () const |
virtual void | setup () |
Setup this object. | |
const std::string & | name () const |
A readonly reference to the object's name. | |
const std::string & | type () const |
A readonly reference to the object's type. | |
const std::string & | path () const |
A readonly reference to the object's path. | |
const std::string & | doc () const |
A readonly reference to the object's docstring. | |
template<typename T = NEML2Object> | |
const T * | host () const |
Get a readonly pointer to the host. | |
template<typename T = NEML2Object> | |
T * | host () |
Get a writable pointer to the host. | |
Public Member Functions inherited from DiagnosticsInterface | |
DiagnosticsInterface (NEML2Object *object) | |
template<typename... Args> | |
void | diagnostic_assert (std::vector< Diagnosis > &diagnoses, bool assertion, Args &&... args) const |
void | diagnostic_assert_state (std::vector< Diagnosis > &diagnoses, const VariableBase &v) const |
void | diagnostic_assert_old_state (std::vector< Diagnosis > &diagnoses, const VariableBase &v) const |
void | diagnostic_assert_force (std::vector< Diagnosis > &diagnoses, const VariableBase &v) const |
void | diagnostic_assert_old_force (std::vector< Diagnosis > &diagnoses, const VariableBase &v) const |
void | diagnostic_assert_residual (std::vector< Diagnosis > &diagnoses, const VariableBase &v) const |
void | diagnostic_check_input_variable (std::vector< Diagnosis > &diagnoses, const VariableBase &v) const |
void | diagnostic_check_output_variable (std::vector< Diagnosis > &diagnoses, const VariableBase &v) const |
Static Public Member Functions | |
static OptionSet | expected_options () |
Static Public Member Functions inherited from Driver | |
static OptionSet | expected_options () |
Static Public Member Functions inherited from NEML2Object | |
static OptionSet | expected_options () |
Protected Member Functions | |
virtual bool | solve () |
Solve the initial value problem. | |
virtual void | advance_step () |
Advance in time: the state becomes old state, and forces become old forces. | |
virtual void | update_forces () |
Update the driving forces for the current time step. | |
virtual void | apply_ic () |
Apply the initial conditions. | |
virtual void | apply_predictor () |
Apply the predictor to calculate the initial guess for the current time step. | |
virtual void | solve_step () |
Perform the constitutive update for the current time step. | |
virtual void | store_input () |
Save the input of the current time step. | |
virtual void | store_output () |
Save the output of the current time step. | |
virtual void | output () const |
Save the results into the destination file/path. | |
Protected Attributes | |
const bool | _enable_AD |
Whether to disable automatic differentiation. | |
Model & | _model |
The model which the driver uses to perform constitutive updates. | |
const torch::Device | _device |
The device on which to evaluate the model. | |
Scalar | _time |
The current time. | |
Size | _step_count |
The current step count. | |
VariableName | _time_name |
VariableName for the time. | |
Size | _nsteps |
Total number of steps. | |
Size | _nbatch |
The batch size. | |
LabeledVector & | _in |
The input to the constitutive model. | |
LabeledVector & | _out |
The output of the constitutive model. | |
std::string | _predictor |
The predictor used to set the initial guess. | |
std::string | _save_as |
The destination file name or file path. | |
const bool | _show_params |
Set to true to list all the model parameters at the beginning. | |
const bool | _show_input |
Set to true to show model's input axis at the beginning. | |
const bool | _show_output |
Set to true to show model's output axis at the beginning. | |
LabeledVector | _result_in |
Inputs from all time steps. | |
LabeledVector | _result_out |
Outputs from all time steps. | |
std::vector< VariableName > | _ic_scalar_names |
Names for scalar initial conditions. | |
std::vector< CrossRef< Scalar > > | _ic_scalar_values |
Values for the scalar initial conditions. | |
std::vector< VariableName > | _ic_rot_names |
Names for the Rot initial conditions. | |
std::vector< CrossRef< Rot > > | _ic_rot_values |
Values for the Rot initial conditions. | |
std::vector< VariableName > | _ic_sr2_names |
Names for the SR2 initial conditions. | |
std::vector< CrossRef< SR2 > > | _ic_sr2_values |
Values for the SR2 initial conditions. | |
Real | _cp_elastic_scale |
Scale value for initial cp predictor. | |
Protected Attributes inherited from Driver | |
bool | _verbose |
Whether to print out additional (debugging) information during the execution. | |
TransientDriver | ( | const OptionSet & | options | ) |
Construct a new TransientDriver object.
options | The options extracted from the input file |
|
protectedvirtual |
Advance in time: the state becomes old state, and forces become old forces.
|
protectedvirtual |
Apply the initial conditions.
|
protectedvirtual |
Apply the predictor to calculate the initial guess for the current time step.
Check for common problems.
This method serves as the entry point for diagnosing common problems in object setup. The idea behind this method is that while some errors could be detected at construction time, i.e., when the object's constructor is called, it doesn't hinder other objects' creation. We therefore would like to defer the detection of errors until after all objects have been created, collect all errors at once, and present the user with a complete understanding of all errors encountered.
Note, however, if an error could interfere with other objects' creation, it should be raised right away inside the constructor, instead of inside this method.
diagnoses | A vector of exceptions of type Diagnosis for each of the detected problem. |
Reimplemented from Driver.
Reimplemented in LargeDeformationIncrementalSolidMechanicsDriver, and SolidMechanicsDriver.
|
static |
|
protectedvirtual |
Save the results into the destination file/path.
|
virtual |
The results (input and output) from all time steps.
|
overridevirtual |
Let the driver run, return true
upon successful completion, and return false
otherwise.
Implements Driver.
|
virtual |
The destination file/path to save the results.
|
protectedvirtual |
Solve the initial value problem.
|
protectedvirtual |
Perform the constitutive update for the current time step.
|
protectedvirtual |
Save the input of the current time step.
|
protectedvirtual |
Save the output of the current time step.
|
protectedvirtual |
Update the driving forces for the current time step.
Reimplemented in LargeDeformationIncrementalSolidMechanicsDriver, and SolidMechanicsDriver.
|
protected |
Scale value for initial cp predictor.
|
protected |
The device on which to evaluate the model.
|
protected |
Names for the Rot initial conditions.
|
protected |
Names for scalar initial conditions.
Values for the scalar initial conditions.
|
protected |
Names for the SR2 initial conditions.
|
protected |
The input to the constitutive model.
|
protected |
The model which the driver uses to perform constitutive updates.
|
protected |
The batch size.
|
protected |
Total number of steps.
|
protected |
The output of the constitutive model.
|
protected |
The predictor used to set the initial guess.
|
protected |
Inputs from all time steps.
|
protected |
Outputs from all time steps.
|
protected |
The destination file name or file path.
|
protected |
The current step count.
|
protected |
The current time.
|
protected |
VariableName for the time.