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.
|
|
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.
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: |
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.
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') endTwo 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:
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:
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
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:
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:
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:
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:
|
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:
|
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:
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:
|
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:
|
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:
|
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:
|
|
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:
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.
|
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:
|
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:
|
|
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.
| ||||||||||||||||||||||||||||||||||||||||||||||||
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
| ||||||||||||||||||||||||||||||||||||||||||||||||
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:
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 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.
| ||||||||||||||||||||||||||||||||||||||||||||||||
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:
| ||||||||||||||||||||||||||||||||||||||||||||||||
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:
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:
|
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:
|
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:
|
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:
|
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:
|
|
|
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 |