# Nonlinear finite elements/Total Lagrangian approach
## Total Lagrangian Approach

In the total Lagrangian approach, the discrete equations are formulated with respect to the reference configuration. The independent variables are $X$ and $t$. The dependent variable is the displacement $u(X,t)$.

#### Total Lagrangian Stress and Strain Measures

The strain is
    ${\varepsilon (X,t)=F(X,t)-1={\frac {\partial x}{\partial X}}-1={\frac {\partial u}{\partial X}}=u_{,X}~.}$
For the reference configuration,
    $\varepsilon _{0}=\varepsilon (X,0)=F(X,0)-1={\frac {\partial X}{\partial X}}-1=0~.$
The Cauchy stress (force/current area) is
    ${\sigma ={\cfrac {T}{A}}~.}$
The engineering stress (force/initial area) is
    ${P={\cfrac {T}{A_{0}}}~.}$
The two stresses are related by
    $\sigma ={\cfrac {A_{0}}{A}}P~;\qquad P={\cfrac {A}{A_{0}}}\sigma ~.$
For the reference configuration,
    $\sigma =P~.$

#### Governing Equations in Total Lagrangian Form

The Total Lagrangian governing equations are:
* Conservation of Mass:
    ${\rho ~J=\rho _{0}~J_{0}=\rho _{0}~.}$
    For the axially loaded bar,
    $\rho {\cfrac {A}{A_{0}}}F=\rho _{0}\qquad \implies \qquad \rho ~A~F=\rho _{0}~A_{0}~.$
* Conservation of Momentum:
    ${{\frac {\partial }{\partial X}}(A_{0}~P)+\rho _{0}~A_{0}~b=\rho _{0}~A_{0}~{\frac {\partial ^{2}u}{\partial t^{2}}}~.}$
* For the bar $A_{0}$ is constant. Therefore,
    ${\frac {\partial P}{\partial X}}+\rho _{0}~b=\rho _{0}~{\frac {\partial ^{2}u}{\partial t^{2}}}~.$
    In short form,
    $P_{,X}+\rho _{0}~b=\rho _{0}~{\ddot {u}}~.$
    If ${\ddot {u}}\approx 0$, we get the equilibrium equation
    $P_{,X}+\rho _{0}~b=0~.$
* Conservation of Energy:
    For the bar:
    ${\rho _{0}{\frac {\partial W_{\text{int}}}{\partial t}}={\frac {\partial F}{\partial t}}~P~.}$
    In short form:
    $\rho _{0}{\dot {W}}_{\text{int}}={\dot {F}}~P~.$
* Constitutive Equations:
** Total Form:
    For a linear elastic material:
    ${P(X,t)=E^{PF}~\varepsilon (X,t)=E^{PF}~u_{,X}=E^{PF}\left[F(X,t)-1\right]~.}$
    The superscript $PF$ refers to the fact that this function relates $P$ and $F$.
    For small strains:
    $E^{PF}=~~{\text{Youngs modulus}}~.$
** Rate Form:
    For a linear elastic material:
    ${{\dot {P}}(X,t)=E^{PF}~{\dot {\varepsilon }}(X,t)=E^{PF}{\dot {F}}(X,t)~.}$

### The Wave Equation

The momentum equation is
    $P_{,X}+\rho _{0}~b=\rho _{0}~{\ddot {u}}~.$
The total form constitutive equation is
    $P(X,t)=E^{PF}~\varepsilon (X,t)=E^{PF}~u_{,X}~.$
Plug constitutive equation into momentum equation to get
    $\left(E^{PF}~u_{,X}\right)_{,X}+\rho _{0}~b=\rho _{0}~{\ddot {u}}~.$
If $E^{PF}$ is constant in the bar and the body force is zero,
    ${E^{PF}~u_{,XX}=\rho _{0}~{\ddot {u}}\qquad \implies \qquad u_{,XX}={\cfrac {\rho _{0}}{E^{PF}}}~{\ddot {u}}={\cfrac {1}{c_{0}^{2}}}~{\ddot {u}}~.}$
This is the wave equation (hyperbolic PDE). The wave speed is $c_{0}$. If acceleration is zero, the equation becomes elliptic.

### Initial and Boundary Conditions

The governing equation for the rod is second-order in time. So two initial conditions are needed.
    ${\begin{aligned}u(X,0)&=u_{0}(X)&~{\text{for}}~&X\in [0,L]\\{\dot {u}}(X,0)&=v_{0}(X)&~{\text{for}}~&X\in [0,L]\end{aligned}}$
The rod is initially at rest. Therefore, the initial conditions are
    ${\begin{aligned}u(X,0)&=0&~{\text{for}}~&X\in [0,L]\\{\dot {u}}(X,0)&=0&~{\text{for}}~&X\in [0,L]\end{aligned}}$
Since the problem is one-dimensional, there are two boundary points. Also, the momentum equation is second-order in the displacements. Therefore, at each end, either $u$ or $u_{,X}$ must be prescribed. In mechanics, instead of $u_{,X}$, the traction is prescribed.
Let $\Gamma _{u}$ be the part of the boundary where displacements are prescribed. Let $\Gamma _{t}$ be the part of the boundary where tractions (force vector per unit area) are prescribed.
Then the displacement boundary conditions are
    ${u(X,t)={\bar {u}}(X,t)\qquad ~{\text{for}}~X\in \Gamma _{u}~.}$
The traction boundary conditions are
    ${n^{0}~P(X,t)=t_{X}^{0}(X,t)\qquad ~{\text{for}}~X\in \Gamma _{t}~.}$
The unit normal to the boundary in the reference configuration is $n^{0}$.
For the axially loaded bar, the displacement boundary condition is
    $u(0,t)=0\qquad ~{\text{for}}~X=0$
The unit normal to the boundary is
    ${\begin{aligned}n^{0}&=-1&~{\text{at}}~&X=0\\n^{0}&=1&~{\text{at}}~&X=L\end{aligned}}$
Therefore, the traction boundary condition is
    $P(L,t)=T(t)\qquad ~{\text{for}}~X=L~.$
For shock problems or fracture problems, an addition interior continuity or jump condition may be needed. This condition is written as
    ${\lfloor P\rceil =0}$
where
    $\lfloor P(X)\rceil =P(X+\epsilon )-P(X-\epsilon )~,\qquad \epsilon \rightarrow 0~.$

## Weak Form for Total Lagrangian

The momentum equation (in its full form) is
    $(A_{0}P)_{,X}+\rho _{0}A_{0}b=\rho _{0}A_{0}{\ddot {u}}~.$
To get the weak form over an element, we multiply the equation by a weighting function and integrate over the length of the element (from $X_{a}$ to $X_{b}$).
    $\int _{X_{a}}^{X_{b}}w\left[(A_{0}P)_{,X}+\rho _{0}A_{0}b-\rho _{0}A_{0}{\ddot {u}}\right]~dX=0~.$
Integrate the first term by parts to get
    $\int _{X_{a}}^{X_{b}}w(A_{0}P)_{,X}~dX=\left[wA_{0}P\right]_{X_{a}}^{X_{b}}-\int _{X_{a}}^{X_{b}}w_{,X}(A_{0}P)~dX~.$
Plug the above into the weak form and rearrange to get
    $\int _{X_{a}}^{X_{b}}w_{,X}(A_{0}P)~dX+\int _{X_{a}}^{X_{b}}w\rho _{0}A_{0}{\ddot {u}}~dX=\int _{X_{a}}^{X_{b}}w\rho _{0}A_{0}b~dX+\left[wA_{0}P\right]_{X_{a}}^{X_{b}}~.$
If we think of the weighting function $w$ as a variation of $u$ that satisfies the kinematic admissibility conditions, we get
    ${\int _{X_{a}}^{X_{b}}(\delta u)_{,X}(A_{0}P)~dX+\int _{X_{a}}^{X_{b}}\delta u\rho _{0}A_{0}{\ddot {u}}~dX=\int _{X_{a}}^{X_{b}}\delta u\rho _{0}A_{0}b~dX+\left[\delta uA_{0}P\right]_{X_{a}}^{X_{b}}~.}$
Recall that
    $u=\varphi (X,t)-X~.$
Therefore,
    $\delta u=\delta \varphi (X,t)=\delta x~.$
Taking a derivative of this variation, we have
    $\delta u_{,X}=\delta x_{,X}=\delta F~.$
Also,
    ${\begin{aligned}\left[\delta uA_{0}P\right]_{X_{a}}^{X_{b}}&=[\delta uA_{0}P]_{X_{b}}-[\delta uA_{0}P]_{X_{a}}\\&=[\delta uA_{0}Pn_{0}]_{X_{b}}+[\delta uA_{0}Pn_{0}]_{X_{a}}\\&=[\delta uA_{0}t_{X}^{0}]_{X_{b}}+[\delta uA_{0}t_{X}^{0}]_{X_{a}}\\&=\left[\delta uA_{0}t_{X}^{0}\right]_{\Gamma _{t}}~.\end{aligned}}$
Therefore, we can alternatively write the weak form as
    ${\int _{X_{a}}^{X_{b}}\delta FA_{0}P~dX+\int _{X_{a}}^{X_{b}}\delta u\rho _{0}A_{0}{\ddot {u}}~dX=\int _{X_{a}}^{X_{b}}\delta u\rho _{0}A_{0}b~dX+\left[\delta uA_{0}t_{X}^{0}\right]_{\Gamma _{t}}~.}$
Comparing with the energy equation, we see that the first term above is the internal virtual work and the weak form is the principle of virtual work for the 1-D problem. The weak form may also be written as
    ${\delta W=\delta W_{\text{int}}-\delta W_{\text{ext}}+\delta W_{\text{kin}}=0}$
where,
    ${\begin{aligned}\delta W_{\text{int}}&=\int _{X_{a}}^{X_{b}}(\delta u)_{,X}(A_{0}P)~dX\\\delta W_{\text{ext}}&=\int _{X_{a}}^{X_{b}}\delta u\rho _{0}A_{0}b~dX+\left[\delta uA_{0}P\right]_{X_{a}}^{X_{b}}\\\delta W_{\text{kin}}&=\int _{X_{a}}^{X_{b}}\delta u\rho _{0}A_{0}{\ddot {u}}~dX\end{aligned}}$

## Finite Element Discretization for Total Lagrangian

The trial solution is
    ${u_{h}(X,t)=\sum _{j=1}^{n}N_{j}(X)u_{j}(t)}$
where $n$ is the number of nodes. In matrix form,
    ${u_{h}(X,t)=\mathbf {N} ~\mathbf {u} }~~{\text{where}}~~\mathbf {N} ={\begin{bmatrix}N_{1}(X)&N_{2}(X)&&N_{n}(X)\end{bmatrix}}~{\text{and}}~\mathbf {u} ={\begin{bmatrix}u_{1}(t)\\u_{2}(t)\\\vdots \\u_{n}(t)\end{bmatrix}}~.$
The test (weighting) function is
    ${\delta u_{h}(X)=\sum _{i=1}^{n}N_{i}(X)\delta u_{i}~.}~~{\text{or}}~~{\delta u_{h}(X)=\mathbf {N} ~\delta \mathbf {u} }~~{\text{where}}~~\delta \mathbf {u} ={\begin{bmatrix}\delta u_{1}\\\delta u_{2}\\\vdots \\\delta u_{n}\end{bmatrix}}~.$
The derivatives of the test functions with respect to $X$ are
    ${(\delta u_{h})_{,X}=\sum _{i=1}^{n}N_{i,X}\delta u_{i}~.}~~{\text{or}}~~{(\delta u_{h})_{,X}=\mathbf {B} _{0}~\delta \mathbf {u} }~~{\text{where}}~~\mathbf {B} _{0}={\begin{bmatrix}N_{1,X}&N_{2,X}&&N_{n,X}\end{bmatrix}}~.$
We will derive the finite element system of equations after substituting these into the approximate weak form
    $\int _{X_{a}}^{X_{b}}(\delta u_{h})_{,X}(A_{0}P)~dX+\int _{X_{a}}^{X_{b}}\delta u_{h}\rho _{0}A_{0}{\ddot {u}}_{h}~dX=\int _{X_{a}}^{X_{b}}\delta u_{h}\rho _{0}A_{0}b+\left[\delta u_{h}A_{0}P\right]_{X_{a}}^{X_{b}}~.$
Let us proceed term by term.

### First LHS Term

The first term represents the virtual internal work
    $\delta W_{\text{int}}=\int _{X_{a}}^{X_{b}}(\delta u_{h})_{,X}(A_{0}P)~dX~.$
Plugging in the derivative of the test function, we get
    ${\begin{aligned}\delta W_{\text{int}}&=\int _{X_{a}}^{X_{b}}\left[\sum _{i=1}^{n}N_{i,X}\delta u_{i}\right](A_{0}P)~dX\\&=\sum _{i=1}^{n}\delta u_{i}\left[\int _{X_{a}}^{X_{b}}N_{i,X}(A_{0}P)~dX\right]\\&=\sum _{i=1}^{n}\delta u_{i}f_{i}^{\text{int}}~.\end{aligned}}$
The last substitution is made because the virtual internal work is the work done by internal forces in moving through a virtual displacement. The matrix form of the expression for virtual internal work is
    ${\delta W_{\text{int}}=\delta \mathbf {u} ^{T}\mathbf {f} _{\text{int}}}~~{\text{where}}~~\mathbf {f} _{\text{int}}={\begin{bmatrix}f_{1}^{\text{int}}\\f_{2}^{\text{int}}\\\vdots \\f_{n}^{\text{int}}\end{bmatrix}}~.$
The internal force is
    ${f_{i}^{\text{int}}=\int _{X_{a}}^{X_{b}}N_{i,X}(A_{0}P)~dX}~~{\text{or}}~~{\mathbf {f} _{\text{int}}=\int _{X_{a}}^{X_{b}}\mathbf {B} _{0}^{T}~(A_{0}P)~dX=\int _{\Omega _{0}}\mathbf {B} _{0}^{T}~P~d\Omega _{0}~.}$

### Second LHS Term

The second term represents the virtual kinetic work
    $\delta W_{\text{kin}}=\int _{X_{a}}^{X_{b}}\delta u_{h}\rho _{0}A_{0}{\ddot {u}}_{h}~dX~.$
Plugging in the test function, we get
    ${\begin{aligned}\delta W_{\text{kin}}&=\int _{X_{a}}^{X_{b}}\left[\sum _{i=1}^{n}\delta u_{i}N_{i}\right]\rho _{0}A_{0}{\ddot {u}}_{h}~dX\\&=\sum _{i=1}^{n}\delta u_{i}\left[\int _{X_{a}}^{X_{b}}\rho _{0}A_{0}N_{i}{\ddot {u}}_{h}~dX\right]\\&=\sum _{i=1}^{n}\delta u_{i}f_{i}^{\text{kin}}~.\end{aligned}}$
The inertial (kinetic) force is
    ${f_{i}^{\text{kin}}=\int _{X_{a}}^{X_{b}}\rho _{0}A_{0}N_{i}{\ddot {u}}_{h}~dX~.}$
Now, plugging in the trial function into the expression for the inertial force, we get
    ${\begin{aligned}f_{i}^{\text{kin}}&=\int _{X_{a}}^{X_{b}}\rho _{0}A_{0}N_{i}\left[\sum _{j=1}^{n}{\ddot {u}}_{j}N_{j}\right]~dX\\&=\sum _{j=1}^{n}\left[\int _{X_{a}}^{X_{b}}\rho _{0}A_{0}N_{i}N_{j}~dX\right]{\ddot {u}}_{j}\\&=\sum _{j=1}^{n}M_{ij}a_{j}\end{aligned}}$
where
    ${M_{ij}:=\int _{X_{a}}^{X_{b}}\rho _{0}A_{0}N_{i}N_{j}~dX\qquad \leftarrow \quad {\text{Consistent Mass Matrix Term.}}}$
and
    $a_{j}:={\ddot {u}}_{j}\qquad \leftarrow \quad {\text{Acceleration.}}$
Note that the mass matrix is independent of time!
In matrix form,
    ${\mathbf {f} _{\text{kin}}=\mathbf {M} \mathbf {a} }~~{\text{where}}~~\mathbf {a} ={\begin{bmatrix}a_{1}\\a_{2}\\\vdots \\a_{n}\end{bmatrix}}={\begin{bmatrix}{\ddot {u}}_{1}\\{\ddot {u}}_{2}\\\vdots \\{\ddot {u}}_{n}\end{bmatrix}}~~~{\text{and}}~~\mathbf {f} _{\text{kin}}={\begin{bmatrix}f_{1}^{\text{kin}}\\f_{2}^{\text{kin}}\\\vdots \\f_{n}^{\text{kin}}\end{bmatrix}}~.$
The consistent mass matrix in matrix notation is
    ${\mathbf {M} =\int _{X_{a}}^{X_{b}}\rho _{0}A_{0}\mathbf {N} ^{T}\mathbf {N} ~dX=\int _{\Omega _{0}}\rho _{0}~\mathbf {N} ^{T}~\mathbf {N} ~d\Omega _{0}~.}$
Plugging the expression for the inertial force into the expression for virtual kinetic work, we get
    ${\begin{aligned}\delta W_{\text{kin}}&=\sum _{i=1}^{n}\delta u_{i}\left[\sum _{j=1}^{n}M_{ij}a_{j}\right]\\&=\sum _{i=1}^{n}\sum _{j=1}^{n}\delta u_{i}M_{ij}a_{j}\end{aligned}}$
In matrix form,
    ${\delta W_{\text{kin}}=(\delta \mathbf {u} )^{T}\mathbf {M} \mathbf {a} =(\delta \mathbf {u} )^{T}~\mathbf {f} _{\text{kin}}~.}$

### RHS Terms

The right hand side terms represent the virtual external work
    $\delta W_{\text{ext}}=\int _{X_{a}}^{X_{b}}\delta u_{h}\rho _{0}A_{0}b~dX+\left[\delta u_{h}A_{0}t_{X}^{0}\right]_{\Gamma _{t}}~.$
Plugging in the test function into the above expression gives
    ${\begin{aligned}\delta W_{\text{ext}}&=\int _{X_{a}}^{X_{b}}\left[\sum _{i=1}^{n}N_{i}\delta u_{i}\right]\rho _{0}A_{0}b~dX+\left[\left(\sum _{i=1}^{n}N_{i}\delta u_{i}\right)A_{0}t_{X}^{0}\right]_{\Gamma _{t}}\\&=\sum _{i=1}^{n}\delta u_{i}\left[\int _{X_{a}}^{X_{b}}N_{i}\rho _{0}A_{0}b~dX\right]+\left[\sum _{i=1}^{n}\delta u_{i}N_{i}A_{0}t_{X}^{0}\right]_{\Gamma _{t}}\\&=\sum _{i=1}^{n}\delta u_{i}\left[\int _{X_{a}}^{X_{b}}N_{i}\rho _{0}A_{0}b~dX+\left[N_{i}A_{0}t_{X}^{0}\right]_{\Gamma _{t}}\right]\\&=\sum _{i=1}^{n}\delta u_{i}~f_{i}^{\text{ext}}~.\end{aligned}}$
In matrix notation,
    ${\delta W_{\text{ext}}=\delta \mathbf {u} ^{T}~\mathbf {f} _{\text{ext}}}~~{\text{where}}~~\mathbf {f} _{\text{ext}}={\begin{bmatrix}f_{1}^{\text{ext}}\\f_{2}^{\text{ext}}\\\vdots \\f_{n}^{\text{ext}}\end{bmatrix}}~.$
The external force is given by
    ${f_{i}^{\text{ext}}=\int _{X_{a}}^{X_{b}}N_{i}\rho _{0}A_{0}b~dX+\left[N_{i}A_{0}t_{X}^{0}\right]_{\Gamma _{t}}~.}$
In matrix notation,
    ${\mathbf {f} _{\text{ext}}=\int _{X_{a}}^{X_{b}}\mathbf {N} ^{T}\rho _{0}A_{0}b~dX+\left[\mathbf {N} ^{T}A_{0}t_{X}^{0}\right]_{\Gamma _{t}}}~~{\text{or}}~~{\mathbf {f} _{\text{ext}}=\int _{\Omega _{0}}\rho _{0}~\mathbf {N} ^{T}~b~d\Omega _{0}+\left[\mathbf {N} ^{T}A_{0}t_{X}^{0}\right]_{\Gamma _{t}}~.}$
Collecting the terms, we get the finite element system of equations
    $\sum _{i=1}^{n}\delta u_{i}\left[f_{i}^{\text{int}}+f_{i}^{\text{kin}}-f_{i}^{\text{ext}}\right]=0$
Now, the weighting function is arbitrary except at nodes where displacement BCs are prescribed. At these nodes the weighting function is zero.
For the bar, let us assume that a displacement is prescribed at node $1$. Then, the finite element system of equations becomes
    $f_{i}^{\text{int}}+f_{i}^{\text{kin}}-f_{i}^{\text{ext}}=0\qquad {\text{for}}~~i=2\dots n$
or,
    ${\sum _{j=1}^{n}M_{ij}~a_{j}+f_{i}^{\text{int}}-f_{i}^{\text{ext}}=0\qquad {\text{for}}~~i=2\dots n~.}$
Since the displacement at node $1$ is known, the acceleration at node $1$ is also known. Note that we have to differentiate the displacement twice to get the acceleration and hence the prescribed displacement must be a $C^{1}$ function.
We can take the known acceleration $a_{1}$ to the RHS to get
    $\sum _{j=2}^{n}M_{ij}~a_{j}+f_{i}^{\text{int}}-f_{i}^{\text{ext}}=-M_{i1}~a_{1}\qquad {\text{for}}~~i=2\dots n~.$
The above equation shows that prescribed boundary accelerations (and hence prescribed boundary displacements) contribute to nodes which are not on the boundary.
We can avoid that issue by making the mass matrix diagonal (using ad-hoc procedures that conserve momentum). If the mass matrix is diagonal, we get
    $M_{ii}~a_{i}+f_{i}^{\text{int}}-f_{i}^{\text{ext}}=0\qquad {\text{for}}~~i=2\dots n~.$
In matrix form,
    ${\mathbf {M} ~\mathbf {a} =\mathbf {f} _{\text{ext}}-\mathbf {f} _{\text{int}}}~~{\text{or}}~~{\mathbf {f} =\mathbf {M} ~\mathbf {a} .}~.$
One way of generating a diagonal mass matrix or lumped mass matrix is the row-sum technique. The rows of the mass matrix are summed at lumped at the diagonal of the matrix. Thus,
    ${\begin{aligned}M_{ii}^{\text{diagonal}}&=\sum _{j=1}^{n}M_{ij}^{\text{consistent}}\\&=\sum _{j=1}^{n}\int _{X_{a}}^{X_{b}}\rho _{0}N_{i}N_{j}A_{0}~dX\\&=\int _{X_{a}}^{X_{b}}\rho _{0}N_{i}\left[\sum _{j=1}^{n}N_{j}\right]A_{0}~dX\\&=\int _{X_{a}}^{X_{b}}\rho _{0}N_{i}A_{0}~dX\qquad {\text{since}}~\sum _{j=1}^{n}N_{j}=1~.\end{aligned}}$

## Discrete Equations for Total Lagrangian

The finite element equations in total Lagrangian form are:
    ${\begin{aligned}u(X,t)&=\sum _{i}N_{i}(X)~u_{i}^{e}(t)=\mathbf {N} ~\mathbf {u} ^{e}\\\varepsilon (X,t)&=\sum _{i}N_{i,X}~u_{i}^{e}(t)=\mathbf {B} _{0}~\mathbf {u} ^{e}\\F(X,t)&=\sum _{i}N_{i,X}~x_{i}^{e}(t)=\mathbf {B} _{0}~\mathbf {x} ^{e}\\\mathbf {f} _{\text{int}}^{e}&=\int _{\Omega _{0}^{e}}\mathbf {B} _{0}^{T}P~d\Omega _{0}\\\mathbf {f} _{\text{ext}}^{e}&=\int _{\Omega _{0}^{e}}\rho _{0}\mathbf {N} ^{T}b~d\Omega _{0}+\left[\mathbf {N} ^{T}A_{0}t_{X}^{0}\right]_{\Gamma _{t}^{e}}\\\mathbf {M} ^{e}&=\int _{\Omega _{0}^{e}}\rho _{0}\mathbf {N} ^{T}\mathbf {N} ~d\Omega _{0}\\\mathbf {M} ~{\ddot {\mathbf {u} }}&=\mathbf {f} _{\text{ext}}-\mathbf {f} _{\text{int}}~.\end{aligned}}$