Lesson 12 – Understanding Looping Pathway Networks
In Unit 6, Lesson 11 we discussed the fact that in order to correctly calculate the values for the elements in a model at any given timestep, GoldSim automatically analyzes the entire model to identify "who affects who" to ensure that the "upstream" elements are calculated prior to the "downstream" elements. This is referred to as the causality sequence.
For a network of pathways, as part of determining the causality sequence, GoldSim analyzes and sorts all of the pathways in terms of the “upstream-downstream” direction of media flows. Typically, you need not be concerned about this sequencing of pathways. However, in some situations, you will be prompted to take action to rectify a sequencing problem. In particular, if the upstream/downstream sequencing of pathways is ambiguous (because the network “loops”), GoldSim will issue a warning message saying that "there is a recursive loop". This, however, is not necessarily an uncommon situation. Many water resource systems recycle/reuse water and hence may loop like this. Therefore it is important to know how to address it.
To see this, go to the “Examples” subfolder of the “Contaminant Transport Course” folder you should have downloaded and unzipped to your Desktop, and open a model file named ExampleCT28_Looping_Pathways.gsm.
Go inside the Pathways Container and you will see two pathway networks:
The top network involves three Cells. 1 g of mass starts in Cell1, and there is an advective mass flux link (of 1 m3/day) from Cell1 to Cell2, Cell2 to Cell3 and Cell3 back to Cell1. Hence, the mass loops through the system until it is spread out evenly between all three Cells. (We can’t yet see this result since we cannot yet run the model, but we will look at it shortly.)
The key point here is that we had no problem creating a looping pathway network with Cell1, Cell2 and Cell3. This is because all of the Cells are linked together via Coupled mass flux links, and hence are treated as a single computational entity (referred to as a Cell net). That is, the equations represented by Cells that are linked in this way (using Coupled links) are coupled equations that GoldSim solves simultaneously. In effect, when computing the causality sequence for the model, the Cells in the Cell net all have the same position in the sequence (i.e., they are computed simultaneously). As a result, there is no problem in creating and representing this looping network.
The bottom network is similar to the top network in that 1 g of mass starts in Cell4, and there is an advective mass flux link (of 1 m3/day) from Cell4 to Cell5 and from Cell5 to Aquifer. However, the network is not yet “closed”. That is, we would like to create an advective mass flux link (of 1 m3/day) from Aquifer to Cell4. Let’s try to do that now. Open the Aquifer element and go to the Outflows tab. Press Add Outflow and select Cell4. Then press OK to complete the link. When you do so, the following message will be displayed:
Unlike Cell pathways, Aquifer (or Pipe) pathways cannot connect to other pathways using a Coupled link. Their default link type is Normal. (We discussed link types in Unit 6, Lesson 11). As a result, a looping network like this (involving an Aquifer or a Pipe) is interpreted as being recursive (i.e., it cannot be unambiguously sequenced). In order to create the advective mass flux link from Aquifer to Cell4, it is necessary to create the link as a Previous-value link. To do so, press the OK button on the error message (you will need to do this twice), which will return you to this dialog:
Select “Previous-value” from the Link Type drop-list and press OK:
You will then be able to create the link. After you do so, enter a Flow Rate of 1 m3/day, and run the model. The two Time History Result elements display the mass in the three pathways for each looping network. In both cases, mass loops through the system until it is spread out evenly between all three pathways.
Note: If you look closely you will note that the results are slightly different. This gives you an idea of the (small) error incurred by using the Previous-value link.
Note that when you create a Previous-value link what this does is specify that the previous timestep's value be used instead of the current timestep's value. This “breaks” the recursive loop and corrects the sequencing problem. Note, however, that as a result, a one timestep delay in the propagation of mass is created at the point that the previous value link is inserted in the pathway network. However, this is unlikely to ever be noticeable in your model (as long as the timestep length is appropriately small).
It should be noted that although in this simple case, it was obvious that the system was looping, in more complex situations, it may not be obvious at all. You should, however, be able to address the recursion by simply inserting a Previous-value link anywhere in the loop (e.g., at the point where the message is first triggered).