Entries for 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 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.

  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 uV1u\in V_1, yV2y\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 vV1v\in V_1, wV2w \in V_2 where a(,):V1×V1Ra(\cdot, \cdot): V_1\times V_1 \to \IR, b(,):V2×V1Rb(\cdot, \cdot): V_2\times V_1 \to \IR, d(,):V1×V2Rd(\cdot, \cdot): V_1\times V_2 \to \IR, e(,):V2×V2Re(\cdot, \cdot): V_2\times V_2 \to \IR are bilinear forms and c():V1Rc(\cdot): V_1\to \IR, f():V2Rf(\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,vhVh1yh=L=1nn2uLNLwh=K=1nn2uKNKyh,whVh2\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 uVu \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 vVv \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+1un]/Δ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+1Mnun]\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)vV.\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+1Mnun]+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+11[Mnun+Δt(bnAnun)]\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+ΔtM1(bnAnun)\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)vV.\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+1Mnun]+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+Δtbn+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

    ut=(Du)(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 tI=[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 uVu \in V such that

    Ωu˙vdv=Ω[(Du)(cu)+ru+f]vdv\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 vVv \in V and tIt \in I.

    We have the following integration by parts relationships:

    Ω(Du)vdv=Ω(vDu)dvΩ(Du)vdv\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)vdv=Ω(cuv)dvΩucvdv\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˙vdva(u,v)=Ω(Du)vdvΩucvdvΩruvdvb(v)=Ωfvdv\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=ΩNJNIdvAI ⁣J=Ω(DBJ)BIdvΩNJcBIdvΩrNJNIdvbI=ΩfNIdv\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.

  4. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/11/21

    Vectorial Finite Elements

    $ \newcommand{\BAhat}{\hat{\boldsymbol{A}}} \newcommand{\Buhat}{\hat{\boldsymbol{u}}} \newcommand{\Bbhat}{\hat{\boldsymbol{b}}} $

    Many initial boundary value problems require solving for unknown vector fields, such as solving for displacements in a mechanical problem. Discretization of weak forms of such problems leads to higher-order linear systems which need to be reshaped to be solved by regular linear solvers. There are also more indices involved than a scalar problem, which can be confusing. In this post, I’ll try to elucidate the procedure by deriving for a basic higher-order system and giving an example.

    The weak formulation of a linear vectorial problem reads

    Find uV\Bu\in V such that

    a(u,v)=b(v)\begin{equation} a(\Bu, \Bv) = b(\Bv) \tag{1}\end{equation}

    for all vV\Bv\in V.

    Discretizations of vectorial problems requires the expansion of vectorial quantities as linear combinations of the basis vectors ei\Be_i:

    u=i=1nduiei\begin{equation} \Bu = \suml{i=1}{\ndim} u_i \,\Be_i \htmlId{eq:discrete6}{} \tag{2}\end{equation}

    where {ui}i=1nd\cbr{u_i}_{i=1}^{\ndim} are the components corresponding to the basis vectors and nd=dimV\ndim=\dim V. Here, we chose Cartesian basis vectors for simplicity.

    We can therefore express its discretization as

    uh=I=1nnuINI=I=1nni=1nduiIeiNI.\begin{equation} \Bu_h = \suml{I=1}{\nnode} \Bu^I N^I = \suml{I=1}{\nnode}\suml{i=1}{\ndim} u^I_i \Be_i N^I. \htmlId{eq:discrete7}{} \tag{3}\end{equation}

    Substituting discretized functions in the weak formulation, we obtain

    a(uh,vh)=i=1ndj=1nda(uh,jej,vh,iei)=I=1nnJ=1nni=1ndj=1ndujJviIa(ejNJ,eiNI)\begin{equation} \begin{aligned} a(\Bu_h, \Bv_h) &= \suml{i=1}{\ndim}\suml{j=1}{\ndim} \, a(u_{h,j}\,\Be_j, v_{h,i}\,\Be_i)\\ &= \suml{I=1}{\nnode}\suml{J=1}{\nnode} \suml{i=1}{\ndim}\suml{j=1}{\ndim} u^J_j v^I_i \,a(\Be_j N^J, \Be_i N^I) \end{aligned} \tag{4}\end{equation}

    and

    b(vh)=i=1ndb(vh,iei)=I=1nni=1ndviIb(eiNI).\begin{equation} b(\Bv_h) = \suml{i=1}{\ndim} b(v_{h,i}\,\Be_i) = \suml{I=1}{\nnode} \suml{i=1}{\ndim} v^I_i b(\Be_i N^I). \tag{5}\end{equation}

    We define the following arrays

    AijI ⁣J=a(ejNJ,eiNI)biI=b(eiNI).\begin{equation} \boxed{ \begin{aligned} A^{I\!J}_{ij} &= a(\Be_j N^J, \Be_i N^I) \\ b^{I}_{i} &= b(\Be_i N^I). \end{aligned} } \tag{6}\end{equation}

    Hence we can express the linear system

    a(uh,vh)=b(vh)\begin{equation} a(\Bu_h,\Bv_h) = b(\Bv_h) \tag{7}\end{equation}

    as

    I=1nnJ=1nni=1ndj=1ndujJviIAijI ⁣J=I=1nni=1ndviIbiI.\begin{equation} \suml{I=1}{\nnode}\suml{J=1}{\nnode} \suml{i=1}{\ndim}\suml{j=1}{\ndim} u^J_j v^I_i \,A^{I\!J}_{ij} = \suml{I=1}{\nnode} \suml{i=1}{\ndim} v^I_i b^{I}_{i}. \tag{8}\end{equation}

    For arbitrary vh\Bv_h, this yields the following system of equations

    J=1nnj=1ndAijI ⁣JujJ=biI\begin{equation} \boxed{ \suml{J=1}{\nnode} \suml{j=1}{\ndim} A^{I\!J}_{ij} \,u^J_j = b^{I}_{i} } \htmlId{eq:discrete8}{} \tag{9}\end{equation}

    for i=1,,ndi=1,\dots,\ndim and I=1,,nnI=1,\dots,\nnode.

    We reshape this higher-order system as shown in the previous post Reshaping Higher Order Linear Systems:

    A^u^=b^\begin{equation} \BAhat \Buhat = \Bbhat \tag{10}\end{equation}

    by defining a map idi_d that maps original indices to the reshaped indices

    id:={[1,nn]×[1,nd][1,nnnd](I,i)nd(I1)+i\begin{equation} i_d := \left\{ \begin{array}{rl} [1,\nnode]\times[1,\ndim] & \to [1,\nnode\ndim]\\[1ex] (I,i) & \mapsto \ndim(I-1)+i\\ \end{array} \right. \tag{11}\end{equation}

    where we used 1-based indexing of the arrays. We set

    α:=id(I,i)=nd(I1)+iβ:=id(J,j)=nd(J1)+j\begin{equation} \boxed{ \begin{alignedat}{3} \alpha &:= i_d(I,i) &&= \ndim(I-1) + i \\ \beta &:= i_d(J,j) &&= \ndim(J-1) + j \\ \end{alignedat} } \tag{12}\end{equation}

    and write

    A^αβ=AijI ⁣J,u^β=ujJandb^α=biI\begin{equation} \hat{A}_{\alpha\beta} = A^{I\!J}_{ij} \quad,\quad \hat{u}_{\beta} = u^{J}_{j} \eqand \hat{b}_{\alpha} = b^{I}_{i} \tag{13}\end{equation}

    The inverse index mapping can be obtained as shown in the previous post.

    Example: Linear Elasticity

    Our initial-boundary value problem is

    divσ=ργinΩu=uˉonΩut=tˉonΩt\begin{equation} \begin{alignedat}{4} -\div\Bsigma &= \rho\Bgamma \qquad&& \text{in} \qquad&& \Omega\\ \Bu &= \bar{\Bu} && \text{on} && \del\Omega_u \\ \Bt &= \bar{\Bt} && \text{on} && \del\Omega_t \\ \end{alignedat} \tag{14}\end{equation}

    The weak formulation reads

    Find uV\Bu\in V such that

    Ωdivσvdv=Ωργvdv\begin{equation} -\int_\Omega \div\Bsigma \dtp \Bv \dv = \int_\Omega \rho \Bgamma\dtp\Bv \dv \tag{15}\end{equation}

    for all vV\Bv\in V where V=H1(Ω)V=H^1(\Omega).

    We apply integration by parts on the left-hand side

    Ωdivσvdv=Ωdiv(σv)dvΩσ:vdv\begin{equation} \int_\Omega \div\Bsigma\dtp\Bv \dv = \int_\Omega \div(\Bsigma\Bv) \dv - \int_\Omega \Bsigma : \nabla\Bv \dv \tag{16}\end{equation}

    and apply the divergence theorem to the first resulting term:

    Ωdiv(σv)dv=Ωttˉvda\begin{equation} \int_\Omega \div(\Bsigma\Bv) \dv = \int_{\del\Omega_t} \bar{\Bt}\dtp\Bv \da \tag{17}\end{equation}

    Substituting the linear stress σ=C:ε=C:u\Bsigma=\IC:\Bvareps=\IC:\nabla\Bu, we obtain the following variational forms:

    a(u,v)=Ωv:C:udvb(v)=Ωργvdv+Ωttˉvda\begin{align} \htmlId{eq:linelastdiscretebilinear}{} a(\Bu,\Bv) &= \int_\Omega \nabla\Bv:\IC:\nabla\Bu \dv \tag{18}\\ \htmlId{eq:linelastdiscretelinear}{} b(\Bv) &= \int_\Omega \rho \Bgamma\dtp\Bv \dv + \int_{\del\Omega_t} \bar{\Bt}\dtp\Bv \da \tag{19}\end{align}

    We have the following discretizations of the unknown function and test function

    uh=J=1nnuJNJandvh=I=1nnvINI.\begin{equation} \Bu_h = \suml{J=1}{\nnode} \Bu^J N^J \eqand \Bv_h = \suml{I=1}{\nnode} \Bv^I N^I. \tag{20}\end{equation}

    With the given discretizations, the matrix corresponding to (18) can be calculated as

    AijI ⁣J=a(ejNJ,eiNI)=Ω(eiNI):C:(ejNJ)dv=Ω(eiNI):C:(ejNJ)dv=ΩNIxkCikjlNJxldv,\begin{equation} \begin{aligned} A^{I\!J}_{ij} = a(\Be_j N^J, \Be_i N^I) &= \int_\Omega \nabla(\Be_iN^I) : \IC : \nabla(\Be_jN^J) \dv \\ &= \int_\Omega (\Be_i\dyd \nabla N^I) : \IC : (\Be_j \dyd \nabla N^J) \dv \\ &= \int_\Omega \partd{N^I}{x_k} \, C_{ikjl} \, \partd{N^J}{x_l} \dv, \end{aligned} \tag{21}\end{equation}

    and finally obtain

    AijI ⁣J=ΩBkICikjlBlJdv.\begin{equation} \boxed{ A^{I\!J}_{ij} = \int_\Omega B^I_k \, C_{ikjl} \, B^J_l \dv \,. } \tag{22}\end{equation}

    The vector corresponding to (19) is calculated as

    biI=b(eiNI)=Ωttˉ(eiNI)da+Ωργ(eiNI)dv\begin{equation} b^{I}_{i} = b(\Be_i N^I) = \int_{\del\Omega_t} \bar{\Bt}\dtp(\Be_iN^I) \da + \int_\Omega\rho\Bgamma\dtp(\Be_iN^I) \dv \tag{23}\end{equation}

    which yields

    biI=ΩttˉiNIda+ΩργiNIdv\begin{equation} \boxed{ b^{I}_{i} = \int_{\del\Omega_t} \bar{t}_i N^I \da + \int_\Omega \rho \gamma_i N^I \dv } \tag{24}\end{equation}
  5. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/11/20

    Reshaping Higher Order Linear Systems

    $ \newcommand{\BAhat}{\hat{\boldsymbol{A}}} \newcommand{\Buhat}{\hat{\boldsymbol{u}}} \newcommand{\Bbhat}{\hat{\boldsymbol{b}}} $

    In vectorial problems, we end up with linear systems of higher order, such as

    k=1Nl=1MAijklukl=bij\begin{equation} \suml{k=1}{N} \suml{l=1}{M} A_{ijkl} \, u_{kl} = b_{ij} \htmlId{eq:1}{} \tag{1}\end{equation}

    for i=1,,Ni=1,\dots,N and j=1,,Mj=1,\dots,M.

    These systems cannot be solved readily with existing software. In order to be able to solve them with existing software, we need to reshape them by defining a matrix of matrices A^\BAhat and vector of vectors u^\Buhat and b^\Bbhat:

    [A1111A111MA11N1A11NMA1M11A1M1MA1MN1A1MNMAN111AN11MAN1N1AN1NMANM11ANM1MANMN1ANMNM]A^[u11u1MuN1uNM]u^=[b11b1MbN1bNM]b^\begin{equation} \underbrace{ \left[ \begin{array}{ccc|c|ccc} A_{1111} & \cdots & A_{111M} & & A_{11N1} & \cdots & A_{11NM} \\ \vdots & \ddots & \vdots & \cdots & \vdots & \ddots & \vdots \\ A_{1M11} & \cdots & A_{1M1M} & & A_{1MN1} & \cdots & A_{1MNM} \\[1ex] \hline & \vdots & &\ddots & & \vdots & \\ \hline &&&&&& \\[-1.5ex] A_{N111} & \cdots & A_{N11M} & & A_{N1N1} & \cdots & A_{N1NM} \\ \vdots & \ddots & \vdots & \cdots & \vdots & \ddots & \vdots \\ A_{NM11} & \cdots & A_{NM1M} & & A_{NMN1} & \cdots & A_{NMNM} \end{array} \right] }_{\BAhat} \underbrace{ \left[ \begin{array}{c} u_{11}\\ \vdots \\ u_{1M} \\[1ex] \hline \vdots\\ \hline \\[-1.5ex] u_{N1} \\ \vdots \\ u_{NM} \end{array} \right] }_{\Buhat} = \underbrace{ \left[ \begin{array}{c} b_{11}\\ \vdots \\ b_{1M} \\[1ex] \hline \vdots\\ \hline \\[-1.5ex] b_{N1} \\ \vdots \\ b_{NM} \end{array} \right]}_{\Bbhat} \tag{2}\end{equation}

    This allows us to express the linear system as

    A^u^=b^\begin{equation} \BAhat \Buhat = \Bbhat \htmlId{eq:3}{} \tag{3}\end{equation}

    Here, we reshape the system by defining a map idi_d that maps original indices to the reshaped indices

    id:={[1,N]×[1,M][1,NM](i,j)M(i1)+j\begin{equation} i_d := \left\{ \begin{array}{rl} [1,N]\times[1,M] & \to [1,NM]\\[1ex] (i,j) & \mapsto M(i-1)+j\\ \end{array} \right. \tag{4}\end{equation}

    where we used 1-based indexing of the arrays. We set

    α:=id(i,j)=M(i1)+jβ:=id(k,l)=M(k1)+l\begin{equation} \boxed{ \begin{alignedat}{3} \alpha &:= i_d(i,j) &&= M(i-1) + j \\ \beta &:= i_d(k,l) &&= M(k-1) + l \\ \end{alignedat} } \tag{5}\end{equation}

    and write

    A^αβ=Aijkl,u^β=uklandb^α=bij\begin{equation} \hat{A}_{\alpha\beta} = A_{ijkl} \quad,\quad \hat{u}_{\beta} = u_{kl} \eqand \hat{b}_{\alpha} = b_{ij} \tag{6}\end{equation}

    For reference, the inverse of the index mapping reads

    id1:={[1,NM][1,N]×[1,M]α(1+(αmod(α,M))/M  ,  mod(α,M))\begin{equation} i_d^{-1} := \left\{ \begin{array}{rl} [1,NM] & \to [1,N]\times[1,M] \\[1ex] \alpha & \mapsto (1+(\alpha-\modop(\alpha,M))/M\;,\; \modop(\alpha,M)) \end{array} \right. \tag{7}\end{equation}

    Thus, we have for our reshaped indices,

    j=mod(α,M)i=1+(αj)/Mandl=mod(β,M)k=1+(βl)/M\begin{equation} \begin{aligned} j &= \modop(\alpha,M) \\ i &= 1+(\alpha-j)/M \end{aligned} \quad\eqand\quad \begin{aligned} l &= \modop(\beta,M) \\ k &= 1+(\beta-l)/M \end{aligned} \tag{8}\end{equation}

    Expressed as a regular linear system (3), the higher-order system (1) can be solved with a linear solver such as LAPACK.

  6. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/11/14

    Linear Finite Elements

    Beginning with this post, I’ll be publishing about the basics of finite element formulations, from personal notes that accumulated over the years. This one is about linear and scalar problems which came to be the “Hello World” for FE. Details regarding spaces and discretization are omitted for the sake of brevity. For those who want to delve into theory, I recommend “The Finite Element Method: Theory, Implementation, and Applications” by Larson and Bengzon.

    The weak formulation of a canonical linear problem reads

    Find uVu\in V such that

    a(u,v)=b(v)\begin{equation} a(u, v) = b(v) \htmlId{eq:femlinear1}{} \tag{1}\end{equation}

    for all vVv \in V where a(,)a(\cdot, \cdot) is a bilinear form and b()b(\cdot) is a linear form.

    We define the discretization of uu as

    uh:=J=1nnuJNJ,uhVhwhereVhV\begin{equation} u_h := \suml{J=1}{\nnode} u^J N^J ,\quad u_h \in V_h \quad\text{where}\quad V_h\subset V \tag{2}\end{equation}

    The discretization uhu_h is a linear combination of basis functions NJN^J and corresponding scalars uJu^J, J=1,,nnJ=1,\dots,\nnode so that VhV_h is a subset of VV. The discretization of (1) then reads

    a(uh,vh)=b(vh)vhVh.\begin{equation} a(u_h, v_h) = b(v_h) \quad \forall v_h \in V_h . \tag{3}\end{equation}

    We then have

    a(J=1nnuJNJ,I=1nnvINI)=b(I=1nnvINI)\begin{equation} a\rbr{\suml{J=1}{\nnode} u^J N^J, \suml{I=1}{\nnode} v^I N^I} = b\rbr{\suml{I=1}{\nnode} v^I N^I} \tag{4}\end{equation}

    Using the linearity properties,

    a(αu,βv)=αβa(u,v)andb(αv)=αb(v)\begin{equation} a(\alpha u, \beta v) = \alpha\beta\, a(u,v) \eqand b(\alpha v) = \alpha b(v) \tag{5}\end{equation}

    we obtain

    I=1nnJ=1nnuJvIa(NJ,NI)=I=1nnvIb(NI).\begin{equation} \suml{I=1}{\nnode} \suml{J=1}{\nnode} u^J v^I a(N^J, N^I) = \suml{I=1}{\nnode} v^I b(N^I) . \htmlId{eq:femlinear2}{} \tag{6}\end{equation}

    For arbitrary test function values vIv^I, we can express (6) as a system of nn\nnode equations

    J=1nnuJa(NJ,NI)=b(NI)\begin{equation} \suml{J=1}{\nnode} u^J a(N^J, N^I) = b(N^I) \htmlId{eq:femlinear3}{} \tag{7}\end{equation}

    for I=1,2,,nnI = 1,2,\dots,\nnode. If we expand the summations as

    a(N1,N1)u1+a(N2,N1)u2++a(Nnn,N1)unn=b(N1)a(N1,N2)u1+a(N2,N2)u2++a(Nnn,N2)unn=b(N2)      a(N1,Nnn)u1+a(N2,Nnn)u2++a(Nnn,Nnn)unn=b(Nnn)\begin{alignat*}{6} & a(N^1, N^1) u^1 &&+ a(N^2, N^1) u^2 &&+ \cdots &&+ a(N^{\nnode}, N^1) u^{\nnode} &&\quad=\quad b(N^1) \\ & a(N^1, N^2) u^1 &&+ a(N^2, N^2) u^2 &&+ \cdots &&+ a(N^{\nnode}, N^2) u^{\nnode} &&\quad=\quad b(N^2) \\ & \qquad\vdots && \qquad\quad\;\vdots && \quad\;\;\vdots && \qquad\qquad\vdots && \qquad\qquad\vdots \\ & a(N^1, N^{\nnode}) u^1 &&+ a(N^2, N^{\nnode}) u^2 &&+ \cdots &&+ a(N^{\nnode}, N^{\nnode}) u^{\nnode} &&\quad=\quad b(N^{\nnode}) \end{alignat*}

    we can see that the terms with aa constitute a matrix A\BA and the terms with bb constitute a vector b\Bb, allowing us to write

    Au=b\begin{equation} \BA\Bu = \Bb \htmlId{eq:discrete9}{} \tag{8}\end{equation}

    where we chose to express the unknown coefficients uIu^I as a vector u=[u1,u2,,unn]T\Bu = [u^1,u^2,\dots,u^{\nnode}]\tra.

    \It can be seen that the components of the A\BA and b\Bb are defined as

    AI ⁣J=a(NJ,NI)andbI=b(NI),\begin{equation} \boxed{ \Aelid{I\!J}{} = a(N^J,N^I) \eqand b^I = b(N^I), } \tag{9}\end{equation}

    we can express the linear system as

    A11u1+A12u2++A1nnunn=b1A21u1+A22u2++A2nnunn=b2            Ann1u1+Ann2u2++Annnnunn=bnn\begin{alignat*}{6} & \Aelid{11}{} u^1 &&+ \Aelid{12}{} u^2 &&+ \cdots &&+ \Aelid{1\nnode}{} u^{\nnode} &&\quad=\quad b^1 \\ & \Aelid{21}{} u^1 &&+ \Aelid{22}{} u^2 &&+ \cdots &&+ \Aelid{2\nnode}{} u^{\nnode} &&\quad=\quad b^2 \\ & \quad\vdots && \qquad\;\vdots && \quad\;\;\vdots && \qquad\;\vdots && \qquad\quad\;\;\vdots \\ & \Aelid{\nnode 1}{} u^1 &&+ \Aelid{\nnode 2}{} u^2 &&+ \cdots &&+ \Aelid{\nnode\nnode}{} u^{\nnode} &&\quad=\quad b^{\nnode} \end{alignat*}

    Note that with the given definitions, (7) becomes

    J=1nnAI ⁣JuJ=bIforI=1,2,nn.\begin{equation} \boxed{ \suml{J=1}{\nnode} \Aelid{I\!J}{} \,u^J = b^I \quad\text{for}\quad I=1,2,\dots\nnode. } \htmlId{eq:discrete10}{} \tag{10}\end{equation}

    Example: Poisson’s Equation

    In the weak form of Poisson’s equation

    Δu=finΩu=0onΩ\begin{equation} \begin{alignedat}{4} - \Var u &= f \quad && \text{in} \quad && \Omega \\ u &= 0 \quad && \text{on} \quad && \del\Omega \end{alignedat} \tag{11}\end{equation}

    The weak formulation reads

    Find uVu\in V such that

    ΩΔ(u)vdv=Ωfvdv\begin{equation} - \int_\Omega \Delta(u) v \dv= \int_\Omega f v \dv \tag{12}\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

    ΩΔ(u)vdv=Ω((u)v)dvΩuvdv=Ωv(un)dav=0 on ΩΩuvdv\begin{equation} \begin{aligned} \int_\Omega \Delta(u) v \dv &= \int_\Omega \nabla \dtp (\nabla (u) v) \dv - \int_\Omega \nabla u\dtp\nabla v \dv \\ &= \underbrace{\int_{\del\Omega} v (\nabla u\dtp\Bn) \da}_{v = 0 \text{ on } \del\Omega} - \int_\Omega \nabla u\dtp\nabla v \dv \\ \end{aligned} \tag{13}\end{equation}

    We have the following variational forms:

    a(u,v)=Ωuvdvb(v)=Ωfvdv\begin{equation} \begin{aligned} a(u,v) &= \int_{\Omega} \nabla u \dtp \nabla v \dv\\ b(v) &= \int_{\Omega} f \, v \dv\\ \end{aligned} \tag{14}\end{equation}

    Following (7), we can calculate the stiffness matrix A\BA as

    AI ⁣J=a(NJ,NI)=ΩNJNIdv=ΩBJBIdv\begin{equation} \begin{aligned} \Aelid{I\!J}{} = a(N^J, N^I) &= \int_{\Omega} \nabla N^J \dtp \nabla N^I \dv \\ &= \int_{\Omega} \BB^J \dtp \BB^I \dv \end{aligned} \tag{15}\end{equation}

    where we have defined the gradient of the basis functions as

    BI:=NI.\begin{equation} \BB^I := \nabla N^I\,. \tag{16}\end{equation}

    Similarly, we integrate the force term into a vector b\Bb as

    bI=ΩfNIdv\begin{equation} \begin{aligned} b^I &= \int_{\Omega} f N^I \dv \end{aligned} \tag{17}\end{equation}
  7. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/10/12

    Balance Laws

    Calculus is all about relating the change in one quantity to another quantity.

    ΔA=B\Var A = B

    Imagine it this way: You have a box full of marbles, and you decide to put some more in. AA is the variable representing the amount of marbles, while BB is the variable representing the amount of marbles that you put in. If you had A1A_1 marbles at the beginning, you have

    A2=A1+ΔA=A1+BA_2 = A_1+\Var A = A_1 + B

    marbles following your action. This is the most fundamental algebraic pattern that characterizes balance laws.

    Take the first law of thermodynamics for example—a.k.a. balance of energy. We have

    ΔU=Q+W\Var U = Q + W

    where UU is the internal energy of a closed system, QQ is the amount of heat supplied to the system, and WW is the amount of work done on the system on its surroundings. Here, AUA\equiv U and BQ+WB\equiv Q+W. Despite having three quantities, it is the combined effect of two which is related to the remaining quantity. Balance laws derived by physicists and chemists can get quite complex and hard to understand.

    It’s always that the change in one quantity is related to the combined effect of remaining quantities. Keeping separate track of your main variable AA and affecting variables that compose BB gives you a mental model which helps you remember and even build your own balance laws.

    Introducing Time

    Let A:tA(t)A: t \to A(t) be a function of time. We can rewrite the equation in terms of the change in AA in a time period Δt\Var t:

    ΔAΔt=C\frac{\Var A}{\Var t} = C

    where the new variable CC represents the change in quantity in Δt\Var t amount of time. In our previous analogy, CC is the amount of marbles put in, say, a minute. As Δt0\Var t \to 0, we have

    dAdt=C(t).\deriv{A}{t} = C(t).

    This prototypical balance law allows us to relate the rates of change of quantities.

    Let’s introduce time into the balance of energy. The equation becomes

    dUdt=PT(t)+PM(t)\deriv{U}{t} = P_T(t) + P_M(t)

    where the new quantities PTP_T and PMP_M are called thermal power and mechanical power, representing the thermal and mechanical work done on the system per unit time, respectively. Given power functions and initial conditions, integrating them would give us the evolution of the internal energy through time.

    Introducing Space

    Let’s say we are not satisfied with an abstract box where the amount of stuff that goes in is measured automatically. We want to write a balance law over different shapes of bodies and we need to specify exactly where the stuff goes in and out.

    To do that, we need to rephrase our laws to work over a continuous domain. The branch of physics that focuses on such problems is called continuum mechanics.

    We introduce our spatial domain Ω\Omega and its boundary Ω\del\Omega. Our quantities now vary over both space and time, so we need to integrate them over the whole domain in order to relate them:

    ddtΩadx=Ωbdx+Ωcnds\ddt\int_\Omega a \dx = \int_\Omega b \dx + \int_{\del\Omega} \Bc \dtp \Bn \ds

    where

    • a(x,t)a(x,t) is the variable representing the main continuous quantity,
    • b(x,t)b(x,t) is the variable representing the rate of change of the quantity inside the domain,
    • and c(x,t)\Bc(x,t) is the variable representing the negative rate of change of the quantity on the boundary of the domain—negative due to surface normals n\Bn having outward direction by definition.

    Notice that when we introduce space, our prototypical balance law needs an additional vectorial quantity, c\Bc. In physical laws, one needs to differentiate actions inside a body from actions on the surface of the body. That’s because one is over a volume and the other over an area, and they have to be integrated separately.

    The area integral is actually a flux where the vectorial quantity c\Bc is penetrating the surface with a given direction. Given that it’s positive when stuff exits the domain, it’s called the efflux of the underlying quantity. Similarly, we name the rate of change field bb as the supply of the underlying quantity, because it being positive results in an increase.

    The idea is to get rid of the integrals by a process called “localization”. In order to localize, we have to convert the surface integral into a volume integral using the divergence theorem:

    Ωcnds=Ωcdx\int_{\del\Omega} \Bc \dtp \Bn \ds = \int_\Omega \nabla\dtp\Bc \dx

    Assuming Ω\Omega doesn’t move, we can also write

    ddtΩadx=Ωdadtdx\ddt\int_\Omega a \dx = \int_\Omega \deriv{a}{t} \dx

    Collecting the results, we have

    Ωdadtdx=Ωbdx+Ωcdx\int_\Omega \deriv{a}{t} \dx = \int_\Omega b \dx + \int_\Omega \nabla\dtp\Bc \dx

    Notice that all integrals are over Ω\Omega now. This allows us to make the balance law more strict by enforcing it point-wise:

    dadt=b+cxΩ\deriv{a}{t} = b + \nabla\dtp \Bc \quad \forall x \in \Omega

    This is the localized version of the prototypical balance law that is used everywhere in continuum mechanics. Unfortunately, I can’t give the energy balance example, because it would require too many additional definitions. For that, I recommend the excellent Mathematical Foundations of Elasticity by Marsden and Hughes.

    Conclusion

    In physics and chemistry, one shouldn’t blindly memorize formulas, but try to see the underlying logic. In this case, I tried to elucidate balance laws, which all build upon the same algebraic and geometrical concepts. I went from discrete to continuous by introducing time and space to the equations, which became more complex but retained the same idea: putting things in a box and trying to calculate how that changes the contents.

  8. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/09/20

    Taylor and Volterra Series

    In the theory of computational mechanics, there are a few operations used that are not taught in Calculus 101, which can be confusing without taking a lecture in calculus of variations. One of them is taking variations (a.k.a. Gateaux derivatives), akin to taking directional derivatives, but with functions of functions called functionals.

    You need to take variations when you are linearizing a nonlinear problem for the purpose of solving with a numerical scheme. Linearization is the process of expanding a function or functional into a series, and discarding terms that are of order higher than linear—i.e. quadratic, cubic, quartic, etc. These expansions are called Taylor for functions, and Volterra for functionals.

    Taylor Series

    A function f:RRf:\IR\to\IR can be expanded about a point xˉ\bar{x} as a power series:

    f(x)=f(xˉ)+dfdxxˉ(xxˉ)1!+d2fdx2xˉ(xxˉ)22!+d3fdx3xˉ(xxˉ)33!+=n=0dnfdxnxˉ(xxˉ)nn!\begin{equation} \begin{aligned} f(x) &= f(\bar{x}) + \frac{\dif f}{\dif x}\evat_{\bar{x}} \frac{(x-\bar{x})}{1!} + \frac{\dif^2 f}{\dif x^2}\evat_{\bar{x}}\frac{(x-\bar{x})^2}{2!} + \frac{\dif^3 f}{\dif x^3}\evat_{\bar{x}}\frac{(x-\bar{x})^3}{3!} + \cdots \\ &= \suml{n=0}{\infty} \frac{\dif^n f}{\dif x^n} \evat_{\bar{x}}\frac{(x-\bar{x})^n}{n!} \end{aligned} \tag{1}\end{equation}

    Letting xx be a perturbation δx\var x from the expansion point xˉ\bar{x}, that is xxˉ+δxx\to\bar{x}+\var x, the series can also be phrased as follows

    f(xˉ+δx)=f(xˉ)+dfdxxˉδx1!+d2fdx2xˉδx22!+d3fdx3xˉδx33!+=n=0dnfdxnxˉδxnn!\begin{equation} \begin{aligned} f(\bar{x}+\var x) &= f(\bar{x}) + \frac{\dif f}{\dif x}\evat_{\bar{x}} \frac{\var x}{1!} + \frac{\dif^2 f}{\dif x^2}\evat_{\bar{x}}\frac{\var x^2}{2!} + \frac{\dif^3 f}{\dif x^3}\evat_{\bar{x}}\frac{\var x^3}{3!} + \cdots \\ &= \suml{n=0}{\infty} \frac{\dif^n f}{\dif x^n} \evat_{\bar{x}}\frac{\var x^n}{n!} \end{aligned} \htmlId{eq:2}{} \tag{2}\end{equation}

    This is what is taught in Calculus 101 and everyone knows. Now for the part that you may have missed:

    Variation

    Let XX be the space of functions RR\IR\to\IR. The variation of a functional FXF\in X is defined as

    DuF(u)v:=limϵ0F(u+ϵv)F(u)ϵddϵF(u+ϵv)ϵ=0\begin{equation} \boxed{ \varn{F(u)}{u}{v} := \lim_{\eps\to 0} \frac{F(u+\eps v) - F(u)}{\eps} \equiv \deriv{}{\eps} F(u + \eps v) \evat_{\eps = 0} } \tag{3}\end{equation}

    where vXv \in X is called the perturbation of the variation. This operation is analogous to taking the directional derivative of a function.

    Shorthand notation

    When working with variational formulations, writing out variations can be a bit of a hassle if there are many symbols involved. Therefore we use the following shorthand for variations:

    ΔF:=DuF(u)v\begin{equation} \Var F := \varn{F(u)}{u}{v} \tag{4}\end{equation}

    Here, we assume that there is no chance of confusing the varied function or perturbation. We use this shorthand in contexts where the perturbation does not play an important role.

    The shorthand for evaluation is

    Fˉ:=F(uˉ)andΔˉF:=DuF(u)vuˉ\begin{equation} \bar{F} := F(\bar{u}) \eqand \bar{\Var} F := \varn{F(u)}{u}{v}\evat_{\bar{u}} \tag{5}\end{equation}

    where there is no risk of confusion for uˉX\bar{u}\in X.

    Volterra Series

    Let XX be the space of functions RR\IR\to\IR. Analogous to the Taylor series, a functional FXF\in X can be expanded about a point uˉ\bar{u} as a power series:

    F(uˉ+v)=F(uˉ)+11!DuF(u)vuˉ+12!Du2F(u)v2uˉ+13!Du3F(u)v3uˉ+=n=01n!DunF(u)vnuˉ\begin{equation} \boxed{ \begin{aligned} F(\bar{u}+v) &= F(\bar{u}) + \frac{1}{1!} \varn{F(u)}{u}{v}\evat_{\bar{u}} + \frac{1}{2!} D^2_u F(u) \dtp v^2 \evat_{\bar{u}} + \frac{1}{3!} D^3_u F(u) \dtp v^3 \evat_{\bar{u}} + \cdots \\ &= \suml{n=0}{\infty} \frac{1}{n!} D^n_u F(u) \dtp v^n \evat_{\bar{u}} \end{aligned} } \htmlId{eq:6}{} \tag{6}\end{equation}

    where vXv\in X is the perturbation of the expansion. This is called the Volterra series expansion of FF. Verbally, the Volterra series expansion of a functional about a function is the infinite sum of the variations of the functional with increasing degree, evaluated at that function, each divided by the factorial of the degree.

    In shorthand notation, the expansion is rendered

    F=Fˉ+ΔˉF1!+Δˉ2F2!+Δˉ3F3!+\begin{equation} \boxed{ F = \bar{F} + \frac{\bar{\Var} F}{1!} + \frac{\bar{\Var}^2 F}{2!} + \frac{\bar{\Var}^3 F}{3!} + \cdots } \htmlId{eq:7}{} \tag{7}\end{equation}

    To me, there is an elegance in (7) that is not reflected in (2) or (6).

  9. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/07/22

    Isomorphisms in Linear Mappings between Vector Spaces

    Equipping a vector space with an inner product results in a natural isomorphism VV\CV\to\CV^\ast, where the metric tensor can be interpreted as the linear mapping g:VV\Bg:\CV\to\CV^\ast and its inverse g1:VV\Bg\inv:\CV^\ast\to\CV.

    Notation: Given two real vector spaces V\CV and W\CW, we denote their inner products as  ⁣, ⁣V\dabrn{\cdot,\cdot}_{\CV} and  ⁣, ⁣W\dabrn{\cdot,\cdot}_{\CW} respectively. Given vectors vV\Bv\in\CV and wW\Bw\in\CW, we define their lengths as

    vV= ⁣v,v ⁣VandwW= ⁣w,w ⁣W.\begin{equation} \Norm{\Bv}_{\CV} = \sqrt{\dabrn{\Bv,\Bv}_{\CV}} \eqand \Norm{\Bw}_{\CW} = \sqrt{\dabrn{\Bw,\Bw}_{\CW}}. \tag{1}\end{equation}

    Regarding V\CV and W\CW,

    1. their bases are denoted {EA}\cbrn{\BE_A} and {ea}\cbrn{\Be_a},
    2. their dual bases are denoted {EA}\cbrn{\BE^A} and {ea}\cbrn{\Be^a},
    3. their metrics are denoted G\BG and g\Bg with the components GAB= ⁣EA,EB ⁣VG_{AB}=\dabrn{\BE_A,\BE_B}_{\CV} and gab= ⁣ea,eb ⁣Wg_{ab}=\dabrn{\Be_a,\Be_b}_{\CW},

    respectively. Here, the indices pertaining to V\CV are uppercase (ABC)(ABC\dots) and the indices pertaining to W\CW are lowercase (abc)(abc\dots).

    Definition: Let P:VW\BP:\CV\to\CW be a linear mapping. Then the transpose, or adjoint of P\BP, written PT\BP\tra, is the linear mapping

    PT:WVsuch that ⁣v,PTw ⁣V= ⁣Pv,w ⁣W\begin{equation} \boxed{ \BP\tra: \CW\to\CV \quad\text{such that}\quad \dabrn{\Bv,\BP\tra\Bw}_{\CV} = \dabrn{\BP\Bv,\Bw}_{\CW} } \tag{2}\end{equation}

    for all vV\Bv\in\CV and wW\Bw\in\CW. Carrying out the products,

    GBAvB(PT)Adwd=gabPbCvCwa.\begin{equation} G_{BA} v^B (P\tra){}^{A}{}_{d} w^d = g_{ab} P{}^{b}{}_{C}v^Cw^a. \tag{3}\end{equation}

    For arbitrary v\Bv and w\Bw,

    GBA(PT)Aa=gabPbA\begin{equation} G_{BA} (P\tra){}^{A}{}_{a} = g_{ab} P{}^{b}{}_{A} \tag{4}\end{equation}

    from which we can obtain the components of the transpose as

    (PT)Aa=gabPbBGABandPT=(PT)AaEAea.\begin{equation} \boxed{ (P\tra){}^{A}{}_{a} = g_{ab} P{}^{b}{}_{B} G^{AB} \eqwith \BP\tra = (P\tra){}^{A}{}_{a} \BE_A\dyd\Be^a . } \tag{5}\end{equation}

    If B:VV\BB:\CV\to\CV is a linear mapping, it is called symmetric if B=BT\BB=\BB\tra.

    Definition: Let P:VW\BP:\CV\to\CW be a linear mapping. Then the dual of P\BP is a metric independent mapping

    P:WVsuch thatv,PβV=Pv,βW\begin{equation} \boxed{ \BP^\ast: \CW^\ast\to\CV^\ast \quad\text{such that}\quad \abrn{\Bv,\BP^\ast\Bbeta}_{\CV} = \abrn{\BP\Bv,\Bbeta}_{\CW} } \tag{6}\end{equation}

    defined through natural pairings for all vV\Bv\in\CV and βW\Bbeta\in\CW^\ast. Carrying out the products,

    vA(P)Aaβa=PbBvBβb.\begin{equation} v^A (P^\ast){}_{A}{}^{a} \beta_a = P{}^{b}{}_{B} v^B \beta_b. \tag{7}\end{equation}

    For arbitrary v\Bv and β\Bbeta, we obtain the components of the dual mapping as

    (P)Aa=PaAandP=(P)AaEAea=PaAEAea.\begin{equation} \boxed{ (P^\ast){}_{A}{}^{a} = P{}^{a}{}_{A} \eqwith \BP^\ast = (P^\ast){}_{A}{}^{a} \BE^A\dyd\Be_a = P{}^{a}{}_{A} \BE^A\dyd\Be_a . } \tag{8}\end{equation}

    To fully appreciate the symmetry that originates from the duality, we can think of not just the mappings between V\CV and W\CW, but also between their dual spaces. To this end we can enumerate four mappings corresponding to {V,V}{W,W}\cbr{\CV,\CV^\ast}\to\cbr{\CW,\CW^\ast} and their duals, corresponding to {W,W}{V,V}\cbr{\CW,\CW^\ast}\to\cbr{\CV,\CV^\ast}. Their definitions can be found in the table below.

    Mappings
    PWV\BP\in\CW \dyd\CV^\ast

    PAa=P(ea,EA)P^a_{\idxsep A}=\BP(\Be^a,\BE_A)
    P=PAaeaEA\BP = P^{a}_{\idxsep A}\, \Be_a \dyd \BE^A
    QWV\BQ\in\CW^\ast \dyd\CV^\ast

    QaA=Q(ea,EA)Q_{aA}=\BQ(\Be_a,\BE_A)
    Q=QaAeaEA\BQ = Q_{aA}\, \Be^a \dyd \BE^A
    RWV\BR\in\CW \dyd\CV

    RaA=R(ea,EA)R^{aA}=\BR(\Be^a,\BE^A)
    R=RaAeaEA\BR = R^{aA}\, \Be_a \dyd \BE_A
    SWV\BS\in\CW^\ast \dyd\CV

    SaA=S(ea,EA)S_a^{\idxsep A}=\BS(\Be_a,\BE^A)
    S=SaAeaEA\BS = S_{a}^{\idxsep A}\, \Be^a \dyd \BE_A
    P:VW\BP: \CV \to \CW

    vP(ea,v)ea=PvvAEAPAavAea\begin{aligned} \Bv &\mapsto \BP(\Be^a,\Bv) \Be_a \\ &= \BP\Bv \\ v^A\BE_A &\mapsto P^a_{\idxsep A} v^A \Be_a \end{aligned}
    Q:VW\BQ: \CV \to \CW^\ast

    vQ(ea,v)ea=QvvAEAQaAvAea\begin{aligned} \Bv &\mapsto \BQ(\Be_a,\Bv) \Be^a \\ &= \BQ\Bv \\ v^A\BE_A &\mapsto Q_{aA} v^A \Be^a \end{aligned}
    R:VW\BR: \CV^\ast \to \CW

    αR(ea,α)ea=RαTαAEARaAαAea\begin{aligned} \Balpha &\mapsto \BR(\Be^a,\Balpha) \Be_a \\ &= \BR\Balpha\tra \\ \alpha_A \BE^A &\mapsto R^{aA} \alpha_A \Be_a \end{aligned}
    S:VW\BS: \CV^\ast \to \CW^\ast

    αS(ea,α)ea=SαTαAEASaAαAea\begin{aligned} \Balpha &\mapsto \BS(\Be_a,\Balpha) \Be^a \\ &= \BS\Balpha\tra \\ \alpha_A \BE^A &\mapsto S_a^{\idxsep A} \alpha_A \Be^a \end{aligned}
    P:W×VR\BP: \CW^\ast \times \CV \to \IR

    (β,v)P(β,v)=βPv=βaPAavA\begin{aligned} (\Bbeta,\Bv) &\mapsto \BP(\Bbeta,\Bv) \\ &=\Bbeta\BP\Bv \\ &= \beta_a P^{a}_{\idxsep A} v^A \end{aligned}
    Q:W×VR\BQ: \CW \times \CV \to \IR

    (w,v)Q(w,v)=wTQv=waQaAvA\begin{aligned} (\Bw,\Bv) &\mapsto \BQ(\Bw,\Bv) \\ &= \Bw\tra\BQ\Bv \\ &= w^a Q_{aA} v^A \end{aligned}
    R:W×VR\BR: \CW^\ast \times \CV^\ast \to \IR

    (β,α)R(β,α)=βRαT=βaRaAαA\begin{aligned} (\Bbeta,\Balpha) &\mapsto \BR(\Bbeta,\Balpha) \\ &= \Bbeta\BR\Balpha\tra \\ &= \beta_a R^{aA} \alpha_A \end{aligned}
    S:W×VR\BS: \CW \times \CV^\ast \to \IR

    (w,α)S(w,α)=wTSαT=waSaAαA\begin{aligned} (\Bw,\Balpha) &\mapsto \BS(\Bw,\Balpha) \\ &= \Bw\tra\BS\Balpha\tra \\ &= w^a S_a^{\idxsep A} \alpha_A \end{aligned}
    Duals
    PVW\BP^\ast\in \CV^\ast \dyd\CW

    PAa=P(EA,ea)P^{\ast \, a}_A=\BP^\ast(\BE_A,\Be^a)
    P=PAaEAea\BP^\ast = P^{\ast \, a}_A \, \BE^A \dyd \Be_a
    QVW\BQ^\ast\in \CV^\ast \dyd\CW^\ast

    QAa=Q(EA,ea)Q^\ast_{Aa}=\BQ^\ast(\BE_A,\Be_a)
    Q=QAaEAea\BQ^\ast = Q^\ast_{Aa}\, \BE^A \dyd \Be^a
    RVW\BR^\ast\in\CV \dyd \CW

    RAa=R(EA,ea)R^{\ast Aa}=\BR^\ast(\BE^A,\Be^a)
    R=RAaEAea\BR^\ast = R^{\ast Aa}\, \BE_A \dyd \Be_a
    SVW\BS^\ast\in\CV \dyd\CW^\ast

    SAa=S(EA,ea)S^{\ast A}{}_{a}=\BS^\ast(\BE^A,\Be_a)
    S=SAaEAea\BS^\ast = S^{\ast A}{}_{a}\, \BE_A \dyd \Be^a
    P:WV\BP^\ast: \CW^\ast \to \CV^\ast

    βP(EA,β)EA=PβTβaeaPAaβaEA\begin{aligned} \Bbeta &\mapsto \BP^\ast(\BE_A,\Bbeta) \BE^A \\ &= \BP^\ast\Bbeta\tra \\ \beta_a\Be^a &\mapsto P^{\ast \, a}_A \beta_a \BE^A \end{aligned}
    Q:WV\BQ^\ast: \CW \to\CV^\ast

    wQ(EA,w)EA=QwwaeaQAawaEA\begin{aligned} \Bw &\mapsto \BQ^\ast(\BE_A,\Bw) \BE^A \\ &= \BQ^\ast\Bw \\ w^a\Be_a &\mapsto Q^\ast_{Aa} w^a \BE^A \end{aligned}
    R:WV\BR^\ast: \CW^\ast \to \CV

    βR(EA,β)EA=RβTβaeaRAawaEA\begin{aligned} \Bbeta &\mapsto \BR^\ast(\BE^A,\Bbeta) \BE_A \\ &= \BR^\ast\Bbeta\tra \\ \beta_a\Be^a &\mapsto R^{\ast Aa} w^a \BE_A \end{aligned}
    S:WV\BS^\ast: \CW \to\CV

    wS(EA,w)EA=SwwaeaSAawaEA\begin{aligned} \Bw &\mapsto \BS^\ast(\BE^A,\Bw) \BE_A \\ &= \BS^\ast\Bw \\ w^a\Be_a &\mapsto S^{\ast A}{}_{a} w^a \BE_A \end{aligned}
    P:V×WR\BP^\ast: \CV \times \CW^\ast \to \IR

    (v,β)P(v,β)=vTPβT=vAPAaβa\begin{aligned} (\Bv,\Bbeta) &\mapsto \BP^\ast(\Bv,\Bbeta) \\ &= \Bv\tra\BP^\ast\Bbeta\tra \\ &= v^A P^{\ast \, a}_A \beta_a \end{aligned}
    Q:V×WR\BQ^\ast: \CV \times \CW \to \IR

    (v,w)R(v,w)=vTQw=vAQAawa\begin{aligned} (\Bv,\Bw) &\mapsto \BR^\ast(\Bv,\Bw) \\ &= \Bv\tra\BQ^\ast\Bw \\ &= v^A Q^\ast_{Aa} w^a \end{aligned}
    R:V×WR\BR^\ast: \CV^\ast \times \CW^\ast \to \IR

    (α,β)S(α,β)=αRβT=αARAaβa\begin{aligned} (\Balpha,\Bbeta) &\mapsto \BS^\ast(\Balpha,\Bbeta) \\ &= \Balpha\BR^\ast\Bbeta\tra \\ &= \alpha_A R^{\ast Aa} \beta_a \end{aligned}
    S:V×WR\BS^\ast: \CV^\ast \times \CW \to \IR

    (α,w)S(α,w)=αSw=αASAawa\begin{aligned} (\Balpha,\Bw) &\mapsto \BS^\ast(\Balpha,\Bw) \\ &= \Balpha\BS^\ast\Bw \\ &= \alpha_A S^{\ast A}{}_{a} w^a \end{aligned}
    Tensors P\BP, Q\BQ, R\BR and S\BS as linear mappings (top), and their duals P\BP^\ast, Q\BQ^\ast, R\BR^\ast and S\BS^\ast (bottom). In the respective tables, the first row displays the tensor spaces, basis vectors and components of the subsequent mappings, and the second and third row display the representations of the tensor as linear and bilinear mappings respectively. The results of the mappings are given in the mapping, matrix and index representations respectively. The mappings are over vectors vV\Bv\in\CV, wW\Bw\in\CW and one-forms αV\Balpha\in\CV^\ast, βW\Bbeta\in\CW^\ast.

    The commutative diagrams pertaining to these mappings can be found in the figure below

    Commutative diagrams involving the linear mappings P,Q,R,S\BP,\BQ,\BR,\BS and their dual P,Q,R,S\BP^\ast,\BQ^\ast,\BR^\ast,\BS^\ast based on the metrics G\BG and g\Bg of V\CV and W\CW.
  10. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/07/13

    Metrics and Natural Isomorphisms

    The assignment of an inner product to a non-degenerate and finite-dimensional vector space V\CV, results in emergence of the natural isomorphism to its dual VV\CV\to\CV^\ast, which means that the morphisms VV\CV\to\CV^\ast and VV\CV^\ast\to\CV are of the same structure and one is the inverse of the other. The notion of naturality (of an isomorphism) becomes most clear in the context of category theory; however it should be sufficient for now to say that a natural isomorphism between a vector space an its dual is one that is basis-independent. As the origin of the isomorphism, the inner product is encapsulated in an object called the metric, defined below, in order to make the resulting symmetry of the mappings more obvious.

    In the context of differential geometry, the metric object is used synonymously with the inner product of a vector space. More specifically, the metric tensor

    g:={V×VR(v,w) ⁣v,w ⁣\begin{equation} \Bg:= \left\{ \begin{aligned} \CV \times \CV &\to \IR \\ (\Bv,\Bw) &\mapsto \dabrn{\Bv, \Bw} \end{aligned} \right. \tag{1}\end{equation}

    of a real vector space V\CV is an object whose components contain the information necessary to linearly transform a vector to its covector. This operation is denoted by the symbol \flat and reads

    :={(VR)(VR)orVVv()g(v,).\begin{equation} \flat := \left\{ \begin{aligned} (\CV^\ast \to \IR) &\to (\CV \to \IR) \\ \text{or}\quad \CV &\to\CV^\ast \\ \Bv(\cdot) &\mapsto \Bg(\Bv, \cdot). \end{aligned} \right. \tag{2}\end{equation}

    We simply define the one-form v\Bv^\flat as

    v(w)g(v,w)= ⁣v,w ⁣.\begin{equation} \Bv^\flat(\Bw) \equiv \Bg(\Bv,\Bw) = \dabrn{\Bv,\Bw}. \tag{3}\end{equation}

    We input the basis vectors ea\Be_a

    v(ea)= ⁣vbeb,ea ⁣= ⁣eb,ea ⁣vb= ⁣ea,eb ⁣vb\begin{equation} \Bv^\flat(\Be_a) = \dabrn{v^b\Be_b, \Be_a} = \dabrn{\Be_b, \Be_a} v^b = \dabrn{\Be_a, \Be_b} v^b \tag{4}\end{equation}

    and define the components of the metric tensor as

    gab= ⁣ea,eb ⁣andg=gabeaeb.\begin{equation} \boxed{ g_{ab} = \dabrn{\Be_a, \Be_b} \eqwith \Bg = g_{ab}\, \Be^a\dyd \Be^b. } \tag{5}\end{equation}

    We then simply say that the operator \flat denotes an index lowering1 through

    v=gvand component-wise va=gabvb.\begin{equation} \Bv^\flat = \Bg\Bv \quad\text{and component-wise }\quad v_a = g_{ab} v^b. \tag{6}\end{equation}

    Moreover, we can define the inverse of the metric tensor as

    g1:={V×VR(α,β) ⁣α,β ⁣\begin{equation} \Bg\inv:= \left\{ \begin{aligned} \CV^\ast\times\CV^\ast &\to \IR \\ (\Balpha,\Bbeta) &\mapsto \dabrn{\Balpha, \Bbeta} \end{aligned} \right. \tag{7}\end{equation}

    The operation of transforming a covector to its corresponding vector is denoted by the symbol \sharp and reads

    :={(VR)(VR)orVVα()g1(,α).\begin{equation} \sharp := \left\{ \begin{aligned} (\CV \to \IR) &\to (\CV^\ast \to \IR) \\ \text{or}\quad \CV^\ast &\to\CV \\ \Balpha(\cdot) &\mapsto \Bg\inv(\cdot,\Balpha). \end{aligned} \right. \tag{8}\end{equation}

    Here, the vector corresponding to the covector α\Balpha is denoted α\Balpha^\sharp and reads

    α(β)=g1(β,α)= ⁣β,α ⁣\begin{equation} \Balpha^\sharp(\Bbeta) = \Bg\inv(\Bbeta,\Balpha) = \dabrn{\Bbeta, \Balpha} \tag{9}\end{equation}

    We input the dual basis vectors ea\Be^a

    α(ea)= ⁣ea,αbeb ⁣= ⁣ea,eb ⁣αb\begin{equation} \Balpha^\sharp(\Be^a) = \dabrn{\Be^a, \alpha_b\Be^b} = \dabrn{\Be^a, \Be^b} \alpha_b \tag{10}\end{equation}

    and define the components of the inverse metric g1\Bg\inv as

    gab= ⁣ea,eb ⁣andg1=gabeaeb.\begin{equation} \boxed{ g^{ab} = \dabrn{\Be^a,\Be^b} \eqwith \Bg\inv = g^{ab}\,\Be_a\dyd\Be_b. } \tag{11}\end{equation}

    Then the operator \sharp denotes an index raising through

    α=g1αand component-wise αa=gabαb.\begin{equation} \Balpha^\sharp = \Bg\inv\Balpha \quad\text{and component-wise }\quad \alpha^a = g^{ab}\alpha_b. \tag{12}\end{equation}

    In some literature, the natural isomorphism VV\CV\to\CV^\ast is called the musical isomorphism—which is also the origin of the notation introduced above—because the process of transforming a vector to its dual space and a covector to the original space is analogous to lowering and raising notes.

    With the given definition of the metric, we can elaborate on the advantage of denoting inner products of different objects with different symbols. Whereas ,\abrn{\cdot,\cdot} always denotes a natural pairing between a vector space and its dual, one can write  ⁣, ⁣V:V×VR\dabrn{\cdot,\cdot}_{\CV}:\CV\times\CV\to\IR to denote an inner product of vectors and  ⁣, ⁣V:V×VR\dabrn{\cdot,\cdot}_{\CV^\ast}:\CV^\ast\times\CV^\ast\to\IR to denote an inner product of covectors. Using the metric, we can link these notations as

     ⁣v,w ⁣V=v,w=v,w=gabvawb ⁣α,β ⁣V=α,β=α,β=gabαaβb\begin{equation} \begin{alignedat}{5} &\dabrn{\Bv,\Bw}_{\CV} &&= \abrn{\Bv, \Bw^\flat} &&= \abrn{\Bv^\flat, \Bw} &&= g_{ab} v^a w^b\\ &\dabrn{\Balpha,\Bbeta}_{\CV^\ast} &&= \abrn{\Balpha, \Bbeta^\sharp} &&= \abrn{\Balpha^\sharp, \Bbeta} &&= g^{ab}\alpha_a\beta_b\\ \end{alignedat} \tag{13}\end{equation}

    for all v,wV\Bv,\Bw\in\CV and α,βV\Balpha,\Bbeta\in\CV^\ast. Similarly,

    v,α= ⁣v,α ⁣V= ⁣v,α ⁣V.\begin{equation} \begin{alignedat}{4} &\abrn{\Bv, \Balpha} &&= \dabrn{\Bv^\flat, \Balpha}_{\CV^\ast} &&= \dabrn{\Bv, \Balpha^\sharp}_{\CV}. \end{alignedat} \tag{14}\end{equation}

    Despite the symmetricity of the inner product, we choose to think of the first operand as a vector and the second as a covector in a natural pairing, as a convention.

    The metric tensor has the following properties:

    • For orthonormal bases, the metric tensor equals the identity tensor, that is, gij=δijg_{ij}=\delta_{ij}.
    • The diagonal terms equal to the square of the lengths of the basis vectors, that is, gii=ei2g_{ii}=\Norm{\Be_i}^2 (no summation).
    • The off-diagonal terms are zero if the basis vectors are orthogonal. Specifically, gij=0g_{ij}=0 iff ei\Be_i and ej\Be_j are orthogonal.
    1. In musical notation, the flat symbol \flat is used to lower a note by one semitone, whereas the sharp symbol \sharp is used to raise a note by one semitone. It is recommended to pronounce v\Bv^\flat as v-flat and α\Balpha^\sharp alpha-sharp.

  11. Portrait of Onur Solmaz
    Onur Solmaz · Post · /2017/07/06 · HN

    Duality of Vector Spaces

    $ \newcommand{\veciup}[1]{#1^1,\ldots,#1^n} \newcommand{\setveci}[1]{\cbrn{\veci{#1}}} \newcommand{\setveciup}[1]{\cbrn{\veciup{#1}}} \newcommand{\tang}{T} $

    When I was learning about Continuum Mechanics for the first time, the covariance and contravariance of vectors confused the hell out of me. The concepts gain meaning in the context of Riemannian Geometry, but it was surprising to find that one doesn’t need to learn an entire subject to grasp the logic behind co-/contravariance. An intermediate knowledge of linear algebra is enough—that is, one has to be acquainted with the concept of vector spaces and one-forms.

    The duality of co-/contravariance arises when one has to define vectors in terms of a non-orthonormal basis. The reason such terminology doesn’t show up in engineering education is that Cartesian coordinates are enough for most engineering problems. But every now and then, a complex problem with funky geometrical requirements show up, like one that requires measuring distances and areas on non-flat surfaces. Then you end up with dual vector spaces. I’ll try to give the basics of duality below.

    Definition: Let V\CV be a finite-dimensional real vector space. The space V=L(V,R)\CV^\ast = \CL(\CV,\IR), defined as the the space of all one-forms α:VR\Balpha:\CV\to\IR, is called the dual space to V\CV.

    Let B={e1,,en}B=\cbr{\Be_1,\dots,\Be_n} be a basis of V\CV. Any vector vV\Bv\in\CV can be written in terms of BB as

    v=a1e1++anen\begin{equation} \Bv = a_1 \Be_1 + \cdots + a_n\Be_n \htmlId{eq:vectorrep1}{} \tag{1}\end{equation}

    with the components a1,,anRa_1,\dots,a_n\in\IR. For any i=1,,ni=1,\dots,n, we can define the ii-th component aia_i by a one-form as

    ei:={VRvei(v)=ai\begin{equation} \Be^i := \left\{ \begin{aligned} \CV &\to \IR \\ \Bv &\mapsto \Be^i(\Bv) = a_i \end{aligned}\right. \tag{2}\end{equation}

    These elements are linear and thus are in the space L(V,R)\CL(\CV,\IR)1. Given any basis B={e1,,en}B=\setveci{\Be}, we call B={e1,,en}B^\ast = \setveciup{\Be} the basis of V\CV^\ast dual to BB. The fact that BB^\ast really is a basis of V\CV^\ast can be proved by showing that ei\Be^i are linearly independent. Then v\Bv has the following representation

    v=e1(v)e1++en(v)en.\begin{equation} \Bv = \Be^1(\Bv)\, \Be_1 + \cdots + \Be^n(\Bv)\, \Be_n. \htmlId{eq:vectorrep2}{} \tag{3}\end{equation}

    Instead of aia_i, it is practical to denote the components of v\Bv as viv^i, lightface of the same symbol with a raised index corresponding to the raised index of the dual basis:

    v=v1e1++vnenandvi=ei(v).\begin{equation} \Bv = v^1 \Be_1 + \cdots + v^n \Be_n \eqwith v^i = \Be^i(\Bv). \tag{4}\end{equation}

    In fact, this convention is more compatible with the symmetry caused by the duality. This point will be more clear after the introduction of dual basis representation of one-forms.

    Proposition: Each eiL(V,R)\Be^i \in \CL(\CV,\IR) can be identified by its action on the basis BB:

    ei(ej)={1if i=j0otherwise.\begin{equation} \Be^i(\Be_j) = \begin{cases} 1 & \text{if } i=j \\ 0 & \text{otherwise}. \end{cases} \htmlId{eq:dualbasis2}{} \tag{5}\end{equation}

    Proof: For any vV\Bv\in\CV, ei(v)\Be^i(\Bv) must give viv^i, the ii-th component of v\Bv. Setting v=ej\Bv = \Be_j, one sees that ei(v)=vi=1\Be^i(\Bv)=v^i = 1 when i=ji=j, and is zero otherwise.

    Geometrically, (5) implies that a basis vector is perpendicular to all the dual basis vectors, except its own dual.

    Dual Basis Representation of One-Forms

    Let α\Balpha be a one form in V\CV^\ast with the corresponding dual basis {e1,,en}\setveciup{\Be}. Then similar to a vector, α\Balpha has the following representation

    α()=α(e1)e1()++α(en)en()=α1e1()++αnen()\begin{equation} \begin{aligned} \Balpha(\cdot) &= \Balpha(\Be_1)\,\Be^1(\cdot) + \dots + \Balpha(\Be_n)\,\Be^n(\cdot) \\ &= \alpha_1 \Be^1(\cdot) + \dots + \alpha_n \Be^n(\cdot) \end{aligned} \tag{6}\end{equation}

    where the components of the one-form α\Balpha are defined as

    αi=α(ei).\begin{equation} \alpha_i = \Balpha(\Be_i). \tag{7}\end{equation}

    Proof: We substitute (3) and obtain

    α(v)=α(i=1nei(v)ei)=i=1nα(ei)ei(v)\begin{equation} \begin{aligned} \Balpha(\Bv) &= \Balpha\rbr{\suml{i=1}{n} \Be^i(\Bv)\, \Be_i} = \suml{i=1}{n} \Balpha(\Be_i)\, \Be^i(\Bv) \\ \end{aligned} \tag{8}\end{equation}

    using α\Balpha‘s linearity.

    Notation: Let V\CV be a finite-dimensional real vector space. For vV\Bv\in\CV and αV\Balpha\in\CV^\ast

    ,:={V×VR(v,α)α(v)\begin{equation} \abrn{\cdot,\cdot} := \left\{\begin{aligned} \CV\times\CV^\ast &\to \IR \\ (\Bv, \Balpha) &\mapsto \Balpha(\Bv) \end{aligned}\right. \tag{9}\end{equation}

    denotes the action of α\Balpha on v\Bv, and is called a natural pairing or dual pairing between a vector space and its dual. It is of the essence to understand that ,\abrn{\cdot,\cdot} does not denote an inner product in V\CV; that is, v,α\abr{\Bv,\Balpha} means α(v)\Balpha(\Bv).

    With this notation, (3) can be written as

    v=v,e1e1++v,enen.\begin{equation} \Bv = \abrn{\Bv,\Be^1}\, \Be_1 + \cdots + \abrn{\Bv,\Be^n}\, \Be_n. \tag{10}\end{equation}

    and (5) as

    ei,ej=δij.\begin{equation} \abrn{\Be_i, \Be^j} = \delta_{ij}. \htmlId{eq:dualbasis1}{} \tag{11}\end{equation}

    Using the convention that ei\Be_i are column vectors and ei\Be^i are row vectors, (11) can be rearranged in the following manner

    [e1e2en]1=[e1e2en]\begin{equation} \left[ \begin{array}{ c|c|c|c } \Be_1&\Be_2&\cdots&\Be_n \end{array} \right]\inv = \left[ \begin{array}{ c } \Be^1 \\ \hline \Be^2 \\ \hline \vdots \\ \hline \Be^n \end{array} \right] \htmlId{eq:computedualbasis1}{} \tag{12}\end{equation}

    which can be used to compute a dual basis.

    Example: Given a two-dimensional vector space V\CV with a basis e1=[2,0.5]T\Be_1=[2,-0.5]\tra, e2=[1,1]T\Be_2=[1,1]\tra, we use (12) to compute

    [210.51]1=[0.40.40.20.8]\begin{equation} \begin{bmatrix} 2 & 1 \\ -0.5 & 1 \end{bmatrix}\inv = \begin{bmatrix} 0.4 & -0.4 \\ 0.2 & 0.8 \end{bmatrix} \tag{13}\end{equation}

    and obtain the dual basis vectors as e1=[0.4,0.4]\Be^1=[0.4,-0.4] and e2=[0.2,0.8]\Be^2=[0.2,0.8]. The result is given in the following figure,

    where one can see that e1e2\Be_1\perp\Be^2, e1e2\Be^1\perp\Be_2.

    A body B\CB embedded in R2\IR^2 with curvilinear coordinates. Every point P\CP at X\BX has an associated two-dimensional vector space, called B\CB's tangent space at X\BX, denoted TXB\tang_{\BX}\CB. The basis ei\Be_i corresponding to coordinates θi\theta_i are not necessarily orthogonal and can admit corresponding duals ei\Be^i, due to curvilinearity. The coordinates appear to be affine at the point's immediate vicinity, and thus in the tangent space.

    The introduction of the dual space allows us to reinterpret a one-form α\Balpha as an object residing in the dual space. In fact, the canonical duality V=V\CV^{\ast\ast}=\CV states that every vector v\Bv can be interpreted as a functional on the space V\CV^\ast via

    v:={VRαv(α) or v,α\begin{equation} \Bv:= \left\{ \begin{aligned} \CV^\ast &\to \IR \\ \Balpha &\mapsto \Bv(\Balpha) \text{ or } \abrn{\Bv, \Balpha} \end{aligned}\right. \tag{14}\end{equation}
    1. Despite being denoted with bold letters, one-forms should not be confused with vectors.