# Time integration (static-quasistatic)= ## Static and Quasistatic The above formulations solve the steady-state equations but with updates to the time parameter in the boundary conditions. Ratel also offers a static solve option via a PETSc SNES solve; this is covered in the [static elasticity example](example-static). The [quasistatic example](example-quasistatic) uses the PETSc Timestepper (TS) object to manage pseudo-timestepping. Large deformation solid mechanics exhibits both geometric and material nonlinearities, leading to path dependence by which there are be multiple static solutions for a specified set of boundary conditions. To disambiguate the multiple solutions, we solve the hyperelastic problem as a non-autonomous differential algebraic equation of index 1, with boundary conditions/loading a function of time $t \in [0, 1]$. The current quasistatic example uses applied load (rather than displacement) and use backward Euler from PETSc's TS with extrapolation-based hot starts disabled for simplicity. Each pseudo time step requires a nonlinear solve, which is implemented using PETSc's Scalable Nonlinear Equations Solver (SNES). By default, Ratel uses Newton-CG in which a multigrid V-cycle is used as a preconditioner for conjugate gradients. Additionally, we use a "critical point" line search, which supposes that the residual is the functional gradient of a latent objective function, $\bm F(\bm u) = \nabla_{\bm u}\Psi(\bm u)$ and uses one step of a secant method to find $\alpha$ for which $F(\bm u + \alpha \delta \bm u)^{T} \delta \bm u = 0$ where $\delta \bm u$ is the search direction found by Newton. This line search is inspired by the strong Wolfe conditions in optimization {cite}`nocedal99`, but without explicit evaluation of the objective $\Psi$, which may not be available or may not exist (e.g., for non-conservative models). More information on the PETSc TS and SNES objects can be found in the [PETSc documentation](https://petsc.org/release). (elastodynamics)= ## Elastodynamics In {eq}`residual-matrix-free`, we represented the static problem i.e. $\ddot{\bm u} = 0$. However, in the [dynamic example](example-dynamic) acceleration is **not zero** and we use the PETSc Timestepper (TS) object to manage timestepping. Specifically, Ratel uses the Generalized-Alpha method for second order systems (`TSALPHA2`) to solve the second order system of equations given by the momentum balance. More information on the PETSc `TSALPHA2` time stepper can be found in the [PETSc documentation TS](https://petsc.org/release/docs/manualpages/TS/index.html). For elastodynamics we need to add $$ \int_{\Omega_0} \bm v \cdot \left(\rho_0 \, \ddot{\bm u} \right) \, dV, $$ (elastodynamics-residual) to the residual equation {eq}`residual-matrix-free` (or adding $\rho_0 \ddot{\bm u}$ to $\bm f_0$ term) and its jacobian $$ \mathrm{shift_a} \, \int_{\Omega_0} \bm v \cdot \left(\rho_0 \, \diff \bm u \right) \, dV, $$ (elastodynamics-jacobian) Note that in general for a time dependent residual function $$ F (t, \bm u, \dot{\bm u}, \ddot{\bm u}) = 0, $$ (time-dependent-residual) we can write the Jacobian as $$ \diff F = \frac{\partial F}{\partial \bm u} \, \diff \bm u + \mathrm{shift_v} \, \frac{\partial F}{\partial \dot{\bm u}} \, \diff \bm u + \mathrm{shift_a} \, \frac{\partial F}{\partial \ddot{\bm u}} \, \diff \bm u, $$ (time-dependent-jacobian) where $\mathrm{shift_v}, \mathrm{shift_a}$ is related to the inverse of time step $\Delta t$ and its square.