Lesson 4 – Exercise: Modelling Mass Transport in Two Flow-Through Tanks
Because advective mass flux links are so important (and you will need to create them often), in this Lesson we will work through a simple Exercise. This is similar to the Example we worked on together in the previous Lesson, but this time you will attempt to build the model on your own. We will also spend a bit of time discussing the best way to display the results.
Like the Example we worked on together, this problem consists of two tanks completely filled with water. However, not only will mass be advected from the first tank, it will also be advected from the second tank. Once it leaves the second tank, we assume it leaves the system (i.e., we are no longer interested in tracking the mass). The system looks like this:
The two tanks are assumed to be continuously and instantaneously mixed. A small quantity of a chemical (named X) is introduced into the first tank at the start of the simulation. There are no Solids in the tanks, and we will consider just that single species (that does not decay). However, water will flow from the first tank to the second and then out of the second at a constant rate. The various input parameters describing this system are summarized below:
|Volume of Water in each Tank||4 m3|
|Initial Mass of X in first Tank||100 g|
|Flow Rate Leaving Tank1 and Tank2||0.1 m3/day|
This model will require three Cells. The first two Cells represent the tanks, while the third represents a sink. You will note that we did not specify the volume of water in the sink. This is because it is irrelevant. The sink Cell itself has no physical meaning. It simply provides a location where mass from Tank2 is advected. It does require us to specify a volume, but the value does not matter (e.g., we can just enter 1 m3, and there is no need to create a Data element for this).
To create this model, you should follow these steps:
- Edit the Species element to change the name of the single species from Species1 to X.
- Create Data elements for the inputs in the table above. Note that initial mass should be defined as a vector of species (even though the vector has only one item).
- Create Cells representing Tank1 and Tank2 and define the Amount of Water and Initial Inventory (for Tank1) appropriately.
- Create a Cell representing the Sink (assign it a volume of 1 m3)
- Create an advective mass flux link from Tank1 to Tank2 and from Tank2 to Sink.
- Change the Duration of the simulation from the default of 100 days to 200 days. The Timestep (1 day) can remain unchanged.
Stop now and try to build and run the model.
Once you are done with your model, save it to the “MyModels” subfolder of the “Contaminant Transport Course” folder on your desktop (call it ExerciseCT4.gsm), as we will build upon this in a later Lesson. If, and only if, you get stuck, open and look at the worked out Exercise (ExerciseCT4_Advection.gsm in the “Exercises” subfolder) to help you finish the model.
Let’s walk through the model now.
In this simple model there was no need to edit the Water Reference Fluid or add any additional Fluids or Solids. You only needed to change the name of the single species in the Species element to X.
After doing so, you should have created all of the input Data elements. Generally, you would want to put these in a separate Container (e.g., named Inputs):
After creating these Data elements, you can create the Cells. In order to keep models like this well organized, it is recommended that you create a new Container (perhaps named Tanks or something else that you think would be appropriate) and place the Cell elements inside. Otherwise you would see that there will be influences from the Material and Inputs Containers to the Cells and this would make the model a bit messy.
Tank1 should look like this:
Tank2 should look identical (without an Initial Inventory). The Sink Cell should look like this:
Note that the volume is simply specified as 1 m3, and there is no need to save results (as concentrations in particular are physically meaningless).
The Outflows tab of Tank1 should look like this:
The Outflows tab of Tank2 should look like this:
Note that for both of these Outflows, the boxes for Save Final Values and Save Time History have been checked. This will allow us to view the results for the advective mass flux links (in the form of mass transfer rates).
After running the model, let’s plot the results for the mass of Tank1 and the mass in Tank2 on the same chart. Let’s start by doing this as follows:
- Left-click on the output port for Tank1 (which will be green), right-click on Mass_in_Pathway, and select Time History Result…
- This will display a chart. At the top of the chart page, press the Edit Properties button:
- This will bring up the Time History Result Properties dialog:
- Press the Add Result… button, then expand Tank2 in the dialog that is displayed and select Mass_in_Pathway (and then press OK):
- After doing so, the Time History Result Properties dialog will look like this:
- If you now press Show Result >>, the result chart will look like this:
This is certainly not very useful! The lines are the same style (color) and cannot be differentiated. Why is this the case? The reason is that the results we are plotting are actually vectors. In this simple model, they only have a single item, but they are still vectors. We are plotting two vectors of the same exact type (vectors of Species) on the same chart. When we plot a vector in GoldSim, the line styles for various items are determined by the vector Array Label set.
To see this, press the Edit Properties button again to view the Time History Result Properties dialog. To the right of either Result, under the Style column, press the Edit… button and select “Edit Row Label Set ‘Species”. The Array Label set dialog for Species will appear:
Note that you could also access this same dialog by selecting Model | Array Labels from the main menu. (Typically, of course, an Array Label set would have more than one item).
We could in fact change the style (e.g., the color) for the line representing item X here. But this would be used for all results that were a vector of Species. That is, every time we plot a vector of species, the X item takes on this style.
So how do we plot the mass of X in Tank1 and Tank2 on the same chart such that they are not the same style? Instead of plotting the entire vector, we need to plot individual items of the vector. To illustrate this, close the current result chart, and let’s create it again in a slightly different way:
- Left-click on the output port for Tank1 (which will be green). Instead of right-clicking on Mass_in_Pathway, left-click on the output to expand the vector, select the item [X] and then right-click and select Time History Result…
- This will display a chart. At the top of the chart page, press the Edit Properties button to display the Time History Result Properties dialog.
- Press the Add Result… button, then expand Tank2 in the dialog that is displayed, and then expand Mass_in_Pathway to select the item [X] (and then press OK):
- After doing so, the Time History Result Properties dialog will look like this:
- If you now press Show Result>>, the result chart will look like this:
This chart is now much improved, as the two lines have different styles (colors). Before we discuss this result further, convert it to a Result element by following these steps:
- Press the Edit Properties button at the top of the chart to display the Time History Result Properties dialog again.
- Press the Create Element button.
- Select the location (it will default to the current Container, and that is fine).
- Give the Result element a meaningful name (e.g., Mass in Tanks).
Now that we have created a Result element, let’s do a couple additional things to improve this chart:
- Double-click on the Result element and press the Edit Properties button at the top of the chart to display the Time History Result Properties dialog again.
- For each Result item, the Label defaults to the full output name. Simplify the Label for each (to Tank1 and Tank2).
- The Y-axis of the chart defaults to the Label for the first Result item (in this case, Tank1). Let’s generalize this. Right-click in the middle of the chart and select Edit Chart Style… (there is also a button for this at the top of the chart). The following dialog will be displayed alongside the chart:
- Select the Y-Axis tab and in the Title replace the keyword %rlabel% with “Mass in Tanks”:
- Press OK.
The chart will look like this:
Now that we have cleaned up our chart, let’s discuss what we see. Notice that the mass in Tank1 steadily decreases, while the mass in Tank2 initially increases and then decreases. This is because initially mass enters Tank2 from Tank1 (and hence mass in Tank2 increases). Gradually, however, the amount of mass entering Tank2 from Tank1 decreases, while mass continues to advect from Tank2 to the Sink. Eventually, the mass in both tanks goes to zero (all mass is flushed out).
We could follow the instructions above to plot the concentration in each tank. This plot would have the same shape as the mass plot (since concentration is directly proportional to the mass in this simple model). Similarly, we could plot the mass transfer rate by selecting the output in the Outflows folder of the output port:
This plot would have the same shape as the concentration (and hence mass) plot (since the mass transfer rate is directly proportional to the concentration in this simple model).
Save your model to the “MyModels” subfolder of the “Contaminant Transport Course” folder on your desktop (call it ExerciseCT4.gsm), as we will build upon this in a later Lesson.
In the next Lesson, we will examine the equations that GoldSim solved to produce these results.