Robert's templates

These are Robert's templates.

My approach is based on instantiating only those parts of the template which are critical to its functioning.   All other bits are left red.  This is a signal to the user, so they can see which bits they ned to tie in to their own model.

I think there is a separate issue about having a working example for each template, but I think that the template itself should oblige the user to instantiate non-template parts.

 

 

Concentration-dependent outflow

This model addresses the following problem:

You have a physical container with two substances, say water and salt.   You know the expression which governs the flow of water out of the container, and need to work out the rate at which salt flows out.  

Assuming that the salt in the outflow is at the same concentration as the salt in the container, the answer is to work out the salt concentration in the container, then use this, along with the water outflow, to calculate the rate of salt outflow.

 model diagram

Note that a single physical container is modelled using two Simile compartments.

In the template, the two substances are represented by substance1 (water) and substance2 (salt).

This template can be daisy-chained, to represent a chain of containers.  This can represent, for example, a food chain, where substance1 is biomass, and substance2 is some trace substance, e.g. DDT.   In this case, you would almost certainly want to have a separate outflow from each container, but only from the substance1 compartment, representing the loss of biomass through metabolic respiration, with the DDT being left behind.  This would result in an increase in the concentration of DDT as youmove along the food chain.

 

Flow between layers - using association submodel

This template is for modelling the flow of some substance between multiple layers.  A typical application would be for modelling the flow of, for example, water or heat between soil layers.

The basic idea is to have a multiple-instance submodel for the layers, with each instance representing a single layer.   Each layer has a single compartment (stock) representing the amount of substance in that layer.   At least two flows are associated with teh compartment, an inflow representing the rate at which the substance flows into the layer from the layer above, and an outflow representing the rate at which the substance flows into the layer below. 

I say "at least two flows...", because the modeller might choose to add additonal flows, e.g. for rainfall into the first layer and drainage flow out of the last layer.  Alternatively, the inflow into the top layer can be considered to be rainfall, and the outflow from the bottom layer can be considered to be drainage out of the system.

We need to link the outflows and inflows of neighbouring layers together, so that the inflow of layer i+1 is set equal to the outflow of layer i (counting the top layer as number 1).   There are two ways of doing this.  One method is to use an array variable outside the submodel: this should be illustrated in another template.  In this template, however, we use an association submodel to link neighbouring layers together.  This has considerable benefits when there are many layers, since Simile needs to handle only as many values as there are interflows between layers.

Simile diagram showing how to model flow between layers using an association submodel.

Equations

Below/condition = layer_number_lower==layer_number_upper+1

Below/interflow = outflow_lower

Layer/inflow = sum({interflow_upper})

AttachmentSize
Image icon flow_between_layers_diagram.gif5.08 KB