PolyFEM
Loading...
Searching...
No Matches
polyfem::time_integrator::ImplicitEuler Class Reference

Implicit Euler time integrator of a second order ODE (equivently a system of coupled first order ODEs). More...

#include <ImplicitEuler.hpp>

Inheritance diagram for polyfem::time_integrator::ImplicitEuler:
[legend]
Collaboration diagram for polyfem::time_integrator::ImplicitEuler:
[legend]

Public Member Functions

 ImplicitEuler ()
 
void update_quantities (const Eigen::VectorXd &x) override
 Update the time integration quantities (i.e., \(x\), \(v\), and \(a\)).
 
Eigen::VectorXd x_tilde () const override
 Compute the predicted solution to be used in the inertia term \((x-\tilde{x})^TM(x-\tilde{x})\).
 
Eigen::VectorXd compute_velocity (const Eigen::VectorXd &x) const override
 Compute the current velocity given the current solution and using the stored previous solution(s).
 
Eigen::VectorXd compute_acceleration (const Eigen::VectorXd &v) const override
 Compute the current acceleration given the current velocity and using the stored previous velocity(s).
 
double acceleration_scaling () const override
 Compute the acceleration scaling used to scale forces when integrating a second order ODE.
 
double dv_dx (const unsigned prev_ti=0) const override
 Compute the derivative of the velocity with respect to the solution.
 
- Public Member Functions inherited from polyfem::time_integrator::ImplicitTimeIntegrator
 ImplicitTimeIntegrator ()
 
virtual ~ImplicitTimeIntegrator ()=default
 
virtual void set_parameters (const json &params)
 Set the time integrator parameters from a json object.
 
virtual void init (const Eigen::MatrixXd &x_prevs, const Eigen::MatrixXd &v_prevs, const Eigen::MatrixXd &a_prevs, double dt)
 Initialize the time integrator with the previous values for \(x\), \(v\), and \(a\).
 
const double & dt () const
 Access the time step size.
 
virtual void save_state (const std::string &state_path) const
 Save the values of \(x\), \(v\), and \(a\).
 
const Eigen::VectorXd & x_prev () const
 Get the most recent previous solution value.
 
const Eigen::VectorXd & v_prev () const
 Get the most recent previous velocity value.
 
const Eigen::VectorXd & a_prev () const
 Get the most recent previous acceleration value.
 
const std::deque< Eigen::VectorXd > & x_prevs () const
 Get the (relevant) history of previous solution value.
 
const std::deque< Eigen::VectorXd > & v_prevs () const
 Get the (relevant) history of previous velocity value.
 
const std::deque< Eigen::VectorXd > & a_prevs () const
 Get the (relevant) history of previous acceleration value.
 
int steps () const
 Get the current number of steps to use for integration.
 

Additional Inherited Members

- Static Public Member Functions inherited from polyfem::time_integrator::ImplicitTimeIntegrator
static std::shared_ptr< ImplicitTimeIntegratorconstruct_time_integrator (const json &params)
 Factory method for constructing implicit time integrators from the name of the integrator.
 
static const std::vector< std::string > & get_time_integrator_names ()
 Get a vector of the names of possible ImplicitTimeIntegrators.
 
- Protected Member Functions inherited from polyfem::time_integrator::ImplicitTimeIntegrator
virtual int max_steps () const
 Get the maximum number of steps to use for integration.
 
void set_x_prev (const Eigen::VectorXd &x_prev)
 Convenience functions for setting the most recent previous solution.
 
void set_v_prev (const Eigen::VectorXd &v_prev)
 Convenience functions for setting the most recent previous velocity.
 
void set_a_prev (const Eigen::VectorXd &a_prev)
 Convenience functions for setting the most recent previous acceleration.
 
- Protected Attributes inherited from polyfem::time_integrator::ImplicitTimeIntegrator
double dt_ = 1
 Time step size.
 
std::deque< Eigen::VectorXd > x_prevs_
 Store the necessary previous values of the solution for single or multi-step integration.
 
std::deque< Eigen::VectorXd > v_prevs_
 Store the necessary previous values of the velocity for single or multi-step integration.
 
std::deque< Eigen::VectorXd > a_prevs_
 Store the necessary previous values of the acceleration for single or multi-step integration.
 

Detailed Description

Implicit Euler time integrator of a second order ODE (equivently a system of coupled first order ODEs).

\[ x^{t+1} = x^t + \Delta t v^{t+1}\newline v^{t+1} = v^t + \Delta t a^{t+1} \]

See also
https://en.wikipedia.org/wiki/Backward_Euler_method

Definition at line 13 of file ImplicitEuler.hpp.

Constructor & Destructor Documentation

◆ ImplicitEuler()

polyfem::time_integrator::ImplicitEuler::ImplicitEuler ( )
inline

Definition at line 16 of file ImplicitEuler.hpp.

Member Function Documentation

◆ acceleration_scaling()

double polyfem::time_integrator::ImplicitEuler::acceleration_scaling ( ) const
overridevirtual

Compute the acceleration scaling used to scale forces when integrating a second order ODE.

\[ \Delta t^2 \]

Implements polyfem::time_integrator::ImplicitTimeIntegrator.

Definition at line 28 of file ImplicitEuler.cpp.

References polyfem::time_integrator::ImplicitTimeIntegrator::dt().

Here is the call graph for this function:

◆ compute_acceleration()

Eigen::VectorXd polyfem::time_integrator::ImplicitEuler::compute_acceleration ( const Eigen::VectorXd &  v) const
overridevirtual

Compute the current acceleration given the current velocity and using the stored previous velocity(s).

\[ a = \frac{v - v^t}{\Delta t} \]

Parameters
vcurrent velocity
Returns
value for \(a\)

Implements polyfem::time_integrator::ImplicitTimeIntegrator.

Definition at line 23 of file ImplicitEuler.cpp.

References polyfem::time_integrator::ImplicitTimeIntegrator::dt(), and polyfem::time_integrator::ImplicitTimeIntegrator::v_prev().

Referenced by update_quantities().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_velocity()

Eigen::VectorXd polyfem::time_integrator::ImplicitEuler::compute_velocity ( const Eigen::VectorXd &  x) const
overridevirtual

Compute the current velocity given the current solution and using the stored previous solution(s).

\[ v = \frac{x - x^t}{\Delta t} \]

Parameters
xcurrent solution vector
Returns
value for \(v\)

Implements polyfem::time_integrator::ImplicitTimeIntegrator.

Definition at line 18 of file ImplicitEuler.cpp.

References polyfem::time_integrator::ImplicitTimeIntegrator::dt(), x, and polyfem::time_integrator::ImplicitTimeIntegrator::x_prev().

Referenced by update_quantities().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dv_dx()

double polyfem::time_integrator::ImplicitEuler::dv_dx ( const unsigned  prev_ti = 0) const
overridevirtual

Compute the derivative of the velocity with respect to the solution.

\[ \frac{\partial v}{\partial x} = \frac{1}{\Delta t} \]

\[ \frac{\partial v}{\partial x^t} = \frac{-1}{\Delta t} \]

\[ \frac{\partial v}{\partial x^{t-1}} = 0 \]

Parameters
prev_tiindex of the previous solution to use (0 -> current; 1 -> previous; 2 -> second previous; etc.)

Implements polyfem::time_integrator::ImplicitTimeIntegrator.

Definition at line 33 of file ImplicitEuler.cpp.

References polyfem::time_integrator::ImplicitTimeIntegrator::dt().

Here is the call graph for this function:

◆ update_quantities()

void polyfem::time_integrator::ImplicitEuler::update_quantities ( const Eigen::VectorXd &  x)
overridevirtual

Update the time integration quantities (i.e., \(x\), \(v\), and \(a\)).

\[ v^{t+1} = \frac{1}{\Delta t} (x - x^t)\newline a^{t+1} = \frac{1}{\Delta t} (v - v^t) \]

Parameters
xnew solution vector

Implements polyfem::time_integrator::ImplicitTimeIntegrator.

Definition at line 5 of file ImplicitEuler.cpp.

References compute_acceleration(), compute_velocity(), polyfem::time_integrator::ImplicitTimeIntegrator::set_a_prev(), polyfem::time_integrator::ImplicitTimeIntegrator::set_v_prev(), polyfem::time_integrator::ImplicitTimeIntegrator::set_x_prev(), and x.

Here is the call graph for this function:

◆ x_tilde()

Eigen::VectorXd polyfem::time_integrator::ImplicitEuler::x_tilde ( ) const
overridevirtual

Compute the predicted solution to be used in the inertia term \((x-\tilde{x})^TM(x-\tilde{x})\).

\[ \tilde{x} = x^t + \Delta t v^t \]

Returns
value for \(\tilde{x}\)

Implements polyfem::time_integrator::ImplicitTimeIntegrator.

Definition at line 13 of file ImplicitEuler.cpp.

References polyfem::time_integrator::ImplicitTimeIntegrator::dt(), polyfem::time_integrator::ImplicitTimeIntegrator::v_prev(), and polyfem::time_integrator::ImplicitTimeIntegrator::x_prev().

Here is the call graph for this function:

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