modeling diffusion using an agent-based approa

Upload: giulio-milanese

Post on 08-Jul-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    1/80

    e University of Toledo

    e University of Toledo Digital Repository 

    3e+e+ ad D#++e*a#+

    2010

    Modeling difusion using an agent-based approachPratibha Sapkotae University of Toledo

    F%% #+ ad add##a% *$+ a: 4://d*.%ed.ed/e+e+-d#++e*a#+

    3#+ 3e+#+ #+ b*! * *ee ad e acce++ b 3e U#e*+# T%ed D#!#a% Re+#*. I a+ bee acceed * #c%+# # 3e+e+ ad

    D#++e*a#+ b a a*#ed ad#+*a* 3e U#e*+# T%ed D#!#a% Re+#*. F* &*e #*&a#, %ea+e +ee e *e+#* '+ Ab

    a!e.

    Rec&&eded C#a#Sa$a, P*a#ba, "Mde%#! d#+# +#! a a!e-ba+ed a*ac" (2010). eses and Dissertations. Pae* 962.

    http://utdr.utoledo.edu/?utm_source=utdr.utoledo.edu%2Ftheses-dissertations%2F962&utm_medium=PDF&utm_campaign=PDFCoverPageshttp://utdr.utoledo.edu/theses-dissertations?utm_source=utdr.utoledo.edu%2Ftheses-dissertations%2F962&utm_medium=PDF&utm_campaign=PDFCoverPageshttp://utdr.utoledo.edu/theses-dissertations?utm_source=utdr.utoledo.edu%2Ftheses-dissertations%2F962&utm_medium=PDF&utm_campaign=PDFCoverPageshttp://utdr.utoledo.edu/about.htmlhttp://utdr.utoledo.edu/about.htmlhttp://utdr.utoledo.edu/about.htmlhttp://utdr.utoledo.edu/about.htmlhttp://utdr.utoledo.edu/theses-dissertations?utm_source=utdr.utoledo.edu%2Ftheses-dissertations%2F962&utm_medium=PDF&utm_campaign=PDFCoverPageshttp://utdr.utoledo.edu/theses-dissertations?utm_source=utdr.utoledo.edu%2Ftheses-dissertations%2F962&utm_medium=PDF&utm_campaign=PDFCoverPageshttp://utdr.utoledo.edu/?utm_source=utdr.utoledo.edu%2Ftheses-dissertations%2F962&utm_medium=PDF&utm_campaign=PDFCoverPages

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    2/80

     

    A Thesis

    entitled

    Modeling Diffusion Using an Agent-Based Approach

     by

    Pratibha Sapkota

    Submitted to the Graduate Faculty as partial fulfillment of the

    requirements for Masters of Science degree in Civil Engineering

    Dr. Defne Apul, Committee Chair

    Dr. Daryl F. Dwyer, Committee member

    Dr. Gursel Serpen, Committee member

    Dr. Patricia R. Komuniecki, Dean

    College of Graduate Studies

    The University of Toledo

    May 2010

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    3/80

     

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    4/80

    iii 

    An Abstract of

    Modeling Diffusion Using an Agent-Based Approach

     by

    Pratibha Sapkota

    Submitted to the Graduate Faculty as partial fulfillment of therequirements for Masters of Science degree in Civil Engineering

    The University of Toledo

    May 2010

    Arsenic is one of the toxic substances introduced in groundwater by various

    anthropogenic and natural sources. Understanding fate and transport of arsenic in

    groundwater and wetlands is crucial for remediation. Previously fate and transport of

    arsenic have been modeled using various equation based methods (EBM) such as

    ordinary differential equations (ODE) and partial differential equations (PDE), which

    encompass rigorous mathematics and assume that only one species of arsenic is present.

    But in reality, various forms of arsenic are present in groundwater. Based on the

    availability of oxygen, arsenic transforms from one form to another, thus creating a

    heterogeneous mix. Therefore, the equations used to describe the relation among

     parameters of interest become non-linear. The agent-based method (ABM) has emerged

    as a potential tool to model multidisciplinary and highly complex environmental

     problems. The goal of this research was to develop an ABM for the transport of arsenate

    (H2ASO4-) in water and soil. First, the diffusion of arsenate from contaminated water into

    the overlying uncontaminated water was modeled and second, the diffusion of arsenate

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    5/80

    iv 

    from contaminated soil to the overlying uncontaminated water was modeled. Since this is

    the first time the model was developed using ABM, the results obtained from both

    models were compared with results from HYDRUS 1-D for verification. Although

    HYDRUS can model diffusion process, it is unable to model processes such as reduction

    and oxidation of arsenic, which is an important process for arsenic remediation.

    Therefore, HYDRUS is used for initial comparison purpose. The results obtained from

    ABM and HYDRUS-1D for diffusion in water showed good agreement with each other.

    However, the results obtained for diffusion in soil using ABM and HYDRUS 1-D were

    not in complete agreement with each other. The difference in the results obtained was due

    to the relation on which each model focused upon. Specifically, HYDRUS results were

    obtained by assigning diffusivity coefficient value and monitoring variability over time

     by using partial differential equations. However, ABM results were obtained by allowing

    each individual contaminant to move freely in the porous soil. Another reason for the

    difference was due to tortuosity. In HYDRUS, tortuosity depends on porosity (i.e. τ = ε-

    1/3), but ABM model does not have a specific relation between tortuosity and porosity,

    therefore, the results obtained differed.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    6/80

    Acknowledgements 

    First of all, I would like to thank my advisor Dr. Defne Apul for her constant support and

    guidance throughout my research. I am thankful for her encouragement during my time in

    UT. I also thank her for giving me an opportunity to work under her guidance.

    I would also like to thank Dr. Daryl Dwyer and Dr. Gursel Serpen, my committee

    members for their presence in my master’s thesis. I would like to thank them for giving

    valuable suggestions and feedbacks.

    Special thanks to my friends Chirjiv Anand and Jill Shalabi for their valuable help and

    suggestions throughout my thesis.

    Lastly, I am very thankful to my family. They have always supported, encouraged, and

    inspired me in every step of my life and work. Finally, and most of all, I want to thank

    my husband, who makes everything I do worthwhile. His love, support, and patience

    make me very happy. I am very thankful for every moment I spend with him and this

    thesis is dedicated to him.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    7/80

    vi 

    Table of Contents

    An Abstract of .................................................................................................................... iii

    Acknowledgements ............................................................................................................. v

    Table of Contents ............................................................................................................... vi

    List of Tables ...................................................................................................................... ix

    List of Figures ..................................................................................................................... x

    1. Introduction ..................................................................................................................... 1

    1.1 Arsenic contamination as a widespread problem ...................................................... 1

    1.2 Remediation of arsenic contaminated waters ............................................................ 2

    1.3 Fate and transport of arsenic in a wetland ................................................................. 2

    2. Motivation ....................................................................................................................... 7

    3. Background .................................................................................................................... 8

    3.1 Contaminant transport processes ............................................................................... 8

    3.1.1 Diffusion ............................................................................................................. 8

    3.2. Agent-Based Modeling (ABM) .............................................................................. 11

    3.2.1 Introduction to ABM......................................................................................... 11

    3.2.2 What is an agent? .............................................................................................. 12

    3.3 Equation Based Modeling (EBM) and Agent-Based Modeling (ABM) ................. 13

    3.4 Comparison of Various ABM tools ......................................................................... 14

    3.5 NetLogo: The ABM of preference .......................................................................... 15

    3.5.1 Features and Structure of NetLogo ................................................................... 16

    3.5.2 NetLogo in various disciplines ......................................................................... 16

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    8/80

    vii 

    4. Overview of Approach and Objectives ......................................................................... 19

    4.1 Objectives ................................................................................................................ 19

    5. Methodology ................................................................................................................ 20

    5.1 Description of NetLogo platform ............................................................................ 20

    5.2 Agents in NetLogo .................................................................................................. 23

    5.3 Input/ Output ........................................................................................................... 25

    5.4 Problem Description ................................................................................................ 25

    5.5 Problem 1: Diffusion in water ................................................................................. 26

    5.5.1 Model setup in NetLogo ................................................................................... 26

    5.5.2 Sensitivity Analysis .......................................................................................... 29

    5.5.3 Modeling diffusion in water using HYDRUS .................................................. 30

    5.6 Problem 2: Diffusion in saturated soil ..................................................................... 32

    5.6.1 Model setup in NetLogo ................................................................................... 32

    5.6.2 Model setup in HYDRUS ................................................................................. 33

    5.7 Problem 3: Diffusion in saturated soil with varying porosity ................................. 35

    5.7.1 Model setup in NetLogo ................................................................................... 35

    5.7.2 Model setup in HYDRUS ................................................................................. 36

    6. Results and Discussion .................................................................................................. 37

    6.1 Results from problem 1: Diffusion in water ............................................................ 37

    6.1.1 Results from NetLogo model ............................................................................ 37

    6.1.2 Result from HYDRUS model ........................................................................... 42

    6.1.3 Comparison of HYDRUS and NetLogo results ................................................ 43

    6.2 Results from problem 2: Diffusion in soil ............................................................... 45

    6.2.1 Results from HYDRUS and NetLogo............................................................... 45

    6.3 Results from problem 3: Diffusion in soil with varying porosity............................ 46

    6.3.1 Results from HYDRUS and NetLogo............................................................... 46

    7. Conclusion and Future work ......................................................................................... 48

    7.1 Conclusion ............................................................................................................... 48

    7.2 Future Work ............................................................................................................. 49

    References ......................................................................................................................... 50

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    9/80

    viii 

    Appendices ........................................................................................................................ 59

    Appendix A: Information Tab for Enzyme Kinetics and B-Z reaction............................. 59

    Appendix B: Information Tab for Diffusion in Water ...................................................... 61

    Appendix C: Information Tab for Diffusion in Porous Media.......................................... 62

    Appendix D: NetLogo Code for Diffusion in Water ........................................................ 63

    Appendix E: NetLogo code for Diffusion in Soil ............................................................. 65

    Appendix F: NetLogo code for Diffusion in Soil with Varying Porosity ......................... 67

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    10/80

    ix 

    List of Tables

    Table 1: Comparison between various agent-based platforms (taken from Railsback,

    (2006)) ............................................................................................................................... 14 

    Table 2: Wetland processes and similar examples in NetLogo library ............................. 18 

    Table 3: Mean, Standard deviation, and Coefficient of Variation (CV) of cumulative flux

    (mg/m

    2

    ) for a turtle ............................................................................................................ 40 

    Table 4: Different number of runs with 1 turtle representing 1mg ................................... 42 

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    11/80

    List of Figures

    Figure 1: Conceptual model [adapted from Zhang et al. 2008] .......................................... 3 

    Figure 2: Conceptual description of an agent (Macal and North, 2005) ........................... 12 

    Figure 3: Screen shot of interface tab. The black box is the view. ................................... 21 

    Figure 4: Screen shot of procedure tab.............................................................................. 22 

    Figure 5 NetLogo world [Adapted from Xin and Li, 2008]............................................. 24 

    Figure 6: Uniformly Contaminated water ........................................................................ 27 

    Figure 7: Screenshot of Coordinates ................................................................................. 28 

    Figure 8: Pink represents contaminated water layer and blue represents uncontaminated

    water layer ......................................................................................................................... 31 

    Figure 9: Uniformly contaminated saturated soil .............................................................. 32 

    Figure 10: Pink represents the contaminated soil layer and blue represents

    uncontaminated water in HYDRUS setup ........................................................................ 34 

    Figure 11: Uniformly contaminated saturated soil ............................................................ 35 

    Figure 12: Pink represents the contaminated soil layer and blue represents

    uncontaminated water in HYDRUS setup ........................................................................ 36 

    Figure 13: 1 turtle equivalent to 100mg. The graph was obtained by running the same

    simulation 50 times with 1 turtle equal to 100mg. The figure shows that the cumulative

    flux varied between 2050 to 2250 mg after 40 days. ........................................................ 38 

    Figure 14: 1 turtle representing 10mg. The graph was obtained by running the same

    simulation 50 times with 1 turtle equal to 10mg. .............................................................. 39 

    Figure 15: Plot obtained by assigning a turtle 1mg each. The plot is smooth although it

    shows some variation among the 50 simulations. ............................................................. 39 

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    12/80

    xi 

    Figure 16 : The plot is obtained by assigning 0.1 mg to a turtle. The plot is very smooth

    and the variation after 50 simulations is also very small. ................................................. 40

    Figure 17: Cumulative flux after 40 days ......................................................................... 43 

    Figure 18: Cumulative flux after 40 days ......................................................................... 44 

    Figure 19: HYDRUS vs. NetLogo for diffusion in water ................................................. 44 

    Figure 20: Diffusion in soil ............................................................................................... 45 

    Figure 21: HYDRUS vs. NetLogo for diffusion in soil .................................................... 46 

    Figure 22: Cumulative flux after 40 days for diffusion in soil with varying porosity ...... 47 

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    13/80

    1. Introduction

    1.1 Arsenic contamination as a widespread problem

    Arsenic is a toxic metal that is introduced in the subsurface by mining activities,

    irrigation practices, and disposal of industrial wastes. Arsenic contaminated groundwater

    is a widespread problem and poses health problems such as black disease, diabetes,

    kidney and lung disease, high blood pressure, and reproductive disorder (WHO, 2004).

    Among the various risks, drinking arsenic contaminated groundwater poses the greatest

    threat to human health. The United States Environmental Protection Agency (USEPA)

    has categorized arsenic as carcinogenic and has lowered the contaminant level deemed

    safe for drinking water from 50 ppb to10 ppb (USEPA, 2001). Arsenic concentrations

    above the given levels have been found in groundwater (often the only source of drinking

    water) in many countries including Bangladesh, India, Vietnam, China, and United

    States; this contamination was attributed to anthropogenic sources (Nordstom,2002;

    Smedley and Kinniburgh, 2002). Therefore, it is of utmost importance to find a way to

    remove arsenic from the contaminated water.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    14/80

    1.2 Remediation of arsenic contaminated waters

    Recently there has been a keen interest in using constructed wetlands for water

    quality improvement (Green et.al., 1997; Goulet et. al., 2001; Kadlec and Reddy, 2001).

    Constructed wetlands are recognized as energetically sustainable systems because they

    use natural energy to reduce pollutants. Various efforts have been made in the past to

    treat arsenic laden wastewater using wetlands and algae ponds (La Force et al., 2000;

    Wilkin and Ford, 2006; Kalbitz and Wenrich, 1998; Buddhawong et al., 2005). These

    studies have shown that the removal capacities are higher in soil based wetlands than in

    algae ponds.

    Mechanisms involved in arsenic removal from water in a wetland are very

    complex, comprising a large array of physical, chemical, and microbiological reactions.

     Numerous studies have given details on complex processes involved in arsenic removal

    from water using wetlands (Smith et al., 1998; Mahimairaja et al., 2005). These studies

    showed that wetlands with proper soil type, plants, and microorganisms are efficient for

    reducing arsenic below influent concentrations.

    1.3 Fate and transport of arsenic in a wetland

    The biogeochemistry of arsenic in wetlands is a complex process which includes

    chemical and microbiological reactions (Figure 1). Several processes such as adsorption,

    reduction-oxidation, precipitation, plant uptake, and microbial activity contribute towards

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    15/80

    removing arsenic from water. Adsorption on soil colloids (clay, oxides, Al, Fe,

    Mn, CaCO3, organic matter) is one of the most important processes in arsenic removal

    from soil solutions. Precipitation of solid phase is another mechanism of arsenic removal

    from the soil solutions. Reduction-Oxidation (Redox) of arsenic compounds also plays a

    vital role in removing arsenic by changing arsenic compound into different forms. Micro-

    organisms such as bacteria, fungi also help in reducing arsenic concentration from the

    soil solutions by changing arsenic compound into volatile form.

    Figure 1: Conceptual model [adapted from Zhang et al. 2008]

    The fundamental processes for moving and mixing contaminants in wetlands are

    advection, diffusion, and dispersion. Advection is the transport of contaminant along the

    ()

    ()

    ()

    ()

    ()

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    16/80

    flow of water. Diffusion and dispersion signify the mixing of contaminants due to

    concentration gradients. The most commonly used equation for the transport of

    contaminants in porous media, the advection dispersion equation, is given by

     

      −

     

    Where

     = linear velocity [L/T]

    D=Hydrodynamic dispersion [L

    2

    /T]

    Hydrodynamic dispersion is the sum of dispersion and diffusion (D =De+ αL  .

    Where

    De = effective diffusion coefficient [L2/T]

    αL = dispersion[L]

    Under flow conditions, diffusion is insignificant, therefore it is neglected. However, in

    quiescent conditions (   ), diffusion dominates because of random motion of

    contaminant molecules. Fick’s law, which is used to describe diffusion, states that the

    mass diffusing is proportional to the concentration gradient. In one dimension, the

    transport process is given by

      −

     

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    17/80

    Where, D= Diffusion coefficient [L2/T]

    dC/dx=Concentration gradient[M/L3/L]

     Numerical models have been widely used to gain insight into the fate of the

    chemicals in wetlands. Finite difference method (FDM), finite element method (FEM),

    integrated finite difference method (IFDM), boundary integral equation method, and

    analytical elements are some of the methods used for fate and transport modeling

    (Alhumaizi, 2004; Narasimhan and Witherspoon, 1978; Ligget and Liu, 1983; Strack,

    1987). Among them, FDM and FEM are more commonly used to solve flow problems. 

    Studies have shown that FDM requires relatively large computational time and is often

    unstable when dealing with steep concentration gradients (Alhumaizi, 2004; Botte, Ritter

    and White, 2000). Piatkowski et al. (2003) showed that FEM is more useful than FDM

    for irregular boundaries and is relatively stable than FDM when dealing with steep

    concentration gradients. To summarize, FDM is easy to program, understand, and is a

    good method when dealing with simpler boundaries. However, FEM is better at

    approximating complex boundaries and is able to simulate point sources and sinks,

    seepage faces, and moving water table. 

    The transport of arsenic in wetlands is determined by the presence of adsorption-

    desorption sites, the effect of humic substance, and the presence of competing anions.

    Adsorption-desorption behavior of arsenic is responsible for non equilibrium transport of

    arsenic in soil, making it difficult to model using existing fate and transport models.

    Because arsenic cycling in wetland is a complex process and adsorption in soils is

    nonlinear (Zhang and Selim, 2006), it is necessary to understand the relationship among

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    18/80

    the individual components in order to make future predictions accurately. Hellweger and

    Kianirad (2007) have shown that for a system that is heterogeneous and non-linear,

    existing modeling methods produce significant errors because variability within species is

    not accounted for. Therefore, research is needed for characterizing and quantifying the

    sources of variability so that accurate models can be developed.

    The agent-based method (ABM) has emerged as a potential tool to deal with the

    multidisciplinary and highly complex environmental problems. The growing interest in

    this technique is due to its ability to incorporate more realistic assumptions than existing

    fate and transport models; therefore, ABM is proving effective in simulating many real

    world fate and transport problems. Salgado and Aranda (2007) developed and compared

    the performance of ABM to equation based modeling (EBM) and found that for modeling

    adsorption on solid surfaces, results obtained from ABM were more stable than the

    results obtained from EBM. Gujer (2002) and Schuler (2005) showed that EBM

    introduces error while simulating water quality models because it uses an averaging

    assumption for nutrient uptake across the entire population. Hellweger (2007) has

    suggested ABM as an alternative to EBM in such a situation as it does not make any

    averaging assumptions.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    19/80

    2. Motivation

    ABM is a simulation method that has proven its usefulness in handling

    complexities in diverse fields such as ecology (Takasu, 2009; Uchmanski et al., 2008),

    medicine (Gary and Wilensky, 2009; Eapen, 2009), and economics (Remenik, 2009;

    Damaceanu, 2008), yet ABM has not been used as much in environmental modeling.

    ABM allows the incorporation of heterogeneity and variability within the population and

    does not make any averaging assumptions; thus it is a promising method for modeling

    fate and transport compared to existing EBM methods. For example, arsenic cycling in

    wetland is a very complex process which requires monitoring of various arsenic species

    simultaneously. The above studies have proved the capabilities of ABM for handling

    complexities. Therefore, the overarching goal of this study was to model wetland

     processes using agent-based approach. However, since this was a daunting task, this

    thesis addressed only the diffusion process in wetlands or any other porous media. To

    my knowledge, this study is the first attempt to model fate and transport of contaminants

    through porous media at the individual level using ABM.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    20/80

    3. Background

    3.1 Contaminant transport processes

    The basic transport processes governing the transport of chemicals are advection,

    diffusion, and dispersion. All of these processes can occur simultaneously during the

    transport of chemicals or the transport can be dominated by a single process. For

    example, when flow velocity is zero, chemical movement takes place through diffusive

    transport and when flow velocity is large, advection and dispersion effects dominate.

    Computational approaches to problems involving advection-diffusion equations are

    relatively well studied, and in depth discussions about transport phenomenon and

    applications can be found in various textbooks (Bear, 1972; Freeze and Cherry, 1979;

    Fetter, 1993).

    3.1.1 Diffusion

    Diffusion is one of the widely studied transport processes in fate and transport

     problems (Selvadurai, 2004; Bulavin et al., 2008; Rebour et al., 1997). Fick introduced

    the concept of diffusion and stated that diffusive flux is directly proportional to

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    21/80

    concentration gradient (Fetter, 1993). Einstein studied the probabilistic nature of

    diffusion process and explained that the Brownian motion of the particles in a fluid use

     probability density functions (Weber, 1996). He showed that the movement of each

     particle in the fluid is independent of the other particles, and that diffusion coefficient

    increases as a function of movement of the particles.

    Existing experimental methods only provide the effective diffusion coefficient i.e.

    coefficient averaged over diffusion zone (Weber, 1996). Gathering information relating

    to individual diffusion mechanisms, molecular level characteristics using the existing

    methods is also very difficult, if not impossible. Individual level modeling appears to be

    the viable method for gaining insights into the complexities of diffusion, and it provides a

    fundamental framework for solving diffusion problems.

    At the microscopic level, diffusion results from individual displacement of

    diffusing particles, also referred as diffusive jumps. Diffusive jumps are usually single-

    molecule jumps of fixed length. Diffusivity can be expressed in terms of physical

    quantities that describe elementary jump processes such as jump rates and jump distance

    of a molecule. The jump rate of a molecule depends on its individual energy, Boltzmann

    constant, and the absolute temperature (Flynn, 1972).

    Γ=νo exp (-G/k BT)

    Γ 

    is the jump rate, ∆G is the Gibbs free energy, k B is the Boltzment constant, νo is the

    Debye frequency, and T the absolute temperature. If the jump distance of the molecule is

    given by λ [L]and the jump rate from one plane to the neighboring one is Γ [L/T], then

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    22/80

    10 

    without a driving force, forward and backward jumps occur with the same jump rate.

    The net flux J [amount L-2

    T-1

    ]

    from one point to another is given by

    J= Γn1 – Γn2. …………………………………………… 1

    where n1[L-2

    ] and n2[L-2

    ] are related to volume concentrations of diffusing molecules

    C1=n1/ λ, C2=n2/ λ ………………………………………2

    where C1 and C2 represent concentration [parts L-3

    ] at point 1 and 2.

    Concentration C(x,t)changes slowly as a function of the distance variable x in terms of

    distances between two jumps. First order Taylor expansion of C(x,t) results in

    C1-C2 =- λ ∂C/∂x……………………………………………… 3

    Inserting equation 2 and 3 in 1 results in

    J= - λ 2 Γ∂C/∂x………………………………………………….4

    After comparison with Fick’s law the diffusion coefficient is determined to be

    D= λ 2  Γ………………………………………………………….5

    This shows that the diffusion coefficient is related to the distance squared and jump rate.

    Additional details on the equation and its derivation can be found elsewhere (Flynn,

    1970; Franklin, 1975; Bennett, 1975)

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    23/80

    11 

    3.2. Agent-Based Modeling (ABM)

    3.2.1 Introduction to ABM

    ABM is a form of computational simulation that is gaining popularity in various

    disciplines (Bonabeau, 2002; Macal and North, 2005). ABM enables building models

    where individual entities and their interactions are directly represented. In ABM, a

    system is modeled as a collection of autonomous decision-making entities called agents.

    These agents are adaptive to their surrounding environment and can react to the

    environmental conditions. ABM allows visualizing the emergence of macro level

     behavior from micro level. A simple ABM can exhibit complex behavior patterns and

     provide valuable information about the system that it emulates. In addition, agents may

     be capable of evolving, allowing unanticipated behaviors to emerge.

    ABM is also known by several other names such as Agent-Based Systems (ABS)

    and Individual Based Modeling (IBM). All of these terminologies are extensively used

    (Macal and North, 2005), but ABM is used throughout this thesis. All the agents in the

    system are modeled within a region called an environment. The environment is a virtual

    world where the agents act.

    Cellular Automata (CA) is yet another form of computational modeling that was

    used to model complex environment but it is not as sophisticated as ABM. In CA the grid

    is homogeneously populated with agents; whereas in ABM, the agents are heterogeneous

    and therefore do not necessarily occupy all spaces within the grid. In CA, agents don’t

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    24/80

    12 

    interact with other agents outside their immediate neighborhood, but in ABM agents are

    more flexible in interaction with other agents.

    3.2.2 What is an agent?

    An agent is defined as an autonomous entity with its own set of characteristics

    and that can act on its own. The important feature of an agent is shown in Figure 2. An

    agent has a set of characteristics that allows it to act independently. An agent is able to

     perceive its environment. Thus, agents can determine what agents or objects are located

    near them. An agent is able to move within the space, can send or receive messages from

    other agents, and can interact with the environment (perform) and it has a set of goals that

    it pursues with its own initiative (making it proactive).

    Figure 2: Conceptual description of an agent (Macal and North, 2005) 

     

     

     

     

                                  

       

                                  

       

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    25/80

    13 

    3.3 Equation Based Modeling (EBM) and Agent-Based Modeling (ABM)

    The fundamental difference between ABM and EBM is the relationship on which

    they focus. EBM begins with a set of equations that has a pre-determined relationship

    among the parameters of interest. The equations are used to monitor parameter

    variability over time by using ordinary differential equations (ODE) or over time and

    space by using partial differential equations (PDE). The results obtained using these

    equations are the outcomes of individual behaviors but those behaviors have no explicit

    representation in EBM. For example, the advection dispersion equation presented in

    section 1.3 models concentrations which is an aggregate parameter arising from a

    collection of individual; individual behaviors are not explicitly represented in the

    advection dispersion equation. In contrast, ABM begins by representing the behavior of

    each individual, and then allows each individual component to interact, which produces

    the ultimate outcome. Thus relationships among the parameters of interest are an output

    of modeling process; they are not the input to the models (Xin and Li, 2008). In most

    cases, EBM tends to aggregate the values when modeling the system. This aggregation of

    the values is imprecise, and eventually leads to erroneous results (Hellweger, 2007).

    To summarize, ABM has several advantages over EBM. ABM captures emergent

     phenomena of global behavior from local interactions and provides a natural description

    of the system that is close to reality (Bonabeau, 2002). Apart from that it is more flexible

    than EBM. For example, more agents can be easily added during the simulation. The

    major advantage of ABM lies in its ability to handle complexity with ease. It can also

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    26/80

    14 

    encapsulate the randomness of complex systems. Moreover, it does not require as much

    mathematical knowledge as is required for traditional methods [EBM] (Wishart et al.,

    2004).

    3.4 Comparison of Various ABM tools

    ABM has been popular in various disciplines including economics, social science,

    medicine, and ecology (Bonabeau, 2002), therefore, various agent-based models have

     been developed. Table 1 shows the comparison of some of the popular ABM tools. ABM

     platforms have been compared with respect to some of the most important features.

    More information on these platforms can be found elsewhere (Berryman, 2008;

    Railsback, 2006).

    Table 1: Comparison between various agent-based platforms (Railsback, (2006))

    ABM

     platforms

    User base Modeling

    Language

    Speed of

    execution

    Ease of

    learning and programmin

    g

    User materials

    Ascape Diminishing Java Moderate Moderate Good

    documentation

    Mason Increasing Java Fastest Moderate Limited

    documentation

    Repast Large Java,

     python

    Fast Moderate Limited

    documentation

    etLogoLarge NetLogo Moderate Good Extensive

    documentation

    SWARM Diminishing Objective

    C,Java

    Moderate Poor Good

    documentation

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    27/80

    15 

    SWARM is one of the oldest and most stable ABM’s that is able to support

    complex models, but has weak error-handling capability. Repast is one of the powerful

    agent-based modeling platforms. However, it requires an extensive knowledge of Java

    and is suitable for computationally intensive models. Mason is also a good simulation

    tool and is a good choice for an experienced programmer but is computationally

    intensive. NetLogo has a user friendly environment and has its own programming

    language that is simpler than Java or Objective-C. It also has good documentation and

    visualization abilities. From the above comparison, NetLogo was found to be a suitable

     platform for modeling since it is able to handle a large number of agents. Time spent on

    developing this model is less than time required for some other library-based platforms

    such as Repast, SWARM. Also, studies in different fields have proven the efficacy of

     NetLogo for handling complexity (Chitnis & Itoh, 2004; Damaceanu, 2008; Xin et al.,

    2008)

    3.5 etLogo: The ABM of preference

     NetLogo is a modeling environment based on agents designed for simulations of

    natural phenomena. It was designed by Uri Wilensky in 1999 and it is in a process of

    continuous development and modernization at the Center for Connected Learning and

    Computer-Based Modeling – Northwestern University. NetLogo is written in Java

    language and can be run on all major platforms (Mac, Windows, Linux). NetLogo is a

    freeware and can be downloaded from the following web address:

    http://ccl.northwestern.edu/netlogo/.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    28/80

    16 

    3.5.1 Features and Structure of etLogo

     NetLogo has three main entities: agents, landscape, and observer. All of these

    entities can run code, and interact with each other. Variables can be defined globally and

    all entities have access to them. This structure gives modelers a great deal of flexibility

    while creating models. Furthermore, NetLogo is easy to use and has excellent

    documentation.

    3.5.2 etLogo in various disciplines

     NetLogo has emerged as a powerful and elegant language that can incorporate

    complexity and heterogeneity in a few lines of code with relative ease. Although

     NetLogo has been increasingly used in many disciplines, a few examples of its use are

    discussed below.

    Lockta Volterra model (predator prey model, Forrestor, 1971), one of the popular

    models in ecology, was traditionally simulated using EBM. Lockta Volterra model is

    used to make future predictions about population level, growing population, and the rate

    of consumption of natural resources. EBM solves differential equations that calculate the

    value of a variable at the next time step for the given population using the value at the

    current time step, but each individual in the population is not uniquely represented. This

    makes it hard to model heterogeneity among individuals. It is also hard to represent

    individual behaviors that depend on its past experience. But NetLogo has proved its

    capability in such a scenario. When the same model was simulated in NetLogo, each

    agent’s past behavior along with heterogeneity was modeled with ease (Wilensky, 1998).

    This feature is very helpful for the current research. Figure 1 shows that arsenic species

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    29/80

    17 

    changes from arsenate to arsenite and vice versa, thus making it heterogeneous. The

    above example shows that NetLogo allows modeling such scenarios which are

    impossible using existing EBM as it can only model homogeneous individuals.

     NetLogo is also popular in medical and biomedical disciplines because of its

    ability to deal with finer details and track numerous parameters at a time. For example,

    Eapen (2009) developed a NetLogo model for laser hair removal. Modeling laser hair

    removal requires monitoring numerous parameters simultaneously which is difficult

    using existing modeling methods, but NetLogo proved effective in tracking the numerous

     parameters. Modeling wetland processes require monitoring various parameters at a time.

    Factors such as pH, Fe and Mn oxides, sulfides, and organic matter should be monitored

    simultaneously as they impact reduction and oxidation of arsenic. The above example

     proves the capability of NetLogo for monitoring numerous parameters at a time which is

    very important for modeling reduction and oxidation.

    Similarly, NetLogo has also been used for modeling complex economic systems.

    For example, Damaceanu (2008) modeled wealth distribution among upper, middle, and

    lower class. Each patch had some amount of resource and the turtles collected some of

    that resource in order to survive. The amount of resource that each turtle collected was its

    wealth. The above example proves the capability of NetLogo to model processes such as

    adsorption and desorption as arsenate adsorbs on soil matrix rich in Fe and Al. Such

    scenarios are difficult to model using EBM as it requires rigorous mathematics and may

    not be solvable.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    30/80

    18 

    Table 2 shows the wetland processes of interest and existing NetLogo models that

    resemble those processes. Left most column shows the general equation used for the

    wetland processes. Middle column gives an example of equation used. The last column

    shows examples of similar processes modeled in NetLogo which is useful for modeling

    the wetland processes. Further details about the NetLogo models can be found in the

    appendix section.

    Table 2: Wetland processes and similar examples in NetLogo library

    Wetland processes Example Related etLogo models

    Adsorption/Desorption

    A +B AB

    Adsorption

    AsO43-

     + FeOH+3H+=

    FeH2ASO4+H20

    Enzyme Kinetics(Appendix A)

    Reduction/Oxidation

    A B

    2MnO2+H3ASO3=

    2MnOOH+H3AsO4 

    2MnOOH+H3AsO3=2MnO+H3AsO4+H2O

    B-Z reaction(Appendix A )

    Precipitation/Dissolution

    A + B AB

    Dissolution

    FeAsO4.2H2O+H+=

    H2AsO4-+Fe(OH)

    2++H2O

    Enzyme Kinetics(Appendix A)

    Plant uptake and Microbial

    uptake

    A + E B C+E

     

     

       ∗  

         

    Where,K M is called the

    Michaelis Constant

    Enzyme Kinetics(Appendix A)

    1  2 

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    31/80

    19 

    4. Overview of Approach and Objectives

    The primary objective of this study was to model diffusion using an agent-based

    approach. With an agent-based approach, a greater understanding of transport of

    contaminants may be possible because the results obtained are the outcomes of individual

    interactions. Also, an agent-based approach provides an opportunity to examine the

    impact of assumptions made by equation based approach.

    4.1 Objectives

    The objectives of the current study was to

      Select an ABM platform for modeling diffusion.

     

    Develop an agent-based model for diffusion in water and porous media using an

    agent-based approach.

      Perform sensitivity analysis to determine a suitable agent size.

      Perform sensitivity analysis to evaluate intrinsic randomness of the agent-

     based model.

      Verify the results obtained from diffusion in water and porous media against a well

    established FEM based fate and transport model, HYDRUS.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    32/80

    20 

    5. Methodology

    5.1 Description of etLogo platform

    The NetLogo window has three tabs: interface tab, the information tab, and

     procedures tab as shown in the top left of Figure 3. Only one tab is visible at a time but

    one can switch between different tabs by clicking on the tabs at the top of the window.

    The interface tab is used to visualize the output of the simulation and to control it. The

    information tab provides text-based documentation about the simulation and expected

    results. The procedure tab is the workspace where the code of the model is stored.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    33/80

    21 

    Figure 3: Screen shot of interface tab. The black box is the view.

    In NetLogo, two-or three-dimensional models can be created. In the 2D version of

     NetLogo, the interface tab includes a black square called view which is made up of

     patches. A patch is a spatial environment on which the agents move. The simulation

     program instructs the agents to move and act from patch to patch. The results can be seen

    in the view (Figure 3). The interface tab is a visual editor in which one can edit graphical

    elements such as buttons, sliders, switches, monitor, and output (Figure 3). Interface tab

    also allows changing the world dimension, and the dimension of the overall setup.

    The information tab provides an environment for the programmer to describe the

    model. By default, the information tab includes the following sections: ‘What is it?’,

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    34/80

    22 

    ‘How it works’, ‘How to use it’, ‘Things to notice’, ‘Things to try’, ‘Extending the

    model’, ‘NetLogo features’, ‘Related models’, and ‘Credit and References’. The

     programmer can edit these sections and add equations and methods used. The

    information tab for the current research can be found in Appendices B and C.

    In the procedure tab commands are written in a specific format as shown in Figure

    4. (The code used in this study is given in Appendices D, E and F) The program has three

     parts: first, the global variables are defined; second, setup procedure is written to

    initialize the simulation; and third, go procedure is written that is repeatedly executed by

    the system. The go procedure tells each agent to carry out the given instruction

    independently. Agents in NetLogo model are referred as turtles. Typically, a population

    of turtles is initialized and procedures are written that control the behavior of the turtles.

    The turtles represent physical entities whose behaviors result in movements around the

    two dimensional world.

    Figure 4: Screen shot of procedure tab

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    35/80

    23 

    5.2 Agents in etLogo

     NetLogo has four different types of agents and each agent can follow instructions

    and carry out its own activity. These agents are turtles, patches, links, and observer

    (Figure 5). Turtles are the functional agents and the patch is a square ground over which

    the turtles move. Initially, the world is empty and the turtles are created by the observer.

    In addition, the patches can create turtles, too. Patches and turtles have their coordinates

    determined by the variables xcor and ycor for turtles, and pxcor and pycor for patches.

    The patch with the coordinate (0, 0) is the origin which can be placed anywhere in the

    view box based on the model requirement. The total number of patches is determined by

    the parameters min-pxcor, max-pxcor, min-pycor, and max-pycor.

    By default, NetLogo has fixed patch coordinate values, when the model starts that

    can be changed accordingly. For example, when NetLogo starts, min-pxcor, max-pxcor,

    min-pycor, and max-pycor values are -16, 16, -16, and 16 respectively (Figure 5). This

    means pxcor and pycor both range from -16 to 16, so there are 33 times 33, or 1089

     patches. The patches coordinates are only integers whereas the turtles coordinates are

    whole numbers and fractions. This means the turtles can move anywhere on the patch. A

    link is an agent that connects two turtles if there is relation between them.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    36/80

    24 

    Figure 5 NetLogo world [Adapted from Xin and Li, 2008]

    In NetLogo world, the patches can wrap around indicating that when a turtle

    moves to the edge of the world it disappears and then reappears on the opposite end. If

    this approach is used, a one dimensional simulation can be run using a two dimensional

    view box. Time is discrete in NetLogo and turtles act on each tick. A tick represents one

    step of the model, i.e., one cycle of the main loop. Ticks can be either seconds, hours,

    days based on the simulation requirement. If the daily events are simulated, then the time

    scale is one tick per day. If hourly events are simulated, then one tick is an hour. The real

    time the model takes to run is different than the model time. For example, if time scale is

    one tick per year, and the model only takes one second to run, then 100 years simulation

    can be simulated in 100 seconds.

    ,

    (16, 16)

    ,

    (16,16)

    ,

    (16,16)

    ,

    (16, 16)

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    37/80

    25 

    5.3 Input/ Output

    Once the code is finalized, input parameters are provided via various buttons in

    the interface tab. Output from the simulation is viewed in the interface tab without

    changing the window. Basic buttons required for NetLogo are setup and go buttons which

    are created by the user. Other buttons such as sliders, switches, and monitors are created

     by the user based on the requirement. Output plots can easily be exported to an excel

    sheet for further analysis.

    5.4 Problem Description 

    Two problems were simulated using NetLogo and HYDRUS. These two

     problems were adopted from Thoma et al.’s work (1993). Thoma et.al (1993) studied the

    transport of 2, 4, 6-trichlorophenol (TCP), a hydrophobic pollutant released from lake

     bed sediments. The model consisted of a uniformly contaminated layer at the bottom of a

    vertical column; sediment cap layer in the middle, and the water column at the top. The

    sediment cap layer and the water column were initially contamination free. With time, the

    contaminant in the contaminated sediment bed diffused into the cap layer and the water

    column. Two diffusion scenarios were studied. First, the transport of contaminant in

    sediment without capping was studied, and then the transport of contaminant with

    sediment cap was studied. The model results were also compared with lab results, which

    showed good agreement with each other, indicating that the transport mechanism is well

    understood.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    38/80

    26 

    The setup for the current research is similar to that of Thoma et al (1993) but

    without the sediment cap. The transport of H2AsO-4 was studied instead of TCP. The

    molecular diffusion coefficient of the species is 7.82*10-5

    m2/day (Li and Gregory, 1974).

    The problem is analyzed in two parts; first, diffusion of contaminant in water was

    modeled, second, diffusion of contaminant in soil was modeled. Thoma et al. (1993) was

    chosen as one of the standards for verifying NetLogo model because of its focus on

    diffusion process. Alshawabkeh et al. (2005) used the Thoma et al. (1993) model to

    develop criteria for evaluation and design of contaminated sediment. Similarly Valsaraj et

    al. (1997) used Thoma’s equation to study diffusion of organic compounds through

     porous media. Other authors (Valsaraj et al. (1998); Eek et al. (2008); Chen et al. (2009)

    etc.) have also used the concept of Thoma et al. because of the simplicity of problem

    analyzed.

    5.5 Problem 1: Diffusion in water

    5.5.1 Model setup in etLogo

    A beaker of water uniformly contaminated to a certain depth was simulated

    (Figure 6). Initially the two sections of the beaker are envisioned to be separated from

    each other using a thin plate which is then instantaneously removed and with time, the

    chemical diffuses throughout the entire beaker of water. The amount of chemical

    reaching the top of the beaker as a function of time was measured as flux. This basic

    numerical experiment was performed for the preliminary evaluation of NetLogo model.

    The success of this model provides insights into the limitations and strengths of NetLogo

    for modeling the diffusion process.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    39/80

    27 

    Figure 6: Uniformly Contaminated water

    The simulation was performed with an initial contaminant (H2AsO-4)

    concentration of 150mg/L. Therefore, the net concentration (per unit area) in the beaker

    for the depth of 15mm of contaminated layer is 2,250mg/m2

    (150mg/L *103/m

    3*1L

    *0.015)). The dimension in the model is entered as patches and the user decides the unit

    dimension a patch represents. For example, a NetLogo dimension of 20mm can be

     populated with 20 patches each 1 mm2, or 40 patches each 0.5 mm

    2. For the current

    simulation, a total of 120 patches were used which was equivalent to a vertical distance

    of 22mm, therefore the size of each patch was 0.1833 mm. The min-pycor, max-pycor,

    min-pxcor and max-pxcor for the current simulation are -82, 38, -60, and 60 (Figure 7).

    Since the model wraps horizontally (turtles appear on left side of view when it disappears

    on right side), it is considered a 1D model and the horizontal patches were not taken into

    account.

    22

    15

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    40/80

    28 

    Figure 7: Screenshot of Coordinates

    According to Weber (1995), individual molecules inside the beaker have their

    respective kinetic energies and undergo frequent collisions with each other. As a result of

    these collisions, contaminants move in random directions. These resulting collisions carry

    individual molecules from the region of higher concentration to lower or vice versa.

    For the given simulation, the contaminants move randomly inside the beaker

     based on a diffusivity value assigned to them. The diffusivity value is the number of

     patches over which a turtle moves in a tick. Molecular Diffusion coefficient of H2AsO-4 

    is given by

    0.0543mm2/min

    = 0.78 mm2/14.4min

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    41/80

    29 

    =0.78 mm2/tick where, 1 tick = 14.4 min

    =4.3 * 0.1833 mm2/tick

    =4.3 patches/tick  

    Where, 1 patch = 0.183mm

    For the given simulation, the turtles move over 4.3 patches in a tick which is equivalent

    to the diffusion coefficient of H2AsO-4. Equation 5 showed that diffusion coefficient is

    related to the distance travelled by an individual molecule (D= λ 2 Γ). Unlike Brownian

     particles, the contaminants were not assigned individual energies since it added to the

    complexity of the model. Keeping track of energies for each molecule would be

    cumbersome, thus making it difficult to model.

    5.5.2 Sensitivity Analysis

    Since the contaminants were represented as agents in the model, the given

    contaminant concentration (150mg/L) needed to be changed into agent form. Sensitivity

    analysis was performed to obtain a proper balance of data points and runtime. The

    simulation was run with a turtle representing various amounts (100mg, 10mg, 1mg, and

    0.1 mg) of contaminants. For example, when each turtle represented 1mg, 2250 turtles

    were used to represent 2250mg of contaminants. Similarly, when each turtle represented

    10mg, 225 turtles were used to represent 2250mg. The simulation was run 50 times in

    each case to see if the variation increased with run time.

     NetLogo also has built-in randomness, therefore, the simulation results vary slightly each

    time the model is run. After determining the suitable amount a turtle should represent, the

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    42/80

    30 

    same simulation was run over and over to see if randomness increased. The same

    simulation was run 100 times to monitor net randomness of NetLogo model.

    5.5.3 Modeling diffusion in water using HYDRUS

    The HYDRUS program is a finite element model that solves Fickian-based

    advection-diffusion equation for solute transport. The standard diffusion equation in one

    dimension is given by

     

     

    Where Dw [L2/T] is the diffusion coefficient in water and

     is the change in

    concentration with time. Molecular diffusion coefficient of contaminant in water was

    7.82*10-5

    m2/day (Li and Gregory, 1974). Contaminant concentration of 150mg/L was

    entered in the contaminated layer via the graphical editor as shown in Figure 8. The

    contaminated sediment depth was 15 mm and the overall depth of the beaker was 22mm

    as in the NetLogo model.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    43/80

    31 

    Figure 8: Pink represents contaminated water layer and blue represents uncontaminated

    water layer

    The profile window allows the user to define the spatial distribution of

     parameters. All the parameters in this window can be added or edited using the edit

    window. The user selects the part of the domain to add a particular value for the selected

    variable. The profile window is very user friendly; it is possible to select an individual

    node, part of the domain, or the entire domain. For the given simulation, the

    concentration of 150mg/L was assigned by selecting the rectangular domain represented

     by pink as shown in Figure 8. Color-coded window on the left side of the window shows

    the values represented by the domains. Blue represents a concentration of 0 and pink

    represents a concentration of 150mg/L.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    44/80

    32 

    5.6 Problem 2: Diffusion in saturated soil

    5.6.1 Model setup in etLogo 

    In problem 2, diffusion of a contaminant from saturated soil to overlying water

    was simulated. It was assumed that the soil was uniformly contaminated throughout the

    depth of 15mm (Figure 9). The setup is similar to Thoma et al (1993) without a cap

    sediment layer. With time the contaminant diffused into the water. The amount of

    chemical reaching the top of the beaker was quantified as flux. The basic buttons required

    for simulation are ‘setup’ and ‘go’. Other buttons used were ‘porosity’, ‘count agents’,

    and ‘count void spaces’.

    Figure 9: Uniformly contaminated saturated soil 

    Brown patches represented soil and white particles represented contaminant. It

    can be seen that the soil was uniformly contaminated to a depth of 15 mm and the overall

    (15)

    (7)

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    45/80

    33 

    depth of the setup was 22mm. Initially, the water above 15mm was assumed to be

    contaminant free. The porosity of soil was 0.49. The contaminants were uniformly

    distributed throughout the depth. As discussed in section 5.5.1, the contaminants move

    over 4.3 patches at each tick. When the contaminants hit a soil particle (brown patch), it

     bounces off of it at an angle. According to particle-wall collision theory, when a particle

    hits a smooth wall with an angle θ, it rebounds with a reflection angle of (180–θ).

    However, in reality the reflection angle depends on factors such as frictional force, wall

    roughness, and particle spin and is a complicated process (El Hor et al., 2008;

    Sommerfield, 1999). The contaminants also follow particle-wall collision principle

    (Weber, 1996). Therefore, in order to keep the model simple, smooth wall reflection was

    assumed for the current simulation.

    5.6.2 Model setup in HYDRUS

    The standard diffusion equation as discussed in section 5.3.3 was used for

    modeling diffusion in soil. The model setup was similar to diffusion in water. In soil,

    diffusion cannot proceed as fast as it can in water because the contaminants must follow

    longer pathways as they travel around soil particles. To account for this, an effective

    diffusion coefficient is used instead of molecular diffusion coefficient in water.

    The effective diffusion coefficient of a solute in a soil is estimated from the solute's

    diffusion coefficient in water, soil porosity, and soil water content using MQ model

    (Millington and Quirk, 1961). Since the contaminant follow tortuous path in the porous

    soil, the effective diffusivity equation for the simulation is given by De = Dw (ε/τ)

    (Millington and Quirk, 1961) and Tortuosity (τ) is given by

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    46/80

    34 

    τ = ε-1/3

    Therefore, the input parameters for diffusion in soil model are porosity and diffusivity.

    The porosity value of 0.49 and the diffusivity value of 7.82*10-5

    m2/day were used, and

    then the simulation was run for 40 days. The contaminated sediment concentration was

    entered through the graphical editor as shown in Figure 10. Pink represents uniformly

    contaminated soil with depth of 15 mm and the blue domain represents water with depth

    of 7mm.

    Figure 10: Pink represents the contaminated soil layer and blue representsuncontaminated water in HYDRUS setup

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    47/80

    35 

    5.7 Problem 3: Diffusion in saturated soil with varying porosity

    5.7.1 Model setup in etLogo

    In problem 3, diffusion of contaminant from saturated soil to overlying water

    layer was simulated. The setup was similar to problem 2, but with varying porosity.

    Figure 11 shows the model setup in NetLogo. The basic buttons required were ‘setup’

    and ‘go’ buttons. Other buttons used were ‘porosity’, ‘count agent’ and ‘count void

    spaces’.

    Figure 11: Uniformly contaminated saturated soil

    Soil was represented by brown patches and contaminants were represented by

    white particles. The soil was uniformly contaminated to the depth of 15mm. Initially the

    water above 15 mm was assumed to be contaminant free. Lower half of the soil was 30

     percent porous and the upper half of the soil was 49 percent porous. The contaminants

    (7)

    (7.32 )

    (0.4)

    (7.68 )

    (0.3)

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    48/80

    36 

    move over 4.3 patches in a tick as discussed in section 5.6.1.The simulation was

     performed with an initial contaminant concentration (H2AsO-4) of 150mg/L. The net

    concentration in the beaker for the depth of 7.32 mm was 1098mg/m2 

    (150mg/L*1000m3*7.32/1000). Similarly, the net concentration in the beaker for the

    depth of 7.68 mm was 1152 mg/m2 (150mg/L*1000m

    3*7.68/1000).Therefore, the net

    concentration in the beaker was 2250mg/m2.

    5.7.2 Model setup in HYDRUS

    The setup was similar to the setup in 5.6.2 and since the HYDRUS model was

    not able to take varying porosities into account, the molecular diffusion coefficients from

     both of the layers were averaged and entered as follows.

    (3.02*10-5

    m2/day + 1.57*10

    -5m

    2/day) /2 = 2.29*10

    -5m

    2/day.

    The overall depth of the beaker was 22mm and the contaminated sediment depth was 15

    mm as in the NetLogo model (Figure 12).

    Figure 12: Pink represents the contaminated soil layer and blue representsuncontaminated water in HYDRUS setup

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    49/80

    37 

    6. Results and Discussion

    6.1 Results from problem 1: Diffusion in water

    6.1.1 Results from etLogo model

    The results obtained from sensitivity analysis for one turtle representing various

    masses of contaminants are shown in Figures 13, 14, 15, and 16. Figure 13 shows that the

     plot obtained by assigning 100mg to 1 turtle is zigzag in nature. It also shows that when

    the same simulation was run multiple times, the resulting flux varies. For example,

    cumulative flux after 10 days varies from 1950 mg to 2250 mg. The mean value of

    cumulative flux was 2137.5mg in 10days and the standard deviation on 10th day was

    112.5(Table 3). Similarly, when the same simulation was run again with relatively small

    amount representing a turtle, then the curve became smoother as shown in Figure 14.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    50/80 

    Figure 13: 1 turtle e

    simulation 50 timescumulative flux vari

    Figure14 shows t

    much smoother than the

    smoother curves are seen

    16), and the variation aft

    amount a turtle represent

    continuous distribution o

    large number of turtles to

    significantly. The simula

    whereas the simulation r

    approximately 1 and 2 m

    representing 0.1mg, the s

    slower compared to the e

    38 

    uivalent to 100mg. The graph was obtained by

    ith 1 turtle equal to 100mg. The figure showsd between 2050 to 2250 mg after 40 days. 

    at the curve obtained by assigning 1 turtle equa

    ne obtained by assigning 1 turtle equal to 100

    when a turtle was assigned 1mg (Figure 15) an

    r multiple runs was also very small. This shows

    the smoother the curve becomes. A smoother

    data and facilitates easy comparison of data. H

      represent the given concentration slows the si

    ion run time for a turtle representing 100mg wa

    n time for a turtle representing 10 mg and 1 mg

    nutes. However, when the simulation was run

    mulation run time increased to 13 minutes, whi

    arlier cases.

    unning the same

    hat the

    l to 10mg is

    g. Even

    0.1 mg (Figure

    that smaller the

    urve represents

    owever, using a

    ulation run

    s ½ minute,

    were

    ith a turtle

    ch is much

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    51/80 

    Figure 14: 1 turtle repres

    simulation 50 times with

    Figure 15: Plot obtained

    shows some variation am

    .

    39 

    nting 10mg. The graph was obtained by runnin

    1 turtle equal to 10mg.

     by assigning a turtle 1mg each. The plot is smo

    ong the 50 simulations.

    g the same

    th although it

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    52/80 

    Figure 16 : The plot is ob

    and the variation after 50

    Table 3: Mean, Standard

    (mg/m2) for a turtle

    Mass

    equivalent

    1 turtle=

    100mgmean

    std.devCV

    1 turtle=

    10mg

    mean

    std.dev

    CV

    1 turtle=

    1mg

    mean

    stdev

    CV

    1 turtle=

    0.1mg

    mean

    std.devCV

    40 

    tained by assigning 0.1 mg to a turtle. The plot

    simulations is also very small.

    deviation, and Coefficient of Variation (CV) of

    Simulation duration (days)

    1 10 20 30

    375 2137.5 2212.5 2225

    128.17 112.6 74.4 70.710.34 0.05 0.033 0.031

    416.25 2097.5 2182.5 2202.5

    64.79 24.34 23.75 19.82

    0.155 0.011 0.01 0.008

    436.5 2097 2180.3 2204

    16.51 10.9 9.86 6.76

    0.037 0.005 0.004 0.003

    422.96 2094.32 2180.98 2203.74

    6.02 4.08 1.42 1.810.014 0.001 0.0006 0.0008

    s very smooth

    cumulative flux

    40

    2225

    70.710.031

    2210

    13.09

    0.005

    2210.2

    5.86

    0.002

    2209.9

    1.10.0004

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    53/80

    41 

    Table 3 shows that deviation is very high after a day when turtles were assigned

    100mg , but the deviation gradually decreased when turtles were assigned 10, 1, and, 0.1

    mg. When small mass equivalents were assigned to each turtle, the deviation decreased

    along with coefficient of variation. The small CV represents small variation among the

    cumulative flux simulations and indicates a good fit for the current scenario. The table

    obtained displays the expected result, which is also in agreement with Figures13-16 in

    showing reduced variation in data for turtles with smaller concentrations. Based on the

    results obtained it was decided to represent 1 turtle as 1mg for the current model.

    Representing 1 turtle as 1mg yields similar result to the one representing 1 turtle as 0.1

    mg but takes less time to run the simulations.

    The results for 1 turtle representing 1mg obtained by running the same simulation

    multiple times is shown in Table 4 along with mean, standard deviation, and CV values.

    Even after running the simulation 100 times the CV was less than 0.1 and the deviation

    was also small. This confirms that the variation among different simulation runs

    remained negligible when 1 turtle represented 1mg.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    54/80

    42 

    Table 4: Different number of runs with 1 turtle representing 1mg

    6.1.2 Result from HYDRUS model

    Cumulative flux is quantified as the amount of contaminant reaching the top of

    the beaker. Figure 17 shows a steep increase in cumulative flux until day 10 and a

    stabilized flux after that. The contaminants had already reached the top of the beaker by

    the10th

     day, therefore the cumulative flux stabilized. The result obtained from HYDRUS

    was deterministic; therefore, sensitivity and randomness analyses were not performed for

    the given simulation.

    umber Simulation duration (days)

    of runs

    1 10 20 30 40

    10-

    runs 

    mean 436.5 2097 2180.3 2204 2210.2

    Stddev 16.51 10.9 9.86 6.76 5.86

    CV 0.037 0.005 0.003 0.003 0.002

    50-

    runs 

    mean 424.46 2098.1 2182.72 2204.76 2210.74

    Std

    dev. 18.51 12.59 8.53 6.91 6.3

    CV 0.043 0.006 0.003 0.003 0.002

    100-

    runs 

    mean 428.46 2097.03 2180.71 2203.48 2209.93

    Stddev. 18.25 12.41 7.84 6.59 6.47

    CV 0.042 0.005 0.003 0.002 0.002

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    55/80

    43 

    Figure 17: Cumulative flux after 40 days

    6.1.3 Comparison of HYDRUS and etLogo results

    When the HYDRUS and NetLogo results were plotted, a close resemblance was

    found between HYDRUS and NetLogo results. Figure 18 shows that the cumulative flux

     predicted by HYDRUS was higher than the cumulative flux predicted by NetLogo. More

    contaminant particles stayed inside the beaker in the case of NetLogo than in HYDRUS.

    Therefore, the amount of flux from NetLogo results was less than the amount from

    HYDRUS results. For example, the flux after 20 days in NetLogo was 2175mg/m2,

    whereas in HYDRUS it was 2230mg/m2.

    500.00

    0.00

    500.00

    1000.00

    1500.00

    2000.00

    2500.00

    0 10 20 30 40 50

                  

                                      

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    56/80

    44 

    Figure 18: Cumulative flux after 40 days

    When HYDRUS and NetLogo results were plotted against each other (Figure 19),

    a good fit was found between the two models. Again when the results were compared

    with a 45 degree line, NetLogo results slightly underpredicted HYDRUS results.

    Figure 19: HYDRUS vs. NetLogo for diffusion in water

    500

    0

    500

    1000

    1500

    2000

    2500

    0 10 20 30 40 50

                  

                                      

    0

    500

    1000

    1500

    2000

    2500

    0 500 1000 1500 2000 2500

                                                 

    .

    45

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    57/80

    45 

    6.2 Results from problem 2: Diffusion in soil

    6.2.1 Results from HYDRUS and etLogo

    It can be seen from Figure 20 that both models produced similar results during the

    first 10 days but after 10 days flux values from NetLogo were less than HYDRUS. The

    difference in the result obtained was due to the relation on which each model focuses

    upon. For example, HYDRUS results were obtained by assigning diffusivity coefficient

    value and monitoring variability over time by using partial differential equations.

    However, NetLogo results were obtained by allowing each individual contaminant to

    move freely in the porous soil, which produced the given output. Another reason for the

    difference is due to the tortuosity. Tortuosity depends on porosity (i.e. τ = ε-1/3

    ), but

     NetLogo model does not have a specific relation between tortuosity and porosity,

    therefore, the result obtained differ. Also, using the ideal scenario for contaminant

     bouncing may have caused the results to differ. 

    Figure 20: Diffusion in soil 

    500

    0

    500

    1000

    1500

    2000

    2500

    0 10 20 30 40 50

       

               

                                      

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    58/80

    46 

    When HYDRUS and NetLogo results were plotted against each other (Figure 21),

    a good fit was found between the two models. However, when the results were compared

    with a 45 degree line, the NetLogo results underpredicted HYDRUS results most of the

    time. This could be because of contaminants getting trapped inside dead-end pores of soil

    in the case of NetLogo.

    Figure 21: HYDRUS vs. NetLogo for diffusion in soil 

    6.3 Results from problem 3: Diffusion in soil with varying porosity

    6.3.1 Results from HYDRUS and etLogo

    Figure 22 shows that the cumulative flux predicted by NetLogo was higher than

    the cumulative flux predicted by HYDRUS during the first 20 days. This could be

     because in NetLogo model the upper part of the soil was highly porous. This means the

     NetLogo setup has a higher molecular diffusion coefficient initially than that of

    HYDRUS, which uses the average value. Therefore, NetLogo slightly overpredicted

    0

    500

    1000

    1500

    2000

    2500

    0 500 1000 1500 2000 2500

                         

    .

    45

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    59/80

    47 

    HYDRUS results for the first 20 days. The flux values from NetLogo were less than the

    flux values from HYDRUS after 20 days. This could be because of contaminants getting

    trapped inside dead-end pores of soil in the case of NetLogo.

    Figure 22: Cumulative flux after 40 days for diffusion in soil with varying porosity

    500

    0

    500

    1000

    1500

    2000

    2500

    0 10 20 30 40 50

                  

                  

                        

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    60/80

    48 

    7. Conclusion and Future work

    7.1 Conclusion

    This is an exploratory research to model wetland processes using an agent-based

    method. Since modeling wetland processes is a daunting task, only diffusion process was

    modeled. The model results obtained for the diffusion have been verified against

    HYDRUS-1D, a FEM based modeling platform. The results obtained from both models

    for diffusion in water were in good agreement with each other. However, the HYDRUS

    and NetLogo results for diffusion in soil differed. The difference is attributed to tortuosity

    and assumption of simple particle-wall collision of contaminants.

    This is the first time diffusion has been modeled using NetLogo; therefore, much

    emphasis is placed on verifying results with HYDRUS, a popular fate and transport

    modeling platform. While comparing NetLogo results with HYDRUS, it appears that

    HYDRUS is used to determine a time frame that a tick should represent in NetLogo.

    However, both the models were run independently, and comparison was done against

    each other. For the current diffusion model, a tick can represent any period of time (e.g.

    day, year), with the diffusion coefficient changed accordingly. Since HYDRUS was run

    with a time increment of 14.4 minutes, a tick for the current NetLogo model represented

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    61/80

    49 

    14.4 minutes. Both models were run upto a period of 40 days with a time increment of

    0.01 days or 14.4minutes.

    7.2 Future Work

    Representing a soil matrix is a complex process in which organic matter, mineral

    (sand, silt, and clay) and micro-pores and macro-pores are organized differently

    according to their size. The soil model can be further developed by adding effects of

    organic matter, and micro and macro-pores. Furthermore, more research is needed to add

     processes such as adsorption-desorption, redox to the existing model simultaneously

    along with diffusion. 

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    62/80

    50 

    References

    Alhumaizi, K., 2004. Comparison of finite difference methods for the numerical

    simulation of reacting flow. Computers and Chemical Engineering., 28:1759-1769

    Alshawabkeh, A.N., Rahbar, N., and Sheahan, T., 2005. A model for contaminant mass

    flux in capped sediment under consolidation. J. Contam. Hydrol., 78:147-165.

    Bastian, R.K., and Hammer, D.A., 1993. The use of constructed wetlands for wastewater

    treatment and recycling. In: G.A. Moshiri, Editor, Constructed Wetlands for Water

    Quality Improvement, Lewis Publishers, Ann Arbor: 59–68.

    Bennett, C.H., 1975. Diffusion in Solids – Recent Developments, A.S. Nowick, J.J.

    Burton (Eds.), Academic Press, Inc.

    Berryman,M., 2008. Review of Software Platforms for Agent-based Models, Defense

    Science and technology operation, Land Operations Division, Edinburgh, Australia: 9-15.

    Bonabeau, E., 2002. Agent-based modeling: Methods and techniques for simulating

    human systems. Proceedings of the National Academy of Sciences, 99:7280-7287.

    Botte,G. G., Ritter, J. A., and White, R.E. 2000.Comparison of finite difference and

    control volume methods solving differential equations. Computers and Chemical

    Engineering., 28:597-603

    Buddhawong, S., Kuschk, P., Mattusch, J., Wiessner, A. and Stottmeister, U., 2005.

    Removal of arsenic and zinc using different laboratory model wetland systems. Eng. Life

    Sci., 5:247-252.

    Bulavin, L.A., Lokotosh, T.V. and Malomuzh, N.P., 2008. Role of the collective self-

    diffusion in water and other liquids. Journal of Molecular Liquids, 137:1-24.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    63/80

    51 

    Cameron, K., Madramootoo, C., Crolla, A., Kinsley, C., 2003. Pollutant removal for

    municipal sewage lagoon effluents with a free-surface wetland. Water Res., 37: 2803– 

    2812.

    Casti, J. L., 1998. Would-Be Worlds: How Simulation is changing the Frontiers of

    Science, John Wiley & Sons Ltd, New York.

    Chen, Y.M., Xie, H.J., Ke, H. and Chen, R.P., 2009. An analytical solution for one-

    dimensional contaminant diffusion through multi-layered system and its applications.

    Environ. Geol., 58:1083-1094.

    Chitnis, A.B. and Itoh, M., 2004. Exploring alternative models of rostral-caudal

     patterning in the zebrafish neurectoderm with computer simulations. Curr. Opin. Genet.

    Dev., 14:415-421.

    Crites, R., and Tchobanoglous,G.,1998.Small and decentralized wastewater management

    systems,McGraw-Hill,Boston

    Damaceanu, R.C., 2008. An agent-based computational study of wealth distribution in

    function of resource growth interval using NetLogo. Appl. Math. Comput., 201:371-377.

    DeAngelis, D.L., Mooij, W.M. 2005. Individual-based modeling of ecological and

    evolutionary processes. Annual Review of Ecology, Evolution, and Systematics., 36:147-

    168.

    Dixit, S., and Hering, J.G., 2003. Comparison of arsenic (V) and arsenic(III) sorption

    onto iron oxide minerals:Implication of arsenic mobility. Environ. Sci. Technol.,

    37:4182-4189.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    64/80

    52 

    Dyke, H. V., Savit, R., and Riolo, R. L., 1998 “Agent-based modeling vs. equation-based

    modeling:A case study and users’ guide”, Proceedings of Workshop on Modeling Agent-

     based Systems:10-25.

    Eapen, B.R., 2009. Agent-based model of laser hair removal: A treatment optimization

    and patient education tool. Indian J Dermatol Venereol Leprol, 75:383-7

    El Hor, H. and Linz, S.J., 2008. Bounce of a particle: Oblique impact on structured

    surfaces. Chaos Solitons & Fractals, 36:73-81.

    Eek, E., Cornelissen, G., Kibsgaard, A. and Breedveld, G.D., 2008. Diffusion of PAH

    and PCB from contaminated sediments with and without mineral capping; measurement

    and modelling. Chemosphere, 71:1629-1638.

    Fetter, C. W. 1993. Contaminant Hydrogeology. Macmillan Pub. Co.

    Flynn, C.P., 1972. Point Defects and Diffusion, Clarendon Press, Oxford.

    Forrester, J. W.1971. World dynamics. Cambridge: MIT Press.

    Franklin, W.M., 1975. Diffusion in Solids – Recent Developments, A.S. Nowick,

    J.J. Burton (Eds.), Academic Press, Inc.

    Freeze, R. A., and Cherry, J.A., 1979. Groundwater Prentice-Hall, Inc., Englewood

    Cliffs, NJ, 604 pp.

    Garcia, J., Aguirre, P., Mujeriego, R., Huang, Y., Ortiz, L., Bayona, J., 2004. Initial

    contaminant removal performance factors in horizontal flow reed beds used for treating

    urban wastewater. Water Res., 38:1669–1678.

    Gary, A., and Wilensky, U., 2009. From Artificial Life to In Silico Medicine. Springer

    London. 183-214.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    65/80

    53 

    Gujer, W., 2002. Microscopic versus macroscopic biomass models in activated sludge

    systems. Water Sci. Technol. 45: 1–11.

    Green, M.B., Griffin, P., Seabridge, J.K., Dhobie, D., 1997. Removal of bacteria in

    subsurface flow wetland. Water Sci. Technol. 35, 109–116.

    Goulet, R.R., Pick, F.R. and Droste, R.L., 2001. Test of the first-order removal model for

    metal retention in a young constructed wetland. Ecol. Eng., 17:357-371.

    Hellweger, F.L., 2007. Is it time to abandon the chemistry approach to biogeochemistry?

    Water Environment Federation, WEFTEC 0.7, 5646-5665.

    Hellweger, F.L., and Kianirad, E., 2007. Accounting for intrapopulation variability in

     biogeochemical models using agent-based methods. Environ. Sci. Technol., 41:2855-

    2860.

    Kadlec, R.H., Reddy, K.R., 2001. Temperature effects in treatment wetlands. Water

    Environ. Res., 73: 543-557

    Kalbitz, K., and Wenrich, R., 1998. Mobilization of heavy metals and arsenic in polluted

    wetland soils and its dependence on dissolved organic matter. Sci. Total Environ. 209:

    27–39.

    Kao, C.M., Wu, M.J., 2001. Control of non-point source pollution by a natural wetland.

    Water Sci. Technol., 43: 169–174.

    Krishna,R., and Wesselingh,J.A.,1997.The Maxwell-Stefan approach to mass

    transfer.,52:861-911.

  • 8/19/2019 Modeling Diffusion Using an Agent-based Approa

    66/80

    54 

    La Force,M.J.,Hansel,C.M