SUMMARY OF THE TIME STRUCTURE IN CUPID
1) GENERAL
CUPID is a model that combines information about the properties of a
soil-plant-atmosphere system with information about the time course of
outside influences on the system to generate a prediction of the system's
behavior in time.
The data representing the 'outside influences' on the system or, in other
words, the boundary conditions of the system for every time step, occupy
one record of the input file. Examples of such data are: upper and lower
boundary temperatures, incident radiation fluxes, wind speed and
precipitation above the canopy. They are typically represented in hourly
time steps, but the time structure of CUPID allows the input of these
variables in time steps of variable duration. This way, periods of rapid
changes in the system, (for example an irrigation event) can be more
accurately simulated by reducing the length of a time step to a few
minutes, while the rest of the day is treated in hourly time steps.
For every one of these records of 'hourly' input data, CUPID calculates the
state variables of the soil-plant-atmosphere system (such as temperature
profiles, photosynthetic rates of all layers and all leaf angle classes, as
well as whole canopy photosynthesis) between the upper and the lower
boundary conditions.
CUPID can work on any number of days and any number of time steps in a day,
which need not be the same for every day. The number of days of a simulation
does not affect the storage requirements of the program, since only one
day's data are input at a time. The number of time steps in a day is limited
by a PARAMETER statement in the main program as well as in some subroutines:
PARAMETER (HM = 98)
This statement determines the maximum number of time steps in a day and is
presently set to 98, so that the maximum number of time steps per day is 96
(a discussion follows). The constant HM is the number by which all time
subscripted variables are dimensioned. Consequently, the greater the
maximum number of time steps in one day of the simulation, the greater
the storage requirements of CUPID.
2) TIME RELATED VARIABLES AND SUBSCRIPTS
Time-independent variables in CUPID are not subscripted by any time index.
Examples are ROWSPC (row spacing in m), LAT (latitude) and RSOIL (soil
reflectance). Most of the output variables are also not subscripted by
time, since they are written into the output file as soon as they have been
generated.
Variables which remain constant throughout one day (daily variables) are
subscripted by day number. As an example:
HT(IDAY): Canopy height on the IDAY'th day
TLAI(IDAY): Total leaf area index on the IDAY'th day
IDAY ranges from 1 to NODAYS. NODAYS is the number of days of the simulation
and is an input variable. (NOTE: The number of days for which CUPID runs
is determined in one line of input, while the number of daily data available
in the input file may exeed NODAYS.)
Finally, 10 input variables and some CUPID variables are subscripted by the
number of time steps in a day:
TIMLOC(IHR): Local time for time step IHR
TAIR(IHR): Air temperature in the canopy at time step IHR
IHR ranges from 1 (first time step of the day) to NOHRS (the number of
'hours' in a day). NOHRS is calculated within the program and may vary
from one day to the next.
3) THE SEQUENCE OF DATA INPUT, PROCESSING, AND OUTPUT
In the beginning of the run, CUPID reads in all the header information
which includes fixed data and daily input data and writes the fixed data
into the output file (see the flow chart on the next page). It then
enters the daily loop and reads all of the first day's 'hourly' data.
After this, some of the daily input variables are processed (e.g. at this
point the vertical structure of the system for this day is set up in HITE2)
and the results of these calculations are written into the output file.
Following this, the 'hourly' loop is entered, where all major calculations
(resulting in the final approximation for the state variables of the system)
are executed. These results are added to the output file and the program
cycles back to the next time step.
At the end of processing one day's information, daily summaries are
calculated and also added to the output file. From here, the program goes
back to the beginning of the daily loop and the next IDAY.
There are important details to be noted:
1. The variables read in by the READ statement (labelled 101 in the main
program) are two unsubscripted variables IYEAR (the year) and ICUMDY
(the Julian day number), followed by 10 variables, all subscripted by IHR.
Since the number of time steps in a day is not known in advance and may
vary from one day to the next, it is necessary to always read to (and
including) the first record of the next day. Through comparing the current
value of ICUMDY with the previous value it is determined whether the last
record belongs to the data currently processed or whether it belongs to the
next IDAY's data. If the value of ICUMDY is not equal to the preceeding
value, the reading loop is interupted, the number of time steps in the day
is determined and the model's 'hourly' calculations are started. This
structure for the data input has two important consequences:
A: The first data record of the next IDAY are read into variables
subscripted by (NOHRS+1).
B: After recycling to the next IDAY, the next record to be read
in is the second record of that day.
Therefore, it becomes necessary to reassign what is stored in the subscript
(NOHRS+1) to the subscript (1) and to set IHR=2, before recycling in the
daily loop (refer to flow chart:(2)).
2. Given the information about the initial conditions of a system, CUPID
simulates the change of the systems state variables between one time step
and the next. This requires that the last time step's value for a variable
be available to calculate the next time step's value.
Since all of one day's data are read in at once and stored in time step
subscripted variables, this creates no problem, ecxept when going from one
day to the next. (ON READING THE NEW DAY'S DATA, THE PREVIOUS DAY'S DATA
WILL BE ERASED.) To avoid the problem, the last data record of every day
is stored in the highest subscript number (HM) and is therefore saved from
being overwritten.
An example may help to explain the role of the subscripts (NOHRS+1) and HM:
The following figure represents a one dimensional array (of an hourly input
variable) with HM locations. Let the days 1 and 2 of a simulation both have
96 time steps. After reading the first day's data the array will have the
following content:
After storing the last record of day 1 in HM, the array will be:
Before recycling to the next IDAY, the first record of the next day is
reassigned to subscript one, overwriting its previous content.
Now, the next IDAY's records are read in:
During the second day's calculations the program has access to all records
of IDAY=2, as well as the last record of IDAY=1 and the first record of
IDAY=3 (which is, however, not used in the calculations).
NOTE: The first record of the next day is not always stored in the same
subscript. Should IDAY=3 only have 50 records, the first record
of IDAY=4 would be in subscript 51.
NOTE: As long as the number of time steps in a day is less than or equal
to HM-2, the content of the location subscripted by HM cannot be
overwritten by the 'hourly' data input loop.
It is now apparent why HM must be at least 2 numbers greater than the number
of time steps in a day:
subscript (NOHRS+1) stores the first data of the next day
subscript HM > (NOHRS+2) stores the last data of the previous day.
Throughout the main calculations there are statements like:
IHRM1 = IHR -1
IF (IHR.EQ.1)IHRM1 = HM
to take this device of saving the last day's data into account.