Numerical modeling (geology)

In geology, numerical modeling is a widely applied technique to tackle complex geological problems by computational simulation of geological scenarios.

Numerical modeling uses mathematical models to describe the physical conditions of geological scenarios using numbers and equations. Nevertheless, some of their equations are difficult to solve directly, such as partial differential equations. With numerical models, geologists can use methods, such as finite difference methods, to approximate the solutions of these equations. Numerical experiments can then be performed in these models, yielding the results that can be interpreted in the context of geological process. Both qualitative and quantitative understanding of a variety of geological processes can be developed via these experiments.

Numerical modelling has been used to assist in the study of rock mechanics, thermal history of rocks, movements of tectonic plates and the Earth's mantle. Flow of fluids is simulated using numerical methods, and this shows how groundwater moves, or how motions of the molten outer core yields the geomagnetic field.

History
Prior to the development of numerical modeling, analog modeling, which simulates nature with reduced scales in mass, length, and time, was one of the major ways to tackle geological problems, for instance, to model the formation of thrust belts. Simple analytic or semi-analytic mathematical models were also used to deal with relatively simple geological problems quantitatively.

In the late 1960s to 1970s, following the development of finite-element methods in solving continuum mechanics problems for civil engineering, numerical methods were adapted for modeling complex geological phenomena, for example, folding and mantle convection. With advances in computer technology, the accuracy of numerical models has been improved. Numerical modeling has become an important tool for tackling geological problems, especially for the parts of the Earth that are difficult to observe directly, such as the mantle and core. Yet analog modeling is still useful in modeling geological scenarios that are difficult to capture in numerical models, and the combination of analog and numerical modeling can be useful to improve understanding of the Earth's processes.

Components
A general numerical model study usually consists of the following components:
 * 1) Mathematical model is a simplified description of the geological problem, such as equations and boundary conditions. These governing equations of the model are often partial differential equations that are difficult to solve directly since it involves the derivative of the function, for example, the wave equation.
 * 2) Discretization methods and numerical methods convert those governing equations in the mathematical models to discrete equations. These discrete equations can approximate the solution of the governing equations. Common methods include the finite element, finite difference, or finite volume method that subdivide the object of interest into smaller pieces (element) by mesh. These discrete equations can then be solved in each element numerically. The discrete element method uses another approach, this method reassembling the object of interest from numerous tiny particles. Simple governing equations are then applied to the interactions between particles.
 * 3) Algorithms are computer programs that compute the solution using the idea of the above numerical methods.
 * 4) Interpretations are made from the solutions given by the numerical models.

Properties
A good numerical model usually has some of the following properties:
 * Consistent: Numerical models often divide the object into smaller elements. If the model is consistent, the result of the numerical model is nearly the same as what the mathematical model predicts when the element size is nearly zero. In other words, the error between the discrete equations used in the numerical model and the governing equations in the mathematical model tends to zero when the space of the mesh (size of element) becomes close to zero.
 * Stable: In a stable numerical model, the error during the computation of the numerical methods does not amplify. The error of an unstable model will stack up quickly and lead to an incorrect result. A stable and consistent numerical model has the same output as the exact solution in the mathematical model when the spacing of the mesh (size of element) is extremely small.
 * Converging: The output of the numerical model is closer to the actual solution of the governing equations in the mathematical models when the spacing of mesh (size of element) reduces, which is usually checked by carrying out numerical experiments.
 * Conserved: The physical quantities in the models, such as mass and momentum, are conserved. Since the equations in the mathematical models are usually derived from various conservation laws, the model result should not violate these premises.
 * Bounded: The solution given by the numerical model has reasonable physical bounds with respect to the mathematical models, for instance mass and volume should be positive.
 * Accurate: The solution given by the numerical models is close to the real solution predicted by the mathematical model.

Computation
The following are some key aspects of ideas in developing numerical models in geology. First, the way to describe the object and motion should be decided (kinematic description). Then, governing equations that describe the geological problems are written, for example, the heat equations describe the flow of heat in a system. Since some of these equations cannot be solved directly, numerical methods are used to approximate the solution of the governing equations.

Kinematic descriptions
In numerical models and mathematical models, there are two different approaches to describe the motion of matter: Eulerian and Lagrangian. In geology, both approaches are commonly used to model fluid flow like mantle convection, where an Eulerian grid is used for computation and Lagrangian markers are used to visualize the motion. Recently, there have been models that try to describe different parts using different approaches to combine the advantages of these two approaches. This combined approach is called the arbitrary Lagrangian-Eulerian approach.

Eulerian
The Eulerian approach considers the changes of the physical quantities, such as mass and velocity, of a fixed location with time. It is similar to looking at how river water flows past a bridge. Mathematically, the physical quantities can be expressed as a function of location and time. This approach is useful for fluid and homogeneous (uniform) materials that have no natural boundary.

Lagrangian
The Lagrangian approach, on the other hand, considers the change of physical quantities, such as the volume, of fixed elements of matter over time. It is similar to looking at a certain collection of water molecules as they flow downstream in a river. Using the Lagrangian approach, it is easier to follow solid objects which have natural boundary to separate them from the surrounding.

Governing equations
Following are some basic equations that are commonly used to describe physical phenomena, for example, how the matter in a geologic system moves or flows and how heat energy is distributed in a system. These equations are usually the core of the mathematical model.

Continuity equation
The continuity equation is a mathematical version of stating that the geologic object or medium is continuous, which means no empty space can be found in the object. This equation is commonly used in numerical modeling in geology.

One example is the continuity equation of mass of fluid. Based on the law of conservation of mass, for a fluid with density $$\rho$$ at position $$x_j$$ in a fixed volume $$V$$ of fluid, the rate of change of mass is equal to the outward fluid flow across the boundary $$S$$:

$$\frac{\partial}{\partial t} \int\limits_V \rho d V = -\int\limits_S \rho u_j d S_j $$ where $$V$$ is the volume element and $$u_j$$ is the velocity at $$x_j$$.

In Lagrangian form:

$$\frac{D \rho}{D t} \equiv \frac{\partial \rho}{\partial t}+ u_j \frac{ \partial \rho}{\partial x_j} = - \rho \frac{\partial u_j}{\partial x_j}$$

In Eulerian form:

$$\frac{\partial \rho}{\partial t} = \frac{\partial(\rho u_j)}{\partial x_j} $$

This equation is useful when the model involves continuous fluid flow, like the mantle is over geological time scales.

Momentum equation
The momentum equation describes how matter moves in response to force applied. It is an expression of Newton's second law of motion.

Consider a fixed volume $$V$$ of matter. By the law of conservation of momentum, the rate of change of volume is equal to: $$\frac{\partial}{\partial t} \int\limits_V \rho u_i dV = \int\limits_V \rho F_i dV + \int\limits_S \sigma_{ij}dS_j - \int\limits_S \rho u_i u_j dS_j $$
 * external force $$F$$ applied on the element
 * plus normal stress and shear stress applied on the surface $$S$$ bounding the element
 * minus the momentum moving out of the element on that surface

where $$V$$ is the volume element, $$u$$ is the velocity.

After simplifications and integrations, for any volume $$V$$, the Eulerian form of this equation is:

$$\rho \frac{\partial u_i}{\partial t} + \rho u_j \frac{\partial u_i}{\partial x_j}= \rho F_i + \frac{\partial \sigma_{ij}}{\partial x_j}$$

Heat equation
The heat equations describe how heat energy flows in a system.

From the law of conservation of energy, the rate of change of energy $$E$$ of a fixed volume $$V$$ of mass is equal to: Mathematically:
 * work done at the boundary $$S$$
 * plus work done by external force $$F$$ in the volume $$V$$
 * minus heat conduction across boundary $$S$$
 * minus heat convection across boundary $$S$$
 * plus heat produced internally

$$\frac{ \partial }{\partial t}\int\limits_V \rho E dV = \int\limits_S u_i \sigma_{ij}dS_j + \int\limits_V \rho u_i F_i dV - \int\limits_S k \frac{\partial T}{\partial x_j} dS_j-\int\limits_S \rho E u_{j} dS_j + \int\limits_V \rho H dV $$

where $$V$$ is the volume element, $$u$$ is the velocity, $$T$$ is the temperature,  $$k$$ is the conduction coefficient and $$H$$ is the rate of heat production.

Numerical methods
Numerical methods are techniques to approximate the governing equations in the mathematical models.

Common numerical methods include finite element method, spectral method, finite difference method, and finite volume method. These methods are used to approximate the solution of governing differential equations in the mathematical model by dissecting the domain into meshes or grids and applying simpler equations to individual elements or nodes in the mesh. The discrete element method uses another approach. The object is considered an assemblage of small particles.

Finite element method
The finite element method subdivides the object (or domain) into smaller, non-overlapping elements (or subdomains) and these elements are connected at the nodes. The solution for the partial differential equations are then approximated by simpler element equations, usually polynomials. Then these element equations are combined into equations for the entire object, i.e. the contribution of each element is summed up to model the response of the whole object. This method is commonly used to solve mechanical problems. The following are the general steps of using the finite element method:
 * 1) Select the element type and subdivide the object. Common element types include triangular, quadrilateral, tetrahedral, etc. Different types of elements should be chosen for different problems.
 * 2) Decide the function of displacement. The function of displacement governs how the elements move.  Linear, quadratic, or cubic polynomial functions are commonly used.
 * 3) Decide the displacement-strain relation. The displacement of the element changes or deforms the element's shape in what is technically called strain. This relation calculates how much strain the element experienced due to the displacement.
 * 4) Decide the strain-stress relation. The deformation of the element induces stress to the element, which is the force applied to the element. This relation calculates the amount of stress experienced by the element due to the strain. One of the examples of this relation is Hooke's law.
 * 5) Derive equations of stiffness and stiffness matrix for elements. The stress also causes the element to deform; the stiffness (the rigidity) of the elements indicates how much it will deform in response to the stress. The stiffness of the elements in different directions is represented in matrix form for simpler operation during calculation.
 * 6) Combine the element equations into global equations. The contributions of every element are summed up to a set of equations that describe the whole system.
 * 7) Apply boundary conditions. The predefined conditions at the boundary, such as temperature, stress, and other physical quantities are introduced to the boundary of the system.
 * 8) Solve for displacement. As time evolves, the displacement of the elements are solved step by step.
 * 9) Solve for strains and stress. After the displacement is calculated, the strains and stress are computed using the relations in steps 3 and 4.

Spectral method
The spectral method is similar to the finite element method. The major difference is that spectral method uses basis functions, possibly by using a Fast Fourier Transformation (FFT) that approximates the function by the sum of numerous simple functions. These kinds of basis functions can then be applied to the whole domain and approximate the governing partial differential equations. Therefore, each calculation takes the information from the whole domain into account while the finite element method only takes the information from the neighborhood. As a result, the spectral method converges exponentially and is suitable for solving problems involving a high variability in time or space.

Finite volume method
The finite volume method is also similar to the finite element method. It also subdivides the object of interest into smaller volumes (or elements), then the physical quantities are solved over the control volume as fluxes of these quantities across the different faces. The equations used are usually based on the conservation or balance of physical quantities, like mass and energy.

The finite volume method can be applied on irregular meshes like the finite element method. The element equations are still physically meaningful. However, it is difficult to get better accuracy, as the higher order version of element equations are not well-defined.

Finite difference method
The finite difference method approximates differential equations by approximating the derivative with a difference equation, which is the major method to solve partial differential equations. Consider a function $$f(x)$$ with single-valued derivatives that are continuous and finite functions of $$x$$, according to Taylor's theorem:

$$f(x+\Delta x) = f(x) + \Delta x f'(x) + \frac{1}{2}\Delta x ^2 f(x) + \frac{1}{6}\Delta x^3 f'(x)+\cdots$$

and

$$f(x-\Delta x) = f(x) - \Delta x f'(x) + \frac{1}{2}\Delta x ^2 f(x) - \frac{1}{6}\Delta x^3 f'(x)+\cdots$$

Summing up the above expressions:

$$f(x+\Delta x) + f(x-\Delta x ) = 2f(x) + \Delta x^2 f''(x) + \text{terms with higher than 4th power of } \Delta x $$

Ignore the terms with higher than 4th power of $$x $$, then:

$$f''(x) \simeq \frac{1}{\Delta x ^2}\left[ f(x+\Delta x) - 2f(x) - f(x-\Delta x) \right]$$

$$f'(x) \simeq \frac{1}{2 \Delta x}\left[ f(x+\Delta x) - f(x-\Delta x) \right]$$

The above is the central-difference approximation of the derivatives, which can also be approximated by forward-difference:

$$f'(x) \simeq \frac{1}{\Delta x}\left[ f(x+\Delta x) - f(x) \right]$$

or backward-difference:

$$f'(x) \simeq \frac{1}{\Delta x}\left[ f(x) - f(x-\Delta x) \right]$$

The accuracy of the finite differences can be improved when more higher order terms are used.

Discrete element method
The discrete element method, sometimes called distinct element method, is usually used to model discontinuous materials, such as rocks with fractures like joints and bedding, since it can explicitly model the properties of discontinuities. This method was developed to simulate rock mechanics problems at the beginning.

The main idea of this method is to model the objects as an assemblage of smaller particles, which is similar to building a castle out of sand. These particles are of simple geometry, such as a sphere. The physical quantities of each particle, such as velocity, are continuously updated at the contacts between them. This model is relatively computationally intensive, as a large quantity of particles needs to be used, especially for large-scale models, like a slope. Therefore, this model is usually applied to small-scale objects.

Bonded-particle model
There are objects that are not composed of granular materials, such as crystalline rocks composed of mineral grains that stick to each other or interlock with each other. Some bonding between particles is added to model this cohesion or cementation between particles. This kind of model is also called a bonded-particle model.

Applications
Numerical modeling can be used to model problems in different fields of geology at various scales, such as engineering geology, geophysics, geomechanics, geodynamics, rock mechanics, hydrogeology, and stratigraphy. The following are some examples of applications of numerical modeling in geology.

Rock mechanics
Numerical modeling has been widely applied in different fields of rock mechanics. Rock is a material that is difficult to model because rock are usually:
 * Discontinuous: There are numerous fractures and micro-fractures in a rock mass and the space in the rock mass maybe filled with other substances like air and water. A complex model is needed to fully capture these discontinuities, since the discontinuities have great effects on the rock mass.
 * Anisotropic: The properties of rock mass, such as permeability (the ability to allow fluid to flow through), may vary in different directions.
 * Inhomogeneous: The properties of different portions of the rock mass may be different. For example, the physical properties of quartz grains and feldspar grains are different in granite.
 * Not elastic: Rock cannot perfectly revert to its original shape after stress is removed.

In order to model the behaviors of rock, a complex model that takes all the above characteristics into account is needed. There are many models modeling rock as a continuum using methods like finite difference, finite element, and boundary element methods. One of the disadvantages is that the ability of modeling cracks and other discontinuities is usually limited in these models. Models that model rock as a discontinuum, using methods like discrete element and discrete fracture network methods, are also commonly employed. Combinations of both methods have also been developed.

Numerical modeling enhances the understanding of mechanical processes in rock by conducting numerical experiments, and is useful for design and construction works.

Thermochronology
Numerical modeling has been used to predict and describe the thermal history of the Earth's crust, which allows geologists to improve their interpretation of thermochronological data. Thermochronology can indicate the time at which a rock cooled below a particular temperature. Geologic events, like the development of a faults and surface erosion, can change the thermochronological pattern of samples collected on the surface, and it is possible to constrain the geologic events by these data. Numerical modeling can be used to predict the pattern.

The difficulties of thermal modeling of the Earth's crust mainly involve the irregularity and the changes of the Earth's surface (mainly erosion) through time. Therefore, in order to model the morphological changes of the Earth's surface, the models need to solve heat equations with boundary conditions that change with time and have irregular meshes.

Pecube
Pecube is one of the numerical models developed to predict the thermochronological pattern. It solves the following generalized heat transfer equation with advection using finite element method. The first three terms on the right-hand side are the heat transferred by conduction in $$x $$, $$y$$ and $$z$$ directions while $$A$$ is the advection. $$ \frac{\partial T}{\partial t} + u \frac{\partial T}{\partial x} + v \frac{\partial T}{\partial y} + w \frac{\partial T}{\partial z} = \frac{\partial}{\partial x} \kappa \frac{\partial T}{\partial x} + \frac{\partial}{\partial y} \kappa \frac{\partial T}{\partial y} + \frac{\partial}{\partial z} \kappa \frac{\partial T}{\partial z} + A $$ After the temperature field is constructed in the model, particle paths are traced and the cooling history of the particles can be obtained. The pattern of thermochronological age can then be computed.

Hydrogeology
In hydrogeology, groundwater flow is often modeled numerically by the finite element method  and finite difference method. These two methods have been shown to produce similar results if the mesh is fine enough.

MODFLOW
One of the well-known programs in modeling groundwater flow is MODFLOW, developed by the United States Geological Survey. It is a free and open-source program that uses the finite difference method as the framework to model groundwater conditions. The recent development of related programs offers more features, including:
 * Interactions between groundwater and surface-water systems
 * Transportation of solutes
 * Flow of fluid with variable density, such as salt water
 * Compaction of aquifer systems
 * Subsidence of land
 * Management of groundwater

Crustal dynamics
The rheology (response of materials to stress) of crust and the lithosphere is complex, since a free surface (the land surface) and the plasticity and elasticity of the crustal materials need to be considered. Most of the models use finite element methods with a Lagrangian mesh. One usage is the study of deformation and kinematics of subduction.

FLAC
The Fast Lagrangian Analysis of Continua (FLAC) is one of the most popular approaches in modeling crustal dynamics. The approach is fast as it solves the equations of momentum and continuity without using a matrix, hence it is fast but time steps must be small enough. The approach has been used in 2D,  2.5D, and 3D studies of crustal dynamics, in which the 2.5D results were generated by combining multiple slices of two-dimensional results.



Mantle convection
There are many attempts to model mantle convection.

Finite element, finite volume, finite difference and spectral methods have all been used in modeling mantle convection, and almost every model used an Eulerian grid. Due to the simplicity and speed of the finite-difference and spectral methods, they were used in some early models, but finite-element or finite volume methods were generally adopted in the 2010s. Many benchmark papers have investigated the validity of these numerical models. Current approaches mostly uses a fixed and uniform grid. Grid refinement, in which the size of the elements is reduced in the part that requires more accurate approximation, is possibly the direction of future development in numerical modeling of mantle convection.

Finite difference approach
In the 1960s to 1970s, mantle convection models using the finite difference approach usually used second-order finite differences. Stream functions were used to remove the effect of pressure and reduce the complexity of the algorithm. Due to the advancement in computer technology, finite differences with higher order terms are now used to generate a more accurate result.

Finite volume approach
Mantle convection modeled by finite volume approach is often based on the balance between pressure and momentum. The equations derived are the same as the finite difference approach using a grid with staggered velocity and pressure, in which the values of velocity and the pressure of each element are located at different points. This approach can maintain the coupling between velocity and pressure.

Multiple codes are developed based on this finite difference/finite volume approach. In modeling three-dimensional geometry of the Earth, since the parameters of mantles vary at different scales, multigrid, which means using different grid sizes for different variables, is applied to overcome the difficulties. Examples include the cubed sphere grid, 'Yin-Yang' grid,   and spiral grid.

Finite element approach
In the finite element approach, stream functions are also often used to reduce the complexity of the equations. ConMan, modeling two-dimensional incompressible flow in the mantle, was one of the popular codes for modeling mantle convection in the 1990s. Citcom, an Eulerian mutlgrid finite element model, is one of the most popular programs to model mantle convection in 2D and 3D.

Spectral method
The spectral method in mantle convection breaks down the three-dimensional governing equation into several one-dimensional equations, which solves the equations much faster. It was one of the popular approaches in early models of mantle convection. Many program were developed using this method during the 1980s to early 2000s. However, the lateral changes of viscosity of mantle are difficult to manage in this approach, and other methods became more popular in the 2010s.



Plate tectonics
Plate tectonics is a theory suggesting that the Earth's lithosphere is essentially composed of plates floating on the mantle. The mantle convection model is fundamental in modeling the plates floating on it, and there are two major approaches to incorporate the plates into this model: rigid-block approach and rheological approach. The rigid-block approach assumes the plates are rigid, which means the plates keep their shape and do not deform, just like some wooden blocks floating on water. In contrast, the rheological approach models the plates as a highly viscous fluid in which the equations applied to the lithosphere beneath also apply to the plates on top.

Geodynamo
Numerical models have been made to verify the geodynamo theory, a theory that posits that the geomagnetic field is generated by the motion of conductive iron and nickel fluid in the Earth's core.

Modeling of the flow of Earth's liquid outer core is difficult because: Most of the models use the spectral method to simulate the geodynamo, for example the Glatzmaier-Roberts model. Finite difference method has also been used in the model by Kageyama and Sato. Some study also tried other methods, like finite volume and finite element methods.
 * the Coriolis effect due to the Earth's rotation cannot be ignored
 * the magnetic field generated will also generate Lorentz force, which will affect the motion of the conductive fluid in the liquid outer core
 * the low viscosity of liquid iron makes the fluid flow hard to model



Seismology
Finite difference methods have been widely used in simulations of the propagation of seismic waves. However, due to limitations in computation power, in some models, the spacing of the mesh is too large (compared with the wavelength of the seismic waves) so that the results are inaccurate due to grid dispersion, in which the seismic waves with different frequencies separate. Some researchers suggest using the spectral method to model seismic wave propagation.

Sources of error
While numerical modeling provides accurate quantitative estimation to geological problems, there is always a difference between the actual observation and the modeling results due to:
 * the simplification of the actual problem when building the numerical model. Since numerous factors can affect a geological system, it is nearly impossible to take everything into account. Therefore, a numerical model usually simplifies the actual system by omitting the less significant factors. For instance, the Earth is often modeled as a sphere, despite the undulation of Earth's surface.
 * the approximations or idealizations of the governing equations. Many objects in nature are complex. It is impossible to capture all the characteristics using equations. For instance, rocks are discontinuous, but modeling rock as a continuous material is reasonable at large scale as it describes the properties accurately enough.
 * the approximations in the discretization process. Since the governing equations in the model cannot be solved directly, approximations to these equations are made using discretization and numerical methods.
 * the uncertainty in physical parameters. For example, the models of the viscosity of mantle and core are not accurate.

Limitations
Apart from the errors, there are some limitations in using numerical models:
 * Users of the models need a high level of knowledge and experience to prevent misuse and misinterpretation of results.