PolyFEM
|
Implicit Euler time integrator of a second order ODE (equivently a system of coupled first order ODEs). More...
#include <ImplicitEuler.hpp>
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 ¶ms) |
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< ImplicitTimeIntegrator > | construct_time_integrator (const json ¶ms) |
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. | |
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} \]
Definition at line 13 of file ImplicitEuler.hpp.
|
inline |
Definition at line 16 of file ImplicitEuler.hpp.
|
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().
|
overridevirtual |
Compute the current acceleration given the current velocity and using the stored previous velocity(s).
\[ a = \frac{v - v^t}{\Delta t} \]
v | current velocity |
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().
|
overridevirtual |
Compute the current velocity given the current solution and using the stored previous solution(s).
\[ v = \frac{x - x^t}{\Delta t} \]
x | current solution vector |
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().
|
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 \]
prev_ti | index 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().
|
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) \]
x | new 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.
|
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 \]
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().