Drift‐foraging, a behavior by which fish capture drift‐born prey items from the water column, is a commonly observed feeding behavior among salmonid species. Salmonids are often observed holding positions in slower velocities while making feeding forays into faster waters with relatively higher prey deliver rates. It is believed that this behavior minimizes energetic expenditures due to swimming (by favoring positions sheltered from the fastest velocities when not actively capturing prey items) while simultaneously maximizing potential energy intake (by capturing and ingesting prey items from the higher prey delivery rates of adjacent faster waters).
Fish ecologists have attempted to model, quantitatively, the energetic tradeoffs of drift‐foraging. Such efforts typically estimate the energy gain from foraging and the energetic costs of swimming, and then they difference the two to estimate net rate of energy intake (NREI). NREI is usually expressed in units of energy per unit time, and it represents the net energy balance a drift‐forager could hope to obtain at a given foraging location per unit time of foraging effort. Fausch {}, Hughes and Dill {}, and Hill and Grossman {} pioneered studies linking NREI to foraging position selection in a variety of lotic settings, and others have since linked NREI to both habitat quality {} and capacity {}.
NREI models typically integrate multiple sources of information to produce NREI estimates. Characterization of depths and velocities near the foraging point of interest, information about the sizes and concentration (individuals/m3) of drifting invertebrates, and an estimate of fish length all serve to inform a foraging model. Velocity at the foraging point, water temperature, and an estimate of fish weight serve as inputs to a swim costs model that predicts the energetic costs of swimming at the foraging location. Because NREI modeling integrates a template of physical habitat (i.e., a map of depths and velocities derived from hydraulic modeling and a CHaMP DEM) with important biological variables (e.g., water temperature, prey concentration, and fish size) to characterize the energetic quality of habitat, NREI has potential as a tool to integrate multiple CHaMP data products in order to produce metrics related to growth potential and energetic habitat quality.
The Columbia Habitat Monitoring Program (CHaMP){} and The Integrated Status and Effectiveness Monitoring Program (ISEMP){} have funded an implementation of NREI modeling for use under the greater CHaMP/ISEMP research umbrella. The model is implemented in R {}, a free and open‐source statistical scripting language. The model uses CHaMP‐standard Delft3D outputs to characterize flow fields near potential foraging points throughout CHaMP reaches, and it has been customized to work with other CHaMP data products. The model allows multiple z foraging positions throughout the water column, which may be important in streams having deep pools {}, and it estimates NREI for many combinations of fish size, water temperature, and prey concentration from a single simulation (rather than one simulation for each unique combination of those inputs).
This document is intended as a user’s guide for distribution with the CHaMP/ISEMP NREI model files.
You will need the free statistical software R installed on your computer to use the NREI model scripts. To install R, go to https://cran.r‐project.org/ and install the latest version. You will also need to install Rtools, a set of tools designed for R developers. This is necessary so the NREI scripts can compress (i.e., zip) some of the larger model outputs to save space on your computer. To install R tools, go to https://cran.r‐project.org/bin/windows/Rtools/ and follow the installation instructions. Other R packages necessary for NREI simulations (i.e., extra tool sets not included in the base distribution of R) will be installed when you run the model.
runNreiMultiFish.R
and
nreiFunctionsMultiFish.R
scripts. If you wanted to permanently implement a change to the code for all future simulations, you would open the scripts here, make the change, and then save the new versions with an appropriate filename. Similar (superior) functionality could also be achieved using git or another version tracking software.runNreiMultiFish.R
to work with your existing file structure.runNreiMultiFish.R
script (copy it from the code folder), an input lookup table (this will be explained later), and any other simulation‐related notes that may be needed for later reference (e.g., methodology of your simulations). In depth analyses of the model itself may, from time to time, require copying the nreiFunctionsMultiFish.R
script to this folder as well in order to make changes to the model’s functions, but this not necessary for routine NREI analyses.Before your first NREI simulation, it is a good idea to briefly familiarize yourself with the model’s scripts and input files.
The NREI model has two main scripts. The first script, nreiFunctionsMultiFish.R
, contains the functions necessary for calculating NREI. The second script, runNreiMultiFish.R
, reads inputs, estimates NREI, and then writes model outputs to file.
Each NREI simulation requires an input table. Each row of the required input table contains the inputs for a single NREI simulation. To see an example input lookup table, navigate to the directory simulations/firstNreiSim_26May2016 and open exampleInlookTab.csv in Excel. You will notice that exampleInlookTab.csv only has a single row (i.e., NREI will only be simulated for one CHaMP visit using this table), but users can batch‐process multiple CHaMP visits by creating similar input lookup tables with multiple rows. The columns VisitID, WatershedName, SiteName, VisitYear, Grad, Area_Wet, DpthBf_Avg, and SubD50 can be found in standard data exports available from champmonitoring.org. The columns est.grid.size, est.sim.duration.h, kroughness, grdreductionfactor, DZ, zreductionfactor are calculated using the Grad, Area_Wet, DpthBf_Avg, and SubD50 columns (described in more detail in Appendix XX). The kSpecies column is used to create a folder in the output file structure that corresponds to the species being modeled. Note that changing this value simply changes the name of a folder that will be inserted in the output file structure. Currently, it does not influence parameters or equations used in the model, although this functionality could be added in the future. The column kPreyLength contains the length of a representative drifting prey item (in meters) and, generally speaking, should not be changed. If you do need to change the kPreyLength value, you will also need to change corresponding lines of runNreiMultiFish.R
(see Appendix XX). Further information on column names and their units as well as creating input lookup tables can be found in Appendix XX.
NREI simulations require depth‐averaged 2D hydraulic model output from Delft3D to characterize depths and velocities throughout CHaMP reaches. To see an example, navigate to the directory data_in/champ/unzipData/JohnDay/CBW05583‐ 240498/2012/VISIT_960 and open the dem_grid_results.csv file in Excel. Each row of dem_grid_results.csv contains select hydraulic model outputs for one wetted raster cell. During NREI simulations, the NREI model will read the contents of dem_grid_results.csv and use its data to interpolate depths and velocities near simulated foraging locations throughout the CHaMP reach being modeled. For information on how to populate the data_in folder with appropriate hydraulic outputs for other CHaMP visits, see Appendix XX.
Once you have an appropriate input lookup table (provided with the example files), you are ready to begin using the model. To simulate NREI for the provided example files:
runNreiMultiFish.R
from the code/nrei folder to the simulations/firstNreiSim_26May2016 folder.runNreiMultiFish.R
. Preferably, you’ll want a text editor with syntax highlighting for R scripts (e.g.,
Notepad++), but you could also open the script in the R console.inputs.dir
(line 30) should point to the high level directory containing the unzipped Delft3D solution files (e.g., C:/data_in/champ/unzipData).
b. The variable outputs.dir
(line 31) should point to the directory where model outputs are to be written. Note that if you provide a directory that doesn’t exist, it will be created for you upon running the NREI scripts.
c. The variable nrei.func.fn
(line 32) should be the full file path of the nreiFunctionsMultiFish.R
script on your hard drive.
d. The variable in.look.tab (line 54) should be the full file path of the input lookup table you wish to use. For the example files, it should point to exampleInLookTab.csv.sim.cores
(line 88) indicates the number of processor cores to be used during simulation. While, in general, distributing the workload across multiple processor cores can decrease the time needed for simulation, there can be a point of diminishing returns and you cannot utilize more cores than your computer has. You can find instructions online to identify the number of processor cores your computer has. Choose a number based on your goals for simulation (i.e., speed vs. using your computer for other things while simulations are running).runNreiMultiFish.R
, and then open the script in R (if you haven’t already).ctrl + a
to select the entire script, then press ctrl + r
to send the highlighted text to the R interpreter and begin
the simulation. Note: the script can also be run block‐by‐block if desired.
Note: Users may also wish to activate/deactivate certain model outputs or alter the default fish size, water temperature, or drifting prey concentration values in the model. See below for more information.for OSX need:
brew install unixodbc