I. The Bubnov–Galerkin functional

Let us write once more the functional for the Euler equation (5.4)

I(υ)\displaystyle I(\upsilon) =(L[υ],υ)\displaystyle = (L[\upsilon], \upsilon) 2(f,υ).\displaystyle - 2 \cdot (f, \upsilon).

The linear operator L[υ]L[\upsilon] for the parabolic equation we are interested in has the form

L[υ]\displaystyle L[\upsilon] =υt\displaystyle = \frac{\displaystyle \partial \upsilon}{\displaystyle \partial t} a2Δυ.\displaystyle - a^2 \cdot \Delta \upsilon.

The scalar product (L[υ],υ)(L[\upsilon], \upsilon) has the form

(L[υ],υ)\displaystyle (L[\upsilon], \upsilon) =M(υta2Δυ)υdM\displaystyle = \int_M \left( \frac{\displaystyle \partial \upsilon}{\displaystyle \partial t} - a^2 \cdot \Delta \upsilon \right) \cdot \upsilon \,dM =MυtυdM\displaystyle = \int_M \frac{\displaystyle \partial \upsilon}{\displaystyle \partial t} \cdot \upsilon \,dM a2MΔυυdM.\displaystyle - a^2 \cdot \int_M \Delta \upsilon \cdot \upsilon \,dM.

The scalar product (f,υ)(f, \upsilon) has the form

(f,υ)\displaystyle (f, \upsilon) =MfυdM.\displaystyle = \int_M f \cdot \upsilon \,dM.

The Ostrogradsky formula for the Laplace operator is known

MΔυdM\displaystyle \int_M \Delta \upsilon \,dM =SυdS,\displaystyle = \int_S \nabla \upsilon \,dS,
(I.1)

where SS is the boundary of the submanifold MM, and dSdS is its vector element directed along the outward normal. Let us integrate the second integral by parts

MΔυυdM\displaystyle \int_M \Delta \upsilon \cdot \upsilon \,dM =SυυdS\displaystyle = \int_S \upsilon \cdot \nabla \upsilon \,dS MυυdM.\displaystyle - \int_M \nabla \upsilon \cdot \nabla \upsilon \,dM.
(I.2)

Thus, the original functional can be written as

I(υ)\displaystyle I(\upsilon) =MυtυdM\displaystyle = \int_M \frac{\displaystyle \partial \upsilon}{\displaystyle \partial t} \cdot \upsilon \,dM a2SυυdS\displaystyle - a^2 \cdot \int_S \upsilon \cdot \nabla \upsilon \,dS +a2MυυdM\displaystyle + a^2 \cdot \int_M \nabla \upsilon \cdot \nabla \upsilon \,dM 2MfυdM.\displaystyle - 2 \cdot \int_M f \cdot \upsilon \,dM.

Let us give the increment υ^\widehat{\upsilon} +ϵυ+ \epsilon \cdot \upsilon, where υ^\widehat{\upsilon} is the exact solution, and ϵ\epsilon is some small number. The full increment of the functional can be written as

I(υ^+ϵυ)\displaystyle I(\widehat{\upsilon} + \epsilon \cdot \upsilon) I(υ^)\displaystyle - I(\widehat{\upsilon}) =M(υ^+ϵυ)t(υ^+ϵυ)dM\displaystyle = \int_M \frac{\displaystyle \partial (\widehat{\upsilon} + \epsilon \cdot \upsilon)}{\displaystyle \partial t} \cdot (\widehat{\upsilon} + \epsilon \cdot \upsilon) \,dM a2S(υ^+ϵυ)(υ^+ϵυ)dS\displaystyle - a^2 \cdot \int_S (\widehat{\upsilon} + \epsilon \cdot \upsilon) \cdot \nabla (\widehat{\upsilon} + \epsilon \cdot \upsilon) \,dS +a2M(υ^+ϵυ)(υ^+ϵυ)dM\displaystyle + a^2 \cdot \int_M \nabla (\widehat{\upsilon} + \epsilon \cdot \upsilon) \cdot \nabla (\widehat{\upsilon} + \epsilon \cdot \upsilon) \,dM 2Mf(υ^+ϵυ)dM\displaystyle - 2 \cdot \int_M f \cdot (\widehat{\upsilon} + \epsilon \cdot \upsilon) \,dM Mυ^tυ^dM\displaystyle - \int_M \frac{\displaystyle \partial \widehat{\upsilon}}{\displaystyle \partial t} \cdot \widehat{\upsilon} \,dM +a2Sυ^υ^dS\displaystyle + a^2 \cdot \int_S \widehat{\upsilon} \cdot \nabla \widehat{\upsilon} \,dS a2Mυ^υ^dM\displaystyle - a^2 \cdot \int_M \nabla \widehat{\upsilon} \cdot \nabla \widehat{\upsilon} \,dM +2Mfυ^dM.\displaystyle + 2 \cdot \int_M f \cdot \widehat{\upsilon} \,dM.

Neglecting the second-order terms proportional to ϵ2\epsilon^2, we obtain

I(υ^+ϵυ)\displaystyle I(\widehat{\upsilon} + \epsilon \cdot \upsilon) I(υ^)\displaystyle - I(\widehat{\upsilon}) =ϵM[υ^tυ+υtυ^]dM\displaystyle = \epsilon \cdot \int_M \left[ \frac{\displaystyle \partial \widehat{\upsilon}}{\displaystyle \partial t} \cdot \upsilon + \frac{\displaystyle \partial \upsilon}{\displaystyle \partial t} \cdot \widehat{\upsilon} \right] \,dM ϵa2S[υ^υ+υυ^]dS\displaystyle - \epsilon \cdot a^2 \cdot \int_S \left[ \widehat{\upsilon} \cdot \nabla \upsilon + \upsilon \cdot \nabla \widehat{\upsilon} \right] \,dS +2ϵa2Mυ^υdM\displaystyle + 2 \cdot \epsilon \cdot a^2 \cdot \int_M \nabla \widehat{\upsilon} \cdot \nabla \upsilon \,dM 2ϵMfυdM.\displaystyle - 2 \cdot \epsilon \cdot \int_M f \cdot \upsilon \,dM.

If we take ϵ\epsilon out of the brackets and take into account that ϵ\epsilon can be negative, while the increment of the functional is always positive, since υ^\widehat{\upsilon} is the exact solution, we obtain as a mandatory condition

M[υ^tυ+υtυ^]dM\displaystyle \int_M \left[ \frac{\displaystyle \partial \widehat{\upsilon}}{\displaystyle \partial t} \cdot \upsilon + \frac{\displaystyle \partial \upsilon}{\displaystyle \partial t} \cdot \widehat{\upsilon} \right] \,dM a2S[υ^υ+υυ^]dS\displaystyle - a^2 \cdot \int_S \left[ \widehat{\upsilon} \cdot \nabla \upsilon + \upsilon \cdot \nabla \widehat{\upsilon} \right] \,dS +2a2Mυ^υdM\displaystyle + 2 \cdot a^2 \cdot \int_M \nabla \widehat{\upsilon} \cdot \nabla \upsilon \,dM 2MfυdM\displaystyle - 2 \cdot \int_M f \cdot \upsilon \,dM =0.\displaystyle = 0.

Taking into account that υ^\widehat{\upsilon} υ\approx \upsilon, and cancelling the common factor, we return to the original equation. This means that the numerical solution of the boundary value problem reduces to the minimization of the functional

I(υ)\displaystyle I(\upsilon) =MυtυdM\displaystyle = \int_M \frac{\displaystyle \partial \upsilon}{\displaystyle \partial t} \cdot \upsilon \,dM a2SυυdS\displaystyle - a^2 \cdot \int_S \upsilon \cdot \nabla \upsilon \,dS +a2MυυdM\displaystyle + a^2 \cdot \int_M \nabla \upsilon \cdot \nabla \upsilon \,dM 2MfυdM\displaystyle - 2 \cdot \int_M f \cdot \upsilon \,dM min.\displaystyle \rightarrow \min.
(I.3)

The factor 22 in front of the linear term MfυdM\int_M f \cdot \upsilon dM is kept deliberately: it is precisely what ensures that the minimum condition δI\delta I =0= 0 returns the original equation rather than an equation with an extra factor of 1/21/2 (when differentiating, the quadratic terms produce a factor of 22, and the linear term must have the same one).

Let us proceed to the separation into stationary and nonstationary problems. It is fundamentally important to perform this separation and the subsequent time discretization at the level of the equation, not of the functional: the time derivative is not a self-adjoint operator, so direct substitution of υ\upsilon =ψ(M)ϕ(t)= \psi(M) \cdot \phi(t) into the functional would lead to incorrect coefficients. Let us write the weak form of the equation L[u]L[u] =f= f, obtained above by integration by parts

MutυdM\displaystyle \int_M \frac{\displaystyle \partial u}{\displaystyle \partial t} \cdot \upsilon \,dM +a2MuυdM\displaystyle + a^2 \cdot \int_M \nabla u \cdot \nabla \upsilon \,dM a2SυudS\displaystyle - a^2 \cdot \int_S \upsilon \cdot \nabla u \,dS =MfυdM,\displaystyle = \int_M f \cdot \upsilon \,dM,
(I.4)

which must hold for an arbitrary trial function υ\upsilon.

The stationary equation with Dirichlet and/or Neumann boundary conditions

If ut\frac{\displaystyle \partial u}{\displaystyle \partial t} =0= 0, the time term disappears, and due to the symmetry of the spatial operator the weak form (I.4) is equivalent to the minimization of the functional

a2MυυdM\displaystyle a^2 \cdot \int_M \nabla \upsilon \cdot \nabla \upsilon \,dM 2MfυdM\displaystyle - 2 \cdot \int_M f \cdot \upsilon \,dM a2SυυdS\displaystyle - a^2 \cdot \int_S \upsilon \cdot \nabla \upsilon \,dS min.\displaystyle \rightarrow \min.
(I.5)

The nonstationary equation with Dirichlet and/or Neumann boundary conditions

We discretize the time derivative by the implicit Euler scheme with step Δt\Delta t, applying it to the weak form of the equation: ut\frac{\displaystyle \partial u}{\displaystyle \partial t} unun1Δt\approx \frac{\displaystyle u_n - u_{n-1}}{\displaystyle \Delta t}, where unu_n is the solution on the current time layer, and un1u_{n-1} on the previous one. Substituting this into (I.4) and multiplying by Δt\Delta t, we obtain the equation for the time step

M(unun1)υdM\displaystyle \int_M (u_n - u_{n-1}) \cdot \upsilon \,dM +Δta2MunυdM\displaystyle + \Delta t \cdot a^2 \cdot \int_M \nabla u_n \cdot \nabla \upsilon \,dM Δta2SυundS\displaystyle - \Delta t \cdot a^2 \cdot \int_S \upsilon \cdot \nabla u_n \,dS =ΔtMfυdM.\displaystyle = \Delta t \cdot \int_M f \cdot \upsilon \,dM.

This equation, in turn, is the minimum condition of the functional

Mυn2dM\displaystyle \int_M \upsilon_n^2 \,dM +Δta2MυnυndM\displaystyle + \Delta t \cdot a^2 \cdot \int_M \nabla \upsilon_n \cdot \nabla \upsilon_n \,dM 2M[Δtf+υn1]υndM\displaystyle - 2 \cdot \int_M \left[ \Delta t \cdot f + \upsilon_{n-1} \right] \cdot \upsilon_n \,dM Δta2SυnυndS\displaystyle - \Delta t \cdot a^2 \cdot \int_S \upsilon_n \cdot \nabla \upsilon_n \,dS min.\displaystyle \rightarrow \min.
(I.6)

Thus, the nonstationary equation has been reduced to successively solving stationary problems: at each step, from the known υn1\upsilon_{n-1} is found υn\upsilon_n.

Matrix form

We discretize the trial function over the mesh nodes: υ\upsilon =iqiϕi(M)= \sum_i q_i \cdot \phi_i(M), where ϕi(M)\phi_i(M) are the basis functions, and q\vec{q} =(q0,,qn)T= (q_0, \ldots, q_n)^T is the vector of nodal values. The substitution turns each integral of the functional into a quadratic or linear form in q\vec{q}, and their coefficients are assembled into matrices:

MυυdM=qTKq,MυυdM=qTDq,MfυdM=FTq\begin{aligned}\int_M \nabla \upsilon \cdot \nabla \upsilon \,dM &= \vec{q}^T \cdot K \cdot \vec{q},\\\int_M \upsilon \cdot \upsilon \,dM &= \vec{q}^T \cdot D \cdot \vec{q},\\\int_M f \cdot \upsilon \,dM &= \vec{F}^T \cdot \vec{q}\end{aligned}
(I.7)

where KK is the stiffness matrix (the integral of the product of the gradients), DD is the damping matrix (the integral of the product of the trial functions), F\vec{F} is the load vector (the integral of the source); the matrices KK and DD are symmetric. The boundary integral a2SυυdS-a^2 \int_S \upsilon \cdot \nabla \upsilon \,dS does not collapse into a matrix: it is a surface term that, in discrete form, enters only the equations of the boundary nodes (for an interior node the trial function vanishes on the boundary) and is determined by the boundary condition itself.

The discrete system is obtained by the Bubnov–Galerkin method: we substitute υ\upsilon =iqiϕi= \sum_i q_i \phi_i into the weak form (I.4) and successively take the trial functions ϕj\phi_j. For the stationary equation this gives the system

a2Kq\displaystyle a^2 K \cdot \vec{q} =F\displaystyle = \vec{F} +a2s,\displaystyle + a^2 \vec{s},
(I.8)

where s\vec{s} is the vector of nodal boundary fluxes. The flux itself is not specified here — what to do with it is determined by the type of boundary condition. Accounting for boundary conditions is a nontrivial task, and it is discussed in detail in separate appendices: “Accounting for Dirichlet boundary conditions” and “Accounting for Neumann boundary conditions”.

For the nonstationary equation (implicit Euler scheme, see (I.6)) the system at the time step takes the form

[D+Δta2K]qn\displaystyle \left[ D + \Delta t \cdot a^2 K \right] \cdot \vec{q}_n =ΔtF\displaystyle = \Delta t \cdot \vec{F} +Dqn1\displaystyle + D \cdot \vec{q}_{n-1} +Δta2s.\displaystyle + \Delta t \cdot a^2 \vec{s}.
(I.9)