# Lesson 5 – Representing Spatial Variability

In most complex systems, there will be spatial variability in parameters controlling mass transport. Much of this variability can be directly represented in a very straightforward way within GoldSim using the basic structure and features of transport pathways.  For example, variability in the effective hydraulic conductivity (and hence flow) in different parts of the system can simply be represented by defining multiple pathways with differing flow properties.

How would one represent, however, the fact that the solubility in Water or the partition coefficient for a particular Solid varied spatially (due to varying chemical conditions)?

Let’s first consider partition coefficients.  For example, assume Sand was present in two different pathways, but the chemical environment in one pathway was different than that in the other pathway such that the partition coefficients were different in those two locations.  In this case, one way to accommodate this is to simply have the pathways reference different Solids at different locations in your model (e.g., Sand1 and Sand2), each having different partition coefficients.

But there are other ways to represent this that avoids having two different names for the Solid like this (and is conceptually clearer). To understand this, open ExampleCT36_Variable_Kd.gsm in the “Examples” subfolder of the “Contaminant Transport Course” folder.

The model we will consider is quite simple. We are simulating a single species. The system consists of two Cells (Cell1 and Cell2). Each Cell contains Water and Sand.  An initial amount of mass starts in Cell1.  There is an advective flow to Cell2 (and then to a Sink). The species partitions onto the Sand.  However, the partition coefficient is different in the two Cells (it is higher in the second Cell). We are going to explore three different ways to represent this. We won’t actually run the model; we simply will explore how the model is defined in each of the three cases.

Let’s start by looking inside the Container named Two_Solids.  You will see the two Cells, with a flow from Cell1 to Cell2:

If you open each Cell element you will see that both contain Water and a Solid.  Cell1 contains a Solid named Sand1 and Cell2 contains a Solid named Sand2. These two Solids can be found in the Material Container at the top of the model.  They are identical, except that they have different partition coefficients. That is, to represent the spatial variability in the partition coefficients we simply have the pathways reference different Solids at different locations in the model (e.g., Sand1 and Sand2), each having different partition coefficients.

Now look inside the Container named Copied_Solid:

In this case, instead of just having two Cells, we have two (localized) Containers to represent the two regions. Localized Containers were discussed in detail in the Unit 9, Lesson 6 of the Basic Course (and all complex models should use such Containers). The key point is that localized Containers have “local scopes”, allowing multiple variables with the same name to exist in the same model.  If you look inside one of these localized Containers (Region1), you will see a Cell.  More importantly, you will see a Solid:

What is different here is that rather than the Solid being located elsewhere in the model (e.g., the Materials Container), it is located exactly where it is being used. If you look inside the Region2 Container, you will see that it also contains a Solid named Sand.  In fact, if you look at the two Sand elements you will note that they appear to be identical:

However, they are not actually identical.  This is because although they both reference the element Kd, Kd is different in the two Containers (the value is higher in Region2 than in Region1). That is, both Sand elements reference an output named Kd, but because the Containers are localized, they link to different elements (the one that is in their “local scope”).

This approach is different from the first approach in that 1) both Cells reference a Solid with the same name (Sand); and 2) the Solid is located in the same Container where it is being referenced. However, both approaches have a weakness. The Solids being referenced actually should have identical properties (except for the Kd).  But if one were to (perhaps inadvertently) edit the properties for one but not the other, the model would be inconsistent. There is, however, a third approach that addresses this.

Look inside the Container named Cloned_Solid. Like the previous approach, instead of just having two Cells, we have two (localized) Containers to represent the two regions. If you look inside one of these localized Containers (Region1), it looks similar to the last case:

However, there is a critical difference: the Solid element has been cloned (as noted by the two overlapping boxes in the upper right-hand side of the icon). You will note that the Solid looks the same in the Region2 Container.  That is, these two Solids are clones of each other.

The key point is that cloned elements automatically mimic each other, such that if you change a property of a clone, the property is automatically changed in all of the other clones.   Hence, if you clone the Solid element and change a property (such as a porosity) in one clone, it is automatically changed in all the other clones. How, then, can you vary a property (such as the partition coefficient) among cloned Solids?  This can be accomplished because if you enter a link ID into an input field for a cloned element, the same ID will appear in the corresponding input field of all of the cloned elements.  If, however, different elements having that same ID exist at the locations (localized Containers) where the clones are, each clone will link to a different element for that particular input, allowing the value of the property to be different in each Container.

This approach, while more complex, ensures that all properties of the Solid, wherever it exists, are consistent, except in cases where a property is overridden by a local value.

Let’s now consider solubilities.  For example, assume the chemical environment in two locations was such that the solubilities for the species were different in those two locations.  This situation is a bit different than the one we just described for partition coefficients.  This is because you specify solubilities as inputs to the Reference Fluid (i.e., Water).  There can be only one Reference Fluid in a model.  You can create other Fluids of course, but for a variety of reasons, it is preferable for the pathways in both locations to use the Reference Fluid.

Hence, if you want different regions to have different solubilities, you would clone the Reference Fluid to each location (in the same way we did in the third approach for partition coefficients).

To see this, open ExampleCT37_Variable_Solubility.gsm in the “Examples” subfolder of the “Contaminant Transport Course” folder.

The model we will consider is similar to what we looked at for the partition coefficients. We are simulating a single species. The system consists of two Cells (Cell1 and Cell2), representing two different regions. Each Cell contains just Water. An initial amount of mass (200 g) starts in Cell1.  There is an advective flow to Cell2 (and then to a Sink). The solubility for the species is different in the two Cells (it is 1 mg/l in Region1 and 0.5 mg/l in Region2) .

Let’s look at the model now. You will note that we have two (localized) Containers to represent the two regions. If you look inside one of these localized Containers (Region1), it looks like this:

What you see here is that there is a cloned Reference Fluid in the Container.  If you looked at Region2, you would see that it also contains a cloned Reference Fluid.  However, they are not actually identical.  This is because although they both reference the element Sol, Sol is different in the two Containers (the value is lower in Region2 than in Region1). That is, both Water elements reference an output named Sol, but because the Containers are localized, they link to different elements (the one that is in their “local scope”).  In fact, there is a third cloned Reference Fluid in the Materials Container (for which the solubility is set to -1 mg/l, indicating there is no solubility limit). What this means is that any pathways outside of Region1 and Region2 Containers (in this case, only the Sink) will link to this clone of the Reference Fluid.  That is, there are three different solubilities defined: one inside Region1, one inside Region2, and one for everywhere else.

If we run this model and view the concentration result we can clearly see the two different solubilities:

The concentration in Cell1 is initially at the solubility limit for Region1 (1 mg/l) until sufficient mass flushes out. As mass enters Cell2 it eventually hits the solubility limit for Region2 (0.5 mg/l) before subsequently dropping below this as more mass flushes out.

Note: In Unit 7 (Lesson 10 and 11) we discussed two specialized mass transfer links (“direct transfer” and “treatment”) for simulating processes that cannot be easily described using just advection or diffusion. There is a third type of specialized mass transfer link (“Precipitate_transfer_rate“).  This method relies on the specification of different solubilities in different parts of your model. Precipitate removal mass flux links are used to transport precipitated mass directly from one pathway (e.g., a treatment tank) to another (e.g., a sink). By specifying a local solubility at one location (e.g., inside the treatment tank), you can therefore instruct GoldSim to remove any mass that has been precipitated.  This is actually a common treatment mechanism in many real-world treatment processes.

Finally, we should note that so far we have discussed spatial variability in properties of media (such as partition coefficients and solubilities). However, for some systems you may also want to represent spatial variability in decay rates for species.  Although this obviously would not be the case for radioactive decay, other types of decay (e.g., decay of organic compounds) can certainly vary as a function of local conditions.

Decay rates are specified in the Species element. Like the Reference Fluid, there can be only one Species element in a model. Hence, if you want different regions to have different decay rates for a species, you would clone the Species to each location (represented by a localized Container) and link to an element that defines the decay rate (in the same way we did for solubilities and the Reference Fluid).