Model Connection Instructions

The transfer requires three files and a point source option:


The three files are:


  1. A file with the geographic relationships between the phase 5 segmentation and the estuarine model segmentation
  2. The connection between the two variable types
  3. A fortran code fragment to output the data in your format
  4. 
 



Once you have compiled these files, please send them to Gary Shenk (GShenk[AT]chesapeakebay[DOT]net) or Jing Wu (JWu[AT]chesapeakebay[DOT]net) for processing.

1. Connections:
A file like p5_to_57k_wqm.prn will be needed. This is a free format. 
To create this file, you'll need to download the following coverages and instructions:

Download River Segs

For each river segment with the DSID = 1 or 0001, determine the estuarine cell or cells that this drains into. Store the UNIQID, the estuarine cell, and the fraction of the riverseg that goes into the estuarine cell. This fraction will normally be 1.0, but there may be places where you have more than one cell at the furthest upstream point.

Download LRseg

For each LRseg with the DSID = 0 or 0000, determine the estuarine cell or cells that this drains into. Store the UNIQID, FIPS, the estuarine cell, and the fraction of the LRseg that goes into the estuarine cell. 


There is one line for each of your cells which receive input.
column 1: your cell name, integer or character
column 2: the number of phase 5 segments (riversegs + LRsegs) that load to the cell in column 1 
columns 3-5, 6-8, 9-11, etc:
working in groups of three, give the:


One way to perform this task relatively easily would be to download the segments for Carl Cerco’s 57k estuarine model and create a crosswalk between your model and Carl’s.
Download 57k segments





2. The connection between our variable types:

Using the variables in the ‘NAME’ column of file rchres_out_3x, construct a file like river_to_wqm57lNPS (give it a different name) that has the variables you want in the units you want. 
The first two columns are for you to specify whatever you want. You can use any 4-character variable names that you want. The units column is just for clarity, conversions are not automatic. The last four are the directions on how to make those from the variables in rchres_out_3x.
 
Note that the BOD is a constituent of ORGP, ORGN, and TOC. The TOC calibration is poor, so you may do better using a ratio of our organic nitrogen.



3. Output format for input to your model:
The variables are stored daily. You can get any temporal aggregation of daily values NOTE: nBvar in the code below is the number of variables specified in the attached 
river_to_wqm57lNPS file
.

The default is the following:

******** loop over years making a file for each year

do ny = year1,year2

*********** name the annual file

 fnam = 'wsm57k_wsm_nps.YY'
! open file

write(fnam(14:17),'(i4)') ny

 fnam(14:15) = 's.'

********** place the file in the phase 5 output structure
fnam = '../out/'//rscen(:lenrscen)//'/'//fnam

*********** open the annual file

open(dfile,file=fnam,status='unknown',iostat=err)

if (err.ne.0) go to 991

print*,'writing file ',fnam(:50)

*********** loop over days in the year and write output for
********** each cell and day
year = ny

month = 1

day = 1

do nd = 1,ndaysinyear(ny)

do nc = 1,ncells

write(dfile,1234)
 .
cell(nc),year,month,day,(wq(nd,ny,nc,nq),nq=1,nBvar)

end do

call tomorrow(year,month,day)

end do

close(dfile)


 end do


Point source option
We also have to know how to handle point sources located in the lrsegs that have DSID = 0000 identified above. For CE-QUAL-ICM we output a separate point source file. For other models there would be 2 options.

  1. Supply them yourself. The CBP would supply only nonpoint source in those areas.
  2. Incorporate the point sources into the output based on the LRseg location of the point source.