Time dependent problems are commonplace in physics, chemistry and many other
disciplines. In this post, I’ll introduce the FE formulation of linear
time-dependent problems and derive formulas for explicit and implicit Euler
integration.
The weak formulation of a first order time-dependent problem reads:
Find u ∈ V u \in V u ∈ V such that
m ( u ˙ , v ; t ) + a ( u , v ; t ) = b ( v ; t ) \begin{equation}
m(\dot{u}, v; t) + a(u,v; t) = b(v; t)
\htmlId{eq:timedependentweak1}{}
\tag{1}\end{equation} m ( u ˙ , v ; t ) + a ( u , v ; t ) = b ( v ; t ) ( 1 )
for all v ∈ V v \in V v ∈ V and t ∈ [ 0 , ∞ ) t \in [0,\infty) t ∈ [ 0 , ∞ ) .
We can convert (1) into a system of equations
M ( t ) u ˙ + A ( t ) u = b ( t ) \begin{equation}
\BM(t)\dot{\Bu} + \BA(t)\Bu = \Bb(t)
\tag{2}\end{equation} M ( t ) u ˙ + A ( t ) u = b ( t ) ( 2 )
where the components of the matrices and vectors involved are calculated as
M I J ( t ) = m ( N J , N I ; t ) A I J ( t ) = a ( N J , N I ; t ) b I ( t ) = b ( N I ; t ) . \begin{equation}
\begin{aligned}
M^{I\!J}(t) &= m(N^J, N^I; t) \\
A^{I\!J}(t) &= a(N^J, N^I; t) \\
b^{I}(t) &= b(N^I; t).
\end{aligned}
\tag{3}\end{equation} M I J ( t ) A I J ( t ) b I ( t ) = m ( N J , N I ; t ) = a ( N J , N I ; t ) = b ( N I ; t ) . ( 3 )
If we further discretize in time with the finite difference
u ˙ ≈ [ u n + 1 − u n ] / Δ t \dot{u} \approx [u_{n+1}-u_n]/{\Delta t} u ˙ ≈ [ u n + 1 − u n ] / Δ t , linearity allows us to write
m ( u ˙ , v ; t ) ≈ 1 Δ t [ m ( u n + 1 , v ; t n + 1 ) − m ( u n , v ; t n ) ] \begin{equation}
\boxed{
m(\dot{u}, v; t)
\approx \frac{1}{\Delta t} [m(u_{n+1}, v; t_{n+1}) - m(u_n, v; t_n)]
}
\htmlId{eq:discretetimedependent1}{}
\tag{4}\end{equation} m ( u ˙ , v ; t ) ≈ Δ t 1 [ m ( u n + 1 , v ; t n + 1 ) − m ( u n , v ; t n )] ( 4 )
This reflects on the system as
M ( t ) u ˙ ≈ 1 Δ t [ M n + 1 u n + 1 − M n u n ] \begin{equation}
\BM(t)\dot{\Bu} \approx
\frac{1}{\Delta t} [\BM_{n+1}\Bu_{n+1} - \BM_n\Bu_n]
\htmlId{eq:discretetimedependent2}{}
\tag{5}\end{equation} M ( t ) u ˙ ≈ Δ t 1 [ M n + 1 u n + 1 − M n u n ] ( 5 )
Here, u n + 1 : = u ( x , t n + 1 ) u_{n+1}:= u(x, t_{n+1}) u n + 1 := u ( x , t n + 1 ) ,
M n + 1 = M ( t n + 1 ) \BM_{n+1} = \BM(t_{n+1}) M n + 1 = M ( t n + 1 )
and vice versa for u n u_n u n and M n \BM_n M n .
Explicit Euler Scheme
For the explicit Euler scheme, we substitute evaluate the remaining terms at t n t_n t n
1 Δ t [ m ( u n + 1 , v ; t n + 1 ) − m ( u n , v ; t n ) ] + a ( u n , v ; t n ) = b ( v ; t n ) ∀ v ∈ V . \begin{equation}
\frac{1}{\Delta t} [m(u_{n+1}, v; t_{n+1}) - m(u_n, v; t_n)]
+ a(u_n,v; t_n) = b(v; t_n)
\quad
\forall v \in V\,.
\tag{6}\end{equation} Δ t 1 [ m ( u n + 1 , v ; t n + 1 ) − m ( u n , v ; t n )] + a ( u n , v ; t n ) = b ( v ; t n ) ∀ v ∈ V . ( 6 )
The corresponding system is
1 Δ t [ M n + 1 u n + 1 − M n u n ] + A n u n = b n \begin{equation}
\frac{1}{\Delta t} [\BM_{n+1}\Bu_{n+1} - \BM_n\Bu_n]
+ \BA_n\Bu_n = \Bb_n
\tag{7}\end{equation} Δ t 1 [ M n + 1 u n + 1 − M n u n ] + A n u n = b n ( 7 )
The update equation becomes
u n + 1 = M n + 1 − 1 [ M n u n + Δ t ( b n − A n u n ) ] \begin{equation}
\boxed{
\Bu_{n+1} = \BM_{n+1}\inv [\BM_n\Bu_n + \Delta t(\Bb_n - \BA_n\Bu_n)]
}
\tag{8}\end{equation} u n + 1 = M n + 1 − 1 [ M n u n + Δ t ( b n − A n u n )] ( 8 )
If m m m is time-independent, that is m ( u ˙ , v ; t ) = m ( u ˙ , v ) m(\dot{u}, v;t) = m(\dot{u}, v) m ( u ˙ , v ; t ) = m ( u ˙ , v ) , we have
u n + 1 = u n + Δ t M − 1 ( b n − A n u n ) \begin{equation}
\Bu_{n+1} = \Bu_n + \Delta t\, \BM\inv(\Bb_n - \BA_n\Bu_n)
\tag{9}\end{equation} u n + 1 = u n + Δ t M − 1 ( b n − A n u n ) ( 9 )
Implicit Euler Scheme
For the implicit Euler scheme, we substitute evaluate the remaining terms at t n + 1 t_{n+1} t n + 1
1 Δ t [ m ( u n + 1 , v ; t n + 1 ) − m ( u n , v ; t n ) ] + a ( u n , v ; t n + 1 ) = b ( v ; t n + 1 ) ∀ v ∈ V . \begin{equation}
\frac{1}{\Delta t} [m(u_{n+1}, v; t_{n+1}) - m(u_n, v; t_n)]
+ a(u_n,v; t_{n+1}) = b(v; t_{n+1})
\quad
\forall v \in V\,.
\tag{10}\end{equation} Δ t 1 [ m ( u n + 1 , v ; t n + 1 ) − m ( u n , v ; t n )] + a ( u n , v ; t n + 1 ) = b ( v ; t n + 1 ) ∀ v ∈ V . ( 10 )
The corresponding system is
1 Δ t [ M n + 1 u n + 1 − M n u n ] + A n + 1 u n + 1 = b n + 1 \begin{equation}
\frac{1}{\Delta t} [\BM_{n+1}\Bu_{n+1} - \BM_n\Bu_n]
+ \BA_{n+1}\Bu_{n+1} = \Bb_{n+1}
\tag{11}\end{equation} Δ t 1 [ M n + 1 u n + 1 − M n u n ] + A n + 1 u n + 1 = b n + 1 ( 11 )
The update equation becomes
u n + 1 = [ M n + 1 + Δ t A n + 1 ] − 1 [ M n u n + Δ t b n + 1 ] \begin{equation}
\boxed{
\Bu_{n+1} = [\BM_{n+1}+\Delta t \BA_{n+1}]\inv [\BM_n\Bu_n + \Delta t \,\Bb_{n+1}]
}
\tag{12}\end{equation} u n + 1 = [ M n + 1 + Δ t A n + 1 ] − 1 [ M n u n + Δ t b n + 1 ] ( 12 )
If m m m is time-independent, one can just substitute M = M n + 1 = M n \BM=\BM_{n+1}=\BM_n M = M n + 1 = M n .
Example: Reaction-Advection-Diffusion Equation
The IBVP of a linear reaction-advection-diffusion problem reads
∂ u ∂ t = ∇ ⋅ ( D ∇ u ) − ∇ ⋅ ( c u ) + r u + f in Ω × I u = u ˉ on ∂ Ω × I u = u 0 in Ω , t = 0 \begin{equation}
\begin{alignedat}{4}
\partd{u}{t} &=
\nabla\dtp(\BD\nabla u) - \nabla\dtp(\Bc u) + ru + f
\qquad&& \text{in} \qquad&& \Omega\times I\\
u &= \bar{u} && \text{on} && \del\Omega\times I\\
u &= u_0 && \text{in} && \Omega, t = 0 \\
\end{alignedat}
\tag{13}\end{equation} ∂ t ∂ u u u = ∇ ⋅ ( D ∇ u ) − ∇ ⋅ ( c u ) + r u + f = u ˉ = u 0 in on in Ω × I ∂ Ω × I Ω , t = 0 ( 13 )
where t ∈ I = [ 0 , ∞ ) t\in I = [0,\infty) t ∈ I = [ 0 , ∞ ) ,
D \BD D is a second-order tensor describing the diffusivity of u u u ,
c \Bc c is a vector describing the velocity of advection,
r r r is a scalar describing the rate of reaction,
and f f f is a source term for u u u .
The weak formulation is then
Find u ∈ V u \in V u ∈ V such that
∫ Ω u ˙ v d v = ∫ Ω [ ∇ ⋅ ( D ∇ u ) − ∇ ⋅ ( c u ) + r u + f ] v d v \begin{equation}
\int_\Omega \dot{u} v \dv =
\int_\Omega [\nabla\dtp(\BD\nabla u) - \nabla\dtp(\Bc u) + ru + f] v \dv
\tag{14}\end{equation} ∫ Ω u ˙ v d v = ∫ Ω [ ∇ ⋅ ( D ∇ u ) − ∇ ⋅ ( c u ) + r u + f ] v d v ( 14 )
for all v ∈ V v \in V v ∈ V and t ∈ I t \in I t ∈ I .
We have the following integration by parts relationships:
∫ Ω ∇ ⋅ ( D ∇ u ) v d v = ∫ Ω ∇ ⋅ ( v D ∇ u ) d v − ∫ Ω ( D ∇ u ) ⋅ ∇ v d v \begin{equation}
\int_\Omega \nabla \dtp(\BD\nabla u) v \dv
= \cancel{\int_\Omega \nabla\dtp(v\BD\nabla u) \dv}
- \int_\Omega (\BD\nabla u)\dtp\nabla v \dv
\end{equation} ∫ Ω ∇ ⋅ ( D ∇ u ) v d v = ∫ Ω ∇ ⋅ ( v D ∇ u ) d v − ∫ Ω ( D ∇ u ) ⋅ ∇ v d v
for the diffusive part and
∫ Ω ∇ ⋅ ( c u ) v d v = ∫ Ω ∇ ⋅ ( c u v ) d v − ∫ Ω u c ⋅ ∇ v d v \begin{equation}
\int_\Omega \nabla\dtp(\Bc u) v \dv
= \cancel{\int_\Omega \nabla \dtp (\Bc u v) \dv}
- \int_\Omega u \Bc \dtp \nabla v \dv
\tag{15}\end{equation} ∫ Ω ∇ ⋅ ( c u ) v d v = ∫ Ω ∇ ⋅ ( c uv ) d v − ∫ Ω u c ⋅ ∇ v d v ( 15 )
for the advective part. The canceled terms are due to divergence theorem and
the fact that v = 0 v=0 v = 0 on the boundary. Then our variational formulation is of
the form (1) where
m ( u ˙ , v ) = ∫ Ω u ˙ v d v a ( u , v ) = ∫ Ω ( D ∇ u ) ⋅ ∇ v d v − ∫ Ω u c ⋅ ∇ v d v − ∫ Ω r u v d v b ( v ) = ∫ Ω f v d v \begin{align*}
m(\dot{u}, v) &= \int_\Omega \dot{u} v \dv \\
a(u, v) &= \int_\Omega (\BD\nabla u) \dtp \nabla v \dv
- \int_\Omega u\Bc \dtp \nabla v \dv
- \int_\Omega ruv \dv \\
b(v) &= \int_\Omega fv \dv
\end{align*} m ( u ˙ , v ) a ( u , v ) b ( v ) = ∫ Ω u ˙ v d v = ∫ Ω ( D ∇ u ) ⋅ ∇ v d v − ∫ Ω u c ⋅ ∇ v d v − ∫ Ω r uv d v = ∫ Ω f v d v
From these forms, we obtain the following system matrices and vector
M I J = ∫ Ω N J N I d v A I J = ∫ Ω ( D B J ) ⋅ B I d v − ∫ Ω N J c ⋅ B I d v − ∫ Ω r N J N I d v b I = ∫ Ω f N I d v \begin{align*}
M^{I\!J} &= \int_\Omega N^J N^I \dv \\
A^{I\!J} &= \int_\Omega (\BD\BB^J) \dtp \BB^I \dv
- \int_\Omega N^J\Bc \dtp \BB^I \dv
- \int_\Omega r N^JN^I \dv \\
b^I &= \int_\Omega f N^I \dv
\end{align*} M I J A I J b I = ∫ Ω N J N I d v = ∫ Ω ( D B J ) ⋅ B I d v − ∫ Ω N J c ⋅ B I d v − ∫ Ω r N J N I d v = ∫ Ω f N I d v
where M \BM M is constant through time.