2. Numerical implementation

The following sections show how the numerical methods were implemented to solve the equations of conservation of mass, momentum and energy that were presented in the Basic theory section.

2.1. Mass and momentum equations

For a solution domain Ω, finding the flow velocity ui=gi+vi and pressure P states the Galerkin weak formulation for Stokes’ flow, where gi is a specified boundary velocity, vi belongs to a set of functions V in which every function is equal to zero on the boundary where the ith components of the velocity is gi, and P belongs to a set of functions P such that the equations of conservation of mass and momentum can be written as follows [1]:

(2.1)Ωwi,jσijdΩΩqui,idΩ=ΩwifidΩ+i=1nsdΓhiwihidΓ

where wiV and qP are weighting functions and the boundary conditions are defined:

(2.2)ui=gi on Γgi,σijnj=hi on Γhi

where Γhi is the boundary where the ith components of the forces are set to be hi, nj is the normal vector at the boundary Γhi, and fi=gρ0αδi3 [6]. The weak formulation can be re-written as below:

(2.3)Ωwi,jcijklvk,ldΩΩqvi,idΩΩwi,iPdΩ=ΩwifidΩ+i=1nsdΓhiwihidΓΩwi,jcijklgk,ldΩ

where cijkl=η(δikδjl+δilδjk) is obtained from the stress tensor equation (see Eq. 1.4 in the basic theory section).

The velocity field, the pressure field and the weighting functions shape functions that interpolate the grid points at every node are given:

(2.4)v=viei=AΩvΓgivNAviAei
(2.5)w=wiei=AΩvΓgivNAwiAei
(2.6)g=AΩvΓgivNAgiAei
(2.7)P=BΩpMBPB
(2.8)q=BΩpMBqB

where NA is the shape function for the velocity at node A, MB is the shape function for the pressure at node B, Ωv is the velocity nodes set, Ωp is the pressure nodes set and Γgig is the velocity nodes set along the boundary Γgi. Mandyoc defines Ωp at the center of each element, while Ωv is defined at every element vertex. This avoids spurious flow solutions and numerical instabilities [1] and it keeps the velocity shape functions one order higher than the pressure shape functions, a common strategy used in finite element modeling of incompressible media [6].

From the shape functions above and the Galerkin weak formulation (Eq. 2.3), the following expression can be obtained:

(2.9)BΩvΓgjv(eiTΩBATDBBdΩejvjB)BΩp(eiΩNA,iMBdΩPB)=ΩNAeifidΩ+i=1nsdΓhiNAeihidΓBΓgjv(eiTΩBATDBBTdΩejgjB)

and also:

(2.10)BΩvΓgjvΩMANBjdΩejvjB=0

The matrix representation of these two equations above can be presented:

(2.11)[KGGT0]{VP}={F0}

where V is the vector of velocity values at Ωv, P is the vector of pressure values at Ωp, F is the resulting vector of the rigth-hand side of equations Eq. 2.9 or Eq. 2.10, K is the stiffness matrix, G is the discrete gradient operator, and GT is the discrete divergence operator [1]. K, G and GT are derived from the first and second terms of Eq. 2.9 and Eq. 2.10.

The matrix operator B from Eq. 2.9 contains the spatial derivatives of the shapes function N and, for a 2-D plane, can be written as:

(2.12)BA=[NA,100NA,2NA,2NA,1]

Again from Eq. 2.9 and for 2-D plane strain problems, the effective viscosity matrix D can be written:

(2.13)D=[2η0002η000η]

The stiffness matrix K and the gradient operator G can be written:

(2.14)Klm=eiTΩBATDBBdΩej
(2.15)Glm=eiΩNAMBdΩej

where the subscripts A and B are the global velocity node numbers, i and j are the degree of freedom per grid node, ranging from 1 to nsd, l and m are global equation numbers for the velocity ranging from 1 to nvnsd, where nv is the number of velocity nodes in the grid.

2.2. Energy equation

It is possible to represent the energy conservation equation (Eq. 1.3) as a finite element problem for a solution domain ΩV as follow:

(2.16)Ma˙T+(Ka+Kc)aT=F

where M, Ka, Kc and F are written below:

(2.17)M=ΩVNVTρ0cpNVdΩV
(2.18)Ka=ΩVNVTρ0cpvBVdΩv
(2.19)Kc=ΩVBVTρ0cpvBvdΩv
(2.20)F=ΩVNVT(HcpαTgu3cp)dΩv

where NV is a row vector of shape functions, aT is a column vector of the unknown temperature parameters, a˙T is its time derivative, and BVNV.

Note

The superscript T represents the transpose of the matrix, while the non-superscript T represents the temperature.

M and Kc are symmetric, but Ka is not. This asymmetry decreases the accuracy of the solution when advection is more dominant than conduction ([7], chapter 2). To increase numerical accuracy and stability, Mandyoc uses the streamline upwind Petrov-Galerkin process to modify Ka to Ka [7, 8, 9]:

(2.21)Ka=ΩVNVTρ0cpvBVdΩV

where NVi is:

(2.22)NVi=NVi+αopthevNVi2|v|

where he is the characteristic element size in the advection velocity direction (v), and αopt is:

(2.23)αopt=cothPe1Pe, where Pe=|v|he2κρ0cp

The time discretization is made by an implicit scheme [3]:

(2.24)aT(t+Δt)aT(t)Δt=θa˙T(t+Δt)+(1θ)aT(t)

where θ=0.5 is a weighting parameter. Multiplying both sides of Eq. 2.24 by M(t+Δt) and assuming M(t+Δt)M(t):

(2.25)M(t+Δt)aT(t+Δt)aT(t)Δt=θ[F(t+Δt)KT(t+Δt)aT(t+Δt)]+(1θ)[F(t)KT(t)aT(t)]

where KT=Ka+Kc.

Rearranging Eq. 2.25 allows to rewrite it in a numerical form to solve the energy equation.

(2.26)[M(t+Δt)+ΔtθKT(t+Δt)]aT(t)(t+Δt)=[M(t+Δt)Δt(1θ)KT(t)]aT(t)+Δt[θF(t+Δt)+(1θ)F(t)]

2.3. Free surface

Mandyoc uses the Free Surface Stabilization Algorithm [10] to modify the Stokes equation and avoid numerical instabilities that can occur on the surface of the model. The up-and-down oscillations around the steady state (“sloshing instability” or “drunken sailer effect”) would require small time steps, which would increase running time by unfeasible amounts.

The modification is done on the stiffness matrix Ke, such that K~e=Ke+Le, where the correction Le is evaluated at the boundary Γe of each finite element. The correction is given by the Eq. 2.27 below:

(2.27)Le=ΓeNΘΔρΔtgndΓ

where N is the element shape function, 0Θ1 is a wight factor of the correction term, Δρ is the density contrast between the two mediums, Δt is the numerical integration time step, g is the gravity acceleration vector, and n is the normal vector to the element.

2.4. Rheology

Considering a visco-plastic model, the effective viscosity η follows the formulation described by Moresi and Solomatov (1998) [11], which combines plastic deformation and viscous deformation:

(2.28)η=min(ηplas,ηvisc)=min(τyield2ε˙II,ηvisc)

where τyield is the rupture tension and ε˙II=(ε˙ijε˙ij/2)1/2 is the second invariant of the deviatoric strain rate tensor, and ηplas and ηvisc are the plastic and ductile viscosities.

2.4.1. Plastic deformation

The plastic deformation can be calculated using the Byerlee Law [12] to compute τyield and ηplas. Eq. 2.29 shows the relationship implemented in Mandyoc.

(2.29)τyield=c0+μρgz

where c0 in the internal cohesion of the rock, μ is the friction coefficient, ρ is the density and z is the depth.

Alternatively, the user can choose to use the the Druker-Prager criterion [13], which is presented in Eq. 2.30.

(2.30)τyield=c0cosφ+Psinφ

where φ is the internal angle of friction.

2.4.2. Viscous deformation

Mandyoc contains several rheology models that the user can choose for viscous deformation. Among them, two will be discussed here.

The ductile rheology can be simulated using the Frank-Kamenetskii approximation, following the formulation described by Solomatov and Moresi (2000) [14], where the viscosity is a function of the temperature T as in the equation below. Such formulation was also used by Sacek (2017) [15] in an earlier Mandyoc version.

(2.31)ηvisc(T)=Cηrbexp(γT)

where ηr is the reference viscosity, C is a compositional factor to scale the effective viscosity, and b and γ=Ea/RTb2 are constants, which in turn, Ea is the activation energy, R is the gas constant, and Tb is the basal temperature.

Additionally, the rheology can also be considered to follow a power law, as a function of the temperature T, compositional factor C, pressure P and strain rate ε as follows:

(2.32)ηvisc=CA1nε˙1nnexpQ+VPnRT

where A is a pre-exponential scale factor, n is the power law exponent, ε˙ is the square root of the second invariant of the strain rate tensor, Q is the activation energy, and V is the activation volume. The values of A, n, Q, and V are measured under laboratory conditions [16, 17].

2.4.3. Non-linear iterations

When the non-linear option is chosen by the user, the effective viscosity is dependent on the velocity field, which is iteratively updated following the algorithm described by Thieulot (2014) [4]. In this algorithm, the velocity and effective viscosity field are iteratively updated until the following convergence criterion is satisfied:

(2.33)χf=1(fifi)(fi+1fi+1)|fifi| |fi+1fi+1|tol

where f represents an array with all the nodal values of the velocity components, tol is a tolerance factor, and f is the mean value of f. The superscript i and i+1 indicate two consecutive iterations in the same time step. In each iteration, the momentum and mass equations are calculated with an updated effective viscosity field.