112
A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM USING DIFFUSION-ADVECTION-REACTION EQUATIONS GABRIELLA WARRENSFORD A SENIOR RESEARCH PAPER PRESENTED TO THE DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE OF STETSON UNIVERSITY IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF BACHELOR OF SCIENCE STETSON UNIVERSITY 2015

A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

  • Upload
    vuliem

  • View
    222

  • Download
    1

Embed Size (px)

Citation preview

Page 1: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

A MODEL OF NUTRIENT FLOW IN ANAQUAPONICS SYSTEM USING

DIFFUSION-ADVECTION-REACTIONEQUATIONS

GABRIELLA WARRENSFORD

A SENIOR RESEARCH PAPER PRESENTED TO THE DEPARTMENTOF MATHEMATICS AND COMPUTER SCIENCE OF STETSON

UNIVERSITY IN PARTIAL FULFILLMENT OF THE REQUIREMENTSFOR THE DEGREE OF BACHELOR OF SCIENCE

STETSON UNIVERSITY2015

Page 2: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

ACKNOWLEDGMENTS

I would like to thank my advisor, Dr. William Miles, for all of his helpthroughout the semester. I would also like to thank Dr. Harry Price forassistance with the chemistry concepts related to this project, and Dr. ErichFriedman for help with Mathematica.

Page 3: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Contents

1 Abstract 1

2 Background 12.1 Advantages of Aquaponic Gardening . . . . . . . . . . . . . . 12.2 System Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 Derivation of the Model 43.1 Derivation of the DAR Equation . . . . . . . . . . . . . . . . . 43.2 Nonhomogenous Terms . . . . . . . . . . . . . . . . . . . . . . 93.3 Flow Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.4 DAR Equations, Initial Conditions, and Boundary Conditions

for each Substance . . . . . . . . . . . . . . . . . . . . . . . . 15

4 Estimation of Parameters 184.1 The Plant Uptake Function . . . . . . . . . . . . . . . . . . . 184.2 The Fish Excretion Function . . . . . . . . . . . . . . . . . . . 214.3 Additional Parameters . . . . . . . . . . . . . . . . . . . . . . 23

5 Numerical Methods 27

6 Future Plans 94

7 Appendix 967.1 The Nonlinear Regression for Fish Excretion Data . . . . . . . 967.2 Original Fish Excretion Data . . . . . . . . . . . . . . . . . . 977.3 The Parameter Table for Plant Uptake of Nitrogen . . . . . . 997.4 An Example of Restrictions on Explicit Numerical Methods . 1007.5 The WENO Scheme . . . . . . . . . . . . . . . . . . . . . . . 1027.6 The Third Order TVDRK Method . . . . . . . . . . . . . . . 104

References 106

Page 4: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

1 Abstract

Aquaponics is a combination of hydroponics (growing plants in a soillessenvironment) and aquaculture (raising fish in a tank). As a byproduct ofrespiration, fish excrete toxic ammonia from their gills. In an aquaponicssystem, the water in the fish tank is pumped to beds where plants are grownin a soilless medium. Nitrifying bacteria colonize in the medium, and convertammonia to nitrite and then nitrate. The plants can readily absorb thenitrate as a vital nutrient, and the water, which is now free of the toxicammonia and nitrite, is pumped back to the fish tank. In this paper, wewill attempt to simulate nutrient flow in an aquaponics system with a two-dimensional model. For each of the three substances of interest: ammonia,nitrite, and nitrate; a diffusion-advection-reaction equation will be used todetermine its concentration within the fish tank and plant bed as a functionof time and space. Model parameters will be estimated based on empiricalevidence, and we will discuss possible numerical methods that could be usedto solve the equations in our model.

2 Background

2.1 Advantages of Aquaponic Gardening

Aquaponics not only combines hydroponics and aquaculture; it is an improve-ment upon each system. In aquaculture, solid fish excrement and ammoniaproduced during respiration must be filtered out of the water and discarded.Aquaponics makes use of these waste products as nutrients for the plants(Bernstein 6-7). Similarly, hydroponics requires growers to use costly man-ufactured nutrient solutions. For the same cost in fish feed, aquaponic gar-deners can grow approximately the same number of plants as hydroponicgardeners, as well as several pounds of fish. Moreover, water in a hydroponicsystem must be thrown out periodically because chemicals accumulate totoxic levels. Water is never discarded in an aquaponics system (Bernstein 4).Aquaponics wastes much less water than traditional or hydroponic gardeningbecause the nutrient solution is continually circulated between the fish tankand plant bed. Thus water is only lost when it evaporates or is taken up byfish and plants (Bernstein 2). In addition, research conducted by Dr. NickSavidov in 2005 showed that aquaponics has a higher yield than hydroponics.

1

Page 5: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

He was able to grow 10-15% more tomatoes than are grown on average ina hydroponics setup. Furthermore, Savidov achieved a threefold increase inplant production within two years (Savidov 20, 24). It is also worth mention-ing that since nutrients for the plants come from fish, aquaponics producesorganic products, while hydroponically grown plants are clearly not organic(Bernstein 5).

Aquaponics is a novel way for the human race to stop using more natu-ral resources than the earth can replenish. Demographers predict that thepopulation will increase by an average of 75 million people each year until2050 (Bernstein 11). According to the World Wildlife Funds Living PlanetReport in 2008, the current population already exceeds the planets regener-ative capacity by about 30 percent (Bernstein 12). As China and India, thetwo countries with the largest populations, continue to raise their standardof living to that of the United States, this shortage of resources will only getworse.

Aquaponics eliminates many aspects of agriculture, such as excessive landand water use, that make it unsustainable. In 2009, United Nations DeputySecretary-General Asha-Rose Migiro projected that two-thirds of the earth’spopulation will go without water within twenty years (Bernstein 15). Inthe U.S., 80% of the water we use is for agriculture; hence it is easy tosee why a recirculating agricultural system would be of value (Bernstein15). Furthermore, everyone knows that deforestation is a major problem;over 40% of the earth’s land has been cleared for agriculture (Bernstein 18).Thus less trees are available to turn carbon dioxide into oxygen, and therebyreduce greenhouse gas emissions. Soilless agriculture such as aquaponics isclearly a way to diminish this problem.

In addition, aquaponics could reduce overfishing. At least 2,048 speciesof fish are extinct because of overfishing (Bernstein 18). If we farm more fishinstead of catching them, then in time maybe less species of fish would beendangered. Moreover, fish are a much more efficient animal to farm thanmost traditional farm animals. Fish convert about 67% of their food weightto body weight gain; whereas chickens, pigs, cows, and sheep only convertroughly 50%, 25%, 15%, and 13%, respectively (Bernstein 19). Aquaponicshas the potential to generate a large amount of nutritious food with a lowimpact on the environment.

2

Page 6: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

2.2 System Design

There are many different ways to construct an aquaponics system. The threemajor techniques are the deep water culture (DWC) method, the nutrient-film technique (NFT), and media-based aquaponics. For both DWC andNFT, water flows from the fish tank through a filter that traps solid fishwaste, and then to a sump tank that contains a biofilter for nitrification (asump is just a tank that holds excess water in an aquaponics system) (Designof Aquaponic Units 64, 68). A typical biofilter would be plastic netting thatencloses PVC pipe shavings; the shavings create adequate surface area forbacteria to colonize. The biofilter must also have an aerator because thebacteria need oxygen to survive (Design of Aquaponic Units 46). From thesump tank, some water is pumped back to the fish tank, and the rest goesto the plants. The water that returns to the fish tank forces it to overflowinto the filter again. After the water flows through the compartments thatcontain the plants, it also goes back to the sump tank (Design of AquaponicUnits 64). For DWC, plants are placed in holes on a floating polystyrene raftso that their roots are submerged in the nutrient-rich water pumped fromthe sump. For NFT, plants are placed in holes that are drilled into pipes.A small amount of water from the sump tank flows through the pipes andbathes the roots (Design of Aquaponic Units 48, 49).

The major downside to DWC and NFT is that a mechanical filter and anaerated biofilter are required, whereas in media-based aquaponics the mediain which the plants grow acts as a biofilter and filters solid waste (Design ofAquaponic Units 45). Furthermore, DWC is mainly limited to small plantslike lettuce and herbs; larger plants are too heavy to float in rafts (Design ofAquaponic Units 73). Additional aeration is also required in the plant canalsfor DWC because plants take up dissolved oxygen (DO) from the water. Thewater is relatively stagnant beneath the rafts, and thus does not containenough DO to support the plants’ needs. These are not problems in media-based aquaponics because the flooding and draining of the bed allows oxygento reach plant roots and bacteria, and any plant that thrives in neutral pHcan be grown (Bernstein 110, 153). For these reasons, we choose to modelbasic flood and drain media-based aquaponics, which is shown in figure 1(Bernstein 98).

3

Page 7: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 1: Basic Flood and Drain Media-Based Aquaponics

3 Derivation of the Model

3.1 Derivation of the DAR Equation

In this model, the fish tank is represented by a rectangular region in thefirst quadrant of the x-y plane, with one corner at the origin, O. Likewise,the plant bed is represented by a rectangular region in the x-y plane, withone corner at the origin, O. The length of the fish tank in the x-directionis lF ; its height in the y-direction is hF . The length of the plant bed inthe x-direction is lP ; its height in the y-direction is hP . It should be notedthat these heights are not the actual heights of the tank and bed, but ratherthe maximum height that water ever reaches throughout the flood and draincycle. Symmetry is assumed for the third dimension of each compartment.In other words, the tank and bed are rectangular boxes, and the nutrient flowwithin each cross-section parallel to the x-y and x-y planes, respectively, areassumed to be the same. The widths of the fish tank and plant bed are wFand wP , respectively. Obviously, this set-up is somewhat unrealistic becausepipe openings typically occupy a small circular region of space; whereas ourassumptions of symmetry require rectangular pipe openings of infinitessimallength and widths equal to the widths of the compartments that contain thepipe openings. However, this notion is not so far-fetched when one considersthat gardeners frequently drill holes along the sides of PVC pipes to sendwater to multiple locations within the plant bed or increase the DO in thefish tank by creating turbulent flow. The pump is located at O, and is

4

Page 8: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

connected to a pipe that opens at O. The overflow pipe has openings at(lP , hP ) in the x-y plane and (lF , hF ) in the x-y plane. We assume that inthe actual aquaponics setup the plant bed is above the fish tank so thatduring overflow water enters the fish tank at (lF , hF ) in the x-y plane.

At time t = 0, the pump turns on, and water is pumped from the fishtank to the plant bed at a rate vp. When t = t, the water has reached themaximum desired height hP in the plant bed, and water begins to flow fromthe plant bed to the fish tank via the overflow pipe. This maintains the waterlevel in the plant bed at hP until time t = t when the pump shuts off. Thenthe water in the plant bed drains back through the pump at a rate vp untilthe bed contains no water; this occurs at t = t. Until the pump turns backon at t = t∗, there is no water flow between the tank and the bed (Bernstein98).

To model the concentrations of ammonia, nitrite, and nitrate as a functionof time and space, we will use diffusion-advection-reaction (DAR) equations.Diffusion, advection, and reaction are the mechanisms by which concentra-tion changes with time. Diffusion is the tendency of solutes to move fromregions of high concentration to those with a lower concentration. This resultsfrom the random movement of molecules in the fluid. When concentration isconstant throughout a solution, collisions between molecules send the samenumber of particles, on average, in all directions. Thus concentration doesnot change over time. However, when concentration varies with respect tolocation in a fluid, the regions of higher concentration tend to expel moreparticles of solute than regions of lower concentration (de Marsily 232). Theresult, is an overall tendency toward uniform concentration. Advection isthe process by which chemicals dissolved in a fluid are transported by themovement of the fluid; reaction describes the the consumption or productionof solutes by chemical reactions (de Marsily 230).

Consider the concentration of ammonia, denoted by A = A(x, y, t), in theplant bed. Since the medium consists of gravel or a similar material, it canbe treated as porous with porosity ω (Bernstein 111). Porosity is the fractionof the plant bed through which water can flow, i.e. the portion that is notoccupied by gravel (Logan 30). We assume that ω is constant throughout theplant bed. This is reasonable because all the pieces of gravel are similar insize to one another. Furthermore, when fish waste starts to clog up regionsin the medium, the gardener must either clean out the plant bed or includered wriggler worms in the bed. These worms break down solid waste, whichprevents clogging (Bernstein 178-9). We also assume that all of the spaces

5

Page 9: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

between pieces of gravel are filled with water at all times (Logan 30). Ofcourse, this contradicts the fill and drain action within the plant bed, but wecan always solve the DAR equation for small intervals of time for which thedecrease in water level is negligible.

The DAR equation for ammonia in the plant bed can be derived fromThe Principle of Mass Balance, which states that the rate of change of themass within an arbitrary volume in a region is equal to the rate at whichthe substance crosses the boundary of the volume plus the rate at which it iscreated or distroyed within the volume (Logan 31). Let Ω denote the regionin R3 that is occupied by the plant bed. Let Ω′ be an arbitrary ball in Ωwith surface ∂Ω′. The outward unit vector that is normal to ∂Ω′ is denotedby n. Let ~Q(x, y, t) denote the rate of flow (mass per unit time) across ∂Ω′.

In other words, ~Q is the flux of ammonia. Let R(x, y, t) be the rate at whichammonia is produced or destroyed in Ω′. Mathematically, mass balance canbe stated as equation (1) (Logan 35).

∂t

∫Ω′ωA dτ = −

∫∂Ω′

~Q · n da+

∫Ω′Rdτ (1)

The left hand side of equation (1) is the rate of change of the total massof ammonia within the ball. Notice that ω is included in the integrand onthe left side. This is because for each infinitessimal volume element dτ , onlya fraction of the volume (ωdτ) is available for water to flow through. Also

observe that ~Q · n is positive when ammonia is flowing out of Ω′. Therefore,the amount of ammonia in the arbitrary ball decreases when the flux integralis positive. Thus we must place a negative sign in front of the flux integral inequation (1). Furthermore, even though there is no flow in the z-direction,~Q can be written as a three-dimensional vector with a z-component that iszero. Hence it can be dotted with n. The second term on the right side isthe rate at which ammonia is consumed during nitrification within the ball(Logan 31).

If A and ∂A/∂t are continuous over Ω′, then we can bring the partialderivative inside the integrand in equation (1). Furthermore, using the di-vergence theorem, the surface integral in equation (1) can be rewritten as avolume integral. The divergence theorem is stated below (Calculus: EarlyTranscendentals 1129).

The Divergence Theorem : Let E be a simple solid region and let S

6

Page 10: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

be the boundary surface of E, given with positive (outward) orientation.

Let ~F be a vector field whose component functions have continuous partialderivatives on an open region that contains E. Then∫

S

~F · d~S =

∫E

~∇ · ~F dτ

By observing that d~a = da n, equation (1) can be rewritten as

∫Ω′ω∂A

∂tdτ = −

∫Ω′

~∇ · ~Qdτ +

∫Ω′Rdτ∫

Ω′

[ω∂A

∂t+ ~∇ · ~Q−R

]dτ = 0

ω∂A

∂t+ ~∇ · ~Q−R = 0, (x, y) ∈ Ω, t ≥ 0 (2)

The last line above follows from the fact that Ω′ is arbitrary. The onlyway that the volume integral can equal zero for any ball Ω′ is if the integrandis identically zero. Also note that though the Del operator does not have the” ” accent, the derivatives are with respect to x and y. The form of ~Q isbased on experimental evidence; it is the sum of the advective flux, moleculardiffusion flux, and dispersion flux. Recall that the advective flux ~Q(a) resultsfrom particles being transported by the movement of water (Logan 32). It isgiven by

~Q(a) = ~VpA (3)

The vector field ~Vp is the velocity field of the water in the plant bed, with

units of length over time. As we stated, the molecular diffusion flux ~Q(m) isdue to molecules colliding with each other (Logan 32). By Fick’s Law,

~Q(m) = −ωD(m)~∇A (4)

The coefficient D(m) is the effective molecular diffusion coefficient in themedium; it is only 10-70% as large as Do, the usual molecular diffusioncoefficent. Do is defined for a stagnant fluid with no boundaries. Finally,the dispersion flux ~Q(d) results from the fluid traveling more quickly throughsome paths in the medium than others (Logan 32). Again, according toFick’s Law,

7

Page 11: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

~Q(d) = −ωD(d)~∇A (5)

The coefficient D(d) is the dispersion coefficient (Logan 33). Thereforethe total flux is given by

~Q = ~VpA− ωD(m)~∇A− ωD(d)~∇A= ~VpA− ωD~∇A (6)

The coefficient D is the hydrodynamic dispersion coefficient; it is thesum of the effective molecular diffusion and dispersion coefficients (Logan

33). With this form for ~Q, equation (2) can be written as

ω∂A

∂t+ ~∇ · [~VpA− ωD~∇A]−R = 0 (7)

For now, we will assume that D is constant within the grow bed. Inreality, the component of D in the direction of flow is much larger than thecomponents of D perpendicular to the flow field (de Marsily 236). This willbe discussed in detail later when we talk about choosing reasonable parametervalues. Therefore,

ω∂A

∂t+ ~∇ · (~VpA)− ωD∇2A−R = 0 (8)

If we let φ and ψ be the x- and y- components of the flow field, respec-tively, then

~∇ · (~VpA) =∂

∂x(Aφ) +

∂y(Aψ)

=

(∂A

∂xφ+ A

∂φ

∂x

)+

(∂A

∂yψ + A

∂ψ

∂y

)=

(∂A

∂xφ+

∂A

∂yψ

)+

(A∂φ

∂x+ A

∂ψ

∂y

)= (~∇A) · ~Vp + A(~∇ · ~Vp) (9)

Thus,

8

Page 12: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

ω∂A

∂t+ [(~∇A) · ~Vp + A(~∇ · ~Vp)]− ωD∇2A−R = 0

∂A

∂t= D∇2A− ω−1~Vp · (~∇A)− ω−1A(~∇ · ~Vp) + ω−1R (10)

Equation (10) is the DAR equation for Ammonia within the plant bed.

Notice that A does not depend on z and the z- component of ~V is zerobecause there is no flow in the z-direction. Therefore, the Laplacian andgradient in equation (10) are two-dimensional for this model. The concen-trations of nitrite and nitrate in the fish tank will be represented by B and C,respectively. The DAR equations for these substances in the plant bed havethe same form as the equation for ammonia. In the fish tank, the equationsfor each substance are derived in exactly the same manner as for the plantbed, except the fish tank does not contain a porous medium. Consequently,the diffusion coefficient is assumed to be Do (though there are boundariesand the water is not still), and the entire volume in the fish tank is availableto water. Hence, the concentration of ammonia, A, in the fish tank is givenby

∂A

∂t= Do∇2A− ~VF · (~∇A)− A(~∇ · ~VF ) +R (11)

where ~VF is now the flow field in the fish tank. The concentrations ofnitrite and nitrate in the fish tank will be represented by B and C, respec-tively. The DAR equations for these substances in the fish tank have thesame form as the equation for ammonia.

3.2 Nonhomogenous Terms

The reaction term R varies depending on the substance and its locationwithin the aquaponics system. In the plant bed, R will describe the rate ofchange of concentration due to nitrification. The chemical reaction equationsfor nitrification are given below (”Wastewater Management...” 1).

NH3 +O2 → NO−2 + 3H+ + 2e− (12)

NO−2 +H2O → NO−3 + 2H+ + 2e− (13)

9

Page 13: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Essentially, these equations state that ammonia (NH3) transforms intonitrite (NO−2 ), which then transforms into nitrate (NO−3 ). Ammonia is con-verted to nitrite mainly by the bacteria Nitrosomonas sp.; nitrite is trans-formed into nitrate mostly by Nitrobacter sp. bacteria (Tyson 20). TheChemical Law of Mass Action given below states that the rate at which aproduct is created (or a reactant is consumed) is proportional to the productof the concentrations of the reactants (”Reaction Kinetics...” 2).

The Chemical Law of Mass Action13: If a chemical reaction is givenby

a+ b→ c,

thend[a]

dt= −k[a][b] =

d[b]

dt= −d[c]

dt,

where [u] denotes the concentration of substance u.

However, we can assume that oxygen (O2) and water (H2O) are at muchhigher concentrations than ammonia and nitrite. This is reasonable becauseammonia and nitrite are dissolved in a large amount of water in the plantbed. Also, the plant bed is well-oxygenated due to the flood and drain pro-cess. Hence, the percentages of oxygen and water consumed by the reactionwill be negligible compared to their total concentrations. With minimalerror, we can assume that the concentrations of oxygen and water remainconstant throughout the reaction. Therefore, these concentrations can beabsorbed into the constants of proportionality (Copeland 479). Thus therates of change of the concentrations of ammonia, nitrite, and nitrate due tonitrification are given by

dA

dt= −k1A (14)

dB

dt= k1A− k2B (15)

dC

dt= k2B (16)

The constants k1 and k2 are called the rate constants for equations (12)and (13), respectively. There are negative signs in equations (14) and (15)

10

Page 14: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

because as the concentrations of the reactants increase, the reaction speedsup, and reactants are consumed faster. The right-hand sides of equations(14), (15), and (16) are reaction terms for ammonia, nitrite, and nitrate,respectively, in the plant bed.

In addition to the reaction term given by equation (16), the DAR equationfor nitrate in the plant bed will include another source (or more accuratelydrain) term P (C) that describes plant uptake of nitrate. Plants also takeup ammonia, but they take up far less ammonia than nitrate. Later, whenwe discuss parameter values, we will prove empirically that plant uptake ofammonia is negligible. Very little nitrification occurs in the fish tank becauseit does not contain a biofilter. Therefore, equations (14) - (16) do not applyin the fish tank. The only source term present in the fish tank is F (t), whichdescribes the fish ammonia excretion. We will approximate P and F laterusing experimental evidence.

3.3 Flow Fields

Advection in the fish tank and plant bed is determined by the velocity fieldof the water during each stage of the flood and drain process. During theperiod when the plant bed is filling with water, let ~VF = ~UF and ~VP = ~UP .To simulate fluid flow in the fish tank, ~UF has a sink at the location of thepump so that the velocity vector at each point in the tank points toward thepump, and |~UF | approaches vp as the distance from the pump approacheszero. As the distance from the pump approaches the maximum distance of√l2F + h2

F , we assume that |~UF | approaches zero. Thus

~VF = ~UF = vp

(1−

√x2 + y2√l2F + h2

F

)< −x,−y >√

x2 + y2

= vp

(1√

l2F + h2F

− 1√x2 + y2

)< x, y >, 0 < t ≤ t (17)

Of course, this creates a removable discontinuity; ~UF is has an infinitemagnitude at the origin, and |~UF | = vp(1−

√x2 + y2/

√l2F + h2

F ) elsewhere.This is okay, since we are only concerned with fluid flow within the tank.When we numerically solve the DAR equations, we can exclude the originfrom our mesh. In the plant bed, ~UP has a source at the origin where waterflows into the bed. As in the fish tank, |~UP | approaches vp as the distance

11

Page 15: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

from the origin approaches zero, and we assume that |~UP | approaches zero asthe distance from the pump approaches the maximum distance of

√l2P + h2

P .Hence,

~VP = ~UP = vp

(1−

√x2 + y2√l2P + h2

P

)< x, y >√x2 + y2

= vp

(1√

x2 + y2− 1√

l2P + h2P

)< x, y >, 0 < t ≤ t (18)

During the period of overflow, ~VF has a sink at the origin and a source at(lF , hF ), where water from the overflow pipe flows in. Notice that the rateof inflow must equal the rate of outflow so that the water level in the plantbed is maintained at hp. This implies that

~VF = ~UF + vp

(√x2 + y2√l2F + h2

F

)< x− lF , y − hF >√(x− lF )2 + (y − hF )2

, t < t ≤ t (19)

Similarly, ~VP has a source at the origin and a sink at (lP , hP ). Hence,

~VP = ~UP + vp

(√x2 + y2√l2P + h2

P

)< lP − x, hP − y >√(x− lP )2 + (y − hP )2

, t < t ≤ t (20)

While the plant bed is draining, ~VF has a source at the origin where waterflows back through the pump. Similarly, ~VP has a sink at the origin. There-fore |~VP | and |~VF | approach vp as the distance from the origin approaches

zero. Again, |~VP | and |~VF | approach zero as the distance from the originapproaches

√l2P + h2

P and√l2F + h2

F , respectively. This yields

~VF = vp

(1√

x2 + y2− 1√

l2F + h2F

)< x, y >, t < t ≤ t (21)

~VP = vp

(1√

l2P + h2P

− 1√x2 + y2

)< x, y >, t < t ≤ t (22)

Finally, for t < t ≤ t∗, the plant bed is completely drained. Thus,~VP = ~VF = 0 until the pump turns on again. These velocity fields assume

12

Page 16: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

that flow within the tank and the bed is only affected by water flowingbetween the tanks. This is fairly accurate for the plant bed; though theporosity of the medium will cause some deviation from the expected flowpattern; However, this assumption is somewhat inaccurate in the fish tank.Fish generally require highly oxygenated water, thus aerators and air stonesare often placed in the fish tank to increase the DO. This creates turbulence,which we have decided to ignore for the purposes of this model. Plots ofthe flow fields are shown in figures 2 - 4. The lengths and heights chosenfor the fish tank and plant bed in these figures are based upon physicalconsiderations that will be discussed when we estimate parameters.

Figure 2: The velocity fields in the fish tank (left) and plant bed (right) for0 ≤ t ≤ t.

13

Page 17: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 3: The velocity fields in the fish tank (left) and plant bed (right) fort ≤ t ≤ t.

Figure 4: The velocity fields in the fish tank (left) and plant bed (right) fort ≤ t ≤ t.

14

Page 18: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

3.4 DAR Equations, Initial Conditions, and BoundaryConditions for each Substance

Now we are ready to write out the DAR equations for each substance ofinterest. Each substance will have its own hydrodynamic dispersion coeffi-cient in the plant bed. The dispersion coefficients for ammonia, nitrite, andnitrate are DP

A , DPB , D

PC , respectively. Likewise, each substance has its own

molecular diffusion coefficient in the fish tank. The diffusion coefficients forammonia, nitrite, and nitrate in the plant bed are DF

A , DFB, D

FC , respectively.

Therefore, the DAR equations in the Fish Tank (0 < x < lF , 0 < y < hF )for 0 < t ≤ t are

∂A

∂t= DF

A∇2A− ~VF · ~∇A− A(~∇ · ~VF ) + F (t) (23)

∂B

∂t= DF

B∇2B − ~VF · ~∇B −B(~∇ · ~VF ) (24)

∂C

∂t= DF

C∇2C − ~VF · ~∇C − C(~∇ · ~VF ) (25)

Similarly, the equations in the Plant Bed (0 < x < lP , 0 < y < hP ) for0 < t ≤ t are written as

∂A

∂t= DP

A∇2A− ω−1~VP · ~∇A− ω−1A(~∇ · ~VP )− ω−1k1A (26)

∂B

∂t= DP

B∇2B − ω−1~VP · ~∇B − ω−1B(~∇ · ~VP ) + ω−1(k1A− (27)

k2B)

∂C

∂t= DP

C∇2C − ω−1~VP · ~∇C − ω−1C(~∇ · ~VP ) + ω−1k2B − (28)

ω−1P (x, y, t)

When t < t ≤ t∗, A = B = C = 0 in the plant bed because the bed isdrained (we are ignoring the small amount of water contained in the porousmedium). In the fish tank, the water is assumed to be stagnant and the fishare still excreting ammonia. Hence the concentrations of the nitrogenous

15

Page 19: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

compounds are given by

∂A

∂t= DF

A∇2A+ F (t) (29)

∂B

∂t= DF

B∇2B (30)

∂C

∂t= DF

C∇2C (31)

Later we will show that, due to the flood-and-drain process, there aresome values of y and y that are not valid during each time period. This occursbecause the DAR equations are only valid in domains that are completelyfilled with water (in the plant bed this means that every void in the porousmedium is filled with water).

For each substance and each boundary in the tank and bed, we havezero-flux (Neumann) boundary conditions (BCs). This makes sense becausenone of our substances of interest are dissolving into the water from the airabove each compartment. Furthermore, material cannot diffuse or advectacross the walls of these containers, which are typically plastic or some otherimpermeable material. For 0 < t ≤ t, we have a source at O and a corre-sponding drain at O. Thus we will impose a Dirichlet BC by solving theequations for the fish tank first, and then requiring that the concentrationat O equal the concentration at O. This implies that the BCs for ammoniawhen 0 < t ≤ t are given by

∂A

∂x= 0 for x = 0, 0 < y ≤ yJ and x = lF , 0 ≤ y ≤ yJ (32)

∂A

∂x= 0 for x = 0, 0 < y ≤ yL and x = lP , 0 ≤ y ≤ yL (33)

∂A

∂y= 0 for y = 0, 0 < x ≤ lF and y = yJ , 0 ≤ x ≤ lF (34)

∂A

∂y= 0 for y = 0, 0 < x ≤ lP and y = yL, 0 ≤ x ≤ lP (35)

A = A for x = y = x = y = 0 (36)

where yJ(t) and yL(t) are the heights of the water in the fish tank andplant bed, respectively. Notice that these heights vary depending on whichpart of the flood and drain cycle we are in. These heights will be found for

16

Page 20: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

each time period when we define our computational grid in the numericalmethods section. When the water in the plant bed drains back through thepump (t < t ≤ t), the BCs are the same except we must find the solution inthe plant bed first so that we have enough information to satisfy equation(36). For the overflow period (t < t ≤ t), the BCs are the same except wemust also impose a Dirichlet BC where the plant bed overflows into the fishtank. Hence for t < t ≤ t,

A(lF , yJ , t) = A(lP , hP , t) (37)

During the period when the plant bed is empty, the BCs are the same asthose given by equations (32) - (35), except there is no Dirichlet BC at theorigin; all BCs are zero-flux. The BCs for the DAR equations for nitrite andnitrate are the same as for ammonia during each time period. It should benoted that when we impose these BCs numerically, equations (36) and (37)will have to be imposed on one or more grid points next to the points O andO because the flow fields are discontinuous at these points.

As for the initial conditions, we will assume that we are starting thissystem when the bacteria have become well-established, so that nitrificationoccurs at a sufficient rate to allow for A ≈ B ≈ 0 (mathematically, we willassume that the bacteria populations have reached the carrying capacity).Aquaponic gardeners call this process of establishing a robust bacteria pop-ulation cycling, and it can be done with or without fish (Bernstein 183-4).For cycling with fish, the gardener would put a small amount of fish in thetank. If the bacteria colonies grow fast enough, and the fish do not producetoo much ammonia, the fish will not die from ammonia toxicity while thesystem is being cycled (Bernstein 186). However, it is unnecessary to en-danger the fish when fishless cycling is an option. For fishless cycling, wewould add liquid ammonia or crystallized ammonia (ammonium chloride) toour aquaponic system daily until the nitrate concentration becomes nonzero(Bernstein 189-90). When ammonia and nitrite concentrations are zero andthe nitrate concentration is at least 5,000 - 10,000 mg/m3, it is safe to addfish. This typically occurs 10 - 21 days after the first dose of ammonia (Bern-stein 189, 191). When cycling is complete, the bacteria populations have notnecessarily reached maximum capacity, but clearly we could cycle until thethe bacteria populations level off, and then add the fish. It should be notedthat plants are added to the system at the beginning of the cycling processbecause they can absorb ammonia as a source of nitrogen, though they will

17

Page 21: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

be much healthier when the nitrate levels increase (Bernstein 192).These conditions imply that A(x, y, 0) = B(x, y, 0) = 0 and C(x, y, 0) ≈

7, 500mg/m3. In the plant bed, there is initially no water; hence A(x, y, 0) =B(x, y, 0) = C(x, y, 0) = 0. For the time periods t < t ≤ t, t < t ≤ t andt < t ≤ t∗, the initial conditions are the concentrations at the end of theprevious time period. When these equations are solved, t = t∗ is set to t = 0at the end of each flood and drain cycle, and then we solve the system forthe next cycle.

4 Estimation of Parameters

In order to solve this system of equations, we will need reasonable estimatesfor all the physical parameters in the system. This will allow us to judgewhether our model accurately describes experimental results. It should benoted that the data used to estimate parameters was often not gathered un-der conditions that are most suitable to an aquaponics system. However,we attempted to find data gathered under circumstances that are as similaras possible to optimal aquaponic conditions. A pH of 6.8 to 7.0 is best foraquaponics, and bacteria grow most quickly between 25 and 30C (Bern-stein 147, 177). We will assume that we are growing pakchoi, since detailedquantitative data was available for this plant. This is also a very reason-able assumption because leafy greens, such as lettuce, herbs, and pakchoi arefrequently grown aquaponically.

4.1 The Plant Uptake Function

The plant uptake function P is estimated using data from an experiment in2012 in which pakchoi seedlings were raised hydroponically at the ZhejiangUniversity. The plants were placed in a mixed solution of nitrate, ammonium(NH+

4 ), and glycine (an amino acid). We are not concerned with glycine,thus we will only consider uptake of NH+

4 and NO−3 . It should be noted thatthough the uptake rate of ammonium was measured, ammonium is just theionized form of ammonia. The proportion of total ammonia that exists asunionized ammonia is a function of pH, temperature, and salinity (Thurstonet al. iii). Since the pakchoi was not grown in salt water, we can estimate theproportion of unionized ammonia based on pH and temperature. The pH ofthe nutrient solution was maintained at 6.5 and the temperature in the lab

18

Page 22: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

was 27.5C on average (Xiaochuang et al. 248). Under these conditions, it isestimated that 0.2135% of the total ammonia is unionized (Thurston et al.95). The uptake rates for each substance could be fit to a Michaelis-Mentenequation of the form

r(γ) =rmaxγ

κ+ γ(38)

where r is the uptake rate, γ is the concentration, rmax is the maximumuptake rate, and κ is the value of γ when r = rmax/2. The Michaelis-Menten equation basically tells us that the rate of plant uptake increases withconcentration, but eventually levels off. This is evident because as γ → ∞,r → rmax. It makes sense for the rate of plant uptake to level off because it isunrealistic for uptake to increase without bound as concentration increases.For NH+

4 , κ and rmax were found to have average values of 2,000µmol/Land 45.2µmol/g DW/h, respectively, where DW stands for plant dry weight.For NO−3 , the values were 177µmol/L and 18.2µmol/g DW/h, respectively(Xiaochuang et al. 250). A table containing these parameter estimates withtheir standard errors can be found in the appendix on page 99. Since thetotal ammonia is expressed in the ionized form, and we want to express itin unionized form, we must multiply by the ratio of the formula weight ofNH3 to the formula weight of NH+

4 (Thurston et al. 4). The formula weightis just the mass of one molecule of a substance, hence the formula weightsof NH3, NH

+4 , and NO−3 are 17.034 u, 18.042 u, and 62.010 u, respectively

(”Periodic Table...”). We want to express mass in milligrams, not atomicmass units, therefore we must use the fact that 1u = 1.661×10−21mg (Serwayet al. A.2). Finally, we will use the facts that there are 6.02× 1023 moleculesin a mole, and 1000L = 1m3. Let the subscripts A and C denote values forammonia and nitrate, respectively. Then

κA =

(2000× 10−6mol

L

)(1000L

m3

)(6.02× 1023molecules

mol

)· (39)(

18.042u(1.661× 10−21mg)

molecule

)(17.034u

18.042u

)(0.002135)

= 72.73mg/m3

where 0.002135 is the decimal percentage of unionized ammonia. Simi-larly, rmax,A = 1.644 × 10−3mg/gDW/h, κC = 10, 974mg/m3, and rmax,C =

19

Page 23: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

1.128mg/gDW/h. Notice that rmax,A is over 650 times smaller than rmax,C .Thus we can ignore plant uptake of ammonia in our model, and assume thatthe plants only take up nitrate. Furthermore, we must divide r by the vol-ume of water in the plant bed, Vw(t), to obtain a plant uptake function withdimensions of concentration per unit time. Also observe that rmax is per mgdry weight. In 1997, it was found that the average weight of pakchoi plantsgrown in a greenhouse during the spring is 196.7 g and they are 4.5% dryweight. In the winter, they have an average weight of 97.7g and they are4.8% dry weight (He 52). Upon averaging the spring and winter data, we getthat pakchoi plants have an average dry weight of 6.771 g. In an aquaponicssystem, we can plant about 22 leafy green plants per m2 (Somerville et al.123). Let the cross-sectional area of the plant bed in the x− z plane be aP .Then the nitrate uptake rate of pakchoi is given by

P (C) =(1.128mg/gDW/h)(22/m2)(6.771gDW )aPC

10, 974 + C

=168.0aPC

10, 974 + C(40)

Figure 5 below shows graphs of plant uptake. From the graph, it appearsthat the uptake rate of ammonia is much larger than that of nitrate. However,uptake of ammonium, rather than ammonia, is displayed in the graph.

20

Page 24: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 5: Plant Uptake of Ammonium and Nitrate

4.2 The Fish Excretion Function

The fish excretion function for ammonia will be estimated using data fromjuvenile tench raised in a recirculating aquaculture system. We did not findevidence of tench being raised in an aquaponics system, but data concerningthe excretion rates of tench was much more detailed than that of other fish.Furthermore, tench could be grown in an aquaponics environment becausethey are freshwater fish. The main type of fish that should not be grownaquaponically is saltwater fish because most plants cannot survive in saltwater (Bernstein 136). That said, it should be noted that tilapia, goldfish,catfish, and koi are the fish most frequently grown in aquaponics systems.Gardeners have also raised shrimp, barramundi, pacu, perch, trout, oscars,and freshwater lobster (Bernstein 136-7). Zakes et al. found that the amountof ammonia excreted by fish is affected by how much the fish are fed, howoften they are fed, and the protein content of the food (Zakes et al. 128).When fish are fed more food, or the protein content of the food is increased,the ammonia excretion rate increases as well (Zakes et al. 136). Moreover,graphs of the data suggest that in the hours after the fish are fed, the rateof excretion increases until a maximum rate is reached. It then decreases sothat the data has a distribution reminiscent of a bell-curve between feeding

21

Page 25: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

times. Thus we will assume that food ration and protein content are heldconstant, and model the fish excretion rate with a bell-curve of the form

F (t) = β1 exp

[−(t− β2

β3

)2]

(41)

In the experiment performed by Zakes et al., the fish fed once per daywere given food that consisted of 55% protein, and they were fed 0.8% of theirbody mass (Zakes et al. 130). The ammonia excretion rate was measuredin mg TAN/kg fish/h, where TAN (total ammonia nitrogen) is the sum ofthe total amount of nitrogen that exists as ammonia and ammonium. Toconvert these values to ammonia levels, we must multiply by the ratio ofthe formula weight of ammonia (17.034 u) to the formula weight of TAN.The formula weight of TAN is twice the mass of a nitrogen atom, hence theweight of TAN is 28.02 u (”Periodic Table...”). Furthermore, the data isgiven per kilogram fish weight, but in order to convert TAN to ammonia,we need the data to be given as a concentration, i.e. in milligrams TAN percubic meter of water. Using the fact that the stocking density of fish in anaquaponics system should be about 15 kg of fish per cubic meter of water,we can convert the data to concentrations (Somerville 125). Finally, the pHand water temperature in the experiment were 8.01 and 23C, respectively,thus the percentage of unionized ammonia in the experiment was 4.755%(Zakes et al. 128-9, Thurston et. al 191). Consequently, we can concludethat each data point can be scaled by a factor of 0.4336 to obtain data withunits of mg NH3/m3/h. Upon estimating the data values from the plotsprovided by Zakes et al., and performing the nonlinear regression we findthat β1 ≈ 11.13mgNH3/m

3/h, β2 ≈ 8.083h, and β3 ≈ 4.337h.

22

Page 26: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 6: The Fish Excretion Function

The original data and Mathematica code used to perform the regressioncan be be found in the appendix on pages 96 - 98.

4.3 Additional Parameters

Estimates for the first-order nitrification rate constants k1 and k2 could notbe fould in the literature. However, we did find cumulative nitrification ratesfor cucumbers grown in an aquaponics system with tilapia. It should benoted that this aquaponics system used a trickle filter rather than flood anddrain aquaponics. In a trickle biofiltration system, water is sprayed on thetop of the media, without immersing the media entirely in water (Tyson 26).Consequently, this system is somewhat different from ours. There were twotrial runs, and it was found that ammonia was converted to nitrite at therates of 231µg/L/day and 300µg/L/day at pH 6.5 and 400µg/L/day and540µg/L/day at pH 8.5 for experiments 1 and 2, respectively. Nitrite wasconverted to nitrate at the rates of 231µg/L/day and 375µg/L/day at pH6.5 and 267µg/L/day and 540µg/L/day at pH 8.5 for experiments 1 and 2,respectively (Tyson 67). After averaging the rates for the two experimentsand interpolating linearly between the rates at pH 6.5 and pH 8.5, we findthat at a pH of 6.9, ammonia is consumed at a rate of 12.77 mg/h/m3 andnitrite is consumed at a rate of 13.46 mg/h/m3 (the reader may recall that6.9 is an optimal pH for aquaponics). When we solve our system of equations,

23

Page 27: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

we want to choose k1 and k2 so that over a period of time the total amountsof ammonia and nitrite consumed by nitrification agree with their respectivenitrification rates.

System size is also a very important parameter. The rule of thumb forbasic flood and drain aquaponics is that the volume of the plant bed shouldequal the volume of the fish tank. If the gardener wishes to add more plantbeds, then a sump tank or indexing valve must also be added to the system.This ensures that the water level in the fish tank never drops to a level thatis unhealthy for the fish. As I said before, a sump tank holds excess waterin an aquaponics system so that it can be supplied to the fish tank while theplant beds are filled with water. An indexing valve is connected to the pump;it causes the pump to fill a different plant bed during each flood and draincycle (Bernstein 58). In addition, we require that the width of the plantbed (wP ) be no larger than 1.2 m wide so that the gardener can easily reachevery plant in the bed. Typical plant beds have a depth of about 0.3 m, andwe want the fish tank to be at least 46 cm deep to support large edible fish.However, we want the length and width of the fish tank to be fairly large incomparison to the height so that the tank has more surface area for oxygento dissolve into the water. Another rule of thumb is that we want the fishtank to have a volume of at least one cubic meter so that changes in watertemperature and pH will occur more slowly (since acidic or basic solutionsintroduced into the water will be more dilute) (Bernstein 75-6). With theseconsiderations, we choose lP = 2.778m, wP = 1.2m, hP = 0.3m, lF =

√2m,

wF =√

2m, and hF = 0.5m.The rate at which the pump delivers water to the plant bed depends

directly on the size of the fish tank. As a good rule of thumb, the pumpshould cycle all of the water in the fish tank in an hour. Many people usea pump capable of cycling the entire tank in fifteen minutes, and then shutit off using a pump timer for the remaining forty-five minutes. If we modelthis type of system, then t = 0.25h, t∗ = 1h, and vp = ΛF/t, where ΛF isthe volume of the fish tank. Our assumptions of symmetry imply that thisis the pump velocity within all cross-sections of the fish tank and plant bedthat are parallel to the x-y and x-y planes, respectively. Thus we can simplydivide the volumetric pump rate by dimensions of length squared to get alinear pump velocity in terms of length per unit time. Linear velocity couldbe measured by placing a flow meter at the opening of the pump pipe whilethe pump is running. With the current values of ΛF and t, vp = 4m/s.

The porosity of the medium is determined by particle size and shape. For

24

Page 28: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

an aquaponics system, we will be using gravel that is between 12 and 18 mmin diameter, or a different medium of a similar size. If smaller material is used,then solid fish waste will accumulate in the spaces between the medium sothat air and water cannot circulate around plant roots. Larger mediums willprevent plants from securing themselves properly in the grow bed (Bernstein112). The porosity of gravel has a mean value of 0.24 (”Total Porosity”).

The time required for the plant bed to fill and drain are also relevantin this model. We know that the volume of the plant bed that is availableto water is ωΛP , where Λp is the total volume of the plant bed. Hencet = ωΛP/vp is the time required for the plant bed to fill with water. Asfor the time required to drain, according to Torricelli’s Law, if apump is thecross-sectional area of the pipe connected to the pump, hw(t) is the height ofthe water, and g is the acceleration due to gravity, then (Calculus: Conceptsand Contexts 517)

dVwdt

= −apump√

2ghw (42)

Since Vw = ωaPhw, equation (42) is equivalent to

dhwdt

=−apump

√2ghw

ωaP(43)

Notice that |dhw/dt| = vp, the rate at which water drains from the plantbed. We can simplify equation (43) by letting γ = apump

√2g/(ωaP ). The

equation can then be solved via separation of variables with the initial con-dition hw( t ) = hP to obtain

hw =[√

hP + γ(t− t)/2]2

(44)

When we solve the DAR equations in the plant bed for t < t ≤ t, theequations are only valid for y ∈ (0, hw), where hw is given by equation (44)for each t. At time tdrain, all of the water has drained from the plant bed.We can find tdrain by setting hw = 0 in equation (44) and solving for t. Thisyields

tdrain = t+ 2√hp/γ (45)

We must also estimate the diffusion and dispersion coefficients for eachDAR equation. The molecular diffusion coefficient (Do) for ammonium in wa-ter is estimated to be 6.696× 10−6m2/h; the diffusion coefficients for nitrite

25

Page 29: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

and nitrate are estimated to be 6.12×10−6m2/h (Milo). I was unable to findthe molecular diffusion coefficient for ammonia, therefore we will assume thatit has a value close to that of ammonium. These will be the difffusion coef-ficients used for the DAR equations in the fish tank. In the porous medium,the effective molecular diffusion coefficients (D(m)) are slightly smaller be-cause the media acts as an obstacle for molecular motion. It is estimatedthat the effective diffusion coefficients in the biofilters used at wastewatertreatment plants are 4.968× 10−6m2/h for ammonia and 4.428× 10−6m2/hfor nitrite and nitrate (Okabe et al. 89). It has been shown experimentallythat, in the direction of flow, the dispersion coefficient in the porous mediumis given by D(d) = αL|~VP |, where αL is the longitudinal dispersivity. Sim-

ilarly, perpendicular to the direction of flow, D(d) = αT |~VP |, where αT isthe transverse dispersivity (Logan). The transverse dispersivity is typicallyonly 1/5 to 1/100 of the longitudinal dispersivity (de Marsily 238). For thepurposes of this model, we will assume D(d) is constant in the plant bed andequal to the dispersion coefficient in the direction of flow. We will approxi-mate |~V | by its value at the center of the bed during each time period. ThusD(d) is given by

D(d) =

αLvp/2 0 < t ≤ t

αLvp t < t ≤ t

αLvp/2 t < t ≤ t

0 t < t ≤ t∗

(46)

The longitudinal dispersivity varies depending on the type of porousmedium and, to a much larger extent, on the scale of the experiment (Schulze-Makuch 455). Dispersivities measured from soil columns in labs are muchsmaller (due to a smaller flow rate) than those measured for water flowingthrough an aquifer. In light of this observation, we considered only experi-ments done on a scale of less than ten meters from the review by Schulze-Makuch on longitudinal dispersivity data. This makes sense becuase thedimensions of the fish tank and plant bed in our model are all less than tenmeters. We also only considered data for sand, which is closest in size to thesmall pieces of gravel typically used in aquaponics systems. From a linearregression of αL vs. scale in meters, we found that for a scale of 1 meter,αL ≈ 0.0786.

Evidently, D(d) is much larger than D(m). To see this, recall that for thechosen parameter values vp = 4m/h. Furthermore, we can see from equation

26

Page 30: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(43) that when the tank is full (hw = hP ), vp = |dhw/dt||t=0 ≈ 1.234m/h, forstandard PVC pipe with a 6 mm inner radius (Bernstein 94). Therefore, itis obvious that the dispersion coefficient is several orders of magnitude largerthan the effective diffusion coefficient. With negligible error, we can definethe hydrodynamic dispersion coefficient as D = D(d).

5 Numerical Methods

To solve the DAR equations in the fish tank and plant bed, we will usefinite differences to estimate derivatives. Let i, j, k, l, and m be nonnegativeintegers and ∆x,∆y,∆x,∆y,∆t > 0. Then our computational grid can bewritten as

xi = i∆x, 0 ≤ i ≤ I, 0 = x0 < x1 < · · · < xI = lF (47)

yj = j∆y, 0 ≤ j ≤ J, 0 = y0 < y1 < · · · < yJ = hF

xk = k∆x, 0 ≤ k ≤ K, 0 = x0 < x1 < · · · < xK = lP

yl = l∆y, 0 ≤ l ≤ L, 0 = y0 < y1 < · · · < yL = hP

tm = m∆t, 0 ≤ m ≤M, 0 = t0 < t1 < · · · < tM = t∗;

t = tδ1 , t = tδ2 , t = tδ3 , such that tδ1 , tδ2 , tδ3 ∈ S = tm| 0 < m < M

However, as we stated before, some of these values of y and y are notvalid during certain time periods, because the height of the water in eachtank fluctuates. For 0 ≤ t ≤ t, water flows from the fish tank to the plantbed at a rate of ΛF/t. Therefore,

aFyJ = ΛF − vpt

yJ = hF −vpt

aF, 0 ≤ t ≤ t (48)

ωapyL = vpt

yL =vpt

ωap, 0 ≤ t ≤ t (49)

For t ≤ t ≤ t, the height of the water in the plant bed is maintained athP , and therefore the height in the fish tank, yJ , satisfies

27

Page 31: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

aFyJ = ΛF − ωΛP

yJ = hF −ωΛP

aF, t ≤ t ≤ t (50)

For t ≤ t ≤ t, it is obvious that yL is given by hw in equation (44). Thusthe volume of water in the fish tank at each time t ∈ (t, t) is equal to thevolume of water that remained in the tank during overflow, plus the totalvolume of water that has drained back into the tank per cross-sectional areaof the tank (aF ). The total volume of water that has drained back into thetank at time t is given by the maximum volume of water that the bed canhold, minus the volume of water that remains in the bed. We can concludethat

aFyJ = (ΛF − ωΛp) + (ωΛP − ωaPhw(t))

yJ = hF −ωaphw(t)

aF, t ≤ t ≤ t (51)

For t ≤ t ≤ t∗, there are no equations to solve for the plant bed, and thefish tank is filled to the maximum height hF .

To simplify the finite difference method, we will assume that the waterlevel does not change in each compartment, and instead solve the DAR equa-tions over all of the grid points throughout the pump cycle. We will simulatethe flood-and-drain process by changing the nature of the flow fields through-out the cycle, and transferring material between the compartments. Duringthe fourth part of the cycle, when all of the water has drained from the plantbed, we will only solve for the concentration in the fish tank.

The finite difference scheme can be derived by using Taylor series toapproximate derivatives. Recall that the taylor series of a function f(x)about a point x = a is given by

f(x) =∞∑n=0

f (n)(a)

n!(x− a)n (52)

= f(a) + f ′(a)(x− a) +f ′′(a)

2!(x− a)2 +

f ′′′(a)

3!(x− a)3 + · · ·

28

Page 32: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Hence if we consider the Taylor series of f(x+ ∆x) centered about x, wefind that

f(x+ ∆x) = f(x) + ∆xf ′(x) +∆x2

2f ′′(x) +

∆x3

6f ′′′(x) + · · · (53)

Similarly, if we consider the Taylor series of f(x−∆x) centered about x,we obtain

f(x−∆x) = f(x)−∆xf ′(x) +∆x2

2f ′′(x)− ∆x3

6f ′′′(x) + · · · (54)

Taylor’s inequality (stated below) tells us that if the derivatives of f arebounded on an interval containing (x, x + ∆x), then we can place a boundon the error associated with approximating f by its Taylor series in that inthat interval (Calculus: Early Transcendentals 756).

Taylor’s Inequality : Let f(x) = Tn(x) + Rn(x) where Tn(x) is the nth-degree Taylor polynomial of f at a. If |f (n+1)(x)| ≤ N for |x− a| ≤ d, thenthe remainder Rn(x) of the Taylor series satisfies the inequality

|Rn(x)| ≤ N

(n+ 1)!|x− a|n+1 for |x− a| ≤ d

For equations (53) and (54), |x−a| = ∆x, thus we can conclude that, forfunctions satisfying the conditions of Taylor’s inequality, smaller values of∆x lead to smaller errors. Solving equation (53) for f ′ gives us the forwarddifference approximation (forward because we are using the function valuex+ ∆x, which is larger than x, in the difference approximation) for the firstderivative of f (Strikwerda 13).

f ′(x) =f(x+ ∆x)− f(x)

∆x− ∆x

2f ′′(x)− ∆x2

6f ′′′(x)− · · ·

f ′(x) =f(x+ ∆x)− f(x)

∆x+O(∆x)

f ′(x) ≈ f(x+ ∆x)− f(x)

∆x(55)

29

Page 33: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Clearly the forward difference formula is first-order accurate, which meansthat the truncation error is on the order of ∆x. Likewise, solving equation(54) for f ′ will result in the backward difference approximation given below,which is also first-order accurate (Strikwerda 13).

f ′(x) =f(x)− f(x−∆x)

∆x+

∆x

2f ′′(x)− ∆x2

6f ′′′(x) + · · ·

f ′(x) =f(x)− f(x−∆x)

∆x+O(∆x)

f ′(x) ≈ f(x)− f(x−∆x)

∆x(56)

To get a central difference approximation to the first derivative, we sub-tract equation (54) from equation (53) to get equation (57), which is second-order accurate.

f(x+ ∆x)− f(x−∆x) = 2∆xf ′(x) +∆x3

3f ′′′(x) + · · ·

f ′(x) =f(x+ ∆x)− f(x−∆x)

2∆x− ∆x2

6f ′′′(x) + · · ·

f ′(x) =f(x+ ∆x)− f(x−∆x)

2∆x−O(∆x2)

f ′(x) ≈ f(x+ ∆x)− f(x−∆x)

2∆x(57)

We can conclude that the central difference formula for the first derivativeis more accurate than the forward and backward approximations. Therefore,we will use central difference approximations for all first spatial derivatives.To derive central difference approximations to the second derivative,we keep an extra term in series (53) and (54), and then add the equationstogether.

30

Page 34: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

f(x+ ∆x) + f(x−∆x) = 2f(x) + ∆x2f ′′(x) +∆x4

12f (4)(x) + · · ·

f ′′(x) =f(x+ ∆x)− 2f(x) + f(x−∆x)

∆x2− ∆x2

12f (4)(x) + · · ·

f ′′(x) =f(x+ ∆x)− 2f(x) + f(x−∆x)

∆x2−O(∆x2)

f ′′(x) ≈ f(x+ ∆x)− 2f(x) + f(x−∆x)

∆x2(58)

Clearly the central difference formula is second-order accurate. Now weare ready to write out the finite difference approximations to the DAR equa-tions. For now, we only consider the DAR equations for ammonia in thefish tank and plant bed. Thus we assume that the ammonia is not beingconverted to nitrite and then nitrate. Our motivation for doing this is thatthe DAR equations for ammonia are the only PDEs in the system that arenot coupled with the rest of the system. So we can study the behavior of theequations for ammonia, without having to worry about the effects that thenitrite and nitrate concentrations have on the system. It is also reasonable toassume that if we find a solution technique that works for ammonia, it mayalso give us good results for the system as a whole. We will let subscriptsdenote spatial indices and superscripts denote temporal indices. For exam-ple, A(xi, yj, tm) = Ami,j and A(xk, yl, tm) = Amk,l. Let φ and φ be the x- and

x- components, respectively, of ~VF and ~VP , respectively. Let ψ and ψ be they- and y- components, respectively, of ~VF and ~VP , respectively. By replacingthe Laplace and Del operators with their corresponding partial derivatives,equation (23) can be written as

∂A

∂t= DF

A

(∂2A

∂x2+∂2A

∂y2

)− < φ,ψ > ·

⟨∂A

∂x,∂A

∂y

⟩− A

(∂φ

∂x+∂ψ

∂y

)+F (t)

= DFA

(∂2A

∂x2+∂2A

∂y2

)− φ∂A

∂x− ψ∂A

∂y− A

(∂φ

∂x+∂ψ

∂y

)(59)

+F (t)

If we replace the time derivative with a forward difference approximation,and all of the spatial derivatives with central difference approximations, thenequation (59) can be approximated by

31

Page 35: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Am+1i,j − Ami,j

∆t= DF

A

(Ami+1,j − 2Ami,j + Ami−1,j

∆x2+Ami,j+1 − 2Ami,j + Ami,j−1

∆y2

)−φmi,j

Ami+1,j − Ami−1,j

2∆x− ψmi,j

Ami,j+1 − Ami,j−1

2∆y

−Ami,j(∂φmi,j∂x

+∂ψmi,j∂y

)+ Fm (60)

Similarly, we can rewrite equation (26) using finite difference approxima-tions.

Notice that the scheme is explicit. This means that the solution at eachgrid point at the (m+1)-th time step only depends on the solution at them-thtime step. To make equation (60) an implicit finite difference approximation,we would replace m with m+ 1 in all terms on the right side of the equation.Then the solution at each grid point at the (m + 1)-th time step dependson neighboring points at the (m+ 1)-th time step, as well as the solution atthe m-th time step. Explicit methods are easier to implement than implicitschemes, but they are also less stable. An example of restrictions on explicitmethods is provided in the appendix on page 100. We will see that thisexplicit method is not stable enough for our system of DAR equations, andwe will implement an implicit scheme later.

Also observe that equation (60) is only valid for 1 ≤ i ≤ I − 1 and1 ≤ j ≤ J − 1. For i = 1, I − 1 and j = 1, J − 1, we will need to apply ourNeumann boundary conditions given by equations (32) and (34). We mustuse forward difference approximations for the the normal derivatives on thebottom and left sides of the fish tank, and backward differences for normalderivatives on the top and right sides. Therefore,

Am1,j − Am0,j∆x

= 0 for xi = 0, 0 < yj ≤ yJ (61)

AmI,j − AmI−1,j

∆x= 0 for xi = xI , 0 ≤ yj ≤ yJ (62)

Ami,1 − Ami,0∆y

= 0 for yj = 0, 0 < xi ≤ xI (63)

Ami,J − Ami,J−1

∆y= 0 for yj = yJ , 0 ≤ xi ≤ xI (64)

32

Page 36: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Equations (61) - (64), respectively, imply that Am1,j = Am0,j, AmI,j = AmI−1,j,

Ami,1 = Ami,0, and Ami,J = Ami,J−1. As for the Dirichlet boundary conditionsthat occur when water is being exchanged between the compartments, weapply these conditions at the two boundary gridpoints adjacent to the upperright and lower left corner gridpoints. Notice that none of the interior pointsdepend on the corner gridpoints, thus we cannot just apply the Dirichlet BCsto the corner gridpoints. Numerically, the material would not be advectedand diffused throughout the compartment. Upon applying these boundaryconditions we get that

Am0,1 = Am0,1, and Am1,0 = Am1,0 for 0 ≤ t ≤ t (65)

Am0,1 = Am0,1, and Am1,0 = Am1,0 for t ≤ t ≤ t (66)

AmI−1,J = AmK−1,L, and AmI,J−1 = AmK,L−1 for t ≤ t ≤ t (67)

We let all spatial step sizes be 0.02 in both compartments, and we set∆t = ∆x/400 = 5 × 10−5. This may seem to be an excessively small timestep. After all, to get an hour’s worth (real-time) of simulation, we mustsolve the recurrence relation given by equation (60) 20,000 times, since weare measuring time in hours. However, we will see that a small time stepis necessary for numerical stability. In fact, we will see that for a diffusioncoefficient much smaller than the flow rate, we cannot choose a small enoughtime step to get a reasonable solution in a reasonable amount of time.

We also simplify the model derived in sections 3 and 4 of this paper.We want to start with a very basic model so that we can determine howthe explicit scheme responds to the physical parameters. We assume thatthere are no moving boundaries; in other words, the water level is constantthroughout the flood-and-drain cycle. Clearly this is unrealistic, but it doeshave physical significance. When water is flowing into a compartment, thisassumption is equivalent to dumping a substance (such as a relatively smallamount of liquid or crystallized ammonia) into a small region of the tank,and then letting it diffuse and advect throughout the tank. When water isflowing out of a compartment, our assumption is similar to placing a filterat the point of outflow to trap the material, and then transferring it to theother compartment in the system.

Furthermore, we simplify the flow fields given in section 3.3 so that thedivergence is smaller and the direction of flow is the same all all points in acompartment at a particular time. We choose a flow field that always makes

33

Page 37: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

an angle of π/4 or 5π/4 with the positive x-axis so that the direction of flowcan still be angled toward or away from the pump and overflow pipes. Wealso make the flow rate linearly dependent on a single variable, x, so that it iseasy to determine where the current is relatively strong. As before, the flowrate is stronger near points of inflow and outflow. With these considerationsin mind, we choose the flow fields given by equations (68) and (69).

~VF =

(−vp/

√2)(1− x/lF ) < 1, 1 > 0 < t ≤ t

−vp/√

2 t < t ≤ t

(vp/√

2)(1− x/lF ) < 1, 1 > t < t ≤ t

0 t < t ≤ t∗

(68)

~VP =

(vp/√

2)(1− x/lP ) < 1, 1 > 0 < t ≤ t

vp/√

2 t < t ≤ t

(−vp/√

2)(1− x/lP ) < 1, 1 > t < t ≤ t

0 t < t ≤ t∗

(69)

Moreover, we neglect any source terms in our equations, i.e. the fishexcretion and nitrification terms. This is equivalent to imposing some initialconcentration of ammonia in the fish tank, and then simulating how it flowsthrough the system. After time t = 0 we do not add more ammonia, orremove any from the system. We let our initial concentration of ammoniain the fish tank be 1 mg/m3; clearly there is no ammonia in the plant bedinitially because it contains no water at t = 0. Finally, we assume thatDd is constant, rather than piecewise. Until we determine how our solutiontechnique will respond to our simplified diffusion-advection equation, we donot want to introduce any additional complications, such as discontinuousfunctions. Dd ranges from zero to a little more than 0.3, so I set Dd = 0.15,a value roughly in the middle. Upon applying the explicit finite differencemethod to our simplified problem, we obtain the solutions given by figure 7.This solution will be referred to as solution 1.

34

Page 38: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 7: Solution 1

(a) (b)

Figure 7:

(c) (d)

35

Page 39: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g)

While the fish tank floods the plant bed, can see from figure 7.a that am-monia is moving toward the −x direction in the fish tank because the flowfield is angled in that direction. There are oscillations near the coordinateaxes; they seem to have the largest amplitude near the origin. This makessense because the flow field makes an angle of 5π/4 with the positive x-axis,and it has the largest magnitude at x = 0. We would expect advection tobe the strongest near x = 0, especially near the origin. The large advec-tion terms have clearly caused numerical instabilities. Figure 7.b reflects thetransfer of ammonia from the fish tank to the plant bed. The solution in-creases quickly near the origin so that the concentration near the origin inboth compartments are the same (about 0.888 mg/m3).

36

Page 40: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

During the overflow period, we can see from figures 7.c and 7.d that thematerial we have been transferring to the plant bed has been pushed bythe flow field toward the boundary at x = lP . Next to this boundary, theconcentration is reduced because material is overflowing out of the plant bedthere. The oscillations near x = 0 in the fish tank have died out, but we arenow seeing much more oscillation near x = lF . This occurs because materialis being tranferred from the plant bed to the fish tank near the overflow pipe.This spike in concentration seems to be creating numerical instability nearthe overflow pipe.

When the plant bed drains back into the fish tank, we can see from figures7.e and 7.f that the concentration is decreased near the origin in the fish tank.This occurs because relatively diluted water is draining back from the plantbed there. Furthermore, because material is flowing out of the plant bed nearthe origin, the large concentrations that accumulated near x = lP duringoverflow are moving back toward x = 0. Near x = 0, the concentration hasdecreased because material is flowing out. The concentration has decreasedthere from roughly 0.888 to 0.639 mg/m3 since the end of the overflow period.

During the period when the plant bed is empty, the concentration in thefish tank barely changes because our diffusion coefficient is very small there.One last thing to note from these surface plots is that there are no oscillationsin the plant bed. This makes sense because the diffusion coefficient (tech-nically the dispersion coefficient because we are in a porous medium) in theplant bed is Dd = .15m2/h, which is several orders of magnitude larger thanthe diffusion coefficient in the plant bed, DF

A = 6.696×10−6m2/h. Moreover,near x = 0 where the flow rate is vP = 4m3/h, the diffusion coefficient in thefish tank is about 27 times smaller than the flow rate, whereas the coefficientin the plant bed is almost 600,000 times smaller.

In an effort to get rid of these spurious oscillations, we set all spatialstep sizes to 0.01 in both compartments. To prevent a decrease in stability,we continue to set ∆t = ∆x/400, which means that we must now solveequation (60) 40,000 times just to get an hour’s worth of information! Infigure 8 below, we show plots of the solution during the periods of floodingand overflow. We will call this solution 2. Not much has improved, exceptthe amplitude of the oscillations is slightly smaller.

37

Page 41: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 8: Solution 2

(a) (b)

Figure 8:

(c) (d)

It is obvious that the explicit method is not equipped to handle ouradvection-dominated problem. So we turn to implicit finite difference meth-ods. As we said before, to make equation (60) an implicit finite differenceequation, we simply replace every m on the right-hand side with m+1. Thismethod is known as the backward-time central-space implicit scheme (Strik-werda 29). At each time step, we must solve a linear system of (I−1)(J−1)equations in (I − 1)(J − 1) unknowns, where the unknown quantities are the

38

Page 42: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

solution at each of the interior grid points. If we apply this implicit schemeto (60) and simplify, we obtain

a1Am+1i,j + a2A

m+1i+1,j + a3A

m+1i−1,j + a4A

m+1i,j+1 + a5A

m+1i,j−1 = Ami,j + ∆tFm+1 (70)

where a1 = 1 + ∆t[2DFA(∆x−2 + ∆y−2) + (~∇ · ~VF )|xi,yj ,tm ],

a2 = (∆t/∆x)(φk+1i,j /2−DF

A/∆x),

a3 = (−∆t/∆x)(φk+1i,j /2 +DF

A/∆x),

a4 = (∆t/∆y)(ψk+1i,j /2−DF

A/∆y),

a5 = (−∆t/∆y)(ψk+1i,j /2 +DF

A/∆y)

Equation (70) is true in general. For now, we will continue to set F (t) = 0to simplify the model. We make all the same assumptions as for the explicitmethod, except we set ∆t and all spatial step sizes equal to 0.01. This way,it only takes 100 time steps to complete an hour long flood-and-drain cycle.Solutions at the end of each part of the flood-and-drain cycle are shown infigure 9; this will be called solution 3. From figure 9.a we can see that thesolution is similar to the solution obtained via the explicit method, exceptit is much more stable. There are no oscillations; in fact, the solution is aconstant value of about 0.888. From figure 9.b we can see the solution inthe plant bed after flooding is very similar to the explicit solution. Figure9.c is where we really start to see the advantage of the implicit method. Thesolution in the fish tank after overflow has the same behavior as the explicitsolution, except there are no oscillations. With the implicit method, we canobtain results that are much more stable, in only a fraction of the numberof time steps required for the explicit method. Furthermore, this appearsto be independent of how small the diffusion coefficient is. We also notice asignificant difference between the explicit and implicit solutions in the plantbed at this time step. With the explicit method, we found that the flow fieldmoved most of the material toward the boundary at x = lP . However, withthe implicit method the ammonia that is poured into the tank near the originappears to spread more slowly and evenly throughout the tank. Due to theflow field in the plant bed, the concentrated water near the origin spreads outslowly toward x = lP so that the concentration has a nearly constant valueof about 0.88 from x = 0 to about x = 1.9. After that, the concentrationdrops off quickly to about 0.56.

39

Page 43: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 9: Solution 3

(a) (b)

Figure 9:

(c) (d)

40

Page 44: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g)

It is interesting to note that the solutions in the fish tank get muchsmoother if we simply increase the diffusion coefficient. If we set DF

A = 0.15,the diffusion coefficient in the plant bed, we can see from figure 10 that thesolutions in the fish tank maintain their overall behavior, but they are muchsmoother. Specifically, the solutions are smoother near points of inflow andoutflow where there are steep concentration gradients. Furthermore, unlikebefore, there is a notable difference between the solution in the fish tankafter the draining period and the solution at the end of the cycle. This isoccurs because even though there is no flow field during this time, there is asignificant amount of diffusion, which acts to make the concentration uniformthroughout the fish tank. This solution will be referred to as solution 4.

41

Page 45: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 10: Solution 4

(a) (b)

Figure 10:

(c) (d)

Next, we try the implicit method with a constant flow field (actually, onlyconstant within each period of the flood-and-drain cycle). This will be calledsolution 5. We choose the constant velocity field given by equation (71)below. This choice makes sense because the magnitude of the field while thepump is running is always the pump velocity. When the plant bed is drainingback into the fish tank, the magnitude at all points in each compartment isthe rate of drainage. The direction of the field is the same as for equations(68) and (69).

42

Page 46: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

~VF = −~VP =

−vp/

√2 < 1, 1 > 0 < t ≤ t

vp/√

2 < 1, 1 > t < t ≤ t

0 t < t ≤ t∗(71)

With a constant velocity field, and all other conditions the same as forsolution 3, we obtain the solution given by figure 11.

Figure 11: Solution 5

(a) (b)

Figure 11:

(c) (d)

43

Page 47: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g)

We notice that the solution looks very similar to solution 3, until afterdraining. To determine why solutions 3 and 5 look different after draining,we consider figure 12 below, where solution 5 is shown at different timesduring the draining period. From figure 12.a, we see that the material thatwas poured into the fish tank during overflow is being carried across theboundaries at x = lF and y = hF by the flow field, which makes an angleof 45 with the x-axis, and has the same magnitude everywhere. This didnot appear to happen for solution 3 because the flow field had a magnitudethat increased linearly from 0 at x = lF to vp = 4m3/h at x = 0, so thatthe flow field was less effective for larger x-values. Similarly, we can see from

44

Page 48: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

figure 12.c that the larger concentrations that occured at smaller x-valuesare being pushed toward larger x-values. At the same time, diluted water ispouring in near the origin. The flow field in the plant bed is in the oppositedirection of the field in the fish tank, therefore the larger concentrations nearthe boundary at x = 0 in the plant bed are lost at the boundary, as we cansee from figure 12.d. Hence the concentration is continually decreased nearthe origin in the fish tank, where increasingly diluted water pours in fromthe plant bed.

Figure 12: The Draining Period for Solution 5

(a) (b)

Figure 12:

(c) (d)

45

Page 49: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g) (h)

We suspect that we have been losing mass out of our aquaponics systembecause none of our flow fields have been divergence-free, except for thevector field given by equation (71). From equations (23) and (26), we cansee that when the divergence is positive, mass flows out of the system at theboundaries. We expect ~∇· ~VF = ~∇· ~Vp = 0 because water is an incompressiblefluid. A fluid is incompressible if its volume does not decrease as pressureincreases (Panton 198). Even with a constant flow field, we still expect tolose some mass because the normal component of our flow field is not zeroat the boundaries. Hence, some of the mass in the system is being carriedaccross the boundaries by the normal components of the flow field there. To

46

Page 50: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

extimate the initial mass in the aquaponics system, we use the MATLABcode

trapz(yf, trapz(xf, Af)) + trapz(yp, trapz(xp, Ap))

where Af is the matrix containing the initial condition for the fish tank,and xf and yf are the vectors of x- and y- values, respectively, for thecomputational grid in the fish tank. Similarly, Ap is the matrix containingthe initial condition for the plant bed, and xp and yp are the vectors ofx- and y- values, respectively, for the computational grid in the plant bed.The trapz command performs a numerical integration using the trapezoidalrule. Therefore, this code integrates the ammonia concentration over theregions occupied by the fish tank and plant bed to find the total mass ofammonia in the system. Since the initial concentration in the fish tank isone everywhere, and the initial concentration in the plant bed is zero, itis no surprise that our initial mass is just lF lP ≈ 0.7071mg. Suprisingly,though, we gain mass by the end of the flood-and-drain cycle for solution5. Our final mass turns out to be about 1.06 mg. If we perfom the samecalculation for solution 3, we obtain a similar result; the mass in the systemafter one cycle is roughly 1.02 mg. After some thought, we realize that byassigning the concentration in one compartment of the aquaponics system tobe the concentration in the other compartment to simulate an exchange ofmaterial, we are not conserving mass. For example, when we assign valuesfrom the fish tank near the origin to gridpoints near the origin in the plantbed during flooding, we are doubling the mass near the origin in the fishtank, and eliminating the mass near the origin in the plant bed.

In an effort to find boundary conditions that conserve mass, we decide tomake all of our boundary conditions zero-flux, and simulate the exchange offluid between the compartments as a source term (we will call the solution tothis problem solution 6). To see how this works, suppose that we are in theperiod of flooding. We assume that in a small rectangular region RF nearthe origin in the fish tank, half of the material is removed at each time stepand transferred to the plant bed. It is transferred to a rectangular region RP

of the same size near the origin in the plant bed. Instead of replacing themass contained in RP by the mass from RF , we sum the two masses. Thisprocess simulates the flow of water through a rectangular pipe that connects

47

Page 51: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

the fish tank and plant bed near the origin. We only transfer half of thematerial in RF because we do not know the flux through the pipe in the realworld. The flux would depend on the orientation of the pipe relative to theflow field. Since this is a two dimensional model, we cannot make the pipeorientation a parameter. During the overflow and drain periods, we apply asimilar source term technique to simulate the exchange of water between thefish tank and plant bed.

Furthermore, we make some other assumptions to simplify the parametersof the problem so that we can see the effects of diffusion and advection. Welet lF = hF = lP = hp = 1, and we set t = 0.5, t = 1, t = 1.5, and t∗ = 2.0.This will allow ample time for diffusion and advection to occur. We set DF

A =Dd = .01 because we want a large enough diffusion coefficient so that thefinite difference method is stable where the solution has a steep slope, but notso much diffusion that discontinuities are smeared. We can see from solution4 that a large diffusion coefficient quickly smoothes out sharp changes inthe solution, possibly more quickly than is realistic. However, we do wanta significant amount of diffusion because obviously the solution will changequickly when mass is being transferred between the two compartments. Weset all spatial step sizes equal to 0.02 and let ∆t = 0.05. For simplicity, weset

~VF = −~VP =

< −1,−1 > 0 < t ≤ t

< 1, 1 > t < t ≤ t

0 t < t ≤ t∗(72)

which only differs from equation (71) by a scaling factor. Our initialconcentration in the fish tank is still 1, and our initial concentration in theplant bed is still 0, except we transfer half of the concentration in the fishtank in a small rectangular region to the plant bed, as you can see fromfigures 13.a and 13.b below. This region consists of nine gridpoints in eachcompartment, and it is a small distance away from the boundary. Specifically,the region is three gridpoints away from each axis in each compartment. Thisprevents a numerical creation of mass that occurs with zero-flux BCs. Ifa source of ammonia is placed at gridpoints adjacent to boundary points,then even if the flow field carries the material away from the walls of thecompartment, boundary points will take on values at the location of thesource. Physically, this does not make sense, and it leads to mass beingaugmented at the boundary.

48

Page 52: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

We can see from figures 13.c and 13.d that material spreads out slightlyaround the source, but is mostly carried by the flow field. Material is carriedaccross the boundary by the field in the fish tank, and ammonia is carrieddiagonally across the plant bed by the flow field there. During overflow, wesee a small amount of material is removed from the plant bed and transferredto the fish tank in a rectangular region that simulates the overflow pipe.During draining, most of the material near the pump in the plant bed istranferred back to the fish tank. By the end of the cycle, diffusion smoothesout the concentration gradient in the fish tank so that our solution does nothave the steep slopes that we see in figures 13.a - 13.h.

Using the trapz command for solution 6, we estimate the initial mass inthe system to be 1 mg (obviously), and the final mass is roughly 0.9514 mg.Hence by simulating the exchange of material between the compartments as asource term rather than a boundary condition, we have stopped introducingadditional mass into our system. The loss of mass (less than 5%) can beattributed to the fact that our flow fields have nonzero normal componentsat the boundary.

Figure 13: Solution 6

(a) (b)

Figure 13:

49

Page 53: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(c) (d)

(e) (f)

50

Page 54: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(g) (h)

(i)

We can see from the graphs of solution 6 that the solution always has adiscontinuity where material is transferred between the compartments. Thisis to be expected since we are manually removing material from a small regionin each compartment, and adding it to the solution in the other compartment.There are some potential issues with this type of model. We may be overes-timating how rapidly we expect the concentration to change near a pipe ina real aquaponics system. We certainly expect to have steep concentrationgradients near regions of inflow and outflow, but maybe not discontinuities.Furthermore, we assumed that half of the material is removed from one com-partment and transfered to the other, or vice versa, at the location of a pipe.

51

Page 55: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

As we said before, this is not entirely realistic, but it is necessary because wedo not know the actual flux through the pipe.

A better model would allow material to advect through pipes connectingthe compartments. This suggests a computational grid that combines theregions occupied by the fish tank and plant bed into one connected region inthe x-y plane. To do this, we place the two regions side by side, as shownin figure 14 (the number of grid points is not necessarily to scale). The twocompartments are no longer in separate coordinate systems, thus ∆x and ∆yare the spatial step sizes for both the fish tank and plant bed. We assume thatthere is a partition of width ∆x that separates the two compartments, whichis depicted by the thick black lines in figure 14. The plant bed occupiesthe region Sp = (x, y) | 0 ≤ x ≤ lp and 0 ≤ y ≤ h, and the fish tankoccupies the region SF = (x, y) | lp + ∆x ≤ x ≤ l and 0 ≤ y ≤ h, wherel = lp + lF , and h = hp = hF . As we have said before, it is not generallytrue that hp = hF . Thus, we will make a change of variables later so thatthe compartments can have different heights. The grid points directly aboveand below the partition represent openings through which water can flowbetween the compartments. The opening below the partition will act as thepump pipe, and the opening above the partition will act as the overflow pipe.These openings will behave like one-way valves for water to flow between thecompartments (this one-way flow will be imposed by a carefully chosen flowfield). Combining the fish tank and plant bed into one grid will allow us tostop treating the exchange of water between the compartments as a boundarycondition or source term.

Figure 14: A Combined Grid for the Fish Tank and Plant Bed

52

Page 56: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Before we implement the combined grid, we make some simplifying as-sumptions. We let lF = lp = h = 1; the reader will see that this greatlysimplifies the process of choosing an appropriate flow field. We also assumethat the water levels do not change over time, so that the depth of the wa-ter in each compartment is always h. Consequently, the aquaponics systemwill always be in a state of overflow. This is somewhat different from theassumptions we had for solutions 1 - 6. Until now, we have been assumingthat the water level remains constant throughout the cycle, even though wewere flooding and draining the plant bed. As the reader will recall, we as-sumed that during the period of flooding, material was filtered out of the fishtank and transferred to the plant bed at the location of the pump. For thecombined grid model, we will assume intead that the pump runs constantly.There are pros and cons to having an aquaponics system in constant overflowconditions. The cons are that the system uses more electricity, and there isdecreased aeration because we are no longer draining the plant bed. On theother hand, the gardener does not need to spend money on a pump timer forcontinuous flow, and there is evidence that it is a more effective. LennardW.A. and Leonard B.V. found that lettuce grew better in a continuous flowaquaponics system (Petrea et al. 235). This is likely due to increased nitrifi-cation because the bacteria population is constantly exposed to water fromthe fish tank.

We also set ∆x = ∆y = 0.02, and ∆t = 0.05. Furthermore, we letDFA = Dd = 0.01. We want a reasonably large diffusion coefficient because

we do not know how the implicit method will respond to a partition in themiddle of the computational grid. The partition will undoubtedly disruptthe flow pattern. We also set the initial condition to be 1 mg/m3 in the fishtank, and 0 mg/m3 in the plant bed. This IC will allow us to see whether thematerial that we place in the fish tank advects into the plant bed as expected.Moreover, we set ω, the porosity, equal to 1 in the plant bed. We do thisbecause it will be a lot easier to analyze the behavior of the solution, withoutworrying about the effects of the porous medium in the plant bed. As thereader can see from equation (26), a porous medium increases advection andnitrification because 0 < ω < 1.

We will let each valve consist of 8 grid points. The pump valve will occupythe region Spump = (x, y) | lp ≤ x ≤ lp + ∆x and ∆y ≤ y ≤ 4∆y, and theoverflow valve occupies the region Sover = (x, y) | lp ≤ x ≤ lp + ∆x andh− 4∆y ≤ y ≤ h−∆y. Clearly, Spump and Sover do not include boundarypoints, therefore the solution satisfies equation (70) at the location of the

53

Page 57: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

valves. The boundaries at x = 0, l and y = 0, h will obey zero-flux boundaryconditions, as usual. The partition will also be treated as a boundary wherezero-flux BCs are imposed. The appropriate BCs at the partition are givenby equations (73) and (74) below, where 5∆y ≤ j ≤ h−5∆y, and I = lp/∆x.

Am+1I,j − A

m+1I−1,j

∆x= 0 =⇒ Am+1

I,j = Am+1I−1,j (73)

Am+1I+2,j − A

m+1I+1,j

∆x= 0 =⇒ Am+1

I+2,j = Am+1I+1,j (74)

Notice that Am+1I,j only depend on Am+1

I+1,j at the location of the valves,which ensures that water is only being exchanged between the compartmentsby means of the valves.

Furthermore, we must choose an appropriate flow field for combined grid,constant overflow conditions. Notice that we only need to use one flow fieldin our DAR equations because the regions occupied by the fish tank andplant bed have merged. In other words, ~Vp = ~VF = ~V . We know that atthe location of the pump valve, we want water to flow from the fish tank tothe plant bed. At the overflow valve, we want water to flow from the plantbed to the fish tank. This suggests a rotational flow field. We also want thefield to be divergence-free, so that mass loss only occurs as a result of theflow field having nonzero normal components at the boundaries. With theseconsiderations in mind, we choose the flow field given by equation (75) anddepicted by figure 15 below.

~V =< 2(y − 1/2), 1− x > (75)

54

Page 58: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 15: The Flow Field, ~V

This flow field is appropriate because it causes fluid to flow clockwiseabout the point (1, 1/2), when viewed from above the x-y plane. Obviously,~∇· ~V = 0, and the flow rate increases as the distance from (1, 1/2) increases.This makes sense physically because we would expect the flow rate to begreatest near the perimeter of the grid, where the valves are located. At thepoints (1, 0) and (1, 1), V = 1. Hence to get a flow rate that is not near 1 at

the location of the valves, we would simply multiply ~V by a constant.Under these conditions, we obtain the solution given by figure 16 below.

We will refer to this solution as solution 7.

55

Page 59: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 16: Solution 7

(a) (b)

Figure 16:

(c) (d)

56

Page 60: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g) (h)

We can see from figures 16.a and 16.b that water containing ammoniahas been pumped from the fish tank to the plant bed via the pump valve.Likewise, pure water has poured into the fish tank from the plant bed throughthe overflow valve. Figures 16.c and 16.d show that the ammonia is diffusingand convecting through the plant bed. The ammonia tends to follow a curvedpath near the perimeter of the plant bed as it makes its way to the overflowvalve. This makes sense because the flow field induces rotational flow aboutthe center of the combined grid. Similarly, the pure water entering the fishtank flows allong a nearly elliptical path toward the pump valve. From figures

57

Page 61: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

16.e and 16.f, we see that ammonia has almost reached the overflow valve inthe plant bed after 1.5 hours. After 2 hours, we can see from figures 16.g and16.h that concentrations of about 0.141 mg/m3 have reached the overflowvalve. Furthermore, water diluted to about 0.793 mg/m3 has made its wayto the pump valve in the fish tank. We notice that concentrations near themiddle of the partition, the point (1, 1/2), in each compartment are slow tochange. After 2 hours, the concentration in the fish tank near the middle ofthe partition is about 0.868. The concentration in the plant bed near themiddle of the partition is about 0.079. This occurs because the strength ofthe flow field decreases as we approach the center of the partition. In fact,~V (x = 1, y = 1/2) = 0. Physically, this behavior is expected because thevalves are located near the perimeter of the combined grid. The initial massin the system is 0.98 mg, and the final mass is about 0.89 mg. Thus, about9% of the mass in our system was carried across the boundaries in a 2-hourperiod.

At this point, we have a flow pattern that we are reasonably satisfiedwith, so we start to make the model more complex. We add in fish excre-tion and nitrification terms. We assume that the fish are excreting 1 mgammonia/m3/h. To implement this, we set F = 1 in equation (23). Wealso assume that the rate constant for the chemical reaction that convertsammonia to nitrite is k1 = 0.1h−1 (see equation (26)). The solution after2 hours is shown below in figure 17; we will call this solution 8. We onlyshow the solution after 2 hours because the overall behavior of the solutionis very similar to that of solution 7. From figure 17, we can see that themaximum concentration after 2 hours in the fish tank is about 2.86. This ismuch larger than the maximum value after 2 hours for solution 7, which isabout 0.898. This occurs because the fish are constantly excreting ammonia.We expect that after two hours, the concentration in the fish tank will beclose to 3 mg/m3, which is the initial concentration plus the amount of am-monia excreted by the fish in 2 hours. The maximum concentration is lessthan 3 because some of the ammonia has flowed into to the plant bed. Wealso notice that more ammonia flows into the plant bed for solution 8, butrelatively less amonia reaches the overflow valve than for solution 7. After 2hours, the ratio of the concentration at the point (1, 1) to the concentrationat the point (1, 0) for solution 8 is 0.174/2.72 ≈ 0.064. For solution 7, theratio is 0.141/0.805 ≈ 0.175. Therefore, about 11% less ammonia reaches theoverflow valve from the pump valve for solution 8. This makes sense becausewe are losing mass due to nitrification.

58

Page 62: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 17: Solution 8

(a) (b)

Figure 17:

Next, we try setting the initial concentration to zero in the fish tank.The reader will recall that ammonia is a toxic substance to fish, hence thegoal is to maintain the concentration near zero over time. We would notwant to put fish into an aquaponics system that already has a high ammoniaconcentration. Thus, with all other conditions the same as for solution 8,figure 18 shows the solution for a system that initially contains no ammonia.We will refer to this as solution 9, and we are pleased to see that the generalbehavior of the solution is the same as for solutions 7 and 8. The onlydifference is that the concentrations are all lower.

59

Page 63: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 18: Solution 9

(a) (b)

Figure 18:

(c) (d)

60

Page 64: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g) (h)

Another thing we must do is scale the lengths and heights of the com-partments so that they are not necessarily 1. We assume the plant bed haslength lp and height hp, and the fish tank has length lF and height hF . Sup-pose we place the two compartments side by side in the x-y plane so thatthe plant bed occupies the region 0 ≤ x ≤ lp, 0 ≤ y ≤ hp, and the fish tankoccupies the region lp < x ≤ l, 0 ≤ y ≤ hF , where l = lp + lF . Then thetransformation given by equations (76) and (77) below maps the plant bedto the region 0 ≤ ξ ≤ 1, 0 ≤ η ≤ 1, and the fish tank to 1 < ξ ≤ 2, 0 ≤ η ≤ 1.Therefore, our transformed computational grid is the same as the grid forsolutions 7 - 9.

61

Page 65: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

ξ =

x/lp 0 ≤ x ≤ lp

(x− lp)/lF + 1 lp < x ≤ l(76)

η =

y/hp 0 ≤ x ≤ lp

y/hF lp < x ≤ l(77)

Upon applying the transformation to the spatial derivatives in equation(59), we find that

∂A

∂t=

DFA

l2F

∂2A

∂ξ2+DFA

h2F

∂2A

∂η2− φ

lF

∂A

∂ξ− ψ

hF

∂A

∂η− A

(∂φ

∂ξ+∂ψ

∂η

)(78)

+F (t)

Notice that we do not apply the scaling transformation to the flow fieldbecause we want to use one continuous flow field for our combined grid. Thus,we just replace x with the variable ξ and y with η in equation (75) to obtainthe flow field that we will use in our scaled problem. From equation (78), wesee that to obtain an implicit finite difference method for the transformedproblem in the fish tank, we simply let ∆x → lF∆ξ and ∆y → hF∆η, forlp < x ≤ l. Similarly, to obtain a tranformed implicit method for ammonia inthe plant bed, we let ∆x→ lp∆ξ and ∆y → hp∆η, for 0 ≤ x ≤ lp. For now,we set the dimensions of the fish tank and plant bed to be the empiricallydetermined dimensions given on page 24.

We also include the porosity in our model. We let ω = 0.24, an appropri-ate porosity for gravel, as discussed on page 25. We still want the constantof proportionality for the ammonia nitrification rate to be 0.1, thus we setk1 = 0.1ω to compensate for the porous medium. With all other conditionsthe same as for solution 9, we calculate the solutions to the scaled prob-lem. The solutions are shown in figure 19 below, and we will refer to this assolution 10.

62

Page 66: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 19: Solution 10

(a) (b)

Figure 19:

(c) (d)

63

Page 67: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g) (h)

Unfortunately, we notice in figure 19.a that there are some small oscil-lations near the overflow valve in the plant bed. However, we can see fromfigure 19.g that the oscillations do not grow over time. Furthermore, whenwe compare figure 19.c to figure 18.c, we can see that diffusion and advectionare more effective in the plant bed for solution 10 than solution 9. Signifi-cantly more material is traveling from the pump valve to other regions of theplant bed in solution 10. Numerically, we expect this because we multipliedthe flow field by ω−1, which increases the strength of the field, and thereforeincreases advection. Also, we can think of the transformed dispersion coeffi-cient as the vector ~D =< Dd/l

2p, Dd/h

2p >. The magnitude of this vector is

given by

64

Page 68: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

√(Dd

l2p

)2

+

(Dd

h2p

)2

=

√(0.01

2.7782

)2

+

(0.01

0.32

)2

≈ 0.111 (79)

Hence, we can conclude that there is more dispersion in the scaled PDE.Equation (79) also explains why more ammonia is carried in the +y-directionthan the −x-direction in figure 19.c. The y-component of the dispersionvector is about two orders of magnitude larger than the x-component. In-tuitively, increased dispersion and advection in the plant bed makes sensebecause the porous medium creates multiple tortuous paths through whichfluid can flow. Likewise, when we compare figure 19.d to figure 18.d, wecan see that, to a lesser degree, diffusion and convection are increased in they-direction and decreased in the x-direction for solution 10. The magnitudeof the diffusion vector in the fish tank is only about 4 times larger than thediffusion coefficient for the fish tank in solution 9.

We suspect that the oscillations are due to the overflow valve being aninterface between two very different regions. We have a porous medium inthe plant bed, whereas in the fish tank we do not. Also, relative to the fishtank, the plant bed is longer and more shallow. However, we are not entirelysure why we do not see oscillations near the pump valve, which is anotherinterface. One possible reason is that η(y) is a discontinuous function atx = lp (notice that ξ(x) is continuous everywhere). This discontinuity hasless of an effect near the pump valve (near y = 0) where η is small. However,near the overflow valve η is maximized, hence the discontinuity has more ofan effect on the solution there. It is necessary that the fish tank and plant beddiffer in size and composition, thus we try to make the solution more stableby implementing a finer spatial and temporal grid. We let ∆x = ∆y = 0.015and ∆t = 0.025. The maximum negative value achieved for solution 10 is−0.0216, and it occurs at the 6th time step. When we reduce the coarsenessof the grid, we find that the maximum negative value is -.0202, and it occursat the 13th time step. It seems that using a finer grid only slightly improvesstability. Therefore, in the interest of minimizing computational time, wewill cease our efforts to get rid of the oscillations, and simply set negativevalues to zero in our solution. As long as the amplitude of the oscillationsremains small, we assume that our error will be small (later we find that thisis not necessarily the case, and that by setting negative values to zero, weincrease the mass in our system).

We are now ready to model the concentration of nitrite over time, as well

65

Page 69: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

as ammonia. As before, we start with some simplifying assumptions. Weassume that the plant bed does not contain porous medium (ω = 1), the fishare not excreting ammonia (F = 0), and lF = lp = hF = hp = 1. Initially,there is no nitrite in the system and no ammonia in the plant bed. The fishtank contains a 1 mg/m3 solution of ammonia at time t = 0. Nitrite, ofcourse, will be modeled using equations (24) and (27), except we set k2 = 0.The rate constant k2 determines what proportion of the nitrite in the plantbed is converted to nitrate. Until we decide to model the concentration ofnitrate, we will assume that no nitrite is removed from the system. We setk1 = 0.1ω, and all other conditions are the same as for solution 7. Uponapplying the implicit method to our system of four PDEs, we obtain thesolution for nitrite given by figure 20. We will refer to this as solution 11.Ammonia does not depend on nitrite, thus the solution for ammonia is thesame as for solution 7.

Figure 20: Solution 11

(a) (b)

Figure 20:

66

Page 70: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(c) (d)

(e) (f)

67

Page 71: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(g) (h)

Since we assumed the lengths and heights of each compartment are equalto 1, we do not see any oscillations in the solution. We also notice that inthe plant bed, nitrite does appear to be created at a rate proportional to theconcentration of ammonia. In regions where the ammonia concentration ishigh, we also find a large amount of nitrite, relative to other regions of theplant bed. At the same time, nitrite-free water pours in from the fish tank,hence B is always close to zero near the pump valve in the plant bed. In thefish tank, we see a small spike near the pump valve. The spike is on the orderof 10−4, which is small compared to the concentrations on the order of 10−2

that we see in the plant bed. This occurs because the nitrite concentrationincreases over time in the plant bed. The solution is trying to transitionbetween a concentration of zero in the fish tank, and an increasingly largerconcentration in the plant bed. Over time, we also see that nonzero nitriteconcentrations slowly start to flow into the fish tank from the plant bed, viathe overflow valve. The initial mass of ammonia in the system is 0.98 mg,just as it was for solution 7. The mass of ammonia after 2 hours is about0.82 mg. The initial mass of nitrite is, of course zero, and the final massof nitrite is roughly 0.07 mg. As expected, the sum of the final masses ofammonia and nitrite is 0.89 mg, which is equal to the final mass of ammoniafor solution 7. We can conclude that mass is not lost due to nitrification; itis converted from ammonia to nitrite.

Next, we make the model a bit more realistic by setting ω = 0.24 andF = 1. We also assume that the initial concentrations of ammonia and nitriteare zero everywhere, and that the dimensions of the fish tank and plant bed

68

Page 72: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

are equal to those given on page 24. All other conditions are the same asfor solution 10. Upon making these changes, we obtain the solution given byfigure 21. We will refer to this as solution 12. The solution for ammonia isthe same as for solution 10, except we set any negative values equal to zero.

Figure 21: Solution 12

(a) (b)

Figure 21:

(c) (d)

69

Page 73: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

(g) (h)

We see the same overall behavior for solution 12 that we saw for solution11. When we do not set negative values to zero, the maximum amplitudeof the negative oscillations is -0.0167, and it occurs at the sixth time step.Graphs of the negative oscillations are shown in figure 22. We notice that thelargest negative values occur for ammonia in the plant bed. Furthermore,there are no negative values for ammonia in the fish tank or nitrite in theplant bed at the sixth time step. The main issue with solution 12 is thatthe final mass of ammonia is about 2.53 mg, while the final mass of nitriteis about 0.073 mg. Before we can begin to model the behavior of nitrate, wemust balance the ammonia production rates and nitrification rates so thatmost of the ammonia is converted to nitrate over an extended period of time.Otherwise, the ammonia will accumulate to toxic levels.

70

Page 74: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 22: Numerical Oscillations for Solution 12

(a) (b)

Figure 22:

To simulate measuring the ammonia and nitrite levels in the system, wefind the average concentrations of ammonia and nitrite. When ammonia ornitrite levels are measured in a real aquaponics system, the water is testedat an arbitrary location in the fish tank. Since water is constantly beingexchanged between the two compartments, it makes sense to use an averageover both compartments as an indication of how much ammonia or nitrite isin the system. To find the average value of ammonia or nitrite at a particulartime, we numerically integrate the solution over the entire grid, and thendivide by the area of that region. Clearly, the area of our scaled region is 2.So far, we have been using the trapezoidal rule (MATLAB’s trapz command)for numerical integration, which is second-order accurate in both x and y. Wewould now like to use a more accurate integration technique to calculate theaverage concentration. Without proof, we implement Simpson’s rule, whichis fourth-order accurate in both x and y (Mathews). Consider the functionf(x, y) on a rectangular region R = (x, y) | a ≤ x ≤ b, c ≤ y ≤ d. Supposewe divide the interval [a, b] into 2m subintervals of equal width, and theinterval [c, d] into 2n subintervals of equal width. Then ∆x = (b− a)/(2m),and ∆y = (d − c)/(2n). Let xi = a + i∆x for i = 0, 1, 2, . . . , 2m; andyj = c+ j∆y for j = 0, 1, 2, . . . , 2n. If Λ is our Simpson’s rule approximationto the integral ∫ b

a

∫ d

c

f(x, y) dy dx,

71

Page 75: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

then

Λ =∆x∆y

9

f(a, c) + f(a, d) + f(b, c) + f(b, d) (80)

+4n∑j=1

f(a, y2j−1) + 2n−1∑j=1

f(a, y2j) + 4n∑j=1

f(b, y2j−1)

+2n−1∑j=1

f(b, y2j) + 4m∑i=1

f(x2i−1, c) + 2m−1∑i=1

f(x2i, c)

+4m∑i=1

f(x2i−1, d) + 2m−1∑i=1

f(x2i, d) + 16n∑j=1

m∑i=1

f(x2i−1, y2j−1)

+8n−1∑j=1

m∑i=1

f(x2i−1, y2j) + 8n∑j=1

m−1∑i=1

f(x2i, y2j−1) + 4n−1∑j=1

m−1∑i=1

f(x2i, y2j)

To achieve a balance between ammonia production and nitrification, wefirst choose a more realistic fish excretion function. It has been shown ex-perimentally that the ammonia excretion rate of fish tends to peak a fewhours after feeding, so that the exretion rate can be fit reasonably well to abell curve (see page 21 for details). Thus we assume that the general formof F (t) is given by equation (41). We will assume that the fish are fed onceper day, so that the exretion rate peaks once every 24 hours. This impliesthat F is a periodic bell curve, i.e. F (t + 24) = F (t). For simplicity, we letβ1 = 3, β2 = 12, and β3 = 3. These parameter values assume that excretionoccurs at a maximum rate of 3 mg/m3/h, 12 hours into each day. Most ofthe ammonia is excreted between 9 and 15 hours into each day. We also setk1 = ω = 0.24. With all other conditions the same as for solution 12, weobtain the solution shown in figure 23. We will refer to this as solution 13.Figure 24 shows the average ammonia and nitrite concentrations calculatedonce every hour over a one week period.

72

Page 76: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 23: Solution 13

(a) (b)

Figure 23:

(c) (d)

73

Page 77: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 24: Average Concentrations for Solution 13

(a) (b)

Figure 24:

(c)

From figure 23, we see that the concentration of ammonia is on the sameorder of magnitude in each compartment. The same is true for nitrite in eachcompartment. This indicates that we have sufficient diffusion and convectionto mix the material in our system. From figure 24.a and 24.b, we see that theaverage ammonia concentration is roughly periodic. Each day, the ammoniaconcentration looks nearly identical to the concentrations from the previousday. Periodic behavior makes sense because the source term for ammonia

74

Page 78: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(F (t)) is periodic. Furthermore, there are periods of time when F is smalleach day so that the nitrification term −k1ω

−1A is able to eliminate nearlyall of the ammonia in the system. These repetitive ammonia concentrationssuggest that we have adequate nitrification so that ammonia does not buildup over time. From figure 24.a, we see that when ammonia concentrationsdecline, nitrite concentrations increase at nearly the same rate. This is ex-pected because ammonia is being converted to nitrite. We also notice fromfigure 24.b that there is a small time lag between peaks in ammonia excre-tion and peaks in ammonia concentration. This makes sense because it takestime for the ammonia excreted in the fish tank to travel to the plant bed,where the nitrifying bacteria can begin to convert ammonia to nitrite. Ni-trite, of course, increases over time. This makes sense because we have yetto implement the conversion of nitrite to nitrate. If we do not set negativevalues to zero, the maximum negative concentration of ammonia or nitrite is−6.54× 10−7, and it occurs at the 80th time step.

If we increase the excretion rate, we find that all of the concentrationsincrease. Figure 25 shows the average concentrations for β1 = 15, β2 = 12,and β3 = 8 (all other conditions are the same as for solution 13). We willrefer to this as solution 14. We did not show graphs of the concentrationsafter a week because the solution has a shape very similar to solution 13.This is to be expected since we are running the simulations for a long time,which gives diffusion and convection plenty of time to mix the material in thesystem. After all, in a real aquaponics system, you would not expect to getvery different concentrations by measuring ammonia or nitrite in differentregions of the fish tank.

75

Page 79: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 25: Average Concentrations for solution 14

(a) (b)

Figure 25:

(c)

From figure 25.b, we see that the maximum concentrations of ammoniaare about 7 times larger than that of solution 13. This is clearly due toincreased fish excretion. Since the same proportion of ammonia is convertedto nitrite for both solutions 13 and 14, it makes sense that a larger concen-tration of ammonia will remain in the system for solution 14. We also noticethat by increasing the full-width at half-max for the fish excretion curve,we have also increased the width of the average ammonia curve. In other

76

Page 80: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

words, If the fish are excreting larger amounts of ammonia over longer peri-ods of time, then the ammonia concentration will not decrease as quickly inresponse to nitrification. The higher ammonia concentrations overwhelm thebacteria population. This is also why the nitrite concentration fluctuates lessfor solution 14 than solution 13 (put simply, we see less ”wiggle” in the aver-age nitrite concentrations). The ammonia concentration does not change asquickly for solution 14, therefore the nitrite concentration does not either. Ifwe do not set negative values to zero, then the largest negative concentrationthat we get is -0.0387, and it occurs at the 7th time step.

If instead, we decrease nitrification without increasing excretion, we alsoget increased ammonia levels. Figure 26 shows the average concentrationsfor k1 = 0.1ω, and all other conditions the same as for solution 13. We willrefer to this as solution 15.

Figure 26: Average Concentrations for Solution 15

(a) (b)

Figure 26:

77

Page 81: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(c)

From figure 26.a and 26.b, we can see that when we decrease nitrifica-tion, the system appears to be overwhelmed during the first part of the week.Ammonia levels climb rapidly over the first few days. We still see ammo-nia concentrations decrease while the excretion rate is small each day, butboth the minimum and maximum average concentrations grow larger eachday. For the first two days, ammonia concentrations are significantly largerthan nitrite concentrations. During the last half of the week, we see thatammonia starts to behave periodically, as it did for solutions 13 and 14. Wecan conclude that, based on our assumptions, nitrification is a very pow-erful stabilizer for the model. Despite the fact that we have decreased thenitrification rate by 90%, ammonia still behaves periodically, rather than in-creasing toward infinity. We also notice that even with a much smaller valuefor k1, the nitrite levels increase at a rate similar to that of solution 13. Theaverage nitrite concentration at the end of 1 week is only about 18% smallerfor solution 15 than solution 13. Mathematically, it makes sense that evenif k1 is small, a large amount of nitrite will be produced. A smaller valueof k1 increases the ammonia concentrations, which in turn increases the rateat which ammonia is converted to nitrite. One final thing to note about theaverage nitrite concentration for solution 15 is that it appears to have evenless ”wiggle” than solution 14. This is likely due to decreased nitrification,as well. Since k1 is smaller, changes in the ammonia concentration have lessof an effect on the nitrite concentration. If we do not set negative values tozero, then the largest negative concentration that we get is −3.55 × 10−8,and it occurs at the 72nd time step.

78

Page 82: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

If we decrease nitrification and increase excretion, we obtain the averageconcentrations given by figure 27. We will refer to this as solution 16. Forthis solution, we set k1 = 0.1ω, β1 = 15, β2 = 12, β3 = 8, and all otherconditions the same as for solution 13.

Figure 27: Average Concentrations for Solution 16

(a) (b)

Figure 27:

(c)

The main thing we notice about solution 16 is that the ammonia con-centrations are much higher than the excretion rate. The ammonia con-centrations are also much larger than those found in solutions 14 and 15. It

79

Page 83: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

appears that when we couple decreased nitrification with increased excretion,the average ammonia concentrations still become periodic over time, but theconcentrations oscillate about a much larger equilibrium. Nitrification is stilla powerful stabilizing force that keeps the ammonia concentrations from in-creasing to infinity. If we do not set negative values to zero, then the largestnegative concentration that we get is -0.0373, and it occurs at the 6th timestep.

Finally, we are ready to include nitrate in our model. The concentrationsof nitrate in each compartment will be modeled using equations (25) and(28). As usual, we start with some simplifying assumptions. We assumethat the initial concentrations of nitrite and nitrate are zero everywhere. Forammonia, the initial concentration is set to zero in the plant bed, and 1mg/m3 in the fish tank. We assume, for now, that F (t) = P (C) = 0, andk1 = k2 = ω = 0.24. We set the dimensions of each compartment to be thosegiven on page 24. With all other conditions the same as for solution 16, weobtain solution 17, which is given by figure 28.

Figure 28: Solution 17

(a) (b)

Figure 28:

80

Page 84: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(c) (d)

(e) (f)

We can see that for solution 17, ammonia is pumped into the plant bed,and water containing a relatively small amount of ammonia overflows backinto the fish tank. In regions of the plant bed where the ammonia concentra-tion is high, relatively large amounts of nitrite are created. At the same time,nitrite-free water is pumped from the fish tank to the plant bed, and nitriteoverflows from the plant bed back into the fish tank. Likewise, a relativelylarge amount of nitrate is created in regions where the nitrite concentrationis high in the plant bed. It appears that the solution behaves as expected.

However, if we use Simpson’s rule to find the initial and final mass in thesystem, we discover that we are gaining mass. Clearly, the initial mass in

81

Page 85: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

the system is 1 mg of ammonia. The final mass is 1.176 mg of ammonia,0.211 mg of nitrite, and 0.081 mg of nitrate. We have increased the massin our system by about 47%. Our initial guess is that perhaps solving fornitrate has made the solutions unstable. If we only solve for ammonia andnitrite under the same conditions (in other words, we set k2 = 0, and we donot solve equations (25) and (28)), we find that the final mass in our systemis 1.176 mg of ammonia and 0.292 mg of nitrite. Hence, the only differenceis that no nitrite was converted to nitrate, as expected. It turns out, if weset lF = hF = lp = hp = ω = 1 for solution 17, and solve for all threesubstances, we no longer add mass to the system. Our final mass is 0.831 mgof ammonia, 0.066 mg of nitrite, and 0.035 mg of nitrate. As I said before, themass loss can be attributed to a nonconservative flow field. We can concludethat our earlier assumptions were wrong; even small oscillations can have alarge impact on the accuracy of the solution. In the interest of numericalaccuracy, we will set the porosity and the dimensions of each compartmentto 1. Moreover, we will no longer set negative values to zero in our solutions.With k1 = k2 = 1, and all other conditions the same as for solution 17, weobtain the solution shown in figure 29. We will refer to this as solution 18.

Figure 29: Solution 18

(a) (b)

Figure 29:

82

Page 86: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(c) (d)

(e) (f)

Solution 18 behaves very much like solution 17. The main difference isthat far less nitrite and nitrate overflow into the fish tank. This is to beexpected, since diffusion and convection are not as large for solution 18. Byincluding porosity and scaled lengths in solution 17, we increased the flowrate and diffusion coefficients. As a result, more material traveled from thepump to the overflow pipe in the plant bed.

To make the model more realistic, we again include the fish excretionfunction. We assume that the fish excretion rate is given by equation (41)with β1 = 5, β2 = 12, β3 = 8. We also assume that all initial concentrationsare zero everywhere. With all other conditions the same as for solution 18,we obtain the solution shown in figure 30. We will refer to this as solution19.

83

Page 87: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 30: Solution 19

(a) (b)

Figure 30:

(c) (d)

84

Page 88: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

The main thing we notice about solution 19 is that water near the mid-dle of the partition in each compartment appears to be relatively stagnant.Mathematically, this makes sense because the magnitude of the flow field iszero at the point (1, 1/2). The concentrations are larger near the partitionin the fish tank because the fish excrete ammonia, and it tend to accumu-late there. However, the concentrations are smaller near the partition in theplant bed because ammonia is not produced in the plant bed. Ammonia onlyends up in the plant bed when it flows in from the fish tank. Nitrite tendsto accumulate near the partition in the fish tank because it is eliminated inthe plant bed, and then the relatively dilute water from the plant bed flowsmostly around the perimeter of the fish tank. Since the concentrations areon the same order of magnitude in each compartment, we will assume thatthe flow rate is sufficient for nitrification. At the end of 1 day, the aver-age concentrations of ammmonia, nitrite, and nitrate in the system are 2.15,2.00, and 27.6 mg/m3, respectively. Hence, most of the ammonia and nitriteis converted to nitrate.

We now make the model more realistic by including plant uptake of ni-trate. We assume that the rate of plant uptake has the form of equation(40), where we let Pmax be the coefficient on C in the numerator, and κ bethe constant term in the denominator. At this point in the semester, we donot have time to add a nonlinear term to our system of PDEs. Therefore, wewill approximate P (C) using the solution at the previous time step. In otherwords, we will assume that P (Cm+1

k,l ) ≈ P (Cmk,l), ∀ k, l,m. This way, the non-

linear term becomes a constant source (or more accurately, drain) term with

85

Page 89: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

respect to the dependent variable C. For simplicity, we let Pmax = κ = 1.With all other conditions the same as for solution 19, we obtain solution 20,which is shown in figure 31.

Figure 31: Solution 20

(a) (b)

Figure 31:

(c) (d)

86

Page 90: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(e) (f)

We show solution 20 after only 4 hours so that the reader can see thesolution before significant mixing occurs. The only difference between solu-tions 19 and 20 is that we included the plant uptake term for solution 20,whereas nitrate builds up in the system for solution 19. Hence, the solutionsfor ammonia and nitrite shown in figures 31.a - 31.d are the same as for solu-tion 19 after 4 hours. On the other hand, the nitrate concentration is lowerfor solution 20 than for solution 19. For comparison, we show the nitrateconcentration for solution 19 after only 4 hours in figure 32.

Figure 32: Nitrate Concentrations for Solution 19 after 4 Hours

(a) (b)

Figure 32:

87

Page 91: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Next, we set k1 = k2 = 2 so that the system has ample nitrification. Wealso increase the maximum fish excretion rate so that β1 = 8, β2 = 12, andβ3 = 8. We set Pmax = 3 and κ = 10. By increasing Pmax, we have increasedthe maximum plant uptake rate. Increasing κ decreases plant uptake forsmaller concentrations because we now assume that the uptake rate is athalf of its maximum value when C = 10, rather than when C = 1, as forsolution 20. With all other conditions the same as for solution 20, we obtainsolution 21, shown in figures 33 and 34. Figure 33 shows the solution after4 hours, and figure 34 shows the average concentrations over the course of 2weeks.

Figure 33: Solution 21

(a) (b)

Figure 33:

88

Page 92: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

(c) (d)

(e) (f)

89

Page 93: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 34: Average Concentrations for Solution 21

(a) (b)

Figure 34:

From figure 33, we see that due to k1 being large, ammonia is depletedin most regions of the plant bed, except where a large amount pours innear the pump valve. Hence, a relatively large amount of nitrite is creatednear the pump valve in the plant bed, while at the same time, nitrite-freewater pours in from the fish tank. In the rest of the plant bed, nitrificationeliminates most of the nitrite because k2 = k1 is fairly large. Nitrificationalso raises the concentration of nitrate everywhere in the plant bed, exceptwhere nitrate-free water pours in from the fish tank.

From figure 34, we see that the ammonia levels tend to oscillate betweenabout 1.83 and 8.60. Average nitrite concentrations oscillate between 0.49and 1.97. We notice that nitrite levels are always less than ammonia levels,at any given time after the first day. This implies that ammonia is created ata faster rate than it its converted to nitrite. Furthermore, we placed verticallines at the locations of maximum concentrations for day three in figure 34.a.The blue vertical line corresponds to the maximum ammonia concentration.Likewise, red and green correspond to nitrite and nitrate, respectively. Wenotice that ammonia levels peak shortly after midday (when the excretionfunction is maximum), nitrite concentrations peak shortly after ammoniapeaks, and the average nitrate concentration has local maximums shortlyafter nitrite levels peak each day. This is expected because nitrificationoccurs at a rate proportional to concentration, and there is a time delay

90

Page 94: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

because ammonia must be produced in the fish tank, and then flow to theplant bed where nitrification occurs. One final thing to note about solution 21is that nitrate levels increase over the course of a week, but tend to fluctuatewithin each 24 hour period. This indicates that nitrification produces morenitrate than the plants can uptake. In a real aquaponics sytem, this wouldbe an indication that we need to add more plants, but it is not a majorconcern because nitrate is fairly nontoxic to fish. Moreover, it seems thatnitrate levels increase at a slower rate over time. The difference between theminimum and maximum average nitrate concentrations is about 131 mg/m3

for the first week, but only about 101 mg/m3 for the second week. Thisoccurs because, as the nitrate concentration increases, the plants take upmore nitrate. However, the plants will never be able to reduce the nitrateconcentration by more than 3 mg/m3/h.

We now try reducing the fish excretion rate and increasing the plantuptake rate to see if we can get the nitrate levels to stabilize within a couple ofweeks. Thus, we set β1 = κ = 5. We also set the initial nitrate concentrationto 10 mg/m3 because, for fishless cycling (see page 17), fish are only addedto the aquaponics system when the nitrate levels are high enough. With allother conditions the same as for solution 21, we obtain solution 22, which isshown in figure 35.

Figure 35: Average Concentrations for Solution 22

(a) (b)

Figure 35:

91

Page 95: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

We can see that the average ammonia and nitrite concentrations behavesimilarly to those for solution 21, except the concentrations are smaller, dueto less fish excretion. Ammonia ranges from about 1.14 to 5.38, and nitriteranges from 0.31 to 1.23 each day. The nitrate levels are also lower. We cansee that the average nitrate concentration increases throughout the first week(from day to day; of course, the concentration rises and falls within each 24hour period). However, during the second week, we notice that nitrate levelsare starting to stabilize in the sense that they oscillate about a near constantequilibrium. Based on our assumptions, this solution suggests that enoughnitrate is being produced to consistently meet the plants’ needs. If ammoniaand nitrite levels as high as 5.38 and 1.23, respectively, are acceptable, thenthe system is in an ideal state. In a real aquaponics system, nitrate levelsbelow 150 ppm (150,000 mg/m3), and ammonia or nitrite levels below 0.5ppm (500 mg/m3) are acceptable (Bernstein 201). To compare with empiricalresults, we would have to scale all of our parameters to obtain much higherconcentrations.

Next, we try assuming that the fish excretion curve has two peaks. Al-though some people choose to feed their fish once per day, many feed their fishtwice per day, usually in the morning and evening. When fish are fed twiceper day, we expect the ammonia excretion function, F (t), to have two peaks(see page 97). To model a two-peak excretion curve, we choose a fourth-orderpolynomial. We use MATLAB’s polyfit command to fit a fourth-order poly-nomial g(t) through the points (0, 0), (6, 1), (12, 2/3), (18, 1), and (24, 0). Wethen find the maximum value, gmax, of g, and let F (t) = (5/gmax)g(t). Thisgives us an excretion curve that is zero for t = 0, 24; and has two global maxi-mums of 5 mg/m3/h. As with the excretion bell curve, we impose periodicityon the polynomial excretion function by requiring that F (t+ 24) = F (t),∀ t.A graph of this two-peak excretion curve is shown in Figure 36.a. A graphof the excretion bell curve used for solution 22 is also shown for comparison.

When we compare the average concentrations for solution 22 to solution23, which is shown in figure 36.b, we find that not much has changed. Themaximum average ammonia concentration is about 5.38, as it was for solu-tion 22. However, we can see that the average ammonia concentration and,to some extent, the average nitrite and nitrate concentrations take on a shapesimilar to that of the two-peak excretion curve. Furthermore, ammonia con-centrations remain higher throughout the day for solution 23. After the first3 hours, the minimum average ammonia concentration is roughly 2.45 forsolution 23, compared to 1.14 for solution 22. This makes sense because

92

Page 96: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

the fish are excreting larger amounts of ammonia for longer periods of timewhen the excretion curve peaks twice. This results in the maximum nitrateconcentration being about 2.9 times larger for solution 23 than solution 22.More ammonia is produced for solution 23, thus more ammonia is availableto be converted to nitrate.

For solutions 24 and 25 (shown in figures 37.a and 37.b, respectively), wedetermine what happens when the nitrification rates k1 and k2 become verysmall. For solution 24, we set k1 = k2 = 0.01, with all other conditions thesame as for solution 23. As a result, ammonia concentrations skyrocket, andare still increasing at the end of the week. Nitrite increases as well, but notnearly as much as ammonia. Since k1 is very small, ammonia is producedat a much faster rate than it can be eliminated. We still see a significantincrease in the nitrite levels because ammonia is converted to nitrite at arate proportional to the ammonia concentration. Nitrate levels, on the otherhand, are very low. Clearly, the plants are able to take up nitrate at a fasterrate than it can be produced.

For solution 25, we let k1 = k2 = 0.1, with all other conditions the sameas for solution 23. We see that even though ammonia concentrations growmuch larger than they did for solution 23, they tend to level off over thecourse of a week, so that they oscillate between 34.2 and 37.6 mg/m3. Wesee much more ”wiggle” in the average ammonia curve for solution 25. Thisis due to a larger nitrification rate. When the excretion rate is relatively low,nitrification is more effective at decreasing the ammonia concentration ac-cordingly. We see that nitrite behaves similarly to ammonia, but the averagenitrate concentration behaves very differently. During the first day, whenthere is very little ammonia and nitrite in the system, the plants take upnearly all of the nitrate that is initially in the system. As the ammonia andnitrite levels increase and then level off throughout the rest of the week, wesee the nitrate levels increase. We increased the rate of nitrification, hencenitrate can be produced at a faster rate than it is eliminated by the plants.

93

Page 97: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Figure 36: Fish Excretion and Average Concentrations for Solution23

(a) (b)

Figure 36:

Figure 37: Average Concentrations for Solution 24 (a) and Solution25 (b)

(a) (b)

Figure 37:

6 Future Plans

There are many ways that we could improve this model. Most importantly,we need to determine a way for the fish tank and plant bed to have differ-ent dimensions, and for the plant bed to contain a porous medium, while

94

Page 98: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

still maintaining numerical stability. It may be that a combined grid is notthe best model, although it does allow for a continuous flow of material be-tween the compartments. Moreover, basic finite difference methods may notyield results that are accurate enough. It is well-known that for advection-dominated problems, the solutions tend to have steep slopes and disconti-nuities in localized regions, due to steep concentration gradients (Shu 83).We have seen that explicit finite difference methods are not stable enough togive accurate solutions for this model. More sophisticated techniques mayalso improve the numerical oscillations that resulted from scaled dimensionsand flow through a porous medium. In anticipation of these problems, welooked for ‘back-up’ numerical methods, and found the Weighted EssentiallyNonoscillatory (WENO) scheme and the Third-Order Total Variation Di-minishing Runge-Kutta (Third-Order TVDRK) method. These schemes aremore accurate, yet at the same time they result in a more challenging codingtask for the user and more computational time for the computer. Descrip-tions of these alternative methods are given in the appendix on pages 102 -105. While we did not have time to implement these methods, the literaturesuggests that they provide increased stability when solving DAR equations.

Furthermore, based on the assumptions of our model, we could solve forthe flow field in the fish tank and plant bed. To do this, we would haveto solve the nonlinear Navier-Stokes equations that govern fluid flow. Thebenefit of incorporating these complex equations in the model is that we couldset the normal component of the flow field to be zero at the boundaries. Thiswould allow us to conserve mass in our aquaponics system.

Finally, it is important to compare theoretical results to experimental re-sults. If our simulations suggest that the model aquaponics system performsoptimally for a particular set of parameters, then we should be able to repli-cate those results for a real aquaponics system. For comparison, it would benecessary to create a basic flood-and-drain media-based aquaponics system,and measure parameters such as nitrification rate constants, plant uptakerates, and fish excretion rates.

95

Page 99: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

7 Appendix

7.1 The Nonlinear Regression for Fish Excretion Data

96

Page 100: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

7.2 Original Fish Excretion Data

Figure 38 below shows graphs of the original fish excretion data gathered byZakes et al. (Zakes et al. 133). The graphs show hourly oxygen consumption(OC) and ammonia excretion (AE). Notice that, as we said before, ammoniaexcretion has a local maximum at some time between each feeding. More-over, ammonia excretion appears to be nearly constant when the fish are fedcontinuously; this is expected because there is no time between feedings.

Figure 38: Fish excretion of ammonia when fed (a) once per day, (b) threetimes per day, and (c) continuously

97

Page 101: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

98

Page 102: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

7.3 The Parameter Table for Plant Uptake of Nitrogen

The table below shows the original data for plant uptake of ammonium andnitrate (Xiaochuang et al. 250).

κ± SE (µmol/L) rmax± SE (µmol/g DW/h)

NO−3 177± 41 18.2± 1.0

NH+4 2, 000± 818 45.2± 9.3

99

Page 103: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

7.4 An Example of Restrictions on Explicit NumericalMethods

Consider the one-dimensional diffusion-advection problem given by

∂u

∂t= D

∂2u

∂x2− v∂u

∂x, 0 ≤ x ≤ 1, t ≥ 0, (81)

u(x, 0) = u(0, t) = 0, u(1, t) = 1

At steady-state, ∂u/∂t = 0. Hence the problem reduces to

d2u

dx2−Rdu

dx= 0, u(0) = 0, u(1) = 1, R = v/D (82)

The characeristic polynomial for equation (82) is q2 −Rq = 0. Thereforethe general solution is u(x) = c1 + c2e

Rx, and the boundary conditions implythat c2 = −c1 = 1/(1− eR). We can conclude that

u(x) =1− eRx

1− eR(83)

However, we would like to find the steady-state solution via finite differ-ences. Using central finite differences with xi = i∆x, 0 = x0 ≤ x1 ≤ · · · ≤xI = 1, we find that

R

[ui+1 − ui−1

2∆x

]−[ui+1 − 2ui + ui−1

∆x2

]= 0

ui+1 =(p+ 1)ui−1 − 2ui

p− 1, where p = R∆x/2, u0 = 0, uI = 1 (84)

Notice that this method is clearly not implicit because there is no timedependence. We can prove by induction that

ui = C(1− zi), z =2 +R∆x

2−R∆x,C ∈ R (85)

Due to the BC at x = 0, the base case is true. For i > 0, we can use equations(84) and (85) to obtain

ui+1 =C

p− 1[(p+ 1)(1− zi−1)− 2(1− zi)] (86)

100

Page 104: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Upon substituting in the value of p and simplifying, we get that

ui+1 = C(1− zi+1) (87)

which proves that equation (85) is true. Notice that if z is nonnegative,then the numerical solution will contain no oscillations. This agrees withthe solution given by equation (83), which is clearly monotonic. Otherwise,we can see from equation (85) that the numerical solution will contain non-physical oscillations. Hence, to ensure that the solution does not containspurious oscillations, we must have that 2 − R∆x > 0. This implies that∆x < 2D/v. Indeed, this is an example of an explicit method that is onlystable when there are restrictions on the step size ∆x.

101

Page 105: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

7.5 The WENO Scheme

For the discretization of the advection terms (first spatial derivatives of thedependent variables in equations (23) - (28), a more sophisticated finite dif-ference method is the Weighted Essentially Nonoscillatory (WENO) scheme.To understand this scheme, we consider WENO applied to one dimension(along the x-direction) for ammonia in the fish tank. For rectangular co-ordinates, WENO can be applied to the second dimension separately, andin a similar fashion (Shu 90). We use the same mesh as for the basic finitedifference method, and we also define midpoints xi+ 1

2= 1

2(xi + xi+1). We

assume that we know the averages of A given by (Shu 87-8).

Ai =1

∆x

∫ xi+1

2

xi− 1

2

Adx (88)

It can be shown that we can obtain approximations, A(j)

i+ 12

, of Ai+ 12

in

terms of averages over nearby intervals, for j ∈ N. We accomplish this byusing interpolating polynomials of the form pj(xi) = ax2

i + bxi + c, such that

pj(xi+ 12) = A

(j)

i+ 12

. Three such approximations are (Shu 88)

A(1)

i+ 12

=1

3Ai−2 −

7

6Ai−1 +

11

6Ai (89)

A(2)

i+ 12

= −1

6Ai−1 +

5

6Ai +

1

3Ai+1 (90)

A(3)

i+ 12

=1

3Ai +

5

6Ai+1 −

1

6Ai+2 (91)

It can also be shown that we can get an approximation using all fiveaverages from equations (89) - (91) with the linear combination (Shu 89)

Ai+ 12

= γ1A(1)

i+ 12

+ γ2A(2)

i+ 12

+ γ3xA(3)

i+ 12

, where γ1 =1

10, γ2 =

3

5, γ3 =

3

10(92)

Furthermore, we can obtain an approximation by defining the combina-tion (Shu 87, 90)

102

Page 106: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Ai+ 12

= w1A(1)

i+ 12

+ w2A(2)

i+ 12

+ w3A(3)

i+ 12

, where (93)

wj =wj

w1 + w2 + w3

, wj =γj

(10−6 + βj)2for j = 1, 2, 3

βj =2∑l=1

∆x2l−1

∫ xi+1

2

xi− 1

2

(dl

dxlpj(x)

)2

dx

Clearly the approximation of Ai+ 12

given in equation (93) is a weightedaverage of approximations. The term βj is called a smoothness indica-tor because if the interpolating polynomial pj is very steep in the interval[xi− 1

2, xi+ 1

2], then its derivatives, and hence βj, will be large. Notice that

each wj is defined as a fraction containing βj in the denominator. Thus wecan see that the nonlinear weights wj decrease as the smoothness indicator ofthe corresponding polynomial pj increases. This ensures that approximationsthat are less smooth will be weighed less heavily than other approximations.The 10−6 in equation (93) is just there to keep the denominator nonzero.

With the approximation given by equation (93), and the finite differenceformula given by equation (94) below, we can replace our basic finite dif-ference approximation of the convection term with a more accurate WENOapproximation.

∂A

∂x

∣∣∣x=xi≈Ai+ 1

2− Ai− 1

2

∆x(94)

103

Page 107: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

7.6 The Third Order TVDRK Method

A more accurate numerical method for the time derivatives in advection-dominated problems is the Third-Order Total Variation Diminishing Runge-Kutta (third order TVDRK) method. The total variation of a discrete solu-tion u(xi, tm) = umi to a differential equation is defined as (Shu and Osher2)

TV (u) =∑i

|umi+1 − umi | (95)

Simply stated, the total variation of a solution tells us how much thesolution changes between consecutive x-values for a given time tm; a solutionwith a large total variation changes rapidly. A numerical method is said tobe total variation diminishing (TVD) if (Shu and Osher 2)

TV (um+1i ) ≤ TV (umi ) (96)

Thus a scheme is TVD if its total variation decreases with each time step.When we require the traditional third-order runge-kutta method given byrecursion (97) below to be TVD, we obtain the third order TVDRK methodgiven by recursion (98) (Senthilkumar 680, Shu and Osher 12).

um+1i,j = umi,j +

∆t

6(q1 + 4q2 + q3), where (97)

q1 = G(tm, umi,j)

q2 = G

(tm +

∆t

2, umi,j +

∆t

2q1

)q3 = G(tm + ∆t, umi,j −∆tq2 + 2∆tq3)

um+1i,j = umi,j +

∆t

6(q1 + q2 + 4q3), where (98)

q1 = G(tm, umi,j)

q2 = G(tm + ∆t, umi,j + ∆tq1)

q3 = G

(tm +

∆t

2, umi,j +

∆t

4q1 +

∆t

4q2

)

104

Page 108: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

At this point, the reader may wonder why we did not consider a fourthorder TVDRK. It is possible to derive a fourth order method, but it turnsout to be restricted to smaller time steps, and it is a multistep method (Shuand Osher 13). Multistep methods are more difficult to use because in orderto find the solution for tm+1, we must use the solution at times prior to tm.Therefore, before we can use an n-step method, we must obtain the solutionat t = t1, t2, · · · , tn−1 using another method (t0 is given by ICs).

105

Page 109: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

References

Bernstein, Sylvia. Aquaponic Gardening, A Step-by-Step Guide to RaisingVegetables and Fish Together. Gabriola Island, BC, CAN: New Society Pub-lishers, 2011. ProQuest ebrary. Web. 4 October 2015.

Copeland, Robert A. Evaluation of Enzyme Inhibitors in Drug Discovery:A Guide for Medicinal Chemists and Pharmacologists (2nd Edition). Somer-set, NJ, USA: John Wiley & Sons, 2013. ProQuest ebrary. Web. 6 October2015. Copyright 2013. John Wiley & Sons. All rights reserved.

de Marsily, Ghislain. Quantitative Hydrogeology: Groundwater Hydrologyfor Engineers. Orlando, FL: Academic, 1986. Print.

”Design of Aquaponic Units.” Food and Agriculture Organization (FAO)of the United Nations. FAO, n.d. Web. 06 Oct. 2015.

He, Hongju. ”Studies for Growth Adaptation and Identification of Glucosi-nolates on Chinese Brassicas.” Munchen: Utz, Wiss., 1999. Print.

Logan, J.D. ”Reaction-Advection-Dispersion Equation.” Transport Model-ing in Hydrogeochemical Systems. N.p.: Springer, 2001. 29-73. Print.

Mathews, John H., Ph. D. ”Module for 2D Integration Using the Trape-zoidal and Simpson Rules.” Department of Mathematics, California StateUniversity, Fullerton. California State University, Fullerton, n.d. Web. 22Apr. 2016.

Mathews, John H., and Kurtis D. Fink. Numerical Methods Using MAT-LAB. 4th ed. Upper Saddle River, NJ: Pearson, 2004. Print.

Milo, Ron. ”Diffusion Coefficient of Ammonium in Water.” Bionumbers.Harvard University and the Weizmann Institute, n.d. Web. 16 Nov. 2015.

Milo, Ron. ”Diffusion Coefficient of Nitrite in Water.” Bionumbers. Har-vard University and the Weizmann Institute, n.d. Web. 16 Nov. 2015.

Milo, Ron. ”Diffusion Coefficient of Nitrate in Water.” Bionumbers. Harvard

106

Page 110: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

University and the Weizmann Institute, n.d. Web. 16 Nov. 2015.

Okabe, Satoshi. ”Analysis of Size Distribution and Areal Cell Density ofAmmonia-oxidizing Bacterial Microcolonies in Relation to Substrate Micro-profiles in Biofilms.” Biotechnol. Bioeng. Biotechnology and Bioengineering85.1 (2003): 86-95. Wiley Periodicals. Web. 16 Nov. 2015.

Panton, Ronald L. Incompressible Flow. [Electronic Resource]. n.p.: Hobo-ken, N.J. : Wiley, c2013., 2013. STETSON UNIV’s Catalog. Web. 13 Apr.2016.

”Periodic Table of Elements: LANL.” Los Alamos National Laboratory.LANS, LLC, 2015. Web. 22 Nov. 2015.

Petrea, Stefan Mihai, et al. ”Vegetable Production In An Integrated AquaponicSystem With Stellate Sturgeon And Spinach-Matador Variety.” Scientific Pa-pers: Animal Science and Biotechnologies / Lucrari Stiintifice: Zootehnie SiBiotehnologii 47.1 (2014): 235-245. Academic Search Complete. Web. 13Apr. 2016.

”Reaction Kinetics in Chemistry.” Montana State University: Departmentof Mathematics. N.p., n.d. Web. 6 Oct. 2015.

Savidov, Nick. ”Evaluation of Aquaponics Technology in Alberta, Canada.”Aquaponics Journal 37 (2005): 20-25. Aquaponics Journal. Nelson andPade, Inc. Web.

Senthilkumar, Sukumar. ”A Study on Third Order Runge-Kutta Techniquesfor Solving Practical Problems.” Walailak Journal (2014): 679-86. Web. 21Nov. 2015.

Serway, Raymond A et al. Modern Physics. 3rd ed. Belmont: Brooks/Cole,2005. Print.

Schulze-Makuch, Dirk. ”Longitudinal Dispersivity Data and Implicationsfor Scaling Behavior.” Ground Water 43.3 (2005): 443-56. Web. 16 Nov.2015.

107

Page 111: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Shu, Chi-Wang. ”High Order Weighted Essentially Nonoscillatory Schemesfor Convection Dominated Problems.” SIAM Rev. SIAM Review 51.1 (2009):82-126. Web. 21 Nov. 2015.

Shu, Chi-Wang, and Stanley Osher. ”Efficient Implementation of EssentiallyNon-oscillatory Shock-Capturing Schemes.” Upwind and High-Resolution Schemes(1987): 328-74. Web. 21 Nov. 2015.

Somerville, Christopher. ”Small-Scale Aquaponic Food Production: Inte-grated Fish and Plant Farming.” (2014): n. pag. Food and AgricultureOrganization of the United Nations. Web. 15 Nov. 2015.

Stewart, James. Calculus: Concepts and Contexts. Belmont: Brooks/Cole,2010. Print.

Stewart, James. Calculus: Early Transcendentals. 7th ed. Belmont: Brooks/Cole,2012. Print.

Strikwerda, John C. Finite Difference Schemes and Partial Differential Equa-tions. Belmont: Brooks/Cole, 1989. Print.

Thurston, Robert et al. ”Aqueous Ammonia Equilibrium: Tabulation ofPercent Un-ionized Ammonia.” (1979): n. pag. United States Environmen-tal Protection Agency. Web. 15 Nov. 2015.

”Total Porosity.” Argonne National Laboratory. N.p., n.d. Web. 16 Nov.2015.

Tyson, Richard. ”Reconciling Ph for Ammonia Biofiltration in a Cucum-ber/Tilapia Aquaponics System Using a Perlite Medium.” ResearchGate.N.p., 2007. Web. 16 Nov. 2015.

”Wastewater Management Fact Sheet: Denitrifying Filters.” United StatesEnvironmental Protection Agency. United States Environmental ProtectionAgency, Sept. 2007. Web. 6 Oct. 2015. Xiaochuang, Cao et al. ”Uptake andUptake Kinetics of Nitrate, Ammonium, and Glycine by Pakchoi Seedlings(Brassica Campestris L. Ssp. Chinensis L. Makino).” Scientia Horticulturae186 (2015): 247-53. Elsevier. Web. 15 Nov. 2015.

108

Page 112: A MODEL OF NUTRIENT FLOW IN AN AQUAPONICS SYSTEM

Zakes, Zdzislaw et al. ”The Effect of Feeding on Oxygen Consumption andAmmonia Excretion of Juvenile Tench Tinca Tinca (L.) Reared in a Wa-ter Recirculating System.” Aquaculture International Aquacult Int 14.1-2(2005): 127-40. Springer. Web. 16 Nov. 2015.

109