# Lesson 11 - Understanding Cell Nets and Different Types of Mass Flux Links

In this Unit we have introduced the concept of a mass flux link between pathways.  So far, we have only discussed advective mass flux links, but as we shall see in subsequent Units, there are also other kinds of mass flux links that we can create.

In order to properly model some kinds of systems that we will discuss in later Units, it is necessary to better understand how these links are actually implemented in GoldSim (and how they are fundamentally different from other links you create between other elements). Therefore, in this Lesson, we are going to briefly discuss some of the numerical implementation details of mass flux links.

Open GoldSim now and start with a new model.  Add two Cell pathways (Cell1 and Cell2).  (For the purpose of this discussion, we don’t need to define any inputs.)  We are going to create an advective mass flux link from Cell1 to Cell2. So go to Cell1 and click on the Outflows tab:

Next, press Add Outflow and select Cell2 when prompted for a pathway to link to.  When you do so, the following dialog will be displayed:

Previously, when you saw this dialog you just pressed OK to accept all of the selections. There are three inputs on this dialog:

• To Pathway: This is the pathway you just selected to link to (it can be changed using the Select… button).
• Medium:  This is the medium that is flowing (e.g., Water).  As we will discuss in the next Unit, this field can also be used to modify the type of mass flux link (from advective to one of three special-purpose mass flux links).
• Link Type: This is the type of link that will be created (and what we will focus on in this Lesson).

You will note that Link Type contains a drop-list with three options:

The default for links between Cells is “Coupled”, and in most cases, this should not be changed.

A Coupled link between Cell pathways in GoldSim is fundamentally different from a Normal link between Cells (or a Normal link between any other types of elements).  To understand this, consider the following simple model (connected by “Normal” links):

In order to correctly calculate the values for these elements 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. At each timestep the elements are updated in this causality-based sequence. In this simple model, A is computed first, followed by B, followed by C.

The manner in which GoldSim goes about computing a causality sequence can be a bit complex (particularly in cases where there are loops in the system). In fact, this was discussed in some detail in Unit 8, Lesson 3 of the Basic Course. But for the purposes of this discussion, what is important to understand is that when computing the outputs for an element all the elements are computed in a pre-determined order (the causality sequence), one element at a time.

However, when Cell pathways are linked together via Coupled mass flux links, they are not computed one element at a time.  Instead, all of the Cells that are linked together via Coupled mass flux links are treated as a single computational entity (referred to as a Cell net). This is because as we have discussed in previous Lessons, the equations represented by Cells that are linked in this way 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).

GoldSim indicates the special nature of this link by modifying the appearance of the influence between the Cells:

Note that the influence includes a small circle at the end opposite the arrow.  This indicates that this is a coupled link.

So now that we understand that mass flux links between Cell pathways are, by default, Coupled links (such that all the linked Cells are solved simultaneously), why are there two other options (“Normal” and “Previous-value”)?

Before explaining why we would want to use one of these other mass flux link types, let’s first briefly consider what these other link types are and how they would actually change the model results. These two link types can be summarized as follows:

• If Cells are connected using Normal or Previous-value links, the difference is that the Cells are not solved simultaneously; instead they are solved sequentially in series (like all other elements in GoldSim). That is, the mass is propagated asynchronously (i.e., the “upstream” pathway is solved first, followed by the “downstream” one).
• In addition, for Previous-value links, the upstream pathway’s output from the previous timestep (rather than the current timestep) is sent to the downstream pathway, resulting in a one timestep delay in how mass is transferred through the link.

Note: Although Normal and Previous-value links are not “coupled”, numerically they are still represented implicitly (rather than explicitly).  They are simply propagated asynchronously.

For advection, solving the Cells asynchronously (rather than in a coupled manner) is mathematically feasible, since the advective mass flux from one Cell to another is only a function of the concentration in the upstream Cell (i.e., it is not necessary to reference the downstream Cell to compute the mass flux).

Note: As we shall see in Unit 8, diffusive mass flux links MUST be Coupled links and there is no option to create these links as Normal or Previous-value links.

Although we can model advection by solving the Cells asynchronously (rather than in a coupled manner), doing so can in fact decrease the accuracy of  the solution.  This is because as discussed in Unit 5, Lesson 9, GoldSim effectively subdivides the computational timestep (into fractional timesteps) when solving a Cell net in order to improve accuracy (when the Medium or High Precision setting is selected). “Breaking” a Cell net and computing fluxes between cells asynchronously effectively reduces the effectiveness of the fractional timesteps, and hence reduces the accuracy somewhat (in the same manner that using the Low Precision setting does). For most systems, using Normal links in a model in several locations (as opposed to throughout the entire model) would be unlikely to affect the results significantly. Using Previous-value links could introduce a more noticeable error (effectively delaying results by a timestep for each Previous-value link in the sequence of Cells). Again, however, for most realistic situations, using Previous-value links a model in several locations is also not likely to affect the results significantly.

So let’s return to the question of why GoldSim provides the mass flux link type option and under what circumstances you would change from the default. We are not actually able to fully answer this question yet, as the (relatively rare) reasons for using the various options will be discussed in detail in subsequent Units as we introduce more advanced features.  But for now, we can answer the question as follows:  Coupled links between Cells (the default) always produce the most accurate solution and should only be replaced by Normal or Previous-value links for very specific reasons (outlined below, and discussed in detail in later Units).

• As we will discuss in the next Unit, GoldSim provides a special feature in a Cell that allows incoming mass to the Cell to be filtered out and discarded (this can be used to model a treatment process).  For computational reasons, incoming Coupled links cannot be filtered.  This is the primary reason to utilize Normal links in place of a Coupled links between Cells.
• Some pathway networks have complex looping (circular flow) logic, in which mass from one pathway moves through the system and may eventually be recirculated back to that pathway. If the entire network consists of Cell pathways, using (the default) Coupled links allows such a system to be easily built and solved with no extra effort to account for these loops.  However, if a variety of pathways are involved in the network, by definition, not all of the mass flux links will be Coupled links (as we shall see, Coupled links can only be created between Cell pathways).  In this case, the only way to create a pathway network with circular flow logic is to “interrupt” the looping logic using a Previous-value mass flux link, and this is the purpose of this link type. This topic will be discussed in Unit 9.
• The computational effort to solve the coupled equations of a Cell net increases rapidly (i.e., not linearly) with the size of the Cell net. In almost all models, this is not a problem, but for extremely large models (hundreds of Cells), it may be worthwhile to break a very large Cell net into several smaller Cell nets (by using a Normal link).  This topic will be discussed in Unit 12.