Idealized Migration Model

This model demonstrates the basic concept of an idealized migration model through a habitat zone.  In this context, the habitat zone is a "lake" and the migratory subjects are juvenile salmon called smolts. Individuals enter the habitat zone -- the square "lake" in this example -- from its tributaries (here represented by a single channel "in" ) and leave the habitat zone. This is also an illustration of a larger concept -- that of a compartmental model in which some substance enters the compartment from external sources and exits through other portals.

powered by NetLogo

view/download model file: MigrationConcept.nlogo


HOW IT WORKS

The setup command initializes the system and the plots, after which "go" repeatedly generates smolts entering the lake at the expected rate shown on the slider and exiting at the rate E indicated by the plots and monitors.


HOW TO USE IT

One the Setup command has been executed, simply press go to set the simulation in motion. The simulation advances in ticks, and the slider ticks-per-unit-time allows the number of ticks corresponding to a unit of time to be adjusted. The flow rate determines how much the water flow influences the smolts in the lake. At a rate of 1.00, the smolts almost certainly follow the flow, whereas at 0 the smolts in the lake move randomly independently of the flow.


THINGS TO NOTICE

The basic idea that this simple model seeks to illustrate is that the population reaches an equilibrium when the rates I and E are approximately the same. Also, it is important to notice that the relative rate of emigration is more or less constant throughout the simulation. This means that this type of density-dependent migration can be modeled by
a differential equation of the form dN/dt = I - m N, and thus that the equilibrium is approximately I / m.


THINGS TO TRY

Try varying the expected number of arrivals per unit time. Also, try changing the relative rate of flow of the smolts (relative to the flow of the lake, that is).


RELATED MODELS

This model created by Dr. Jeff Knisley as part of the Symbiosis project module on migratory models in differential calculus. It is one of the simulations located at http://math.etsu.edu/symbiosis/migrations.


PPROCEDURES

globals [ from0to1 MaxDist Current-Time Previous-Time AllTime N0P N1P m0 m1 
          Arrivals-per-unit-time Departures-per-unit-time IMI EMI Deaths-per-tick ]

patches-own [ iswater? inlake? pzone flow-heading flow-strength ] ; flow-strength is 0 to 1, percentage of main-channel flow speed
turtles-own [ zone ]

to setup
  clear-all
  
  set from0to1 0 
  set Previous-Time 0
  set Current-Time 0
  
  setup-patches
  set Arrivals-per-unit-time [ 0 ]
  set Departures-per-unit-time [ 0 ]
  set N0P [ 0 ]
  
  set-current-plot "N(t)"   
  plotxy 0 0
  
end



to setup-patches 
  ;set source info and zone transition points
  ask patches 
  [ 
      ifelse ( pxcor >= min-pxcor and pycor > -4 and pycor < 4 ) 
       [ set pcolor blue
         set iswater? true 
         set inlake? false
         set pzone 0
         set flow-heading 90   
         set flow-strength 1     
       ]
       [ set pzone -1 
         set iswater? false
         set inlake? false 
       ]
   ]
  make-compartment   min-pxcor + 4  max-pxcor  1 
    
end
      
to make-compartment [ L R zn ]
  let U max-pycor
  let B min-pycor 
  set MaxDist sqrt ( ( R - 4 - L ) ^ 2 + U ^ 2 )
  ask patches [ 
    if ( pxcor >= min-pxcor and pxcor >= L and pxcor < ( R - 4 ) and pycor < U and pycor > B ) 
       [ set pcolor blue
         set iswater? true
         set inlake? true 
         set pzone zn
         set flow-heading towardsxy ( R - 4 ) 0   
         set flow-strength 1 - sqrt ( ( pxcor - R ) ^ 2 +  pycor ^ 2) / MaxDist      ]  
    if ( pxcor <= R  and pxcor >= ( R - 4 ) and pxcor <= max-pxcor and pycor > -4 and pycor < 4 ) 
       [ set pcolor blue
         set iswater? true 
         set inlake? false
         set pzone 2
         set flow-heading 90   
         set flow-strength 1     ]
  ]
  
end 



to go 
   set Deaths-per-tick 0
   ask turtles [
      if ( random-float 1 < 1 / ticks-per-unit-time ) 
        [ smoltMove
          smoltLearn
        ]
   ]
   smoltMake 
   smoltCount 
end 

to smoltMove 
   rt random 90
   lt random 90
   let p [ flow-strength ] of patch-here
   if( [ pzone ] of patch-here >= 0 ) [ set p p * Relative-Flow-In-Lake ] 
   ifelse ( heading <  270 ) 
     [ set heading ( ( 1 - p ) * heading + p * ( [ flow-heading ] of patch-here )  ) ]
     [ set heading ( ( 1 - p ) * heading + p * ( [ flow-heading ] of patch-here + 360 ) ) ]
   if not ( member?  patch-ahead 1  neighbors with [ iswater? ] ) 
     [  set heading towards one-of neighbors with [ iswater? ]  ]
   fd 1
   
   set zone [pzone] of patch-here

   if ( xcor >= max-pxcor ) 
     [  die 
        set Deaths-per-tick ( Deaths-per-tick + 1 ) ]
   
end

to smoltMake 
  if( random-float 1 < Expected-Arrivals-per-unit-time / ticks-per-unit-time ) 
    [ create-turtles 1  
        [   
           set shape "fish"
           set color green
           setxy min-pxcor 0
           set heading 90 
           set zone 0
        ]
    ]
  
end  

to smoltCount 
  tick
  
  set Current-time ticks / ticks-per-unit-time  
  set Arrivals-per-unit-time lput count turtles with [ zone = 0 ] Arrivals-per-unit-time
  set N0P lput count turtles with [ zone = 1 ] N0P
  set Departures-per-unit-time lput ( Deaths-per-tick + count turtles with [ zone = 2 ] ) Departures-per-unit-time
    
  if( Current-Time < Previous-Time ) 
    [ clear-all-plots 
      reset-ticks  
      set Current-Time 0
    ]
  
  set-current-plot "N(t)"   
  plotxy Current-Time last N0P
  
  set-current-plot "Rates I (blue) and E (red)" 
  if( last N0P > 0 and Current-Time > 0 ) 
     [ set IMI precision ( sum Arrivals-per-unit-time / ( length Arrivals-per-unit-time ) / 11 ) 5 
       set EMI precision ( sum Departures-per-unit-time / ( length Departures-per-unit-time ) / ( 7 + 3 * Relative-Flow-In-Lake ) ) 5 
       set m0  precision ( EMI / last N0P ) 5
       set-current-plot-pen "I"
       plotxy Current-Time IMI
       set-current-plot-pen "E"  
       plotxy Current-Time EMI 
     ]
     
  
  if( length N0P > ticks-per-unit-time ) 
     [  set N0P remove-item 1 N0P
        set Departures-per-unit-time remove-item 1 Departures-per-unit-time
        set Arrivals-per-unit-time remove-item 1 Arrivals-per-unit-time
     ]
      
  set Previous-Time Current-Time 
  
end

to smoltLearn
   ; Zone number, simple flow concept means no going to earlier zone /font>
   
end