Courses: The GoldSim Contaminant Transport Module:

Unit 3 - Introduction to Contaminant Transport Modeling Using GoldSim

Lesson 7 - Solving the Mass Transport Equations

In the preceding four Lessons we’ve briefly discussed the processes controlling mass transport and introduced the mathematical equations that represent those processes. Solving the equations associated with realistic contaminant transport problems (using any tool) generally requires use of numerical methods (as opposed to analytical solutions), and this is certainly the case for GoldSim.

Although a detailed understanding of the numerical methods used to solve the equations is not necessary, the basic assumptions associated with how the equations are solved (and the implications of those assumptions) should be understood. This is important, because as a general rule, you should not use “black boxes” to build models.  If you don’t understand how a tool works, you should not use it. Hence, in this Lesson, the general concepts necessary to understand how GoldSim solves the equations numerically is provided. Additional details will be provided in the subsequent Units when discussing the specific elements in GoldSim that are used to represent the various processes.

In the previous Lessons, we described two different ways we might represent parts of an environmental system.  In one, we represented the system using one or more well-mixed compartments. These kinds of systems can be represented using ordinary differential equations. This would be appropriate, for example, when dealing with a system of well-mixed tanks, or perhaps a stratified lake.  In the other, we described a system (e.g., a one-dimensional “tube”) in which the concentration varies continuously over the length of the component, and the governing equation is defined in terms of a concentration gradient. These kinds of systems must be represented using partial differential equations, in that concentration is a function of both time and space. This would be appropriate, for example, when dealing with a system such as an aquifer. Because they are represented mathematically using different kinds of equations, in GoldSim we treat these equations using different approaches.

Let’s start by revisiting the simple two tank example from Lesson 3 (you may want to briefly revisit that Lesson to refresh your memory). We noted that the governing equations for this system were as follows:

A key feature of these equations is that the rate of mass transport from one location (compartment 1) to the other (compartment 2) is only a function of the mass in the “upstream” compartment.  

This is a system of coupled first-order linear ordinary differential equations. What we want to do, of course, is use these two equations to predict M1 and M2 at any time in the future. To do this, GoldSim uses a (fully implicit) finite-difference approximation for the two derivatives. In particular, we can approximate these equations as follows:

where the superscript k refers to the current timestep, k-1 refers to the previous timestep, and Δt is the timestep length. Since at any given time k we know what the values were at time k-1, this simply represents a set of two equations with two unknowns (M1k and M2k) and can be easily solved as such every timestep. In this simple case, this can be solved by substitution. Generally, however, this cannot typically be done, and in GoldSim the equations are formulated as a set of matrix equations and solved.

Now let’s consider the case where there is an explicit spatial component to the governing equation. To do so, let’s revisit the simple example from Lesson 4 in which mass was advecting and diffusing/dispersing within a tube (again, you may want to briefly revisit that Lesson to refresh your memory). We noted that the governing equation for this system was as follows:

This is a partial differential equation. We have simplified the equation introduced in Lesson 4 by combining the eddy diffusion, molecular diffusion and mechanical dispersion into one term (DT) which simply sums these. This is the one-dimensional advection-dispersion equation.

As we shall see, GoldSim actually provides two alternative ways to solve this differential equation. The first can be thought of as an analytical approach using Laplace transforms. Laplace transforms solve differential equations by converting them into algebraic equations. We won’t go into any further detail in this Course on how Laplace transforms do this (you can read about this in any differential equations textbook if you are curious).  For the purposes of this Course, you can simply view it as an analytical approach that solves the equation without requiring use of spatial discretization.

The second approach for solving this differential equation involves using a finite difference approximation in the same manner that we did above for the two tank problem.  However, now instead of only approximating the time derivative using finite differences, we must also approximate the spatial derivatives. To do so, we must not only discretize time, but we must also discretize space. The finite difference approximation to the equation looks like this:

In this equation, the tube has been discretized spatially into a fixed number finite volumes (of length Δx). The equation involves the concentration in three adjacent volumes: j,  j-1 (which is immediately upgradient of j) and j+1 (which is immediately downgradient of j). The superscript k refers to the timestep (k is the current timestep k-1 is the previous timestep, and Δt is the timestep length). There is an equation for every volume so, for example, if the tube was divided into 20 finite volumes, there would be 20 equations with 20 unknowns for each contaminant being modeled.

Note: Obviously, the equations for the first and the last volumes would be modified slightly to account for boundary conditions.

These equations could be rewritten in terms of the mass in each volume (rather than the concentration). After doing so, this system of equations would look very similar to the equations for several well-mixed tanks in series (the equations are just a bit more tightly coupled since each equation references volumes both upstream and downstream). However, the equations are still linear, and hence can actually be solved in the same way. As we will discuss in a subsequent Unit, the degree to which space is discretized (i.e., how many finite volumes are used) is consequential and must be selected with care.

Each of these two approaches to solving the differential equation has its advantages and disadvantages.  We will discuss these in a later Unit.

So as can be seen, the manner in which GoldSim numerically solves the equations for both well-mixed compartments and continuous systems is conceptually straightforward. The basic concepts themselves are in fact not very complicated. The two examples we used are very simple.  Incorporating other processes that we discussed in Lesson 5 such as partitioning and first-order reactions does not add much complexity to the equations and solution approaches we have discussed above (either more terms are added and/or the coefficients change, but the equations are still linear). Other processes, however, do add some complexity to how the equations are solved, including solubility constraints and time variability in the coefficients (e.g., Q , V and v in the equations above).  For example, when considering solubility constraints for isotopes, the equations become non-linear. We will revisit these complicating factors as they pertain to solving the equations in later Units.

Our goal in the last five Lessons was to review the key mass transport processes represented by GoldSim, describe very briefly how they are mathematically represented by equations and how in general terms those equations are solved.  An understanding of these concepts is critical for building defensible models.  And as noted previously, if you don’t understand how a tool works, you should not use it.

What we have not yet described in any way is how GoldSim actually allows you to construct models that use the equations we have been discussing.  That is, we have not discussed the overall philosophy on which GoldSim is based, and then, in more concrete terms, discussed the specific elements and features in GoldSim that are used to construct contaminant transport models.  We are almost ready to do so.  However, before we can do that, we need to discuss one more important topic, the problem of uncertainty, and will do so in the next Lesson.