Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
Classes | Public Member Functions | Static Public Attributes | List of all members
serac::mfem_ext::FirstOrderODE Class Reference

FirstOrderODE is a class wrapping mfem::TimeDependentOperator so that the user can use std::function to define the implementations of mfem::TimeDependentOperator::Mult and mfem::TimeDependentOperator::ImplicitSolve. More...

#include <odes.hpp>

Collaboration diagram for serac::mfem_ext::FirstOrderODE:
Collaboration graph
[legend]

Classes

struct  State
 A set of references to physics-module-owned variables used by the residual operator. More...
 

Public Member Functions

 FirstOrderODE (int n, FirstOrderODE::State &&state, const EquationSolver &solver, const BoundaryConditionManager &bcs)
 Constructor defining the size and specific system of ordinary differential equations to be solved. More...
 
void Mult (const mfem::Vector &u, mfem::Vector &du_dt) const
 Solves the equation du_dt = f(u, t) More...
 
void ImplicitSolve (const double dt, const mfem::Vector &u, mfem::Vector &du_dt)
 Solves the equation du_dt = f(u + dt * du_dt, t) More...
 
void SetEnforcementMethod (const DirichletEnforcementMethod method)
 Configures the Dirichlet enforcement method to use. More...
 
void SetTimestepper (const serac::TimestepMethod timestepper)
 Set the time integration method. More...
 
void Step (mfem::Vector &x, double &time, double &dt)
 Performs a time step. More...
 
TimestepMethod GetTimestepper ()
 Query the timestep method for the ode solver. More...
 

Static Public Attributes

static constexpr double epsilon = 0.000001
 a small number used to compute finite difference approximations to time derivatives of boundary conditions. More...
 

Detailed Description

FirstOrderODE is a class wrapping mfem::TimeDependentOperator so that the user can use std::function to define the implementations of mfem::TimeDependentOperator::Mult and mfem::TimeDependentOperator::ImplicitSolve.

The main benefit of this approach is that lambda capture lists allow for a flexible inline representation of the overloaded functions, without having to manually define a separate functor class.

Definition at line 238 of file odes.hpp.

Constructor & Destructor Documentation

◆ FirstOrderODE()

serac::mfem_ext::FirstOrderODE::FirstOrderODE ( int  n,
FirstOrderODE::State &&  state,
const EquationSolver solver,
const BoundaryConditionManager bcs 
)

Constructor defining the size and specific system of ordinary differential equations to be solved.

Parameters
[in]nThe number of components in each vector of the ODE
[in]stateThe collection of references to input/output variables from the physics module
[in]solverThe solver that operates on the residual
[in]bcsThe set of Dirichlet conditions to enforce

Implements mfem::TimeDependentOperator::Mult and mfem::TimeDependentOperator::ImplicitSolve (described in more detail here: https://mfem.github.io/doxygen/html/classmfem_1_1TimeDependentOperator.html)

where

mfem::TimeDependentOperator::Mult corresponds to the case where dt is zero mfem::TimeDependentOperator::ImplicitSolve corresponds to the case where dt is nonzero

Definition at line 250 of file odes.cpp.

Member Function Documentation

◆ GetTimestepper()

TimestepMethod serac::mfem_ext::FirstOrderODE::GetTimestepper ( )
inline

Query the timestep method for the ode solver.

Returns
The timestep method used by the underlying ode solver

Definition at line 355 of file odes.hpp.

◆ ImplicitSolve()

void serac::mfem_ext::FirstOrderODE::ImplicitSolve ( const double  dt,
const mfem::Vector &  u,
mfem::Vector &  du_dt 
)
inline

Solves the equation du_dt = f(u + dt * du_dt, t)

Parameters
[in]dtThe time step
[in]uThe true DOFs
[in]du_dtThe first time derivative of u

Definition at line 317 of file odes.hpp.

◆ Mult()

void serac::mfem_ext::FirstOrderODE::Mult ( const mfem::Vector &  u,
mfem::Vector &  du_dt 
) const
inline

Solves the equation du_dt = f(u, t)

Parameters
[in]uThe true DOFs
[in]du_dtThe first time derivative of u

Definition at line 308 of file odes.hpp.

◆ SetEnforcementMethod()

void serac::mfem_ext::FirstOrderODE::SetEnforcementMethod ( const DirichletEnforcementMethod  method)
inline

Configures the Dirichlet enforcement method to use.

Parameters
[in]methodThe selected method

Definition at line 323 of file odes.hpp.

◆ SetTimestepper()

void serac::mfem_ext::FirstOrderODE::SetTimestepper ( const serac::TimestepMethod  timestepper)

Set the time integration method.

Parameters
[in]timestepperThe timestepping method for the solver

Definition at line 261 of file odes.cpp.

◆ Step()

void serac::mfem_ext::FirstOrderODE::Step ( mfem::Vector &  x,
double &  time,
double &  dt 
)
inline

Performs a time step.

Parameters
[in,out]xThe predicted solution
[in,out]timeThe current time
[in,out]dtThe desired time step
See also
mfem::ODESolver::Step

Definition at line 341 of file odes.hpp.

Member Data Documentation

◆ epsilon

constexpr double serac::mfem_ext::FirstOrderODE::epsilon = 0.000001
staticconstexpr

a small number used to compute finite difference approximations to time derivatives of boundary conditions.

Note: this is intended to be temporary Ideally, epsilon should be "small" relative to the characteristic time of the ODE, but we can't ensure that at present (we don't have a critical timestep estimate)

Definition at line 249 of file odes.hpp.


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