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 and pressure states the Galerkin weak formulation for Stokes’ flow, where is a specified boundary velocity, belongs to a set of functions in which every function is equal to zero on the boundary where the components of the velocity is , and belongs to a set of functions such that the equations of conservation of mass and momentum can be written as follows [1]:
(2.1)
where and are weighting functions and the boundary conditions are defined:
(2.2)
where is the boundary where the components of the forces are set to be , is the normal vector at the boundary , and [6]. The weak formulation can be re-written as below:
(2.3)
where 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)
(2.5)
(2.6)
(2.7)
(2.8)
where is the shape function for the velocity at node A, is the shape function for the pressure at node B, is the velocity nodes set, is the pressure nodes set and is the velocity nodes set along the boundary . Mandyoc defines at the center of each element, while 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)
and also:
(2.10)
The matrix representation of these two equations above can be presented:
(2.11)
where is the vector of velocity values at , is the vector of pressure values at , is the resulting vector of the rigth-hand side of equations Eq. 2.9 or Eq. 2.10, is the stiffness matrix, is the discrete gradient operator, and is the discrete divergence operator [1]. , and are derived from the first and second terms of Eq. 2.9 and Eq. 2.10.
The matrix operator from Eq. 2.9 contains the spatial derivatives of the shapes function and, for a 2-D plane, can be written as:
(2.12)
Again from Eq. 2.9 and for 2-D plane strain problems, the effective viscosity matrix can be written:
(2.13)
The stiffness matrix and the gradient operator can be written:
(2.14)
(2.15)
where the subscripts and are the global velocity node numbers, and are the degree of freedom per grid node, ranging from to , and are global equation numbers for the velocity ranging from to , where 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 as follow:
(2.16)
where , , and are written below:
(2.17)
(2.18)
(2.19)
(2.20)
where is a row vector of shape functions, is a column vector of the unknown temperature parameters, is its time derivative, and .
Note
The superscript represents the transpose of the matrix, while the non-superscript represents the temperature.
and are symmetric, but 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 to [7, 8, 9]:
(2.21)
where is:
(2.22)
where is the characteristic element size in the advection velocity direction (), and is:
(2.23)
The time discretization is made by an implicit scheme [3]:
(2.24)
where is a weighting parameter. Multiplying both sides of Eq. 2.24 by and assuming :
(2.25)
where .
Rearranging Eq. 2.25 allows to rewrite it in a numerical form to solve the energy equation.
(2.26)
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 , such that , where the correction is evaluated at the boundary of each finite element. The correction is given by the Eq. 2.27 below:
(2.27)
where is the element shape function, is a wight factor of the correction term, is the density contrast between the two mediums, is the numerical integration time step, is the gravity acceleration vector, and 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)
where is the rupture tension and is the second invariant of the deviatoric strain rate tensor, and and are the plastic and ductile viscosities.
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)
where represents an array with all the nodal values of the velocity components, is a tolerance factor, and is the mean value of . The superscript and 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.