Prey-Predator Work Statement Context Students of Environmental Modeling have got some training in mathematical modelling in Environmental Fluid Mechanics (MFA) where they learned how to solve the diffusion equation in a one-dimensional geometry and in the Transfer of Energy and Mass (TEM) course where they added the advection transport processes. In MFA students studied situations with and without decay (first-order) and with and without boundary discharges. In this work the effect of dispersion promoted homogenization of the spatial distribution and the effect of decay promoted elimination of contamination. There was also a situation with continuous emission where dilution and decay generate a stationary spatial distribution with maximum concentration at the point of discharge and a spatial gradient depending on diffusivity. In TEM students verified the effect of advection in the removal of material from the discharge zone and studied the effect of heat exchange across the free surface in case of temperature. They have considered the effect of radiation, convective heat transfer - depending on the temperature difference between the air and river water and verified the importance of latent heat loss by evaporation. The aim of Modelação Ambiental is to add production processes arising from biogeochemical processes to the advection and diffusion processes. Biogeochemical processes transfer material between properties by biological and/or chemical processes. To solve the problem students have software that developed in MFA and TEM, but also a program provided by the teaching staff that can replace the previous one. This second solution is important to the students who did not attend the earlier disciplines or for students who consider this second option more interesting. Objective Develop a model for a set of 4 variables (prey, predator, debris and nutrient) and realize the importance of residence time, i.e. the time that water resides in a system that can be too short to allow reactions and the effect of model parameters on the solution. Information available Students have got: 1. Text on Evolution equation, 2. Text and PPT on discretization of the Evolution equation, 3. PPT's from classes with the model equations to solve 4. Basic program to solve the equation of evolution (that must be adapted to this case). Simulations to carry out The aim is that students present results for situations that illustrate the problem. Globally those results should put into evidence the consistency between the results obtained and expected and the sensitivity of the solution to model parameters. The following results are examples of what can be done: a) Make the simulation of a discharge of a property with and without decay (of faecal bacteria type or BOD) and with different intensities of advection and diffusion. b) Prey-Predator model: make two simulations with two different parameters of the predator's semi-saturation constant (without transport) and interpret the the effect of changing the parameter. c) Assess the importance of the detritus decay rate (mineralizing rate) also without transport. d) Repeat the previous simulation with transport and analyse the effect of residence time. Students can however include other examples (or different examples), the most interesting ones being those that surprised them more. Below it is described the stability issue. However students are not required to implement an implicit algorithm. Format of the Report and deadline The report must be clear and succinct, not requiring more than a 6 pages of text. Must have an introduction to explain the problem to solve, one chapter with the equations, including the meaning of the parameters, a short description of the algorithm of solving, presentation and discussion of results, including a discussion of the expected consequences of variation of parameters. The report should be delivered up to March 18th. Basic Concepts In Lecture 2 we have seen the equation that describes the dynamics of the population: Figure 1: Slide from Lecture 2, showing the equation of Population dynamics and a graphical representation in case of growing (positive k) and decaying (negative k). We have seen that the permanently positive k is not sustainable. It would generate an exponential growth. We have seen that the logistics equation is a response to this problem. In that formulation the value of k tends to zero when we reach the carrying capacity. In this more complex model the value of k is depends dynamically on the value of other variables and can be null or negative positive. Another aspect put into evidence by this four-equations simple model is the stability issue. In that lecture we have seen that the k is positive when an explicit formulation should be used, while when k is negative an implicit formulation should be used. Generalizing the concept one can say that source terms should be computed explicitly and sink terms should be implicitly computed in order to get the most stable formulation. In order to minimize instabilities it is common to avoid negative values of the state variables, just performing a test of the type "if negative then get the minimum positive value". This simplistic equation can become a source of variable that in some cases can be enough to create an exponential growth. Model formulations Prey-predator models consider only two interacting state variables (a Prey and a Predator) originating two interdependent temporal evolutions. That model has analytical solution but it is not realistic because the prey grows from nothing and there is nothing originated from predator’s activity, i.e. the model is not conserving mass. AT that time we have seen that at least a third variable would be required to conserve mass. We have called it “Detritus”. Three state variable’s model A model with three state variables would generated a system as shown on the Figure below Predator (r) mr G my Prey (y) Detritus (d) μmax Figure 2: Processes relating state variables in case of a 3 state variables model where detritus include all types of material lost by living organisms and the prey grows consuming detritus. This model is not realistic but can preserve total mass. Equations for this model are described below. The analytical model is conservative. To every dPy dt ( max my ).Py G dPr E .G mr .Pr dt dPd my .Py mr .Pr (1 E ).G max .Py dt Py G gz Pr P K y s y Equation 1 Equation 2 Equation 3 Equation 4 positive term in one equation correspond a negative term in another equation. However the model is too simple because the prey is generating detritus and is consuming also detritus. At least another equation. The parameters in these equations are given in Table 1. The values proposed are in the typical order of magnitude for phytoplankton and zooplankton, but can vary by 200% or 300%. Table 1: Parameters used in Equation 1 to Equation 4 and some typical values Description µmax Ksy my mr E G Maximum Growth Rate Half-Saturation Constant for Prey Mortality Rate Prey Mortality Rate Predator Grazing Efficency Grazing Rate 0.11 (d-1) 1 (mg/L) 0.06 (d-1) 0.08 (d-1) 0.8 0.3 (d-1) The units are the same in all equations (e.g Nitrogen). In this case, if the Prey were “Primary Producers”, e.g. Phytoplanktor the biomass would be accounted as Organic Nitrogen in the form of Phytoplankton. In that case, the Predator could be Zooplankton and the biomass would be Organic Nitrogen in the form of Zooplankton and on the same way for Detritus. Four Equations model Four state variable (Equation 5 to Equation 8) increase the realism of the model. In these conditions the prey is consuming a nutrient that is regenerated by other state variables. This nutrient would be mineral Nitrogen if mass was quantified through nitrogen, as above. The total mass of each state variable should be accounted knowing the ration between Nitrogen and other atoms (e.g. using the Redfield ratio, C:N:P = 116:16:1). Again, this model would consider that there is a single nutrient controlling growth. If more than one nutrient could limit it, than an extra equation should be added for that nutrient. Also the temperature and the solar radiation should be added to obtain a seasonal variation. Without that effect we cannot expect this model to follow the reality. Predator (r) mr G e my Prey (y) Detritus (d) μ Nutrients (n) ϕ Figure 3: schematic representation of processes in case of a four equations model. Equations for this model are described below. The analytical model is conservative. To every dPy dt ( max my ).Py G dPr E.G mr .Pr dt dPd my .Py mr .Pr (1 E ).G .Py dt dPn .Pd e.Pr .Py dt Py G g z Pr P K sy y Pn Pn K s n max Equation 5 Equation 6 Equation 7 Equation 8 Equation 9 Equation 10 The actual growth rate of the Prey depends on a maximum growth rate and on the availability of nutrients using a “Michaelis-Menton” formulation based on a “semi-saturation constant”. The larger is the value of that constant, the larger is the concentration required by phytoplankton to grow. Temporal discretization Temporal discretization requires the time derivatives to be described by the rate of infinitesimal differences and the appointment of a time to calculate the term on the right equations’ member. Using an explicit discretisation method the Prey equation becomes: t t Py Py t ( my ).Pyt G t t t t t Py Py .(1 t .( my ) tG t This equation can generate negative values if the parenthesis becomes negative of if G is too large. Using an explicit formulation G is computed as: Pyt G gz P t P K sy y t t r Replacing this equation in the equation above one gets: Py t t 1 t Py 1 t . my g z Prt t . P K y s y When mortality plus grazing is larger than production it gets a negative value, that multiplied by the time step very easily generates negative values for the Prey. An implicit calculation of the decaying terms manages this problem. In that case one would write: Py t t Py t Pyt my Pyt t G t t t G t t Pyt t gz P t P K sy y t r Replacing G in the Prey Equation one gets: Py t t Py t Py t t t 1 Pyt .Pyt t my g z t P K s y y tPyt 1 1 t my g z t P K y s y And in this case the negative values will never be obtained. Doing on a similar way to every property one gets a more stable model. This is however not enough to get a stable solution. In fact in order to preserve mass the source terms in this equation (that do not generate instabilities in this equation) are negative terms somewhere. It is the case of tPyt that is a negative term in the nutrients equation. A straight forward solution is to perform a test to the final values obtained and when a negative value is obtained to push it to the minimum reasonable value. In that case we are in fact creating a mass of nutrients equal to the difference between the minimum value assumed and the negative value to be corrected. Doing so we are implicitly assuming that it is a sporadic situation and the error is not important. If it is s systematic situation the error can be very large and we can end up with a huge biomass. This can be avoided comparing the value of tPyt with the nutrients available before updating the Py. The following algorithm avoids the problem: PyGrowth tPyt if (PyGrowth P nt .)Then PyGrowth P nt EndIf Using this value of PyGrowth in the equation for Py t t We will preserve the mass and will get a model that is unconditionally stable, supporting any time step, which will be limited only by accuracy and not by stability. Transport Processes The numerical issues for solving the transport processes are described in the Statement provided to support the TEM practical work. Diffusion is always computed using central differences. This algorithm is physically correct and has second order accuracy. Upwind or Central-Differences are simple algorithms to solve advection. Central differences are physically correct when the grid Reynolds number is smaller than 2 and upwind is the most adequate above that value. The accuracy of the results depends on the grid size, requiring spatial steps much smaller than the size of the plumes being transported. Stability is limited also by the Courant number that must be smaller than 1 in case of explicit algorithms. In implicit algorithms there is no such limitation.