CHyM model Version 5.00 documentation
Source code available for local users only
The basic equations of CHyM model are available here.
Last update: February 19, 2022.
This page is organized with four different tables. In the first table the general purpose routines available in the chym library are listed and documented. In the second table a complete description of CHyM internal flags written in the header of the output file is reported. In the third table the CHyM script parameters are listed and described. The table 4 lists the arrays used inside CHyM fortran code and related meaning. The documentation of CHyMLab utility is now also available.
General concept about the use of CHyM model
Run o restart
CHyM model
CHyM model can be runned for a new simulation or restared form a previous output depending on the script flag RESTART descript in the third table.
  • RESTART = 0 means that a new run is started and a new output file must be created. The static fields are calculated from the CHyM database and dynamical fields are initialized with a null value, more specifically the arrays port, gh2o, bwet, deepw and snow are set to zero. Of course, in this case, an adeguate phase of spin-up is needed before resonable values of dynamical fields are reached.
  • RESTART = 1 means that a new run is started and a new output file must be created, but the domain and the resolution is the same of a previous simulation. In this case the static fields are read from the specified by RFILE script parameters. In order to avoid confusion and not coeherent definition of different parameters, CHyM code check, after acquiring the script parameters, that the parameters NLON, NLAT, SLON, SLAT and DIJ are the same of the domain with which RFILE file has been produced; if this is not the case, an appropriate errore massage is displayed and code is stopped.
    The dynamical fields are initialized with a null value, more specifically the arrays port, gh2o, bwet, deepw and snow are set to zero and, also in this case, an adeguate phase of spin-up is needed before resonable values of dynamical fields are reached.
  • RESTART = 2
    ....to be completed....
    CHyM model also creates a file for a "quick" restart. The filename is created
Table 1. General purpose fortran subroutine included in the CHyM library
Reading CHyM output file
chymreadstaticfields([lun/file],[flag]) Read from the source specified by the first argument the CHyM static fields. This data will be stored in the arrays defined within the chymdata module. This subroutine also read the header of the file containing the vectors mchym, rchym and schym.
chymreadstaticfields is actually an interface (means that the name of the subroutine is the same, but you may invoke it using a different combination of arguments) and you may invoke it in four different ways namely specifying the file name or logic unit (first argument) and specifying (or not) a two digit integer option as second argument; if the second argument is not specifyed the value 00 for it is assumed.
  • If an integer is passed as first argument the fields are read form this logic unit; if a string is passed as first argument, the subroutine assumes that this argument specifyes the filename to be opened in a free logic unit, in this case the the file is closed after reading the fields.
  • Valid options for the integer flag are 00, 01, 10 and 11. More specifically: If the second digit is = 1, this subroutines check whether or not the parameters defining the grid written in the file corresponds to the grid defined by the parameters that are currently stored in the mchym/rchym vectors (this option is usually used by CHyM model in order to restart from a previous run); if the first digit is 1 a short list of info is given on standard output, specifying the grid and other informations about the CHyM output you are reading.
The subroutine chymreadstaticfields provides a very simple way to retrieve the basic fields of a CHyM simulation. As an example to plot the DEM of the selected domain only a three-line program is needed:
	use chymdata , only : chymreadstaticfields
	call chymreadstaticfields('tmp/Po.chym')
	call chymplot(1,'dLl')
       
chymreaddynamicfields(lun) Read from the logic unit specified by the argument the CHyM dynamical fields and store them in the arrays defined within chydata module; each time you invoke this routine the next time step is read and variable time is also updated. If the CHyM grid is not yet defined this routine also call chymreadstaticfields in order to define it; to plot and manage dynamical is consequently very simple, as an example to plot the rain at the first time step, the following few lines are enough:
	open(10,file='../chym/tmp/test.chym',status='old',form='unformatted')
	call chymreaddynamicfields(10)
	call chymplot(6,'dLlc2')
	
You may also manipulate the data stored in the CHyM module, adding the use statement in your code and specifying the list of arrays you want to manipulate, these arrays are descript in the table 4, the list also includes two "work arrays" wkm1 and wkm2, you may want to use these arrays insteand to define an new allocatable array as in the example reported below. In the following example the plot of cumulative rain is produced.
	use chymdata , only : rain,nlon,nlat,mchym,chymreadstaticfields
	real , allocatable , dimension(:,:) :: myrain
	open(10,file='../chym/tmp/test.chym',status='old',form='unformatted')
	call chymreadstaticfields(10)
	allocate(myrain(nlon,nlat)) ; myrain=0
	do i=1,mchym(6)
	   call chymreaddynamicfields(10)
	   myrain=myrain+rain
	enddo
	rain=myrain
	call chymplot(6,'Llc2')
	call displayplot(' ','Total accumulated rain',' ')
	
The list of table 4 also includes two "work arrays" wkm1 and wkm2, you may want to use these arrays insteand to define an new allocatable array as in the previous example as follow.
	use chymdata , only : rain,wkm1,nlon,nlat,mchym,chymreadstaticfields
	open(10,file='../chym/tmp/test.chym',status='old',form='unformatted')
	call chymreadstaticfields(10)
	wkm1=0
	do i=1,mchym(6)
	   call chymreaddynamicfields(10)
	   wkm1=wkm1+rain
	enddo
	rain=wkm1
	call chymplot(6,'Llc2')
	call displayplot(' ','Total accumulated rain',' ')
	
The following routines are usually automatically called by the previous two and not by the users.
chymheader(iunit) Read from the logic unit specified by the first argument the header of CHyM output files. Informations are stored in the vectors mchym, rchym and schym defined in the chymdata module.
chymreadpar(iunit,mchym,rchym,schym,ndat) Read from the logic unit specified by the first argument the header of CHyM output files. The header of such files contains all the information about the run that produced the file. See the description of vectors mchym, rchym and schym in the table below. Please note: in the current version: the integer input parameter ndat must be set to 50, and all the output vectors must be dimensioned 50 as follow:
integer mchym(50) ; real rchym(50) ; character schym(50)*50
chymreadrec(iunit,fld,source,vect,ildate) Read from the logic unit specified by the first argument the CHyM field specified by the second character argument. The static and dynamical fields saved in the output file are listed in the elements of string vector schym (see the table below). The string output argument source will contain the source of the retrieved array (as an example: "CHyM" or "USGS" etc...), the array vect will contain, as output, the retrieved array, the integer ildate will contain, as output, the coded value of the date.
The following two routines allow to create a netcdf file containing a CHyM field and are available only if netcdf library are available in the used platform
call chym2nchead(ncs,nci,ncr)
call chym2ncfield(field,ncs,nci,ncr)
chym2nchead and chym2ncfield allow to create a netcdf file containing a CHyM field. The first is used to create (or overwrite) the file, the second one is used to add the field time slice(s).
The real array field(nlon,nlat) contains, as input, the field; ncs,nci,ncr are three vectors dimensioned character ncs(10)*32 ; integer nci(10) ; real ncr(10). The meaning of the each component is specified in the following table.
Component ncs nci ncr
1 I/O filename Number of time slices to write in the nc file NOT YET USED
2 Short name of the field as an example "rain" Coded value of first saved time slice; usually CHyM variable: mchym(4)
3 Unit as an example "mm/h" Number of the current time slice to save (1, 2, ....nci(1))
4 Long name of the field as an example "Precipation field" Coded value of current time to save, usually the same of CHyM variable: time
5 NOT YET USED NOT YET USED

The following example shows how to save the precipitation fields from CHyM output

	use chymdata , only : chymreadstaticfields,mchym,temp,time
	integer i,,nci(10) ; real ncr(10) ; character ncs(10)*32
	open(10,file='tmp/oprun03.chym',status='old',form='unformatted')
	call chymreadstaticfields(10)
	ncs(1)='temp.nc' ; ncs(2)='temp' ; ncs(3)='degree (K)' ; ncs(4)='Temperature'
	nci(1)=mchym(6) ; nci(2)=mchym(4)
	call chym2nchead(ncs,nci,ncr)
	do i=1,mchym(6)
	   call chymreaddynamicfields(10)
	   nci(3)=i ; nci(4)=time
	   call chym2ncfield(temp,ncs,nci,ncr)
	enddo
	end
        
Routine to calculate specific fields
bddfield(thresh) This routine calculate the bdd matrix from the current value of port array. The threshold value passed as argument represent the minimum value of drained area below which bdd array is set to the special value -9999; if a value lower than zero is passed, this value is calculated as a function of longitude resolution, in this case the threshold will be 25 Km2 for a resolution of 0.006 and will increase or decrease accordingly. An example of how to calculate and plots bdd follows:
	use chymdata , only : chymreadstaticfields
	open(10,file='tmp/oprun03.chym',status='old',form='unformatted')
	call chymreadstaticfields(10)
	call chymreaddynamicfields(10)
	call bddfield(-1.0)
	call chymplotbdd('Lldm0M200c2')
	end
       
caiindex(flag,thresh) This routine calculate the CAI alarm index, from the accumulated rain.
Please carrefully consider that the calculated field is stored in the array bdd, and therefore the field previously calculated with bddfield routine IS LOST.

If the integer flag passed as first argument is zero, the array is not calculated, but the rain is accumulated in the appropriate array allocated by caiindex. The CAI alarm index is actually calculated only if the flag is non-zero; note that you may calculate CAI index, in an consistent way, only if you accumulated the rain for a number of hour at least equal to the highest value for average runoff speed for the simulated domain; as an example, if the maximumum value for average runoff speed is 50, you have to call caiindex at least 50 times with flag=0, before to actually calculate CAI index (with flag=1), if this is not the case a warning message is provided by caiindex subroutine.

The threshold value passed in the second argument represents the minimum value of drained area (Km²) below which cai array is set to the special value -9999; if a value lower than zero is passed, the valid range will be between zero and the absolute value of the threshold passed as second argument (this will be a possible application for landslide prediction). An example of how to calculate and plots CAI index follows:
	use chymdata , only : chymreadstaticfields
	areath=25.0
	open(10,file='tmp/oprun03.chym',status='old',form='unformatted')
	call chymreadstaticfields(10)
	do i=1,100
	   call chymreaddynamicfields(10)
	   call caiindex(0,areath)
	enddo
	call caiindex(1,areath)
	call chymplot(29,'Lldc2')
	end
       
Two examples obtained whit a positive and negative value of area threshold are shown below.
chymrunoffspeed Calculate the runoff speed and the lenght of river path along each cell (arrays alfa and dx), it is usually called by chymstaticfields that, in turn, is called by the interface chymreadstaticfields.
General pourpose routines for drainage network manipulation
rollingstones2
(inp,fmap,out,nlon,nlat)
This routine allows to calculate the accumulation matrix of an arbitrary field. The input field is passed as first argument (inp) and the output array out is calculated by this subroutine. fmap is an integer array containing for each cell the surface flow direction (1 means North-West, 2 means North, 3 means North-East and so on).
If all the elements of input array inp contains the value 1.0, the output array out will contain, as output, the total number of cells drained by each grid point. If elements of input array inp contains the area of each cell, the output array out will contain, as output, the total area drained by each cell. If the elements of input array inp contains the precipitation of each cell, the output array out will contain, as output, the total precipitation drained by each cell.
All the arrays must be dimensioned (nlon,nlat).
rollingstones
(inp,wk1,wk2,out,fmap,nlon,nlat)
This routine is the older (and less efficient) version of rollingstones2, it is left for backward compatibility only. wk1 and wk2 are 2 work arrays, the other arguments are the same descript in the section about the subroutine rollingstones2.
runofftime(inp,fmap,out,nlon,nlat) Calculate the total runoff time for each grid point, namely the time that a raindrop will take to runoff until the mouth of the basin, note the mouth must be intended here in the numerical sense, namely it may be a "true" mouth cell draining toward a sea point or a cell in the border of the current simulated domain. The input real array inp must contains the runoff time of the single cell (seconds); the output real array out will contain the results expressed in hours. fmap is an integer input array containing, for each cell, the surface flow direction (1 means North-West, 2 means North, 3 means North-East and so on).
selectbasin(im,jm,wkm1,wkm2)

or the obsolete
basinpaint
(dem,fmap,luse,wkm1,nlon,nlat,im,jm,wkm2)
This routine allows to select a subdomain containing a basin or a part of it. im and jm are the numerical indexes locating the cell of the river mouth; (or any arbitrary point) whose upstream basin must be rebuilt.
wkm1 array will contain, as output, the number of drained cells.
wkm2 array will contain, as output:
  • the value of dem for the cells belonging to the selected basin
  • the special value -5 for not drained cells
  • the special value -10 for other cells
Calling the old version basinpaint, dem, fmap and luse are respectively the dem, flow directions and land use arrays. nlon and nlat specify the number of longitudes and latitudes of each array.
findijonchymgrid(xlat,xlon,i,j)
or the obsolete
locateij
(xla,xlo,slat,slon,dlat,dlon,nlat,nlon,i,j)
findijonchymgrid (locateij) routine allows to locate the indexes (i,j) of the cell corresponding to the (xlat,xlon) values of latitude and longitude. The value -1 is returned for the index i if the point is located outside the domain.
For the old version, the input variables (slat,slon) respectively specify the first value of latitudes and longitudes; the input variables (dlat,dlon) respectively specify the step (difference between two adjacent cells) in latitudes and longitudes; nlon and nlat specify the number of longitudes and latitudes.
chymlocatedn(xlat,xlon,opt,i,j) chymlocatedn allows to locate the closest point of drainage network for an arbitrary point specified by lat/lon.
The subroutine returns back in the integer arguments i and j the lon/lat indexes of CHyM grid corresponding to the river point closest to thre coordinates xlat and xlon passed as first two arguments. opt is a character string containing any combination of the following characters:
  • cX To set the search rank to X (range 1-3). The default is that chymlocateriver looks for the river grid point in the closest 8 adjacent cells. If this parameter is set to 2, the 24 adjacent cells are considered; if this parameter is set to 3, the 48 adjacent cells are considered.
  • mXX To set the minimum value of drained area to XX Km². The default is that chymlocateriver consider a cell of river all those cells draining at least 100 Km²; this option allows to change the value of this threshold.
If a wrong character is passed to the subroutine an error message with all the valid options is displayed.
Other arguments are the same of chymlocatedn
chymlocateriver
(xlat,xlon,lat,lon,dra,nlon,nlat,opt,i,j)
chymlocateriver is a "lower level" routine of the previous one. It is leaved for backward compatibility. The input real arrays lat, lon and dra respectively contains the matrix of latituds, longitudes and drained area of the CHyM domain; nlon and nlat specify the dimension of the arrays, namely the dimension of CHyM grid.
chymsalmone(drai,luse,fmap,nlon,nlat,cut,
ibas,jbas,nsec,isec,jsec,seqi,seqj,nrivp)
chymsalmone routine allows to calculate the path of the segments of drainage network from the array containing the accumulation values of drained area. The first 8 argument are input variables, while the other are output arguments.

Input parameters

  • drai is the array containing the accumulated drained area
  • luse is the array containing the land use code
  • fmap is the array containing the flow direction code
  • nlon and nlat are the number of longitudes and latitudes for previous arrays array
  • cut specify the threshold value to discriminate between land and river points (typically 10 Km²)
  • ibas and jbas are the indexes corresponding to the location of the mouth of the river the user want to rebuilt
Output parameters
  • nsec is an integer that will be incremented each time the chymsalmone will "encounter" a new tributary
  • isec and jsec are two integer vectors where the indexes corresponding the new tributaries, encountered by chymsalmone, will be stored
  • seqi and seqj are two integer vectors where the indexes corresponding to the path of the selected river will be stored (order is from mouth to spring)
  • nrivp (number of river points) is an integer specifying the numer of points belonging to the river and stored in the seqi and seqj vectors
chymmouths(cut,nsec,isec,jsec)
or
chymmouthsfinder(w,luse,fmap,nlon,nlat,
cut,nsec,isec,jsec)
chymmouthsfinder (old version) or chymmouths (new version) routines allows to locate the mouths of the river for a CHyM domain, the number of mouths will be stored in the nsec integer variable, while the integer vectors isec and jsec will contain the indexes of the mouths. The input real variable cut specify the threshold value to discriminate between land and river points (typically few Km²).
A mouth must be intented in a numerical sense, namely one of the two following condition must be verified:
  • The grid point drains from its upstream basin at least cut Km² and it drains toward a point belonging to the sea or to a water body
  • The grid point drains from its upstream basin at least cut Km² and it drains toward a point located on the border of the simulated domain, namely the true mouth is located outside the selected domain.
For the old version, the input array drai contains the accumulation values of drained area, namely each component of drai matrix contains the area of upstream basin for that cell. The arrays luse and fmap respectively contains the land use and the flow direction code. nlon and nlat specify the number of longitudes and latitudes for each array. In the new version routine chymmouths these variables are taken from chymdata module.
chymriverpath(istart,jstart,cut) chymriverpath is essentially similar (for some point of view identical) to the previous chymsalmone routine, but it is easier to use beacuse it needs only feew arguments.
istart and jstart are the indexes corresponding to the starting point (usually the mouth of the river).
cut is real input parameter specifying the minimum value of drained area (in Km²) to be considered, this parameter is usually few tens of Km², to be more general it is usully calculated as rchym(6)/40.0 being rchym(6) the approximate resolution (meters) for the current domain.
The results of the subroutine are stored in the variables and vectors of chymdata, more specifically:
  • nrivp will contain as output the number of points belonging to the river path
  • seqi and seqj are two integer vectors containg the sequence of coordinates for the nrivp points belonging to the river path, the sequence is from mouth to spring
chymmouths(cut,nriv,im,jm) chymmouths is essentially similar (for some point of view identical) to the previous chymsalmone routine, but it is easier to use beacuse it needs only feew arguments.
cut is real input parameter specifying the minimum value of drained area (in Km²) to be considered, this parameter is usually few tens of Km², to be more general it is usully calculated as rchym(6)/40.0 being rchym(6) the approximate resolution (meters) for the current domain.
nriv is an integer containing, as output, the number of river mouths draining at least the a surface greater than the value specified by cut input variable.
im and jm are two integer vectors containg the longitude and latitude indices of nriv mouths.
Utilities for grid manipulations.
chymdownscaling(tm,xlon,xlat,ixm,jxm
mt,ca,work,nlon,nlat,slon,slat,dij,dji)
chymdownscaling is a general purpose routine to downscale on CHyM grid a field defined on an arbitrary grid. ixm and jxm are the dimension of the input matrix tm while xlon and xlat contain, as input, the latitudes and longitudes of such matrix. nlon and nlat are the dimension of the output matrix mt while slon and slat are respectively the first longitude and latitude of CHyM grid, dij and dji are respectively the resolution of CHyM grid along longitude and latitude. ca and wk are two matrix dimensioned (nlon,nlat) that will be used by chymdownscaling routine to apply Cellular Automata based downscaling; note that this tecnique is generally very timeconsuming if you use it with default parameter (few second per each map to downscale), the number of CA cycles are calculated as 100xR being R the average ratio between input and output grid resolution; you may want to speed up this algorithm setting an adequate value to chymdownscaling cycles MVLib parameter.
chymmoveahead(id,i,j) Modify the integer arguments i and j with the coordinate of the cell specifyed by the first integer arguments. As an example if, as input, i=20 and j=10 and id=1 this routines gives back i=19 and j=11 namely the indexes corresponding to the closest north-west cell; if id=2 this routines gives back i=20 and j=11 namely the indexes corresponding to the closest cell in the northward direction.
neighborhood(id,di,dj) Returns, in the integer arguments di and dj the relative coordinates corresponding the idth cell in the neighborhood.
According to the rules used inside CHyM code, the cells of the neighborhood are numbered in a clockwise direction starting from north-west. As an example, if the input is id=1, this routines gives back di=-1 and dj=1 namely the relative cooordinates corresponding to the closest north-west cell; if id=2 this routines gives back di=0 and dj=1 namely the relative cooordinate corresponding to the closest north cell; and so on.
As can be visualized in the first picture, the cells of each frame are numbered in a clockwise direction starting from north-west grid point: the second frame starts from 9, the third frame starts from 25 and so on.
In the corrent version, the subroutine is conventionally limited to 40 frames (only the first 6 are shown in the fugures below), and then the input parameters of this routine can be in the range 0-6560.
The second and third picture shows the output values corresponding to different input value.
withinrange(val,left,right) withinrange is an integer function returning 1 or 0 depending whether or not the first value passed as argument is included between the interval specified by the other two argments, as an example withinrange(5,3,10) returns 1 and withinrange(5.0,13.5,20.0) returns 0. Note that this function is actually an interface accepting all real arguments or all integer arguments and therefore it must be declared where used.
	use chymdata , only : withinrange
       
MVLib-CHyM variables exchange (Usually NOT called by the users)
chymdomain(nlon,nlat,
zoom,lon1,lon2,lat1,lat2)
Allows to define the boundaries for the next CHyM 2-dim plot. The first three integer arguments respectively specify the number of longitudes, the number of latitudes and the zoom flag. If zoom is not zero the for integer parameters lon1, lon2, lat1 and lat2 specify the range of lat/lon indexes to be plotted. This routine is usually called by chym2mvlib or chymgrid
chym2mvlib(mchym,rchym,schym) It is used (usually by chymreadpar routine) to pass to MVLib libraries the parameters of "current" CHyM run.
chymgetrpar(i,r) Return in the second real argument the ith component of CHyM real parameter, as an example if the first argument is equal 2, the first value of latitude for the selected domain is returned in the second argument.
chymgetipar(i,r) Return in the second integer argument the ith component of CHyM integer parameter, as an example if the first argument is equal 2, the number of longitudes for the selected domain is returned in the second argument.
chymgetcpar(i,r) Return in the second character argument the ith component of CHyM character parameter, as an example if the first argument is equal 6, the title of the simulation is returned in the second argument.
chymgrid(nlon,nlat,slon,slat,dij,dji) Same pourpose as chym2mvlib, but in this case only the parameters needed to define the CHyM grid are passed to MVLib libraries.
getchymgrid(nlon,nlat,slon,slat,dij,dji) opposite function of chymgrid, in this case the variable stored in MVLib internal vectors are retrieved.
chymsavedfield(fld) chymsavedfield is logical function returning true if the string passed as argument is saved in the current output file. It must be called after read the CHyM output file header or after call chym2mvlib routine.
chymrivername(lat,lon,river) Returns in the character variable river, the name of the river whose mouth is located in the coordinates specified by the first two real arguments. The river name must be defined in the museo database and the lat-lon must be located at less than one chilometer respect to data saved in museo database. If the river is not find, the string "Unknown" is returned in the river variable.
chymstdomain(idom) Define standard CHyM domain for graphic routines, if the integer argument is 21, parameters for Acqwa project Po basin are defined; with this flag set to 22 the parameters for Acqwa project Rhone basin are defined.
Subroutines to access temperature and precipitation data in a suitable form for CHyM model.
acqwascen01
(hour,day,month,year,flag,vec,lat,lon,n)
Allow to rertrieve the precipitation (flag=1) and temperature (flag=2) for Acqwa project 01 scenario, namley the Post processed RCM-REMO, 25x25 km, 3 hours of time resolution. The data are stored in the output real vectors vec, lat and lon (sontaining respectively temperature or precipitation, latitudes and longitudes), the last argument is the number of data available and the first four integer input arguments specify the time step. Note that, for temperature data, it is returned n=0 if the routine is called two (or more) consecutive times with the same 3 hours-step, this is done to speed-up the execution of the model, because, in this case, CHyM will use the same temperature field of the previous step. See here the complete description of Acqwa project scenarios.
acqwascen02
acqwascen03
acqwascen04
acqwascen5a
acqwascen5b
acqwascen6a
acqwascen6b
(hour,day,month,year,flag,vec,lat,lot,n)
Same as acqwascen01 but for Acqwa 02, 03, 04, 5a, 5b, 6a and 6b scenarios. See here the complete description of ACQWA project scenarios.
Graphic routines
chymplot(flag,opt) chymplot is an high level routine allowing to produce the standard plots of chym fields. The first argument is an integer flag specifying the field to be plotted. For each plot the data currently stored in the chymdata module is used, as a consequence to plot CHyM fields is usually very simple. As an example to produce the plot of DEM require a three-line program looking as follow:
	use chymdata , only : chymreadstaticfields
	call chymreadstaticfields('tmp/Po.chym',0)
	call chymplot(1,'dLl')
       
For each value of the first integer flag, the following plot are produced:
  • 01 Digital Elevation Model
  • 02 Land Use Map
  • 03 Flow Direction Map
  • 06 Precipitation Map
  • 10 Precipitation Source Code Map
  • 13 Temperature Map
  • 21 Surface runoff speed
  • 22 Runoff time on the single grid point
  • 23 Average runoff time
  • 24 Number of drained cells
  • 25 Average runoff time for the upstream basin
  • 26 ModIS snow cover map
  • 28 BDD alarm index map
  • 29 CAI alarm index map
The meanings of the options are the same described for chymplottemp routine described below.
chymplottemp(temp,nlon,nlat,opt) Plot the temperature field contained in the real array temp; nlon and nlat specify the number of longitudes and latitudes for this array. opt is a character string containing any combination of the following characters:
  • a To avoid the automatic setting of window frame. The plot is produced with current settings allowing, as an example, to produce several plots on the same figure. See example 45.
  • d To activate the display of the plot
  • l To activate the display of the label bar
  • L To activate the the tracking of lat/lon lines
  • cXX To set the boundary flag to XX (range 1-9), if XX is omitted or a wrong value is passed, the routine will draw provinces boundaries for Italy and political boundaries for the rest of the world
  • mXX To set the minimum value of plot to XX, if the minimum is not specified it will be set as the minimum value of the input array passed as first argument
  • MXX To set the maximum value of plot to XX, if the maximum is not specified it will be set as the maximum value of the input array passed as first argument
If a wrong character is passed to the subroutine an error message containing all the valid options is displayed.
chymplottemp is actually a general purpose routine to display most of CHyM fields; in fact chymplot described above is just an higher level interdace to this routine.
chymplotdiff(diff,nlon,nlat,opt) Plot the difference field contained in the real array diff; nlon and nlat specify the number of longitudes and latitudes for this array. opt is a character string containing any combination of the following characters:
  • a To avoid the automatic setting of window frame. The plot is produced with current settings allowing, as an example, to produce several plots on the same figure. See also the example 45 to understand the details.
  • d To activate the display of the plot
  • l To activate the display of the label bar
  • L To activate the the tracking of lat/lon lines
  • cXX To set the boundary flag to XX (range 1-9), if XX is omitted or a wrong value is passed, the routine will draw provinces boundaries for Italy and political boundaries for the rest of the wordl
  • MXX To set the maximum value of plot to XX, if the maximum is not specified it will be set as the maximum value of the input array passed as first argument. The minimum value is alway set to minus the maximum value.
  • r To reverse the color bar, by default the color bar are from blu to red tones
  • Txx To set the style of the plot to the value XX, valid ragnges are 0-4 and 10-14. If this parameter is greater than 10 the label bar is produced under the current frame, instead at bottom of the plot. If you pass T0 (default) the whole palette is used (10 or 15 if r is specified); if you pass T1 only three colours are used; a colour for the values less than -max, a colour for the values greater than max, and a colour for other values. If you pass T2 subset of 16 colours are used centered around the zero; if you pass T3 a subset of 9 colours are used centered around the zero; if you pass T4 a subset of 5 colours are used centered around the zero. See the example 45 to better understand the differences.
If a wrong character is passed to the subroutine an error message containing all the valid options is displayed.
chymplotrain(rain,luse,wk,nlon,nlat,opt) Plot the precipitation field contained in the real array rain; the input integer array luse contains the land use code and the input real array wk is a dummy array used inside the routine. nlon and nlat specify the number of longitudes and latitudes of each array.
opt is a character string containing any combination of the following characters:
  • a To avoid the automatic setting of window frame. The plot is produced with current settings allowing, as an example, to produce several plots on the same figure.
  • d To activate the display of the plot
  • L To activate the the tracking of lat/lon lines
  • l To activate the display of the label bar
  • cXX To set the boundary flag to XX (range 1-9), if XX is omitted or a wrong value is passed, the routine will draw provinces boundaries for Italy and political boundaries for the rest of the wordl
  • mXX To set the minimum value of plot to XX, if the minimum is not specified it will be set as the minimum value of the input array passed as first argument
  • MXX To set the maximum value of plot to XX, if the maximum is not specified it will be set as the maximum value of the input array passed as first argument
If a wrong character is passed to the subroutine an error message containing all the valid options is displayed.
chymplotbdd(opt) Plot the the real array bdd that usually contains BDD alarm index (calculated by bddfield subroutine) or CAI alarm index (calculated by caiindex subroutine). opt is a character string containing any combination of the following characters:
  • a To avoid the automatic setting of window frame. The plot is produced with current settings allowing, as an example, to produce several plots on the same figure (see exeample 45).
  • cX To set the boundary flag to X (range 1-9), if X is omitted or a wrong value is passed, the value 5 is assumed.
  • d To activate the display of the plot
  • L To activate the the tracking of lat/lon lines
  • l To activate the display of the label bar
  • mXX To set the minimum value of plot to XX, if the minimum is not specified it will be set to zero.
  • MXX To set the maximum value of plot to XX, if the maximum is not specified it will be set to 20, reccomended value for CAI is 120.
    For BDD index, warning level must be considered aroud 11; alarm level must be considered aroud 16.
    For CAI index, warning level must be considered aroud 60; alarm level must be considered aroud 110.
If a wrong character is passed to the subroutine an error message containing all the valid options is displayed.
chymplotdem(dem,luse,wk,nlon,nlat,opt) Plot the Digital Elevation Model contained in the real array dem; the input integer array luse contains the land use code and the input real array wk is a dummy array used inside the routine. nlon and nlat specify the number of longitudes and opt is a character string containing any combination of the following characters:
  • d To activate the display of the plot
  • L To activate the the tracking of lat/lon lines
  • l To activate the display of the label bar
  • cXX To set the boundary flag to XX (range 1-9), if XX is omitted or a wrong value is passed, the routine will draw provinces boundaries for Italy and political boundaries for the rest of the wordl
  • MXX To set the maximum value of plot to XX, if the maximum is not specified it will be set as the maximum value of the input array passed as first argument
If a wrong character is passed to the subroutine an error message containing all the valid options is displayed.
chymplotrsrc(rscm,nlon,nlat,opt) Plot the rain source map contained in the real array rscm; nlon and nlat specify the number of longitudes and latitudes for this array. opt is a character string containing any combination of the following characters:
  • d To activate the display of the plot
  • l To activate the display of the label bar
  • L To activate the the tracking of lat/lon lines
  • cXX To set the boundary flag to XX (range 1-9), if XX is omitted or a wrong value is passed, the routine will draw provinces boundaries for Italy and political boundaries for the rest of the wordl
If a wrong character is passed to the subroutine an error message containing all the valid options is displayed.
chymplotlanduse(luse,nlon,nlat,opt) Plot the land use map contained in the integer array luse; nlon and nlat specify the number of longitudes and latitudes for this array. opt is a character string containing any combination of the following characters:
  • cXX To set the boundary flag to XX (range 1-9),
  • d To activate the display of the plot
  • l To activate the display of the label bar
  • L To activate the the tracking of lat/lon lines
  • s To activate the printing of statistics
  • tXX To plot only points with landuse type XX
If a wrong character is passed to the subroutine an error message containing all the valid options is displayed.


Table 2. CHyM internal parameters written in the output file header
Component CHyM Internal Integer parameters - Vector mchym(50)
1 Who write this output file. 1 means Chym Model, other values should cause a warning message because the file we are reading is probably not a CHyM output file.
2 Number of grid points (Longitudes)
3 Number of grid points (Latitudes)
4 Coded value of the start date of this run (yymmddhh)
5 Coded value of the end date of this run (yymmddhh)
6 Number of time slices written in this output
7 Number of static fields written in this output
8 Number of dynamical fields written in this output
9 Restart flag. Same meaning as RESTART csh parameter. mchym(9)=0 means that a new run is started and a new output file must be created. mchym(9) > 0 means that static and dynamical fields must be initializied from a previous run. See the description of RESTART csh parameter for a complete desciption.
10 Land use code for sea
11 Land use code for internal waterbodies
12 MM5 domain used for MuSEO data base (used only if MuSEO is a rain data source)
13 DEM source: 1 means Italy DEM, 2 means world DEM (1 Km of resolution) 3 means both, 4 means NASA World DEM with 90-meters of resolution, 21 means world+Rhone basin data, 31 means Mars planet DEM from MOLA data, 32 means Mars planet DEM from HRSC data.
14 Every how many hourly time steps Dynamical fields are saved in the output file [1]. equivalent to script parameter NSAVE
15 This parameter is set by the script parameter TEMPFL and allows to establish the source to be used to rebuild the temperature field on CHyM grid. The value must be an integer with the following meaning:
  1. Temperature fields are rebuilt merging MuSEO observed sparse data base and hourly temperatures as simulated by MM5 meteorological model (equivalent to 1+2 options, see the following options)
  2. Temperature fields are rebuilt from MuSEO sparse data base at hourly time step.
  3. Hourly temperatures as simulated by MM5 meteorological model are used, the data set only covers the Italy and the surrounding zone.
These option are usually used for climatic hydrological simulations
  1. Temperatures are read from RegCM output
  2. Monthly average temperature from global ERA data are used; more information abuot ERA available here.
Other special values allow to read temperatures from ACQWA/Regcm archives:
  1. Temperatures are read from ACQWA/RCM-REMO 25x25 km (Scenario 01)
  2. Temperatures are read from ACQWA/Regcm 25x25 km run (Scenario 02)
  3. Temperatures are read from ACQWA/REMO 10x10 km run (Scenario 03)
  4. Temperatures are read from ACQWA/Regcm 3x3 km run (Scenario 04)
  5. Temperatures are read from ACQWA/Post processed RCM-REMO 25x25 km run (Scenario 5a)
  6. Temperatures are read from ACQWA/Post processed RCM-REMO (Scenario 5b)
  7. Temperatures are read from ACQWA/Post processed RegCM 25x25 km run (Scenario 6a)
  8. Temperatures are read from ACQWA/Post processed RCM- RegCM3 (Scenario 6b)
  9. Temperatures are read from ACQWA/RCM-RegCM3 50x50Km km; 3 of hours time resolution (Scenario c1)
16 Number of integration steps (hours) for the current run
17 This flag is set by the user using the chs parameter SAVEP and allows to speed up the run reading the precipitation from a previous run without to rebuid it at each hourly time step. If this flag is set to 1 the precipitation field, rebuilt at each hourly time step is saved in the binary file tmp/rainfall.chym. In the following simulations you may set mchym(17) to 2 and CHyM model will read the precipitation fields at each hourly time step from the file tmp/rainfall.chym. If mchym(17)=0 precipitation fields are recalculated from the selected rain sources and the file tmp/rainfall.chym is not read or written.
18 The number of the river selected for CHyM plots.
19 Number of mchym component in the current version of CHyM. This is set to 50 in the current version.
20 An integer flag specifying if a Grads output is created by the current run. This is set by the csh flag GRADS of CHyM scrip.
21 Number of time slices carried out in this simulation, this flag is equivalent to the component 6 if mchym(9) (RESTART csh parameter) = 0, 1 or 2.
22 Number of time step per hour (equivalent to the script parameter STEP) to be used for the solution of the prognostic continuity equation. Please note: the value of this parameter may be critical for a corretct prediction of the discharge, usually the default value is adequate for a domain simulated with an horizontal resolution of about 1 Km, but the value must be increased if the resolution is increased, as ann example with a space resolution of 300 meters a value of STEP parameter in the range 20-30 is reccomended. A good test to check if the continuity equation solution is producing unrealistic instabilities is to plot the flow discharge along the path of the river(s) your are simulating (command "plot riverport" of CHyMLab utility).
23 This flag is set by the user using the chs parameter SAVET and allows to speed up the run reading the temperature field from a previous run without to rebuid it at each hourly time step. If this flag is set to 1 the temperature field field, rebuilt at each hourly time step is saved in the binary file tmp/temperature.chym. In the following simulations you may set mchym(23) to 2 and CHyM model will read the temperature fields at each hourly time step from the file tmp/temperature.chym. If mchym(23)=0 temperature fields are recalculated from the selected rain sources and the file tmp/temperature.chym is not read or written.
24 This flag is set by the user using the chs parameter MODIS and allows to select if ModIS data should be used to map the snow cover. By default (mchym(24)=0) ModIS data are not used.
  • If this flag is set to 1 the MODIS MuSEO database is used to build the snow cover mask, data are available since 2012
  • If this flag is set to 21 the ACQWA modis database is used to build the snow cover mask, in this case the same flag is changed to the the value -21 by the routine acqwamodis if the data are not available (before January 23, 2000 and after December 31, 2009).
25 This flag allows to select the plot to be produced. See the description of PLOT script parameter
26 This flag allows to select the time step to plot. See the description of TPLOT script parameter
27 The century of start date (usually 1900 or 2000)
28 The date at which restart file for operational run is created. This date is set to the midnight of 2 days before the current system time for operational run and 24 hours before the end of run (mchym(5)) of other runs.
29-50 Not yet used
Component CHyM Internal Real parameters - Vector rchym(50)
1 First value of longitude for the selected domain
2 First value of latitude for the selected domain
3 Last value of longitude for the selected domain
4 Last value of latitude for the selected domain
5 Latitude and Longitude resolution of the selected domain
6 Approximate resolution (meters)
7 Version of CHyM code.
8 Longitude resolution (same as rchym(5) in the current version)
9 Latitude resolution (same as rchym(5) in the current version)
10 Radius of inluence (kilometers) to be used for Cellular Automata based interpolation of sparse precipitation and temperature data.
11 Channel lenght factor, default=1. Used in the subroutine runoffspeed, this factor allow to take into accont that, when the resolution is very low, the actual lenght of the channel inside a single cell cannot be considered the same of the side (or diagonal) of the celll itself.
12 Minimum value of DEM. This is set to zero for Earth, but it is usually a negative value for Mars surface. The absolute value of rchym(12) is added to dem array and therefore, for a generic cell, the actual value of DEM, as released by NASA, is dem(i,j)+rchym(12)
13 This parameter is used for the simulation on Mars surface and it set the relative DEM level below which the cells must be considered as Internal water bodies. The value of of this parameter is set according to the value of MSL variable set within CHyM script. The value of this parameter is intented relative to the minimum value of DEM within the current domain that is calculated inside marsdem subroutine and stored in rchym(12) variable.
14-20 Not yet used.
21-40 Same of cpar(1:20), namely the parameters used for the calibration. A complete description is reported in the fourth table
41-50 Not yet used.
Component CHyM Internal String parameters - vector schym(50)
1 Data sources used to rebuild precipitation field, the same selected with RSRC csh parameter, see the complete description in the third table below and the complete description of precipitation data sources.
2 MM5 or RegCM input filename
3 Coded value of start date
4 System time when CHyM code was executed
5 Hostname running CHyM code
6 Title of the simulation set by TITLE csh parameter
7 Dynamical 2-dim fields saved in the output file.
8 Start date of the run in the form: "Month day, year h: hour"
9 End date of the run in the form: "Month day, year h: hour"
10 Museo database to be used for discharge comparison
11 Specification of output file, it is the same of OFILE csh parameter, see the description below.
12 Specification of restart file, it is the same of RFILE csh parameter, see the description below.
13 If mchym(17)>0 (see description above) this parameter specify the file where the precipitation fields are saved or read. It is the same of PFILE csh parameter, see the description below.
14 If mchym(23)>0 (see description above) this parameter specify the file where the temperature fields are saved or read. It is the same of TFILE csh parameter, see the description below.
15
16:17 Contains the directory where RegCM data files are stored.
18 Name of "quick file" containing the dynamical fields for restart. The file is created at the date specifield by mchym(28)
19:24 Not yet used.
25:33 List of static 2-dim fields saved in the header of the output file. These fields can be retrieved from CHyM output file using the chymreadrec routine listed above, the list of possible code (namely the first argument of chymreadrec routine) follow:
  • 'dem': a real array containing the Digital Elevation Model
  • 'lat': a real array containing the latitudes of each grid point
  • 'lon': a real array containing the longitudes of each grid point
  • 'fdm': an integer array containing the the coded value (1-8) for the drainage direction;
  • 'acc': a real array containing the acclivity of each grid point expressed as the tangent of the angle
  • 'lus': an integer array containing the land use coded value (1-100)
  • 'aer': a real array containing the area (Km²) of each grid point
  • 'dra': a real array containing the total drained area (Km²) of each cell
  • 'run': a real array containing the surface ronoff speed of each cell.
34:38 Not yet used
39:50 List of dynamical 2-dim fields saved in the output file. These fields can be retrieved from CHyM output file using the chymreadrec routine listed above, the list of possible code (namely the first argument of chymreadrec routine) follow:
  • rai. The hourly precipitation field (mm)
  • rsr. The rain source field (coded value)
  • ara. The water available for runoff field (mm)
  • por. The Flow discharge (m³/sec) field
  • wet. The hourly wet area (m²) field
  • gwt. The ground water field
  • evp. The evapotranspiration field
  • sno. The accumulated snow field (mm)
  • tem. The temperature field (C)
  • dgw. Deep water contents (mm)
All these data are stored as real arrays. Please note that the fields that are actually saved in CHyM output file are selected using the SAVEFLD script parameter discussed below.
TABLE 3. CHyM script parameters
General purpose flags
COMP This script parameter allows to select the compiler used to compile the CHyM fortran code. If this parameter is not set by the user the CHyM script will try to compile with gfortran, ifort and pgf90 compiler (in this other) on the linux platforms. For other operating systems CHyM script will try to use the vendor specific compiler, namely f90 for HP-alpha platforms, f90 for SunOS and Sylicon Graphics platforms, xlf for IBM-Irix platforms.
VERB A logical script variable. If it is set to "true" many verbose information are provided on standard output during the compilation and execution phase.
The following flags determines how the CHyM output file will be built and used to restart a simulation.
RESTART RESTART csh parameter is an integer coded value determining the manner used by CHyM model to build the static fields and inizialize the dynamical fields.
  • RESTART=0 means that a new run is started and a new output file must be created, the name of the output file is established by the OFILE csh parameter described below. The static fields are calculated from the CHyM database and dynamical fields, as an example the flow discharge are initialized with a null value. Not that in this case an adeguate phase of spin-up is needed before resonable values of dynamical fields are reached.
  • RESTART=1 means that a new run is started, but the simulated geographical domain is the same as a previous one. In this case the static fields (DEM, Land use, etc.) are read from the file specified by the RFILE csh parameter described below. If the user does not specify a value for RFILE csh parameter, CHyM assume that the input and output file are the same, namely RFILE=OFILE, Warning: in this case the existing input file will be overwritten. Also with RESTART=1 the dynamical fields are initialized with a null value and an adeguate phase of spin-up is needed before resonable values of dynamical fields are reached.
  • RESTART=2 means that CHyM have to continue a previous run. In this case static fields are read from the file specifield by RFILE csh parameter described below and also the dynamical fields are inituialized reading form RFILE files the time slice corresponding to the date of start of the current run. A new output file si created (the name is specified by OFILE script parameter)
Please, also carefully consider what follow:
  • If you want to restart the model in a proper way, you have to save at least:
    1. Flow discharge field (code "por")
    2. Ground Water Content (code "gwt")
    3. Accumulated snow (code "sno")
    4. Deep ground water content (code "dgw")
    as a consequence the csh parameter SAVEFLD must, at least, contains these four fields, namely:
    set SAVEFLD = "por,gwt,sno,dgw"
    If you do not save these fields, one or more of the above listed fields are re-initialized to zero at the restart of the run.
  • If RESTART>0 the the CHyM csh parameters DEMF, NLON, NLAT, SLON, SLAT, DIJ are ignored.
OFILE A string specifying the file where CHyM model will store the results of simulation. Note that this file is also an input file (and therefore it must exist) if
  • RESTART parameter is greater than zero and RFILE parameter is not specified
In this situation the model assumes that the input file, where the static and initial dynamical fields are read, is this same of output file and therefore it will be overwritten after reading it, to be clearer: this is the typical situation of operational simulation when we want to restart the model from the previous simulation, but we are not interested to save the results of the previous run.
RFILE A string specifying the file to be used for restart. This file must be a previous CHyM output file where the model will read the static (and dynamical if RESTART > 1) fields before to start the integration. If this parameter is not specified CHyM assumes that RFILE=OFILE.
SAVEFLD This parameter allows to specify the combination of two dimensional dynamical fields that will be saved in the output file. The format is a string containing a sequence of three characters separated by a comma. The complete list of the possible options follow:
  • rai. To save the hourly precipitation field (mm)
  • rsr. To save the rain source field (coded value)
  • ara. To save the water available for runoff field (mm)
  • por. To save the Flow discharge (m³/sec) field
  • wet. To save the hourly wet area (m²) field
  • gwt. To save the ground water field
  • evp. To save the evapotranspiration field
  • sno. To save the accumulated snow field (mm)
  • tem. To save the temperature field (C)
  • dgw. To save the deep water contents (mm)
Please carefully consider what follow: if you want to restart the model in a proper way, you have to save at least:
  1. Flow discharge field (code "por")
  2. Ground Water Content (code "gwt")
  3. Accumulated snow (code "sno")
  4. Deep ground water content (code "dgw")
as a consequence the csh parameter SAVEFLD must, at least, contains these four fields, namely:
set SAVEFLD = "por,gwt,sno,dgw"
If you do not save these fields, one or more of the above listed fields are re-initialized to zero at the restart of the run.
The list of saved fields in the output file are stored in the components 39:50 of "CHyM Internal String".
NSAVE Is an interger paramater specifying every how many hourly steps, dynamical fields must saved in the output files.
GRADS If this flag is set to a value greater than 0, CHyM also produce output suitable to be used by grads utility. More specifically for each run the following output files will be created or overwritten:
  • The description file for the static fields called tmp/TITLE_domain.ctl, being the string TITLE the same string set by the user with the TITLE scrip parameters with all the blank characters replaced by underscore character.
  • The file containing the static fields called tmp/TITLE_domain.dat, being the string TITLE the same string set by the user with the TITLE scrip parameters with all the blank characters replaced by underscore character.
  • The description file for the dynamic fields called tmp/TITLE_output.ctl, being the string TITLE the same string set by the user with the TITLE scrip parameters with all the blank characters replaced by underscore character.
  • The file containing the dynamic fields called tmp/TITLE_DDDDDDDD.dat, being the string TITLE the same string set by the user with the TITLE scrip parameters with all the blank characters replaced by underscore character and DDDDDDDD the start date of integration coded with 8 integer digit, as an example 02062018 is the start date is June, 20 2002 h: 18.
The following 5 flags allow to select the geographical domain to simulate and determine its size and resolution.
NLON Is an interger paramater specifying the number of longitudes and the first dimesion of all the arrays of CHyM fortran code.
NLAT Is an interger paramater specifying the number of latitudes and the second dimesion of all the arrays of CHyM fortran code.
SLON It is a real paramater specifying the longitude of the geographical domain to simulate.
SLAT It is a real paramater specifying the latitude of the geographical domain to simulate.
DIJ It is a real paramater specifying the resolution, the meaning is the the different in latitude/longitude of two adjacent cell of the grid.
The following flags allow to select sources of data to be used to rebuild precipitation, temperature, DEM and snow-cover fields.
DEMF An integer flag specifying DEM source to be used.
  1. means that Italy DEM with 300 m of resoltion must be used;
  2. means that World DEM with one Km of resolution must be used;
  3. means Italy+World DEM must be used (equivalent to 1+2 options);
  4. means that NASA World DEM with 90-meters of resolution must be used;
Other special vali options are:
  • 21. means that the world+Rhone basin DEM is used, this is a special option for ACQWA Project simulation.
  • 31. means that the Mars DEM from Mars Orbiter Laser Altimeter (MOLA) data will be used
  • 32. means that the Mars DEM from High Resolution Stereo Camera (HRSC) data will be used (these data are available only for Arabia Terra domain
RSRC This parameter allows to specify the source(s) to be used to rebuild the precipitation field on the CHyM grid; it must contains a comma separeted list of any combination of the following words:
  • "intdb" - MuSEO hourly rain gauge database must be used
  • "radar" - Radar hourly estimation must be used
  • "ein75" - ERA interim 0.75 deg resolution database must be used
  • "persiann" - Persiann 0.25 deg database must be used
  • "trmm" - TRIMM database must be used
  • "wrf1" - Archive of WRF model forecast on domain 1 must be used
  • "wrf2" - Archive of WRF model forecast on domain 2 must be used
  • "regcm" - RegCM output file must be used
  • "museo" - The Museo archive of MM5 simulation must be used
  • "mm5file" - MM5 output file must be used
  • "acqwa01" - Scenario number 01 of ACQWA project correspondirng to RCM-REMO 25x25 km
  • "acqwa02" - Scenario number 02 of ACQWA project correspondirng to RCM-RegCM 25x25 Km, 3 hours of resolution
  • "acqwa03" - Scenario number 03 of ACQWA project correspondirng to RM-ReMo 10x10 Km, 3h of resolution
  • "acqwa04" - Scenario number 02 of ACQWA project correspondirng to RCM-RegCM 3x3 Km, 3 hours of resolution
  • "acqwa5a" - Scenario number 5a of ACQWA project correspondirng to the post processed RCM-REMO 25x25 Km, 3h of resolution
  • "acqwa5b" - Scenario number 5b of ACQWA project correspondirng to the post processed RCM-REMO 10x10 Km, 3h of resolution
  • "acqwa6a" - Scenario number 6a of ACQWA project correspondirng to the post processed RCM-RegCM 25x25 Km, 3h of resolution
  • "acqwa6b" - Scenario number 6b of ACQWA project correspondirng to to the post processed RCM-RegCM 3x3 Km, 3h of resolution
See also the complete description of precipitation data sources.
TEMPFL This parameter allows to establish the source to be used to rebuild the temperature field on CHyM grid. The value must be an integer with the following meaning:
  1. Temperature fields are rebuilt merging MuSEO observed sparse data base and hourly temperatures as simulated by MM5 meteorological model (equivalent to 1+2 options, see the following options)
  2. Temperature fields are rebuilt from MuSEO sparse data base at hourly time step.
  3. Hourly temperatures as simulated by MM5 meteorological model are used, the data set only covers the Italy and the surrounding zone.
These option are usually used for climatic hydrological simulations
  1. Temperatures are read from RegCM output
  2. Monthly average temperature from global ERA data are used; more information abuot ERA available here.
Other special values allow to read temperatures from ACQWA/Regcm archives:
  1. Temperatures are read from ACQWA/RCM-REMO 25x25 km (Scenario 01)
  2. Temperatures are read from ACQWA/Regcm 25x25 km run (Scenario 02)
  3. Temperatures are read from ACQWA/REMO 10x10 km run (Scenario 03)
  4. Temperatures are read from ACQWA/Regcm 3x3 km run (Scenario 04)
  5. Temperatures are read from ACQWA/Post processed RCM-REMO 25x25 km run (Scenario 5a)
  6. Temperatures are read from ACQWA/Post processed RCM-REMO (Scenario 5b)
  7. Temperatures are read from ACQWA/Post processed RegCM 25x25 km run (Scenario 6a)
  8. Temperatures are read from ACQWA/Post processed RCM- RegCM3 (Scenario 6b)
  9. Temperatures are read from ACQWA/RCM-RegCM3 50x50Km km; 3 of hours time resolution (Scenario c1)
MODIS The MODIS flag allow to select the data to be used to build the snow cover field. If this flag is set to zero (default) the MODIS data are not used to rebuild the snow cover field; in this case CHyM consider snow the precipitation when the temperature is lower than zero; tipically this assunption is valid when model data are taken from models (RegCM, MM5, etc.). If the precipitation data are retrieved from rain gauges observation this assuption is usually not correct because rain gauges do not measure snow precipitation, as a consequence a different method is needed to realistically estimate the subdomain covered by snow/ice. By default (MODIS=0) CHyM assumes that a cell is covered by snow if the land use code is 12 (glaciers) or the accumulated snow calculated by CHyM is greater than zero; to customize this behaviour you may want to modify snowcv integer function inside CHyM code. Another option to modify the MODIS flag, the valid option follows:
  • 1. Museo ModIS database is used to build the snow cover mask, data are available since 2012
  • 21. ACQWA ModIS data are used for Rhone and Po basins from February 23, 2000 to December 31, 2010 (453 weekly records)
RADIUS This parameter allows to specify the radius of inluence (kilometers) to be used for Cellular Automata based interpolation of sparse precipitation data, it is used if "intdb" is included in RSRC flag. The same flag also affects the rebuilding process of temperature field from sparse data (TEMPFL=5). Default value is 10 Kilometers.
SAVEP This is an integer flag allows to speed up the run reading the precipitation from a previous run without to rebuild it at each hourly time step. If this flag is set to 1 the precipitation field, rebuilt at each hourly time step is saved in the binary file tmp/rainfall.chym. In the following simulations you may set SAVEP to 2 and CHyM model will read the precipitation fields at each hourly time step from the file tmp/rainfall.chym. If SAVEP=0 the precipitation fields are recalculated from the selected rain sources and the file tmp/rainfall.chym is not read or written.
PFILE If SAVEP>0 (see description above) this parameter specify the file where the precipitation fields are saved or read.
SAVET This is an integer flag allows to speed up the run reading the temperature field from a previous run without to rebuild it at each hourly time step. If this flag is set to 1 the temperature field, rebuilt at each hourly time step is saved in the binary file tmp/temperature.chym. In the following simulations you may set SAVET to 2 and CHyM model will read the temperature fields at each hourly time step from the file tmp/temperature.chym. If SAVEP=0 the temperature fields are recalculated from the selected rain sources and the file tmp/temperature.chym is not read or written.
TFILE If SAVET>0 (see description above) this parameter specify the file where the temperature fields are saved or read.
IFILE1 A string specifying the MM5 or RegCM output file that CHyM will use to retrieve the precipitation fields. This file is actually used depending on the value set for RSRC parameter.
IFILE2 For MM5 precipitation module two different file can be used within a single run. To actually use the MM5 output file selected with IFILE2 script parameter, the user have also to modify the integer variable newmm51 in the fortran code; if this variable is set to a value greater than zero, this value represents the step at which the precipitation will be rebuilt from IFILE2 instead of IFILE1. A value of newmm51 lower than zero means that only the first file must ne used.
MUSDM For operational Cetemps runs this flag specify which domain of MM5 archive must be used. The flag must be specified in the range 1-3 to select the three operational domains with different resolution. If other values are set the domain are calculated by CHyM from the selected geographical domain.
Paramaters affecting the integration cycle
STEP Specifies the number of time integration steps per hour to be used for the solution of the prognostic continuity equation. Default is STEP=10.
Please note: the value of this parameter may be critical for a corretct prediction of the discharge, usually the default value is adequate for a domain simulated with an horizontal resolution of about 1 Km, but the value must be increased if the resolution is increased, as ann example with a space resolution of 300 meters a value of STEP parameter in the range 20-30 is reccomended. A good test to check if the continuity equation solution is producing unrealistic instabilities is to plot the flow discharge along the path of the river(s) your are simulating (command "plot riverport" of CHyMLab utility).
NSLI Number of hourly steps of integration. Default is NSLI=120.
DATE Start date in the integer format YYMMDDHH. If a value less or equal zero is specified, CHyM script assume that this is an operational run, namely the start date will be h: 00 of three days ago respect to the current system time; as an example if the run is started at February 08, 2018, the DATE value is assumed to be 18020500. The same apply if an inconsistent value (less than 7 digit) is specified for this parameter. Default is DATE=0.
If the YY value si greater than 60 CHyM model assumes that we are in XX century, otherwise we are are carrying out a simulation for the XXI century; as an example YY=82 means that the year is 1982, YY=10 means means that the year is 2010. If this assumption is not correct, it is enought to set DATE in a 10 digit format, namely YYYYMMDDHH.
During chym integration and for any other off-line application the century of start date is stored in the component 27 of mchym vector.
CENTURY Set the century of the start date of simulation; it is usually set to 1900 or 2000. In the current version the filename is built according to this parameter
Other paramaters
TITLE A string containing the title of the simulation
MUSEODB This flag specify the Museo database to be used for flow discharge comparison. This flag is not used by CHyM model but it is used by CHyMLab utility.
MSL The Mars Sea Level parameter is used only for Mars surface simulations and allows to set the relative DEM level below which the cells must be considered as Internal water bodies. The value of this parameter is intented relative to the minimum value of DEM within the current domain that is calculated inside marsdem subroutine and stored in rchym(12) variable.
Parameters affecting the graphic output
PLOT Specify a plot to be produced during the integration. It must be specified as an integer, depending on the value of this flag the following plots are produced:
  1. A 2-dim plot of Digital Elevation Model for the selected geographic domain is displayed
  2. A 2-dim plot of Land Use for the selected geographic domain is displayed
  3. A 2-dim plot of flow direction for the selected geographic domain is displayed. The eight different colors correspond to the flow direction for each cell.
  4. A plot of incline map for the selected geographic domain is displayed. Incline corresponds to the longitudinal bed slope of each flow element.
  5. A 2-dim plot of accumulation matrix for the selected geographic domain is displayed. The accumulation matrix allow to visualize the drainage network and to ensure that it is rebuild in a realistic way.
  6. A 2-dim map of the precipitation field is displayed at the hourly time step selected by csh script TPLOT (see below).
  7. During the ingestion of different data set for the rainfall fields, produces a sequence of maps showing the different phase in rebuilding the precipitation on CHyM grid. The plots is displayed at the hourly time step selected by csh script TPLOT (see below).
  8. A 2-dim plot of the river selected by RIVER parameters (see below) is displayed. This option also produce on standard output the list of the river mouths included in the selected geographical domain, this is needed to correctly set the RIVER parameter descript below.
  9. A 2-dim map of the whole drainage network for the selected domain is displayed.
  10. A 2-dim map of the rain sources used to rebuild precipitation field is displayed at the hourly time step selected by csh script TPLOT (see below).
  11. An histogram is displayed showing the distribution of DEM corrections carried out by the DEM smoothing algorithm. See picture 7 in section 2.3 of CHyM manual and related discussion.
  12. A 2-dim map of the DEM corrections is displayed. See picture 7 in section 2.3 of CHyM manual and related discussion.
  13. A 2-dim map of the temperature field is displayed at the hourly time step selected by csh script TPLOT (see below).
  14. A 2-dim map of the potential evaporation field is displayed at the hourly time step selected by csh script TPLOT (see below).
  15. A 2-dim map of the melting rate is produced at the hourly time step selected by csh script TPLOT (see below).
  16. A 2-dim map of the accumulated snow is produced at the hourly time step selected by csh script TPLOT (see below).
  17. A 2-dim map of the ground humidity is displayed at the hourly time step selected by csh script TPLOT (see below).
  18. A 2-dim map of the deep ground water is displayed at the hourly time step selected by csh script TPLOT (see below).
  19. An animated gif is produced and displayed showing the "work" of Cellular Automata based algorithm to smooth the precipitation field. The plot is displayed at the hourly time step selected by csh script TPLOT (see below).
  20. Produce the file chymriver.txt where of values of major arrays are stored as function of longitudinal coordinate along the river bed. The hourly time step selected by csh script TPLOT (see below).
  21. A 2-dim map of the surface runoff speed (m/sec) is displayed
  22. A 2-dim map of runoff time on the single cell (hours) is displayed
  23. A 2-dim map of total runoff time until the sea
  24. A 2-dim map of the total number of drained cells
  25. A 2-dim map of average runoff time in the upstream basin
  26. A 2-dim map of snow cover from MODIS data
  27. A 2-dim map of snow cover from snowcv function
  28. BDD Alarm index (not yet implemented)
See also the documentation of CHyMLab utility .
TPLOT An integer parameter specifying the hourly time slice at which the plot of dynamical fields are produced. As an example if the start date is set to 10031200, PLOT parameter is set to 13 (see above) and TPLOT is set to 24, the plot of temperature field is produced after 13 hours of integration, namely at March 13, h: 13.
RIVER An integer code to select a river basin to be displayed, see above option 8 of PLOT parameter
ZOOM If this integer value is greater than 1, the 2-dim plot are produced on a selected sub domain specified by the following LON1, LON2, LAT1 and LAT2 parameters described below.
LON1, LON2,
LAT1, LAT2
This group of four parameters specify the subdomain to be plotted (if ZOOM parameter described above is > 1). LON1 and LON2 specify the longitude range and must be within 1 and NLON. LAT1 and LAT2 specify the latitude range and must be within 1 and NLAT.
Table 4. Arrays defined and used inside CHyM fortran code - The list is not yet complete
Array
name
Save
code
Meaning Modified or
Updated by
Used by
accl * Acclivity field. It is expressed as the sinus of the terrein slope in the direction of surface flow. buildacclivitymap runoffspeed
alfa Surface runoff speed (m/sec), it also corresponds to the proportionality factor between flow discharge Q and wet section area A in the momentum equation. runoffspeed
(also automatically calculated
after reading static field)
runoff
ara Surfce water available for runoff. This field is not stored in a specific array, but it is saved after the water balance has been calculated for each cell. The routine chymreaddynamicfields stores the data in work array wkm1 rainfall, evapotranspiration,
melting, groundwater
CHyM
area * Area of each cell (Km²) areamatrix cvmm2m3, cvm32mm,
runoff
bdd BDD alarm index calculate as a function of flow-discharge bddfield
bwet wet Wet area (m²) runoff
deepw dgw mm of water infiltrated in the deep layer in the last N days (see component 7 of cpar vector described below) groundwater returnflow
dem * Digital Elevartion Model (m) buiddem,angioplasty,
demsmoothing,demholefilling
CHyM
ddeepw Drained infiltrated water in the deep layer in the last N days (see component 7 of cpar vector described below) groundwater returnflow
drai * Total drained area of each cell (Km²) areamatrix riveronlanduse, calibration,
returnflow, runoffspeed
dx Channel lenght (m) for each cell. runoffspeed
(also automatically calculated
after reading static field)
runoff
evap evp Actual evapotranspiration term (mm) potevapotransp evapotranspiration
fmap * Coded value for surface flow direction, 1 means North-West, 2 means North, 3 means North-East, 3 means North-East, 4 means East, 5 means South-East, 6 means South, 7 means South-West, 8 means West. estabilishfowdir, angioplasty,
dircorrflow
buildacclivitymap,
demsmoothing
runoff, runoffspeed
gh2o gwt Total content of water for each cell (m³) groundwater,
evapotranspiration (is it right?)
lon * Longitude of each grid point acquirescriptpar CHyM
lat * Latitude of each grid point acquirescriptpar CHyM
luse * Land Use (coded value) buildlandusemap,calibration,
riveronlanduse
CHyM
modis A real array containing a coded value, 1 means that the cell is covered by snow, 0 means that the cell is not covered by snow. snowcover snowcv
port por Flow discharge (m³/sec) runoff
rain rai Precipitation field (mm) rainfall, datisparsi,
museodata, mm5data,
returnflow,snowacc
runoff,snowacc
runt * Mean runoff time (hours) for the upstream basin of each cell, in the current version it is not used within CHyM model, but it is usually used for flood alert mapping from CHyM operational run. runoffspeed (CHyM)
rain ara Precipitation field (mm) plus melting and returnflow terms. rainfall, datisparsi,
museodata, mm5data, melting
returnflow snowacc
to check
rsrm rsr Rain source map (coded value). For each grid point store the source used to rebuild the precipitation field at the current time step with the following meaning: 6=Radar, 7=Rain Gauges, 8=ERA-Interim reanalisys, 9=RegCM, 10=MM5, 11=MuSEO rainfall, datisparsi,
museodata, mm5data
snow sno Accumulated snow (equivalent mm of rain) snowacc,melting melting,snowcv
temp tem Temperature (C) potevapotransp snowacc,melting,
potevapotransp
wkm1 Work arrays. These arrays are usullay used for temporary storage of data. In the current version, the routine chymreaddynamicfields stores in work array wkm1 the surface water available for runoff. CHyM
wkm2
NOTES:
  • All the arrays are dimensioned (nlon,nlat) being these two parameters the same selected by the user with NLON and NLAT script parameters.
  • All the arrays are declared as real*4, except luse and fmap that are integer*4 arrays
  • The three characters in the second column represents the code to add to SAVEFLD csh parameter to save this field
  • An asterisk (*) in the second column means that this field is always saved in the CHyM output file
  • If the second column is empty means that the field cannot be saved in the current version.
  • Only the first level routine are listed in the fourth column. As an example temperature fields are rebuild by several subroutines (depending on the value of TEMPFL csh parameter), all these subroutines are called by potevapotransp routine.
  • In the last column "CHyM" means that the matrix is used by the whole model or in many subroutines and it useless to list them.
  • The array name listed in the first column usually correspond to the the name used inside CHyMLab environment to plot that field, as an example to plot the rain source map, the command is plot rsrm
Other vectors defined and used inside CHyM fortran code - The list is not yet complete
Vector
name
Meaning Calculated, set
or updated by
Used by
iriv(nlon+nlat) Contains the sequence of longitude indexes from the mouth up to the spring of the selected river. The sequence of indexes is rebuilt by the library routine chymsalmone; the vector is dimensioned nlon+nlat but the number of point actually belonging to the sequence is saved in the integer variable nselrp. The river can be selected by the csh parameter RIVER and the river mouths of the selected geographical domain can be visualized setting the value 8 for the PLOT option or using the the command "show river from CHyMLab utility. plotting writeoutfile
jriv(nlon+nlat) Same as iriv vector but for latitude indexes plotting writeoutfile
cpar(52) Contains the calibration parameters, the list of different components follows:
  1. Return flow factor, the return flow contribute is proportional to the this factor, to the drained area and the average precipitation in the upstream basin in the past N days; the number N is established by the parameter cpar(7) descript below. Used inside returnflow subroutine. Default=4.8e-07
  2. Alpha coefficient for the calculus of hydraulic radius. Used inside runoffspeed subroutine. Default=0.0015
  3. Beta coefficient for the calculus of hydraulic radius. Used inside runoffspeed subroutine. Default=0.050
  4. Melting temperature factor. Used inside melting subroutine. Default=0.050
  5. Melting shortwave radiation factor. Used inside melting subroutine. Default=0.0094
  6. River/land threshold (Km²). Used inside runoffspeed and riveronlanduse subroutines. Default=100.0
  7. Number of days to consider for return flow. Used inside returnflow subroutine. Default=90
  8. Reduction of manning coefficient for channel flow. Used inside runoffspeed subroutine. Default=4.5
  9. River/land threshold (Km²). Above this threshold returnflowfactor is computed. Used inside returnflow subroutine. Default=200.0
  10. Precipitation threshold (mm) above which flow occur over channel instead of land (see cpar(6) discussed above)
  11. Beta coefficient used to calculate BDD index (def=0.55). In principal this parameter should be the same of cpar(3), but it is set in a separate way in order to avoid confusions between different version.
calibration (see description)
evc(110,12) Monthly average potential evaporation (mm) depending on land use type (first index) and month (second index). chymdata module potevapotransp
infi(110) Infiltration and interception capacity (mm) for each land use type chymbd, calibration groundwater
logun(10) Logic units used by different routines for I/O operations, specific use of each component follow:
  1. Logic unit used to write CHyM output
  2. Logic unit used to write CHyM log
  3. Logic unit used to write CHyM output in grads format
  4. Logic unit used to read MM5 output file
  5. Logic unit used to read or write temperature file
  6. Logic unit used to read or write precipitation file
  1. writeintes0
  2. MAIN
  3. gradsheader
  4. definerainsources
  5. potevapotransp
  6. rainfall
  1. writeoutfile
  2. CHyM
  3. writeoutfile
  4. mm5data
  5. potevapotransp
  6. rainfall
manning(110) Manning coefficient for each landuse type (m/sec) chymbd, calibration runoffspeed
perc(110) Percolation from surface to deep ground (mm/hour) for each land use type chymbd, calibration groundwater
Variables defined and used inside CHyM fortran code - The list is not yet complete
Name Meaning Calculated, set
or Updated by
Used by
chymcrec Last record read by chymreadrec for dynamical fields Reset to 0 by chymheader, chymreadpar and chymreadstaticfields; updated by chymreadrec.
hourstep During CHyM simulation contains the current hourly step of integrationi. For output analysis it is updated by chymreaddynamicfields routine MAIN, chymreaddynamicfields CHyM
now A character string containing the date at the present step of integration MAIN CHyM
nselrp Number of grid points actually belonging to the sequence following the path of the selected river. The indexes of this sequence is stored in the vectors iriv and iriv (see above). plotting writeoutfile
time Coded value of the time in the format YYMMDDHH at the present step of integration MAIN CHyM
CHyM model documentation by Marco Verdecchia This document has been updated on February 19, 2022 h: 11:23