$ \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}