NEML2 1.4.0
Loading...
Searching...
No Matches
TransientDriver Class Reference

The driver for a transient initial-value problem. More...

Detailed Description

The driver for a transient initial-value problem.

#include <TransientDriver.h>

Inheritance diagram for TransientDriver:

Public Member Functions

 TransientDriver (const OptionSet &options)
 Construct a new TransientDriver object.
 
bool run () override
 Let the driver run, return true upon successful completion, and return false otherwise.
 
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 OptionSetinput_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.
 

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 void check_integrity () const override
 Check the integrity of the set up.
 
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

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.
 
TorchSize _step_count
 The current step count.
 
VariableName _time_name
 VariableName for the time.
 
TorchSize _nsteps
 Total number of steps.
 
TorchSize _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.
 

Constructor & Destructor Documentation

◆ TransientDriver()

Construct a new TransientDriver object.

Parameters
optionsThe options extracted from the input file

Member Function Documentation

◆ advance_step()

void advance_step ( )
protectedvirtual

Advance in time: the state becomes old state, and forces become old forces.

◆ apply_ic()

void apply_ic ( )
protectedvirtual

Apply the initial conditions.

◆ apply_predictor()

void apply_predictor ( )
protectedvirtual

Apply the predictor to calculate the initial guess for the current time step.

◆ check_integrity()

void check_integrity ( ) const
overrideprotectedvirtual

Check the integrity of the set up.

Reimplemented from Driver.

Reimplemented in LargeDeformationIncrementalSolidMechanicsDriver, and SolidMechanicsDriver.

◆ expected_options()

OptionSet expected_options ( )
static

◆ output()

void output ( ) const
protectedvirtual

Save the results into the destination file/path.

◆ result()

torch::nn::ModuleDict result ( ) const
virtual

The results (input and output) from all time steps.

Returns
torch::nn::ModuleDict The results (input and output) from all time steps. Keys of the dict are "input" and "output". Each buffer in the submodules correspond to a variable.

◆ run()

bool run ( )
overridevirtual

Let the driver run, return true upon successful completion, and return false otherwise.

Implements Driver.

◆ save_as_path()

std::string save_as_path ( ) const
virtual

The destination file/path to save the results.

◆ solve()

bool solve ( )
protectedvirtual

Solve the initial value problem.

◆ solve_step()

void solve_step ( )
protectedvirtual

Perform the constitutive update for the current time step.

◆ store_input()

void store_input ( )
protectedvirtual

Save the input of the current time step.

◆ store_output()

void store_output ( )
protectedvirtual

Save the output of the current time step.

◆ update_forces()

void update_forces ( )
protectedvirtual

Update the driving forces for the current time step.

Reimplemented in LargeDeformationIncrementalSolidMechanicsDriver, and SolidMechanicsDriver.

Member Data Documentation

◆ _cp_elastic_scale

Real _cp_elastic_scale
protected

Scale value for initial cp predictor.

◆ _device

const torch::Device _device
protected

The device on which to evaluate the model.

◆ _ic_rot_names

std::vector<VariableName> _ic_rot_names
protected

Names for the Rot initial conditions.

◆ _ic_rot_values

std::vector<CrossRef<Rot> > _ic_rot_values
protected

Values for the Rot initial conditions.

◆ _ic_scalar_names

std::vector<VariableName> _ic_scalar_names
protected

Names for scalar initial conditions.

◆ _ic_scalar_values

std::vector<CrossRef<Scalar> > _ic_scalar_values
protected

Values for the scalar initial conditions.

◆ _ic_sr2_names

std::vector<VariableName> _ic_sr2_names
protected

Names for the SR2 initial conditions.

◆ _ic_sr2_values

std::vector<CrossRef<SR2> > _ic_sr2_values
protected

Values for the SR2 initial conditions.

◆ _in

LabeledVector& _in
protected

The input to the constitutive model.

◆ _model

Model& _model
protected

The model which the driver uses to perform constitutive updates.

◆ _nbatch

TorchSize _nbatch
protected

The batch size.

◆ _nsteps

TorchSize _nsteps
protected

Total number of steps.

◆ _out

LabeledVector& _out
protected

The output of the constitutive model.

◆ _predictor

std::string _predictor
protected

The predictor used to set the initial guess.

◆ _result_in

LabeledVector _result_in
protected

Inputs from all time steps.

◆ _result_out

LabeledVector _result_out
protected

Outputs from all time steps.

◆ _save_as

std::string _save_as
protected

The destination file name or file path.

◆ _show_input

const bool _show_input
protected

Set to true to show model's input axis at the beginning.

◆ _show_output

const bool _show_output
protected

Set to true to show model's output axis at the beginning.

◆ _show_params

const bool _show_params
protected

Set to true to list all the model parameters at the beginning.

◆ _step_count

TorchSize _step_count
protected

The current step count.

◆ _time

Scalar _time
protected

The current time.

◆ _time_name

VariableName _time_name
protected

VariableName for the time.