Lesson 8 - Representing Complex Boundary and Initial Conditions in Pathways
In all of the previous Examples and Exercises, we have assumed an initial amount of mass of contaminant(s) in the mixing Cells we have been simulating. But of course, there will also be situations in which we wish to add mass at a specified rate or add mass at a specified rate AND have an initial amount of mass present.
Cell pathways (and as we shall see, other kinds of pathways) provide a mechanism to do this. To see how we can do 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 ExampleCT6_Mass_Input.gsm. This model is set up with a single species (Species1). The inside of the Pathways Container looks like this:
This model includes three Cells. No mass leaves any of the Cells, and we add mass to them in three different ways:
- Initial Mass Only: This Cell receives an initial amount of mass at the beginning of the simulation equal to 100 g (it is computed as the product of a (constant) volume and an initial concentration).
- Input_Rate: This Cell receives no initial mass, but mass is added at a specified rate (computed as the product of an inflow rate and a concentration).
- Initial_Mass_and_Mass_Rate: This Cell receives both an initial amount of mass and mass that is added at a specified rate.
Open the Initial_Mass_Only Cell:
The manner in which initial and/or boundary conditions are added to the Cell are controlled in the Cell Inventory section. The drop-list is used to select how this is done:
In this Cell, we have selected “Initial Inventory” (as has been the case for all the previous examples). When we do so, the input immediately to the right represents the initial mass of each species in the Cell (recall that this must be a vector of Species; in this case it is a vector with one item).
If you open the Mass_Rate Cell, you will note that the Cell Inventory section looks like this:
Here, we have selected “Input Rate”. When we do so, the input immediately to the right represents the mass rate at which each species is added to the Cell (again, this must be a vector of Species, and in this case it is a vector with one item). In this simple model, this input is constant, but it does not need to be. It can vary with time.
These two cases are pretty straightforward. But what if we wanted to specify an initial mass AND an input rate? This requires two separate inputs. GoldSim solves this by having you specify a “Cumulative Input”, as shown in the Initial_Mass_and_Mass_Rate Cell:
The input immediately to the right represents the cumulative amount of mass of each species added to the Cell at any given time (again, this must be a vector of Species, and in this case it is a vector with one item). Hence, if it is constant, it represents an initial condition. If it increases with time, its rate of change represents a specified rate of addition. To specify an initial mass AND an input rate, you simply define the “Cumulative Input” using a time integral. In GoldSim, we have three ways to do this (an Integrator, a Reservoir and a Pool). The most straightforward is the Integrator, and that is what we have done here:
The Initial Value for the Integrator is the Initial_Mass, and the Rate of Change is the Mass_Input_Rate. Hence, the output of the Integrator is the cumulative amount of mass added to the Cell.
If we run this model and double-click on the Time History Result element to look at the amount of mass in each Cell, the result looks like this:
Although the “Input Rate” and “Cumulative Input” options are convenient in simple cases for representing mass input rates, there is a different approach that provides a slightly more accurate way (both numerically and conceptually) for specifying mass input rates that are changing with time (e.g., because concentration is changing).
This approach takes advantage of the fourth option in the drop-list in the Cell Inventory section, “Defined Concentration”:
To see how we can do 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 ExampleCT7_Defined_Concentration.gsm. This model is set up with a single species (Species1).
The inside of the Pathways Container looks like this:
The model considers two different approaches to representing a boundary/initial condition for a Cell. Conceptually, we have a boundary condition with a constant inflow rate (Flow_Rate) and a time-varying Inflow_Concentration. There is also an Initial_Concentration in the Cell, which has a Constant_Volume and constant outflow rate (equal to the inflow rate).
The first approach uses the “Cumulative Input” option for the “Cell Inventory” in Cell1 (similar to what was done in the previous example):
The Cumulative_Input Integrator element is defined as follows (with an initial mass and a mass input rate):
The second approach defines a “Source_Cell” that looks like this:
The volume is set to an arbitrarily small number (it is not used to compute concentrations since the concentration is fixed). A “Defined Concentration” is specified for this Source_Cell that will flow into Cell2. That is, the Source_Cell has an outflow to Cell2:
Cell2 looks like this:
It has an “Initial Inventory”, as well as an inflow from the Source_Cell.
If we run this model (for 100 days with a 5-day timestep) and compare the results for these two different approaches to representing the boundary condition (in terms of mass in Cell1 and Cell2), they look like this:
What we see is that the mass that is input “externally” (using the “Cumulative Input”) lags by one timestep. This is because in this approach (or in the absence of an initial condition, using an “Input Rate”), due to the way the external boundary condition must be applied when solving the pathway equations, a one timestep lag is introduced. Hence, the second approach is a more accurate representation (although for a small timestep, the differences would likely be insignificant). Conceptually, however, this is a bit more accurate way to represent the boundary condition (since the boundary condition is actually treated as part of the pathway network).
Learn More in GoldSim Help: Defining Initial and/or Boundary Conditions for a Cell
Note: There is also a Discrete Changes option in the Cell Inventory section. This provides a mechanism for you to instantaneously add, remove or redefine (replace) the amount of species mass in a Cell. This must be used with great care, as it can break mass conservation. However, there are instances where it can be quite useful, as will be discussed in Unit 12.