Courses: The GoldSim Contaminant Transport Module:

Unit 12 - Pulling it All Together: Building Complex Contaminant Transport Models

Lesson 7 – Instantaneously Changing Mass in Pathways Using Discrete Events

Throughout the Course we have discussed in detail how mass can be moved between pathways via advection and diffusion (as well as several specialized mass flux links).  Sometimes, however, you may want to “instantaneously” change mass in a pathway in a way that cannot be represented using mass flux links.

For example, you may want to suddenly add a slug of mass to a pathway (e.g., representing a sudden input from “outside” the model) in the middle of a simulation. You could represent this as a sudden (and temporary) change to the Input Rate for the pathway, but the method we will demonstrate in this Lesson is easier to implement. Another example (which cannot be easily represented using mass flux links) is a case in which you wanted to simulate the instantaneous movement of mass from one location in your model to another to simulate inadvertent human intrusion into a hazardous waste site. 

GoldSim supports this in Cell, Aquifer a Pipe pathways by providing a Discrete Changes field in each pathway dialog.  For Cell pathways, it appears in the Inventory section:

For Aquifer and Pipe pathways, it appears towards the bottom of the dialog:

This field accepts only discrete change signals. Discrete change signals were discussed in Unit 13, Lesson 6 of the Basic Course (if you are not familiar with discrete event modeling in GoldSim, you should refer to that Unit in the Basic Course). In this case, the discrete change signal must be a vector by species and have dimensions of mass.  Typically, such a discrete change signal will be the output of a Discrete Change element that has been triggered by an event.

To illustrate the use of this feature, we will look at an Example model. Open ExampleCT38_Discrete_Change.gsm in the “Examples” subfolder of the “Contaminant Transport Course” folder. You will see three Containers (we will discuss three different models). In all cases, we will simply consider a single species (i.e., if you look in the Materials Container, you will see the Species element contains just a single species).

Let’s start by looking inside the Add_to_Pathway Container:

In this model we have an Aquifer element that is flowing into a Sink Cell. The Aquifer starts with an initial mass (of 1 g). The Add_Mass_Event is a Triggered Event element that emits a discrete event signal at 100 days.

This discrete event signal triggers a Discrete Change element that looks like this:

Note that this is a vector by species and has dimensions of mass. Moreover, it has an Add instruction.

Note: Discrete change signals have an instruction associated with them.  Two types of instructions are possible: Add and Replace.  The Discrete Changes field for an Aquifer or a Pipe only accepts Add signals. As we shall see, however, Replace signals are accepted for a Cell.

The Amount_Added in this case (the Value) is 2 g.

Note: The Value for the items in the discrete change vector cannot contain negative numbers when applying a discrete change to an Aquifer or a Pipe (i.e., you can NOT discretely remove mass from an Aquifer or a Pipe; you can only add mass). As we shall see, however, you can remove mass (by specifying negative numbers) from a Cell.

The output of the Discrete Change element is then added into the Aquifer:

Now run the model and view the Mass Leaving Aquifer Result element:

As can be seen, the initial mass added to the Aquifer at the beginning of the simulation breaks through over the first 80 days.  The second slug of mass added (at 100 days by the Discrete Change) was twice as large as the initial mass.  It breaks through by 180 days.

Return to Edit Mode and navigate to the Move_Between_Cells Container.  It looks like this:

In this model we have two Cell elements (that are not connected by any mass flux links). Cell1 starts with an initial mass (of 10 g) and Cell2 has no initial mass. The Move_Event is a Triggered Event element that emits a discrete event signal at 120 days.

This discrete event signal triggers a Discrete Change element named Remove that looks like this:

Note that this is a vector by species and has dimensions of mass. Moreover, it has an Add instruction. Note, however, that the Value actually has a value  of -2 g (the input Amount is positive, but there is a negative sign in front of it). As noted above, when applying a discrete change to an Aquifer or a Pipe, the Value for the items in the discrete change vector cannot contain negative numbers (i.e., you can NOT discretely remove mass from an Aquifer or a Pipe; you can only add mass). But this is not the case for a Cell.  We can remove mass from a Cell this way.

The output of this Discrete Change element is input into Cell1:

The Remove Discrete Change element serves as a trigger for the Add Discrete Change element. This element looks identical to the other, except the Value is positive rather than negative. The output of the Add Discrete Change element is then input into Cell2. So what we are doing here is removing 2 g from Cell1 and adding 2 g to Cell2.  We can see this if we run the model and view the Mass Result element:

Note that because we are actually removing mass in this case, great care needs to be taken by the modeler to ensure that mass is conserved.  We do this by having the Remove Discrete Change trigger the Add Discrete Change (and ensuring that the Value of one cancels the other).

Finally, return to Edit Mode and navigate to the Replace_Cell Container.  It looks like this:

In this model we have a single Cell element that starts with an initial mass of 10 g.   The Replace_Event is a Triggered Event element that emits a discrete event signal at 90 days.

This discrete event signal triggers a Discrete Change element named Replace that looks like this:

Note that this is a vector by species and has dimensions of mass. However, unlike our other examples, in this case, it has a Replace instruction (the Value is equal to 2 g). As noted above, when applying a discrete change to an Aquifer or a Pipe, the Discrete Changes field only accepts Add signals (with non-negative values). But this is not the case for a Cell.  We can use a Replace instruction for a Cell.  When a Cell receives a Replace instruction for its Discrete Change, the current mass in the Cell is instantaneously replaced with the specified values (although you cannot assign a negative mass in this case).

The output of this Discrete Change element is input into the Cell. Run the model and view the Mass Result element:

As can be seen, the mass in the Cell is instantaneously replaced with the new value.

Obviously when using a Replace instruction like this, you need to take great care as mass balance can easily be lost!