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 uVu\in V such that

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

for all vVv\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)Δuu=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)Δuu=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)NJu=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

uuˉ+Δ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 uVu\in V such that

Ω(g(u)u)vdv=Ωfvdv\begin{equation} - \int_\Omega \nabla \dtp (g(u)\nabla u) v \dv= \int_\Omega f v \dv \tag{9}\end{equation}

for all vVv\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)vdv=Ω(g(u)(u)v)dvΩg(u)uvdv=Ωg(u)v(un)dav=0 on ΩΩg(u)uvdv\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)uvdvΩfvdv=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)=Ω(dgduuˉΔuuˉ+g(uˉ)(Δu))vdvb(v)=Ω[fvg(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=Ω(dgduuˉNJuˉ+g(uˉ)BJ)BIdvbI=Ω[fNIg(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ˉINIanduˉ=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 uVu \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 vVv \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+1un]/Δ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+1Mnun]+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+11[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ΔtM1fn\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Δuu=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Δuu=uˉ=1Δtm(Δu,v;tn+1)+DuF(u,v;tn+1)Δuu=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)NJu=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

uuˉ+Δ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 uV1u\in V_1, yV2y\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 vV1v\in V_1, wV2w \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)Δuuˉ,yˉ+DyF(u,y,v)Δyuˉ,yˉLin[G(u,y,w)]uˉ,yˉ=G(uˉ,yˉ,w)+DuG(u,y,w)Δuuˉ,yˉ+DyG(u,y,w)Δyuˉ,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)Δuuˉ,yˉb(Δy,v):=DyF(u,y,v)Δyuˉ,yˉd(Δu,w):=DuG(u,y,w)Δuuˉ,yˉe(Δy,w):=DyG(u,y,w)Δyuˉ,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

uuˉ+Δuyyˉ+Δ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

ct=(Mμ)inΩ×Icn=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 tI=[0,)t\in I = [0,\infty). Here,

  • cc is the scalar variable for concentration,
  • μ\mu is the scalar variable for the chemical potential,
  • f:cf(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 cV1c \in V_1, μV2\mu\in V_2 such that

ΩctvdxΩ(Mμ)vdx=0Ω[μdfdc]wdx+Ω(Λc)wdx=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 vV1v \in V_1, wV2w \in V_2 and tIt \in I.

We discretize in time implicitly with c/t(cn+1cn)/Δ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(ccn)vdx+Ω(Mμ)vdx=0G(c,μ,w)=Ω[μdfdc]wdxΩ(Λc)wdx=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ΔcvdxDμFΔμ=Ω(M(Δμ))vdxDcGΔc=Ωd2fdc2ΔcwdxΩ(Λ(Δc))wdxDμGΔμ=ΩΔμwdx\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ΔtNJNIdxQIL=Ω(MBL)BIdxrI=Ω1Δt(cˉcn)NIdx+Ω(Mμˉ)BIdxSK ⁣J=Ωd2fdc2c=cˉNJNKdxΩ(ΛBJ)BKdxTK ⁣L=ΩNLNKdxuK=Ω[μˉdfdcc=cˉ]NKdxΩ(Λcˉ)BKdx\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

ccˉ+Δ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.