The finite element system of equations is
M
u
¨
=
f
ext
−
f
int
=
f
.
{\displaystyle \mathbf {M} ~{\ddot {\mathbf {u} }}=\mathbf {f} _{\text{ext}}-\mathbf {f} _{\text{int}}=\mathbf {f} ~.}
Let's assume that the mass matrix is diagonal. Let us also assume that we would like to solve this problem using an explicit method that uses central differencing.
Let the time step size be
Δ
t
{\displaystyle \Delta t}
. Let us also assume that the time step is constant. Then, at time step
n
{\displaystyle n}
, the time is
t
n
=
n
Δ
t
{\displaystyle t_{n}=n\Delta t}
.
Let
u
n
=
u
(
t
n
)
.
{\displaystyle \mathbf {u} _{n}=\mathbf {u} (t_{n})~.}
Let us take a half step to compute the velocity at the middle of the
timestep. Then,
v
n
+
1
/
2
=
u
n
+
1
−
u
n
Δ
t
.
{\displaystyle \mathbf {v} ^{n+1/2}={\cfrac {\mathbf {u} ^{n+1}-\mathbf {u} ^{n}}{\Delta t}}~.}
We will use this half-step velocity to compute the acceleration
a
n
=
u
¨
n
=
v
n
+
1
/
2
−
v
n
−
1
/
2
Δ
t
.
{\displaystyle \mathbf {a} ^{n}={\ddot {\mathbf {u} }}^{n}={\cfrac {\mathbf {v} ^{n+1/2}-\mathbf {v} ^{n-1/2}}{\Delta t}}~.}
Now,
u
¨
n
=
M
−
1
f
n
.
{\displaystyle {\ddot {\mathbf {u} }}^{n}=\mathbf {M} ^{-1}~\mathbf {f} ^{n}~.}
Therefore,
M
−
1
f
n
=
v
n
+
1
/
2
−
v
n
−
1
/
2
Δ
t
⟹
v
n
+
1
/
2
=
v
n
−
1
/
2
+
Δ
t
M
−
1
f
n
.
{\displaystyle \mathbf {M} ^{-1}~\mathbf {f} ^{n}={\cfrac {\mathbf {v} ^{n+1/2}-\mathbf {v} ^{n-1/2}}{\Delta t}}\qquad \implies \qquad \mathbf {v} ^{n+1/2}=\mathbf {v} ^{n-1/2}+\Delta t~\mathbf {M} ^{-1}~\mathbf {f} ^{n}~.}
Initialize:
Set
t
=
0
{\displaystyle t=0}
and
n
=
0
{\displaystyle n=0}
.
Set the initial velocities (
v
0
{\displaystyle \mathbf {v} ^{0}}
) at the nodes.
Set the initial accelerations (
a
0
{\displaystyle \mathbf {a} ^{0}}
) at the nodes.
Set the initial stresses (
σ
0
{\displaystyle \sigma ^{0}}
) at the element Gauss points.
Compute the lumped mass
M
{\displaystyle \mathbf {M} }
at the nodes.
Set the displacements and velocities at the first time step:
Displacement:
u
0
=
0
.
{\displaystyle \mathbf {u} ^{0}=0~.}
Velocity:
v
1
/
2
=
v
0
+
Δ
t
2
a
0
.
{\displaystyle \mathbf {v} ^{1/2}=\mathbf {v} ^{0}+{\cfrac {\Delta t}{2}}~\mathbf {a} ^{0}~.}
Apply essential BCs:
[
v
1
/
2
]
Γ
v
=
v
¯
(
x
,
Δ
t
/
2
)
.
{\displaystyle [\mathbf {v} ^{1/2}]_{\Gamma _{v}}={\bar {\mathbf {v} }}(\mathbf {x} ,\Delta t/2)~.}
Update the nodal displacements:
u
1
=
u
0
+
Δ
t
v
1
/
2
.
{\displaystyle \mathbf {u} ^{1}=\mathbf {u} ^{0}+\Delta t~\mathbf {v} ^{1/2}~.}
Set
n
=
1
{\displaystyle n=1}
and
t
=
Δ
t
{\displaystyle t=\Delta t}
.
Loop through the following steps until
t
=
t
max
{\displaystyle t=t_{\text{max}}}
.
For each element (at the Gauss points):
Compute the strain measure:
ε
n
=
u
,
X
or
D
n
=
v
,
x
.
{\displaystyle \varepsilon ^{n}=u_{,X}~~{\text{or}}~~D^{n}=v_{,x}~.}
Compute the stress:
P
=
E
P
F
ε
n
or
σ
˙
=
E
σ
D
D
n
.
{\displaystyle P=E^{PF}~\varepsilon ^{n}~~{\text{or}}~~{\dot {\sigma }}=E^{\sigma D}~D^{n}~.}
For each node:
Compute the internal force
(
f
i
n
)
int
{\displaystyle (f_{i}^{n})_{\text{int}}}
.
Compute the external force
(
f
i
n
)
ext
{\displaystyle (f_{i}^{n})_{\text{ext}}}
.
Compute the total force
f
i
n
{\displaystyle f_{i}^{n}}
.
Compute the acceleration
a
i
n
{\displaystyle a_{i}^{n}}
:
a
i
n
=
M
i
i
−
1
f
i
n
.
{\displaystyle a_{i}^{n}=M_{ii}^{-1}~f_{i}^{n}~.}
Update the velocity
v
i
n
+
1
/
2
{\displaystyle v_{i}^{n+1/2}}
.
v
i
n
+
1
/
2
=
v
i
n
−
1
/
2
+
Δ
t
a
i
n
.
{\displaystyle v_{i}^{n+1/2}=v_{i}^{n-1/2}+\Delta t~a_{i}^{n}~.}
Apply the essential boundary conditions.
Update the displacement
u
i
n
+
1
{\displaystyle u_{i}^{n+1}}
.
u
i
n
+
1
=
u
i
n
+
Δ
t
v
i
n
+
1
/
2
.
{\displaystyle u_{i}^{n+1}=u_{i}^{n}+\Delta t~v_{i}^{n+1/2}~.}
Update the counters:
n
=
n
+
1
{\displaystyle n=n+1}
,
t
=
t
+
Δ
t
{\displaystyle t=t+\Delta t}
.
If the time step
Δ
t
{\displaystyle \Delta t}
is too large, the algorithm may not be stable and may give unreasonable results. To provide a check on the time step size, we use the CFL (Courant-Friedrichs-Lewy) condition to determine
Δ
t
{\displaystyle \Delta t}
. This condition (in 1-D) states that
Δ
t
crit
=
l
0
c
0
{\displaystyle {\Delta t_{\text{crit}}={\cfrac {l_{0}}{c_{0}}}}}
where
l
0
{\displaystyle l_{0}}
is the initial length of the element, and
c
0
{\displaystyle c_{0}}
is speed of sound in the material (wavespeed) given by
c
0
=
E
P
F
ρ
0
.
{\displaystyle {c_{0}={\cfrac {E^{PF}}{\rho _{0}}}~.}}