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::SecondOrderODE Class Reference

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

#include <odes.hpp>

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

Classes

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

Public Member Functions

 SecondOrderODE (int n, 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, const mfem::Vector &du_dt, mfem::Vector &d2u_dt2) const override
 Solves the equation d2u_dt2 = f(u, du_dt, t) More...
 
void ImplicitSolve (const double c0, const double c1, const mfem::Vector &u, const mfem::Vector &du_dt, mfem::Vector &d2u_dt2) override
 Solves the equation d2u_dt2 = f(u + c0 * d2u_dt2, du_dt + c1 * d2u_dt2, t) More...
 
void ImplicitSolve (const double dt, const mfem::Vector &u, mfem::Vector &du_dt) override
 
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, mfem::Vector &dxdt, double &time, double &dt)
 Performs a time step. More...
 
const StateGetState ()
 Get a reference to the current state.
 
TimestepMethod GetTimestepper ()
 Query the timestep method for the ode solver. More...
 

Static Public Attributes

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

Detailed Description

SecondOrderODE is a class wrapping mfem::SecondOrderTimeDependentOperator so that the user can use std::function to define the implementations of mfem::SecondOrderTimeDependentOperator::Mult and mfem::SecondOrderTimeDependentOperator::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 34 of file odes.hpp.

Constructor & Destructor Documentation

◆ SecondOrderODE()

serac::mfem_ext::SecondOrderODE::SecondOrderODE ( int  n,
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::SecondOrderTimeDependentOperator::Mult and mfem::SecondOrderTimeDependentOperator::ImplicitSolve (described in more detail here: https://mfem.github.io/doxygen/html/classmfem_1_1SecondOrderTimeDependentOperator.html)

where

mfem::SecondOrderTimeDependentOperator::Mult corresponds to the case where fac0, fac1 are both zero mfem::SecondOrderTimeDependentOperator::ImplicitSolve corresponds to the case where either of fac0, fac1 are nonzero

Definition at line 11 of file odes.cpp.

Member Function Documentation

◆ GetTimestepper()

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

Query the timestep method for the ode solver.

Returns
The timestep method used by the underlying ode solver

Definition at line 171 of file odes.hpp.

◆ ImplicitSolve() [1/2]

void serac::mfem_ext::SecondOrderODE::ImplicitSolve ( const double  c0,
const double  c1,
const mfem::Vector &  u,
const mfem::Vector &  du_dt,
mfem::Vector &  d2u_dt2 
)
inlineoverride

Solves the equation d2u_dt2 = f(u + c0 * d2u_dt2, du_dt + c1 * d2u_dt2, t)

Parameters
[in]c0coefficient on d2u_dt2 appearing the first argument of f
[in]c1coefficient on d2u_dt2 appearing the second argument of f
[in]uThe true DOFs
[in]du_dtThe first time derivative of u
[out]d2u_dt2The second time derivative of u

Definition at line 125 of file odes.hpp.

◆ ImplicitSolve() [2/2]

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

The FirstOrder recast that can be used by a first order ode solver

Definition at line 120 of file odes.cpp.

◆ Mult()

void serac::mfem_ext::SecondOrderODE::Mult ( const mfem::Vector &  u,
const mfem::Vector &  du_dt,
mfem::Vector &  d2u_dt2 
) const
inlineoverride

Solves the equation d2u_dt2 = f(u, du_dt, t)

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

Definition at line 111 of file odes.hpp.

◆ SetEnforcementMethod()

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

Configures the Dirichlet enforcement method to use.

Parameters
[in]methodThe selected method

Definition at line 140 of file odes.hpp.

◆ SetTimestepper()

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

Set the time integration method.

Parameters
[in]timestepperThe timestepping method for the solver

Definition at line 22 of file odes.cpp.

◆ Step()

void serac::mfem_ext::SecondOrderODE::Step ( mfem::Vector &  x,
mfem::Vector &  dxdt,
double &  time,
double &  dt 
)

Performs a time step.

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

Definition at line 77 of file odes.cpp.

Member Data Documentation

◆ epsilon

constexpr double serac::mfem_ext::SecondOrderODE::epsilon = 0.0001
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 45 of file odes.hpp.


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