Entries for December 2017

  1. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/12/22

    Nonlinear Finite Elements

    This post builds on the formulations I showed in my previous posts by introducing their nonlinear versions.

    In a typical nonlinear problem, the variational setting leads to the weak formulation

    Find u∈Vu\in V such that

    F(u,v)=0\begin{equation} F(u,v) = 0 \htmlId{eq:femnonlinear2}{} \tag{1}\end{equation}

    for all v∈Vv\in V where the semilinear form FF is nonlinear in terms of uu and linear in terms of vv.

    We linearize FF:

    Lin[F(u,v)]u=uˉ=F(uˉ,v)+DuF(u,v)⋅Δu∣u=uˉ\begin{equation} \Lin [F(u,v)]_{u=\bar{u}} = F(\bar{u}, v) + \varn{F(u,v)}{u}{\Var u}\evat_{u=\bar{u}} \htmlId{eq:femnonlinear4}{} \tag{2}\end{equation}

    Equating (2) to zero yields a linear system in terms of Δu\Var u

    a(Δu,v)=b(v)\begin{equation} \boxed{ a(\Var u, v) = b(v) } \htmlId{eq:femnonlinear6}{} \tag{3}\end{equation}

    where

    a(Δu,v)=DuF(u,v)⋅Δu∣u=uˉb(v)=−F(uˉ,v).\begin{equation} \boxed{ \begin{aligned} a(\Var u, v) &= \varn{F(u,v)}{u}{\Var u}\evat_{u=\bar{u}} \\ b(v) &= -F(\bar{u}, v) . \end{aligned} } \htmlId{eq:femnonlinear5}{} \tag{4}\end{equation}

    We can compute the components of the matrices and vectors according to (3)

    AI ⁣J=a(NJ,NI)=DuF(u,NI)⋅NJ∣u=uˉbI=b(NI)=−F(uˉ,NI).\begin{equation} \boxed{ \begin{alignedat}{3} \Aelid{I\!J}{} &= a(N^J,N^I) &&= \varn{F(u,N^I)}{u}{N^J}\evat_{u=\bar{u}} \\ b^{I} &= b(N^I) &&= -F(\bar{u}, N^I). \end{alignedat} } \htmlId{eq:femnonlinear9}{} \tag{5}\end{equation}

    Then the update vector Δu=[Δu1,Δu2,…,Δunn]T\Var \Bu = [\Var u^1, \Var u^2, \dots, \Var u^{\nnode}]\tra is obtained by solving

    AΔu=b\begin{equation} \BA \Var \Bu = \Bb \tag{6}\end{equation}

    Letting Δu\Var u be the difference between consequent iterates, we obtain the update equation as

    u←uˉ+Δu\begin{equation} \boxed{ \Bu \leftarrow \bar{\Bu} + \Var\Bu } \tag{7}\end{equation}

    Example: Nonlinear Poisson’s Equation

    Consider the following nonlinear Poisson’s equation

    −∇⋅(g(u)∇u)=finΩu=0on∂Ω\begin{equation} \begin{alignedat}{4} - \nabla \dtp (g(u)\nabla u) &= f \quad && \text{in} \quad && \Omega \\ u &= 0 \quad && \text{on} \quad && \del\Omega \end{alignedat} \htmlId{eq:femnonlinear8}{} \tag{8}\end{equation}

    The weak formulation reads

    Find u∈Vu\in V such that

    −∫Ω∇⋅(g(u)∇u)v dv=∫Ωfv dv\begin{equation} - \int_\Omega \nabla \dtp (g(u)\nabla u) v \dv= \int_\Omega f v \dv \tag{9}\end{equation}

    for all v∈Vv\in V where V=H01(Ω)V=H^1_0(\Omega).

    Applying integration by parts and divergence theorem on the left-hand side

    ∫Ω∇⋅(g(u)∇u)v dv=∫Ω∇⋅(g(u)∇(u)v) dv−∫Ωg(u)∇u⋅∇v dv=∫∂Ωg(u)v(∇u⋅n) da⏟v=0 on ∂Ω−∫Ωg(u)∇u⋅∇v dv\begin{equation} \begin{aligned} \int_\Omega \nabla \dtp (g(u)\nabla u) v \dv &= \int_\Omega \nabla \dtp (g(u)\nabla (u) v) \dv - \int_\Omega g(u)\nabla u\dtp\nabla v \dv \\ &= \underbrace{\int_{\del\Omega} g(u) v (\nabla u\dtp\Bn) \da}_{v = 0 \text{ on } \del\Omega} - \int_\Omega g(u)\nabla u\dtp\nabla v \dv \\ \end{aligned} \tag{10}\end{equation}

    Thus we have the semilinear form

    F(u,v)=∫Ωg(u)∇u⋅∇v dv−∫Ωf v dv=0\begin{equation} F(u,v) = \int_{\Omega} g(u) \nabla u \dtp \nabla v \dv - \int_{\Omega} f \, v \dv = 0 \tag{11}\end{equation}

    The linearized version of this problem is then with (4)

    a(Δu,v)=∫Ω(dgdu∣uˉΔu ∇uˉ+g(uˉ)∇(Δu))⋅∇v dvb(v)=∫Ω[f v−g(uˉ)∇uˉ⋅∇v] dv\begin{equation} \begin{aligned} a(\Var u,v) &= \int_{\Omega} \rbr{\deriv{g}{u}\evat_{\bar{u}} \Var u\, \nabla \bar{u} + g(\bar{u})\nabla(\Var u)} \dtp \nabla v \dv \\ b(v) &= \int_{\Omega} [f \, v - g(\bar{u}) \nabla \bar{u} \dtp \nabla v] \dv\\ \end{aligned} \tag{12}\end{equation}

    and the matrix and vector components are with (5)

    AI ⁣J=∫Ω(dgdu∣uˉNJ ∇uˉ+g(uˉ)BJ)⋅BI dvbI=∫Ω[f NI−g(uˉ)∇uˉ⋅BI] dv\begin{equation} \begin{aligned} \Aelid{I\!J}{} &= \int_{\Omega} \rbr{\deriv{g}{u}\evat_{\bar{u}} N^J \, \nabla \bar{u} + g(\bar{u})\BB^J} \dtp \BB^I \dv \\ b^{I} &= \int_{\Omega} [f \, N^I - g(\bar{u}) \nabla \bar{u} \dtp \BB^I ] \dv\\ \end{aligned} \tag{13}\end{equation}

    where the previous solution and its gradient are computed as

    uˉ=∑I=1nnuˉINIand∇uˉ=∑I=1nnuˉIBI.\begin{equation} \bar{u} = \suml{I=1}{\nnode} \bar{u}^I N^I \eqand \nabla \bar{u} = \suml{I=1}{\nnode} \bar{u}^I \BB^I . \tag{14}\end{equation}

    Nonlinear Time-Dependent Problems

    In the case of a nonlinear time-dependent problem, we have the following weak form:

    Find u∈Vu \in V such that

    m(u˙,v;t)+F(u,v;t)=0\begin{equation} m(\dot{u}, v; t) + F(u,v; t) = 0 \htmlId{eq:nonlineartimedependentweak1}{} \tag{15}\end{equation}

    for all v∈Vv \in V and t∈[0,∞)t \in [0,\infty) where FF is a semilinear form.

    Discretization yields the following nonlinear system of equations

    M(t)u+f(u;t)=0\begin{equation} \BM(t)\Bu + \Bf(u; t) = \Bzero \tag{16}\end{equation}

    where

    MI ⁣J(t)=m(NJ,NI;t)fI(u;t)=F(u,NI;t).\begin{equation} \begin{aligned} M^{I\!J}(t) &= m(N^J, N^I; t) \\ f^{I}(u;t) &= F(u, N^I; t). \end{aligned} \tag{17}\end{equation}

    Explicit Euler Scheme

    We discretize in time with the finite difference u˙≈[un+1−un]/Δt\dot{u} \approx [u_{n+1}-u_n]/{\Delta t} and linearity allows us to write

    \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)] } \label{eq:discretetimedependent1} \end{equation}

    We discretize the variational forms in time according to \eqref{eq:discretetimedependent1}, and evaluate the remaining terms at tnt_n:

    1Δt[m(un+1,v;tn+1)−m(un,v;tn)]+F(un,v;tn)=0\begin{equation} \frac{1}{\Delta t} [m(u_{n+1},v;t_{n+1}) - m(u_{n},v;t_{n})] + F(u_n, v; t_n) = 0 \tag{18}\end{equation}

    The corresponding system of equations is

    1Δt[Mn+1un+1−Mnun]+fn=0\begin{equation} \frac{1}{\Delta t} [\BM_{n+1}\Bu_{n+1} - \BM_n\Bu_n] + \Bf_n = \Bzero \tag{19}\end{equation}

    where fn=f(un,tn)\Bf_n = \Bf(u_n, t_n). This yields the following update equation

    un+1=Mn+1−1[Mnun−Δtfn]\begin{equation} \boxed{ \Bu_{n+1} = \BM_{n+1}\inv [\BM_n\Bu_n - \Delta t \Bf_n] } \tag{20}\end{equation}

    For a time-independent mm, this becomes

    un+1=un−ΔtM−1fn\begin{equation} \Bu_{n+1} = \Bu_n - \Delta t \BM\inv\Bf_n \tag{21}\end{equation}

    Implicit Euler Scheme

    For the implicit scheme, we evaluate the remaining terms at tn+1t_{n+1} and let the result be equal to

    G(un+1,v):=1Δt[m(un+1,v;tn+1)−m(un,v;tn)]+F(un+1,v;tn+1)=0\begin{equation} G(u_{n+1}, v) := \frac{1}{\Delta t} [m(u_{n+1},v;t_{n+1}) - m(u_{n},v;t_{n})] + F(u_{n+1}, v; t_{n+1}) = 0 \tag{22}\end{equation}

    We will hereon replace un+1u_{n+1} with uu for brevity. The update of this nonlinear system requires the linearization of G(u,v)G(u, v):

    Lin[G(u,v)]u=uˉ=G(uˉ,v)+DuG⋅Δu∣u=uˉ=0\begin{equation} \Lin[G(u,v)]_{u=\bar{u}} = G(\bar{u}, v) + \varn{G}{u}{\Var u}\evat_{u=\bar{u}} = 0 \tag{23}\end{equation}

    We thus have the following linear setting for the Newton update Δu\Var u:

    a(Δu,v)=b(v)\begin{equation} a(\Var u, v) = b(v) \tag{24}\end{equation}

    where

    a(Δu,v):=DuG⋅Δu∣u=uˉ=1Δtm(Δu,v;tn+1)+DuF(u,v;tn+1)⋅Δu∣u=uˉb(v):=−G(uˉ,v)=−F(uˉ,v;tn+1)−1Δt[m(uˉ,v;tn+1)−m(un,v;tn)]\begin{equation} \begin{aligned} a(\Var u, v) &:= \varn{G}{u}{\Var u} \evat_{u=\bar{u}} = \frac{1}{\Delta t} m(\Var u, v; t_{n+1}) + \varn{F(u, v; t_{n+1})}{u}{\Var u} \evat_{u=\bar{u}} \\ b(v) &:= -G(\bar{u}, v) = - F(\bar{u}, v; t_{n+1}) -\frac{1}{\Delta t} [m(\bar{u},v;t_{n+1}) - m(u_{n},v;t_{n})] \end{aligned} \tag{25}\end{equation}

    Discretization yields

    (1ΔtMn+1+A~)Δu=b\begin{equation} \rbr{\frac{1}{\Delta t} \BM_{n+1} + \tilde{\BA}}\Var \Bu = \Bb \tag{26}\end{equation}

    where

    A~I ⁣J:=DuF(u,NI;tn+1)⋅NJ∣u=uˉandbI:=b(NI)\begin{equation} \tilde{A}^{I\!J} := \varn{F(u, N^I;t_{n+1})}{u}{N^J} \evat_{u=\bar{u}} \eqand b^I := b(N^I) \tag{27}\end{equation}

    The Newton update is rendered

    u←uˉ+ΔuandΔu=[1ΔtMn+1+A~]−1b\begin{equation} \boxed{ \Bu \leftarrow \bar{\Bu} + \Var\Bu \eqwith \Var \Bu = [\frac{1}{\Delta t} \BM_{n+1} + \tilde{\BA}]\inv\Bb } \tag{28}\end{equation}

    which is repeated until the solution for the next timestep u\Bu converges to a satisfactory value.

    Nonlinear Coupled Problems

    For a nonlinear coupled problem, the weak formulation is as follows

    Find u∈V1u\in V_1, y∈V2y\in V_2 such that

    F(u,y,v)=0G(u,y,w)=0\begin{equation} \begin{aligned} F(u, y, v) &= 0 \\ G(u, y, w) &= 0 \\ \end{aligned} \htmlId{eq:nonlinearcoupled1}{} \tag{29}\end{equation}

    for all v∈V1v\in V_1, w∈V2w \in V_2 where F(⋅,⋅,⋅)F(\cdot,\cdot, \cdot), G(⋅,⋅,⋅)G(\cdot, \cdot, \cdot) are nonlinear in terms of uu and yy and linear in terms of vv and ww.

    We linearize the semilinear forms about the nonlinear terms:

    Lin[F(u,y,v)]uˉ,yˉ=F(uˉ,yˉ,v)+DuF(u,y,v)⋅Δu∣uˉ,yˉ+DyF(u,y,v)⋅Δy∣uˉ,yˉLin[G(u,y,w)]uˉ,yˉ=G(uˉ,yˉ,w)+DuG(u,y,w)⋅Δu∣uˉ,yˉ+DyG(u,y,w)⋅Δy∣uˉ,yˉ\begin{equation} \begin{alignedat}{4} \Lin[F(u, y, v)]_{\bar{u},\bar{y}} &= F(\bar{u},\bar{y},v) &&+ \varn{F(u, y, v)}{u}{\Var u} \evat_{\bar{u},\bar{y}} &&+ \varn{F(u, y, v)}{y}{\Var y} \evat_{\bar{u},\bar{y}} \\ \Lin[G(u, y, w)]_{\bar{u},\bar{y}} &= G(\bar{u},\bar{y},w) &&+ \varn{G(u, y, w)}{u}{\Var u} \evat_{\bar{u},\bar{y}} &&+ \varn{G(u, y, w)}{y}{\Var y} \evat_{\bar{u},\bar{y}} \end{alignedat} \htmlId{eq:nonlinearcoupled2}{} \tag{30}\end{equation}

    where the evaluations take place at u=uˉu=\bar{u} and y=yˉy=\bar{y}.

    Equating the linearized residuals to zero, we obtain a linear system of the form

    a(u,v)+b(y,v)=c(v)d(u,w)+e(y,w)=f(w)\begin{equation} \begin{alignedat}{3} a(u, v) &+ b(y, v) &&= c(v) \\ d(u, w) &+ e(y, w) &&= f(w) \\ \end{alignedat} \htmlId{eq:coupledweakform1}{} \tag{31}\end{equation}

    with the bilinear forms aa, bb, dd, ee and the linear forms cc, ff which are defined as

    a(Δu,v):=DuF(u,y,v)⋅Δu∣uˉ,yˉb(Δy,v):=DyF(u,y,v)⋅Δy∣uˉ,yˉd(Δu,w):=DuG(u,y,w)⋅Δu∣uˉ,yˉe(Δy,w):=DyG(u,y,w)⋅Δy∣uˉ,yˉandc(v):=−F(uˉ,yˉ,v)f(w):=−G(uˉ,yˉ,w)\begin{equation} \begin{gathered} \begin{alignedat}{4} a(\Var u, v) &:= \varn{F(u, y, v)}{u}{\Var u} \evat_{\bar{u},\bar{y}} \quad & b(\Var y, v) &:= \varn{F(u, y, v)}{y}{\Var y} \evat_{\bar{u},\bar{y}} \\ d(\Var u, w) &:= \varn{G(u, y, w)}{u}{\Var u} \evat_{\bar{u},\bar{y}} \quad & e(\Var y, w) &:= \varn{G(u, y, w)}{y}{\Var y} \evat_{\bar{u},\bar{y}} \end{alignedat} \\ \text{and} \\ \begin{aligned} c(v) &:= -F(\bar{u},\bar{y},v) \\ f(w) &:= -G(\bar{u}, \bar{y}, w) \end{aligned} \end{gathered} \tag{32}\end{equation}

    Discretizing as done in the previous section, we obtain the following linear system of equations

    [ABDE][ΔuΔy]=[cf]\begin{equation} \begin{bmatrix} \BA & \BB \\ \BD & \BE \end{bmatrix} \begin{bmatrix} \Var \Bu \\ \Var \By \end{bmatrix} = \begin{bmatrix} \Bc \\ \Bf \end{bmatrix} \tag{33}\end{equation}

    whose solution yields the update values Δu\Var \Bu and Δy\Var \By. Thus the Newton update equations are

    u←uˉ+Δuy←yˉ+Δy.\begin{equation} \begin{alignedat}{3} \Bu &\leftarrow \bar{\Bu} &&+ \Var\Bu \\ \By &\leftarrow \bar{\By} &&+ \Var\By . \end{alignedat} \tag{34}\end{equation}

    Example: Cahn-Hilliard Equation

    The Cahn-Hilliard equation describes the process of phase separation, by which the two components of a binary fluid spontaneously separate and form domains pure in each component. The problem is nonlinear, coupled and time-dependent. The IBVP reads

    ∂c∂t=∇⋅(M∇μ)inΩ×I∇c⋅n=0on∂Ω×I∇μ⋅n=0on∂Ω×Ic=c0inΩ,t=0μ=0inΩ,t=0\begin{equation} \begin{alignedat}{4} \partd{c}{t} &= \nabla\dtp(\BM\nabla \mu) \qquad&& \text{in} \qquad&& \Omega\times I \\ \nabla c\dtp\Bn &= 0 && \text{on} && \del\Omega\times I\\ \nabla \mu\dtp\Bn &= 0 && \text{on} && \del\Omega\times I\\ c &= c_0 && \text{in} && \Omega, t = 0 \\ \mu &= 0 && \text{in} && \Omega, t = 0 \\ \end{alignedat} \htmlId{eq:cahnhilliard1}{} \tag{35}\end{equation}

    where

    μ=dfdc−∇⋅(Λ∇c)\begin{equation} \mu = \deriv{f}{c} - \nabla\dtp(\BLambda\nabla c) \htmlId{eq:cahnhilliard2}{} \tag{36}\end{equation}

    and t∈I=[0,∞)t\in I = [0,\infty). Here,

    • cc is the scalar variable for concentration,
    • μ\mu is the scalar variable for the chemical potential,
    • f:c↦f(c)f: c \mapsto f(c) is the function representing chemical free energy,
    • M\BM is a second-order tensor describing the mobility of the chemical,
    • Λ\BLambda is a second-order tensor describing both the interface thickness and direction of phase transition.

    The fourth-order PDE governing the problem can be formulated as a coupled system of two second-order PDEs with the variables cc and μ\mu, as demonstrated in (35) and (36).

    The weak formulation then reads

    Find c∈V1c \in V_1, μ∈V2\mu\in V_2 such that

    ∫Ω∂c∂tv dx−∫Ω∇⋅(M∇μ)v dx=0∫Ω[μ−dfdc]w dx+∫Ω∇⋅(Λ∇c)w dx=0\begin{equation} \begin{aligned} \int_\Omega \partd{c}{t} v \dx - \int_\Omega \nabla\dtp(\BM\nabla \mu) v \dx &=0 \\ \int_\Omega \sbr{\mu - \deriv{f}{c}} w \dx + \int_\Omega \nabla\dtp(\BLambda\nabla c) w\dx &= 0 \end{aligned} \tag{37}\end{equation}

    for all v∈V1v \in V_1, w∈V2w \in V_2 and t∈It \in I.

    We discretize in time implicitly with ∂c/∂t≈(cn+1−cn)/Δt\del c/\del t \approx (c_{n+1}-c_n)/\Var t. We also denote the values for the next timestep cn+1c_{n+1} and μn+1\mu_{n+1} as cc and μ\mu for brevity. Using integration-by-parts, the divergence theorem, and the given boundary conditions, we arrive at the following nonlinear forms

    F(c,μ,v)=∫Ω1Δt(c−cn)v dx+∫Ω(M∇μ)⋅∇v dx=0G(c,μ,w)=∫Ω[μ−dfdc]w dx−∫Ω(Λ∇c)⋅∇w dx=0\begin{equation} \begin{alignedat}{3} F(c,\mu,v) &= \int_\Omega \frac{1}{\Var t} (c-c_n) v \dx + \int_\Omega (\BM\nabla \mu)\dtp \nabla v \dx &&= 0 \\ G(c,\mu,w) &= \int_\Omega \sbr{\mu - \deriv{f}{c}} w \dx - \int_\Omega (\BLambda\nabla c)\dtp \nabla w\dx &&= 0 \end{alignedat} \tag{38}\end{equation}

    which is a nonlinear coupled system of the form (29).

    We linearize the forms according to (30) and obtain the following variations

    DcF⋅Δc=∫Ω1ΔtΔc v dxDμF⋅Δμ=∫Ω(M∇(Δμ))⋅∇v dxDcG⋅Δc=−∫Ωd2fdc2Δc w dx−∫Ω(Λ∇(Δc))⋅∇w dxDμG⋅Δμ=∫ΩΔμ w dx\begin{align*} \varn{F}{c}{\Var c} &= \int_\Omega \frac{1}{\Var t} \Var c\, v \dx \\ \varn{F}{\mu}{\Var \mu} &= \int_\Omega (\BM\nabla (\Var\mu))\dtp \nabla v \dx \\ \varn{G}{c}{\Var c} &= - \int_\Omega \dderiv{f}{c}\Var c \, w \dx - \int_\Omega (\BLambda\nabla (\Var c))\dtp \nabla w\dx \\ \varn{G}{\mu}{\Var \mu} &= \int_\Omega \Var\mu \, w \dx \end{align*}

    We substitute basis functions and obtain our system matrix and vectors

    PI ⁣J=∫Ω1ΔtNJNI dxQIL=∫Ω(MBL)⋅BI dxrI=∫Ω1Δt(cˉ−cn)NI dx+∫Ω(M∇μˉ)⋅BI dxSK ⁣J=−∫Ωd2fdc2∣c=cˉNJNK dx−∫Ω(ΛBJ)⋅BK dxTK ⁣L=∫ΩNLNK dxuK=∫Ω[μˉ−dfdc∣c=cˉ]NK dx−∫Ω(Λ∇cˉ)⋅BK dx\begin{align*} P^{I\!J} &= \int_\Omega \frac{1}{\Var t} N^JN^I \dx \\ Q^{IL} &= \int_\Omega (\BM\BB^L)\dtp\BB^I \dx \\ r^{I} &= \int_\Omega \frac{1}{\Var t}(\bar{c}-c_n)N^I \dx + \int_\Omega (\BM\nabla\bar{\mu})\dtp\BB^I\dx \\ S^{K\!J} &= - \int_\Omega \dderiv{f}{c}\evat_{c=\bar{c}} N^J N^K \dx - \int_\Omega (\BLambda \BB^J)\dtp \BB^K\dx \\ T^{K\!L} &= \int_\Omega N^L N^K \dx \\ u^{K} &= \int_\Omega \sbr{\bar{\mu} - \deriv{f}{c}\evat_{c=\bar{c}}} N^K \dx - \int_\Omega (\BLambda\nabla \bar{c})\dtp \BB^K\dx \end{align*}

    which constitute the system

    [PQST][ΔcΔμ]=[ru]\begin{equation} \begin{bmatrix} \BP & \BQ \\ \BS & \BT \end{bmatrix} \begin{bmatrix} \Var \Bc \\ \Var \Bmu \end{bmatrix} = \begin{bmatrix} \Br \\ \Bu \end{bmatrix} \tag{39}\end{equation}

    Solution yields the update values Δc\Var \Bc and Δμ\Var \Bmu. The Newton update equations are then

    c←cˉ+Δcμ←μˉ+Δμ.\begin{equation} \begin{alignedat}{3} \Bc &\leftarrow \bar{\Bc} &&+ \Var\Bc \\ \Bmu &\leftarrow \bar{\Bmu} &&+ \Var\Bmu . \end{alignedat} \tag{40}\end{equation}

    The system is solved for cn+1c_{n+1} and μn+1\mu_{n+1} at each t=tnt=t_n to obtain the evolutions of the concentration and chemical potential.

  2. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/12/12

    Coupled Finite Elements

    In this post, I’ll introduce the FE formulation of a generalized linear and coupled weak form. Said weak formulation has the form

    Find u∈V1u\in V_1, y∈V2y\in V_2 such that

    a(u,v)+b(y,v)=c(v)d(u,w)+e(y,w)=f(w)\begin{equation} \begin{alignedat}{3} a(u, v) &+ b(y, v) &&= c(v) \\ d(u, w) &+ e(y, w) &&= f(w) \\ \end{alignedat} \htmlId{eq:coupledweakform1}{} \tag{1}\end{equation}

    for all v∈V1v\in V_1, w∈V2w \in V_2 where a(⋅,⋅):V1×V1→Ra(\cdot, \cdot): V_1\times V_1 \to \IR, b(⋅,⋅):V2×V1→Rb(\cdot, \cdot): V_2\times V_1 \to \IR, d(⋅,⋅):V1×V2→Rd(\cdot, \cdot): V_1\times V_2 \to \IR, e(⋅,⋅):V2×V2→Re(\cdot, \cdot): V_2\times V_2 \to \IR are bilinear forms and c(⋅):V1→Rc(\cdot): V_1\to \IR, f(⋅):V2→Rf(\cdot): V_2\to \IR are linear forms.

    Here, the objective is to solve for the two unknown functions uu and yy. One can also imagine an arbitrary degree of coupling between nn variables with nn equations.

    We introduce the following discretizations

    uh=∑J=1nn1uJNJvh=∑I=1nn1uINIuh,vh∈Vh1yh=∑L=1nn2uLNLwh=∑K=1nn2uKNKyh,wh∈Vh2\begin{equation} \begin{alignedat}{3} u_h &= \suml{J=1}{n_n^1} u^J N^J \qquad\qquad & v_h &= \suml{I=1}{n_n^1} u^I N^I \qquad\qquad & u_h, v_h\in V_{h1} \\ y_h &= \suml{L=1}{n_n^2} u^L N^L & w_h &= \suml{K=1}{n_n^2} u^K N^K & y_h, w_h\in V_{h2} \\ \end{alignedat} \tag{2}\end{equation}

    where the corresponding number of shape functions are nn1n_n^1 and nn2n_n^2, respectively.

    Substituting the discretizations in (1), we obtain two linear systems of equations

    ∑J=1nn1a(NJ,NI) uJ+∑L=1nn2b(NL,NI) yL=c(NI)∑J=1nn1d(NJ,NK) uJ+∑L=1nn2e(NL,NK) yL=f(NK)\begin{equation} \begin{alignedat}{3} \suml{J=1}{n_n^1} a(N^J, N^I) \,u^J &+ \suml{L=1}{n_n^2} b(N^L, N^I) \, y^L &&= c(N^I) \\ \suml{J=1}{n_n^1} d(N^J, N^K) \,u^J &+ \suml{L=1}{n_n^2} e(N^L, N^K) \, y^L &&= f(N^K) \\ \end{alignedat} \tag{3}\end{equation}

    for I=1,…,nn1I=1,\dots,n_n^1 and K=1,…,nn2K=1,\dots,n_n^2.

    We write this system as

    Au+By=cDu+Ey=for[ABDE][uy]=[cf]\begin{equation} \boxed{ \begin{alignedat}{3} \BA \Bu &+ \BB\By &&= \Bc \\ \BD \Bu &+ \BE\By &&= \Bf \\ \end{alignedat} \eqor \begin{bmatrix} \BA & \BB \\ \BD & \BE \end{bmatrix} \begin{bmatrix} \Bu \\ \By \end{bmatrix} = \begin{bmatrix} \Bc \\ \Bf \end{bmatrix} } \htmlId{eq:coupledsystem1}{} \tag{4}\end{equation}

    where the components of given matrices and vectors are defined as

    AI ⁣J:=a(NJ,NI)BI ⁣L:=b(NL,NI)cI:=c(NI)DK ⁣J:=d(NJ,NK)EK ⁣L:=e(NL,NK)fK:=f(NK)\begin{equation} \begin{alignedat}{6} A^{I\!J} &:= a(N^J, N^I) \qquad & B^{I\!L} &:= b(N^L, N^I) \qquad & c^{I} &:= c(N^I)\\ D^{K\!J} &:= d(N^J, N^K) & E^{K\!L} &:= e(N^L, N^K) & f^{K} &:= f(N^K)\\ \end{alignedat} \tag{5}\end{equation}

    Solution of (4) yields the unknown vectors u\Bu and y\By.

  3. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/12/07

    Time-Dependent Finite Elements

    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∈Vu \in 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}

    for all v∈Vv \in V and t∈[0,∞)t \in [0,\infty).

    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}

    where the components of the matrices and vectors involved are calculated as

    MI ⁣J(t)=m(NJ,NI;t)AI ⁣J(t)=a(NJ,NI;t)bI(t)=b(NI;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}

    If we further discretize in time with the finite difference u˙≈[un+1−un]/Δt\dot{u} \approx [u_{n+1}-u_n]/{\Delta t}, linearity allows us to write

    m(u˙,v;t)≈1Δt[m(un+1,v;tn+1)−m(un,v;tn)]\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}

    This reflects on the system as

    M(t)u˙≈1Δt[Mn+1un+1−Mnun]\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}

    Here, un+1:=u(x,tn+1)u_{n+1}:= u(x, t_{n+1}), Mn+1=M(tn+1)\BM_{n+1} = \BM(t_{n+1}) and vice versa for unu_n and Mn\BM_n.

    Explicit Euler Scheme

    For the explicit Euler scheme, we substitute evaluate the remaining terms at tnt_n

    1Δt[m(un+1,v;tn+1)−m(un,v;tn)]+a(un,v;tn)=b(v;tn)∀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}

    The corresponding system is

    1Δt[Mn+1un+1−Mnun]+Anun=bn\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}

    The update equation becomes

    un+1=Mn+1−1[Mnun+Δt(bn−Anun)]\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}

    If mm is time-independent, that is m(u˙,v;t)=m(u˙,v)m(\dot{u}, v;t) = m(\dot{u}, v), we have

    un+1=un+Δt M−1(bn−Anun)\begin{equation} \Bu_{n+1} = \Bu_n + \Delta t\, \BM\inv(\Bb_n - \BA_n\Bu_n) \tag{9}\end{equation}

    Implicit Euler Scheme

    For the implicit Euler scheme, we substitute evaluate the remaining terms at tn+1t_{n+1}

    1Δt[m(un+1,v;tn+1)−m(un,v;tn)]+a(un,v;tn+1)=b(v;tn+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}

    The corresponding system is

    1Δt[Mn+1un+1−Mnun]+An+1un+1=bn+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}

    The update equation becomes

    un+1=[Mn+1+ΔtAn+1]−1[Mnun+Δt bn+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}

    If mm is time-independent, one can just substitute M=Mn+1=Mn\BM=\BM_{n+1}=\BM_n.

    Example: Reaction-Advection-Diffusion Equation

    The IBVP of a linear reaction-advection-diffusion problem reads

    ∂u∂t=∇⋅(D∇u)−∇⋅(cu)+ru+finΩ×Iu=uˉon∂Ω×Iu=u0inΩ,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}

    where t∈I=[0,∞)t\in I = [0,\infty),

    • D\BD is a second-order tensor describing the diffusivity of uu,
    • c\Bc is a vector describing the velocity of advection,
    • rr is a scalar describing the rate of reaction,
    • and ff is a source term for uu.

    The weak formulation is then

    Find u∈Vu \in V such that

    ∫Ωu˙v dv=∫Ω[∇⋅(D∇u)−∇⋅(cu)+ru+f]v dv\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}

    for all v∈Vv \in V and t∈It \in I.

    We have the following integration by parts relationships:

    ∫Ω∇⋅(D∇u)v dv=∫Ω∇⋅(vD∇u) dv−∫Ω(D∇u)⋅∇v dv\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}

    for the diffusive part and

    ∫Ω∇⋅(cu)v dv=∫Ω∇⋅(cuv) dv−∫Ωuc⋅∇v dv\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}

    for the advective part. The canceled terms are due to divergence theorem and the fact that v=0v=0 on the boundary. Then our variational formulation is of the form (1) where

    m(u˙,v)=∫Ωu˙v dva(u,v)=∫Ω(D∇u)⋅∇v dv−∫Ωuc⋅∇v dv−∫Ωruv dvb(v)=∫Ωfv dv\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*}

    From these forms, we obtain the following system matrices and vector

    MI ⁣J=∫ΩNJNI dvAI ⁣J=∫Ω(DBJ)⋅BI dv−∫ΩNJc⋅BI dv−∫ΩrNJNI dvbI=∫ΩfNI dv\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*}

    where M\BM is constant through time.