|
HYPE
|
Functions/Subroutines | |
| subroutine, public | model_version_information (funit) |
| subroutine, public | define_output_variables () |
| subroutine, public | load_modeldefined_input (dir, dir2, dir3, nsmax, ns, indexarray, bdate, edate, loadxoms, loadregs, loadcrun, loadextflow, status) |
| subroutine, public | reload_modeldefined_observations (dir, status) |
| subroutine, public | close_modeldefined_observations () |
| subroutine, public | open_modeldefined_outputfiles (dir, n, na) |
| subroutine, public | close_modeldefined_outputfiles (na) |
| subroutine | load_xoms_files (dir, ns, bdate, edate, status) |
| subroutine | reload_xoms_files (dir, status) |
| subroutine | close_xoms_files () |
| subroutine, public | get_current_xoms (cd, n) |
| subroutine, public | load_data_for_regression_parameter_estimate (dir, nsbase, ns, indexarray, status) |
| subroutine | load_regression_parameters (dir, status) |
| subroutine, public | deallocate_regest_input_variables () |
| subroutine, public | get_regest_parameter (isub, ipar, rgpar, term) |
| subroutine | load_precalculated_runoff (dir, dir2, nsbase, bdate, edate, status) |
| subroutine, public | get_current_precalculated_runoff (sumaland, runoff, crunoff) |
| subroutine | load_external_inflows (mdir, edir, nsbase, nsubsub, bdate, edate, status) |
| subroutine, public | get_filename_external_inflow (edir, inflowid, filename, status) |
| subroutine | check_variables_in_txt_file (funit, infile, numsubst, nskip, ncolfile, oindex, status) |
| subroutine, public | get_external_inflow_for_routing_network (inflow, acinflow, indexwb, localwbflows) |
Variables | |
Variables for HYPE input files: XobsXOxx.txt | |
| integer, parameter, public | max_xoms = 10 |
| character(len=20), dimension(max_xoms, 2), public | xoms_filename = RESHAPE(SOURCE=(/ 'XobsXOM0.txt','XobsXOM1.txt','XobsXOM2.txt','XobsXOM3.txt','XobsXOM4.txt', 'XobsXOM5.txt','XobsXOM6.txt','XobsXOM7.txt','XobsXOM8.txt','XobsXOM9.txt', 'XobsXOS0.txt','XobsXOS1.txt','XobsXOS2.txt','XobsXOS3.txt','XobsXOS4.txt', 'XobsXOS5.txt','XobsXOS6.txt','XobsXOS7.txt','XobsXOS8.txt','XobsXOS9.txt'/), SHAPE=(/max_xoms,2/)) |
| integer | num_xomsfiles |
| integer, dimension(2), public | num_xoms |
| integer | max_nstn |
| integer, dimension(max_xoms, 2) | ncom |
| integer, dimension(:,:), allocatable | xoms_funit |
| integer, dimension(:,:), allocatable | xoms_nstn |
| integer, dimension(:,:), allocatable | xomindex |
| integer, dimension(:,:), allocatable | xosindex |
| integer, dimension(max_xoms, 2) | xoms_timeformat |
| type(datetype), dimension(:,:), allocatable | xoms_fbdate |
| type(datetype), dimension(:,:), allocatable | xoms_fedate |
| real, dimension(:,:), allocatable, public | xom |
| real, dimension(:,:), allocatable, public | xos |
Variables for HYPE input files (precalculated runoff): timeCRUN.txt etc | |
| integer | runoff_timeformat |
| integer | nlandbasins |
| integer, dimension(:), allocatable | nrunoffcolumns |
| integer, dimension(:), allocatable | funit_runoff |
| integer, dimension(:,:), allocatable | runoffindex |
Variables for HYPE input files (external inflow): 0000nnn.txt etc | |
| integer | externalinflow_timeformat |
| integer | nexternalflows |
| integer | nextinfdatacols |
Variables for HYPE regression parameter estimates input data | |
| integer | npar_regr |
| integer | npc_catdes |
| integer | ngroup_cat |
| integer, dimension(:), allocatable | indx_par |
| integer, dimension(:,:), allocatable | ndes_reg |
| integer, dimension(:,:,:), allocatable | idx_catdes |
| real, dimension(:,:,:), allocatable | wght_catdes |
| integer, dimension(:), allocatable | clust_group |
| real, dimension(:,:), allocatable | catdes |
This module is used to define HYPE version and output variables. It handles specific input data (files) for the HYPE model; observations in XobsXOMN.txt, XobsXOSN.txt and regression parameters in reg_par.txt, CatchDes.txt, CatchGroup.txt.
|
private |
Opens a file with time series of variables and check for wanted variables and save their order. Used for external inflow files.
| [in] | funit | Unit for file |
| [in] | infile | Name of file to be read |
| [in] | numsubst | Number of substances simulated |
| [in] | nskip | Number of comment row to skip before station row |
| [in] | ncolfile | Number of columns in file |
| [out] | oindex | Index to find correct variabel/column in matrix (of all columns in file) |
| [out] | status | error number |
Algorithm
Read heading; variable names
Find wanted variables location in file
Check if all variables present
| subroutine, public modeldata_module::close_modeldefined_observations |
Close files with model specific observations (xom0..xom9,xos0..xos9).
| subroutine, public modeldata_module::close_modeldefined_outputfiles | ( | integer, intent(in) | na | ) |
Close files for printout.
| [in] | na | Number of aquifers |
|
private |
Close files with observations.
| subroutine, public modeldata_module::deallocate_regest_input_variables |
Deallocate input data for regression parameter estimates.
| subroutine, public modeldata_module::define_output_variables |
Set variables holding output information from the HYPE model; outvarid.
Algoritm
Initialize outvarid structure
Set each HYPE variable id's information (name, type, units etc.) to outvarid structure
Set other variables based on the outvarid indices for other functions that depend on finding correct outvar
| subroutine, public modeldata_module::get_current_precalculated_runoff | ( | real, dimension(nsub), intent(in) | sumaland, |
| real, dimension(nsub), intent(out) | runoff, | ||
| real, dimension(numsubstances,nsub), intent(out) | crunoff ) |
Collect the current runoff fromm pre calculated slc output crun and coNN.
| [in] | sumaland | land area fraction for subbasins |
| [out] | runoff | runoff for subbasins |
| [out] | crunoff | load of runoff |
| subroutine, public modeldata_module::get_current_xoms | ( | type(datetype), intent(in) | cd, |
| integer, intent(in) | n ) |
Get current observations from file.
| subroutine, public modeldata_module::get_external_inflow_for_routing_network | ( | real, dimension(nsub), intent(inout) | inflow, |
| real, dimension(numsubstances,nsub), intent(inout) | acinflow, | ||
| integer, intent(in) | indexwb, | ||
| real, dimension(:,:), intent(inout) | localwbflows ) |
Collect the current external inflow from files.
| [in,out] | inflow | accumulated upstream inflow to subbasin (m3/s) |
| [in,out] | acinflow | load of upstream inflow (mg/L*m3/s) |
| [in,out] | localwbflows | flow for water balance output (m3/ts) |
Algorithm
For each external inflow:
| subroutine, public modeldata_module::get_filename_external_inflow | ( | character(len=*), intent(in) | edir, |
| integer, intent(in) | inflowid, | ||
| character(len=*), intent(out) | filename, | ||
| integer, intent(out) | status ) |
Finds the file name for external inflow data file.
| [in] | edir | File directory (externaldir) for time series file |
| [in] | inflowid | inflow id of file to search for |
| [out] | filename | Collected file name |
| [out] | status | Status of subroutine |
Get filename and check file existance
| subroutine, public modeldata_module::get_regest_parameter | ( | integer, intent(in) | isub, |
| integer, intent(in) | ipar, | ||
| real, intent(inout) | rgpar, | ||
| real, intent(in), optional | term ) |
Calculate regression parameter estimate from regression coefficients and catchment characteristics.
| [in] | isub | current subbasin |
| [in] | ipar | current regression parameter |
| [in,out] | rgpar | parameter value |
| [in] | term | term to be added to parameter |
| subroutine, public modeldata_module::load_data_for_regression_parameter_estimate | ( | character(len=*), intent(in) | dir, |
| integer, intent(in) | nsbase, | ||
| integer, intent(in) | ns, | ||
| integer, dimension(ns), intent(in) | indexarray, | ||
| integer, intent(out) | status ) |
Reads three files with basin characteristics, and regression coefficients for parameters.
| [in] | dir | File directory (modeldir) |
| [in] | nsbase | Number of subbasins (model set-up) |
| [in] | ns | Number of subbasins (submodel) |
| [in] | indexarray | index for basemodel |
| [out] | status | Status of subroutine |
Algorithm
Initialise
Read catchment group and catchment descriptor information (CatchGroup.txt,CatchDes.txt)
Read reg_par.txt
|
private |
Prepare reading external flow files from pre calculated subbasins or other external source, to be added to main river inflow.
| [in] | mdir | File directory (modeldir) for ExternalInflowKey-file |
| [in] | edir | File directory (externaldir) for time series file |
| [in] | nsbase | Number of subbasins (model set-up) |
| [in] | nsubsub | Number of subbasins (submodel) |
| [in] | bdate | Begin simulation date |
| [in] | edate | End simulation date |
| [out] | status | Status of subroutine |
Algorithm
Initialise
Check for correct model set up
Load a file with coupling between inflows and main rivers (subbasins) The result will be a number of inflows nexternalflows, which can be more than one for a main river (>=nsub_basemodel) (submodel allowed) and a indexarray for location of substances
Read file
Find the inflows to current submodel, and their recievers subbasin index, and the number of them
Set module variable with initial information
For every input file:
Get filename and check file existance
Count comment rows and columns
Check presence and column order of variables in file, and get a index linking them
Check time period
Prepare reading file
| subroutine, public modeldata_module::load_modeldefined_input | ( | character(len=*), intent(in) | dir, |
| character(len=*), intent(in) | dir2, | ||
| character(len=*), intent(in) | dir3, | ||
| integer, intent(in) | nsmax, | ||
| integer, intent(in) | ns, | ||
| integer, dimension(ns), intent(in) | indexarray, | ||
| type(datetype), intent(in) | bdate, | ||
| type(datetype), intent(in) | edate, | ||
| logical, intent(in) | loadxoms, | ||
| logical, intent(in) | loadregs, | ||
| logical, intent(in) | loadcrun, | ||
| logical, intent(in) | loadextflow, | ||
| integer, intent(out) | status ) |
Reads files with model specific input For HYPE it is files with different observations (xom0..xom9,xos0..xos9), files for regression estimated parameters, and timefiles with runoff from pre-run.
| [in] | dir | File directory (modeldir) |
| [in] | dir2 | File directory (otherobsdir) |
| [in] | dir3 | File directory (externaldir) |
| [in] | nsmax | Number of subbasins, basemodel |
| [in] | ns | Number of subbasins, submodel |
| [in] | indexarray | index for basemodel |
| [in] | bdate | Begin simulation date |
| [in] | edate | End simulation date |
| [in] | loadxoms | flag for using xoms-files |
| [in] | loadregs | flag for using regression estimation-files |
| [in] | loadcrun | flag for using pre calculated slc output |
| [in] | loadextflow | flag for using external inflow to main river(s) |
| [out] | status | Status of subroutine |
|
private |
Prepare time output files from pre calculated output of crun and coNN.
| [in] | dir | File directory (modeldir) |
| [in] | dir2 | File directory (externaldir) |
| [in] | nsbase | Number of subbasins (model set-up) |
| [in] | bdate | Begin simulation date |
| [in] | edate | End simulation date |
| [out] | status | Status of subroutine |
Algorithm
Initialise
Check for correct model set up
Load a file with coupling between subbasins (routing) and (possible fewer) "landbasins" for land runoff The result will be a number of areas nlandbasins<=nsub (submodel not allowed) and a indexarray runoffindex(1:nsub)=ilandbasin These are module variables here in this modeldata_module
Read file
Find the unique runoffid in the key file, and the number of unique runoffid:s
Find index in runoffid-variable for all subbasins, in subbasin order
Prepare to read pre-calculated land runoff and substances
For every input file:
Get filename
Check that file exist
Count comment rows
Check landbasins' runoff' ids, those in runoff file against those in runoffkey file
Set the runoff index linking subbasins to column of data in runoff files
Check time period
Prepare reading file
|
private |
Read parameter values from file.
Consequences The module variables npar_regr, ndes_reg, idx_catdes, wght_catdes, indx_par will be allocated and set.
| [in] | dir | File directory |
| [out] | status | Status of subroutine |
Algorithm
Allocate and load regression parameter coefficients
|
private |
Reads files with different observations (xom0..xom9,xos0..xos9).
| [in] | dir | File directory (otherobsdir, was forcingdir) |
| [in] | ns | Number of subbasins |
| [in] | bdate | Begin simulation date |
| [in] | edate | End simulation date |
| [out] | status | Status of subroutine |
| subroutine, public modeldata_module::model_version_information | ( | integer, intent(in) | funit | ) |
Information about the model version to print in log-file.
| [in] | funit | fileunit for log-file |
| subroutine, public modeldata_module::open_modeldefined_outputfiles | ( | character(len=*), intent(in) | dir, |
| integer, intent(in) | n, | ||
| integer, intent(in) | na ) |
Opens files for printout.
| [in] | dir | Result file directory |
| [in] | n | Number of subbasins |
| [in] | na | Number of aquifers |
| subroutine, public modeldata_module::reload_modeldefined_observations | ( | character(len=*), intent(in) | dir, |
| integer, intent(out) | status ) |
Reload files with model specific observation input For HYPE it is files with different observations (xom0..xom9,xos0..xos9).
| [in] | dir | File directory (otherobsdir) |
| [out] | status | Status of subroutine |
|
private |
Prepare files with different observations (xom0..xom9,xos0..xos9) for rereading No checks.
| [in] | dir | File directory (otherobsdir, was forcingdir) |
| [out] | status | Status of subroutine |
|
private |
catchment descriptors for catchments to be used in parameter regionalization (nsub,npc_catdes)
|
private |
group id of catchment after catchments are grouped based on their charactersistics (nsub)
|
private |
|
private |
fileunits for runoff output to be read
|
private |
indices of the pca of catchment descriptors used for regionalization of the parameter (ngroup_cat,npar_regr,npc_catdes)
|
private |
contains info on whether a given parameter is regionally estimated and which parameter order it has (max_par)
|
private |
Maximum number of stations (columns) in any file.
| integer, parameter, public modeldata_module::max_xoms = 10 |
Maximum number of xom- resp xos-files (0-9).
|
private |
Number of comment rows in Xoms files (starting with !!).
|
private |
number of descriptors used to regionalize each of the parameters in each group (ngroup_cat,npar_regr)
|
private |
Number of external flows (files) to use.
|
private |
Number of columns in files (except date-time column).
|
private |
maximum number of catchment groups
|
private |
Number of land basins (<= normal subbasins still used for routing).
|
private |
number of parameters to be estimated using a regression relationship
|
private |
maximum number of catchment descriptors
|
private |
Number of data columns (beside date) in runoff output (for reading files, can be larger than nsub).
| integer, dimension(2), public modeldata_module::num_xoms |
Number of xom- resp xos-files each.
|
private |
Number of xom- resp xos-files (max filenumber).
|
private |
|
private |
Index of land basin for each subbasin.
|
private |
weights of the pca used to estimate the model parameter (ngroup_cat,npar_regr,npc_catdes)
| real, dimension(:,:), allocatable, public modeldata_module::xom |
Observations of current time step of variable averaged over period (nvar,nobs).
|
private |
Index of observations of variable averaged over period (nvar,subbasin).
|
private |
File starting date within simulation period (nvar,2).
|
private |
File ending date within simulation period (nvar,2).
| character(len=20), dimension(max_xoms,2), public modeldata_module::xoms_filename = RESHAPE(SOURCE=(/ 'XobsXOM0.txt','XobsXOM1.txt','XobsXOM2.txt','XobsXOM3.txt','XobsXOM4.txt', 'XobsXOM5.txt','XobsXOM6.txt','XobsXOM7.txt','XobsXOM8.txt','XobsXOM9.txt', 'XobsXOS0.txt','XobsXOS1.txt','XobsXOS2.txt','XobsXOS3.txt','XobsXOS4.txt', 'XobsXOS5.txt','XobsXOS6.txt','XobsXOS7.txt','XobsXOS8.txt','XobsXOS9.txt'/), SHAPE=(/max_xoms,2/)) |
Filenames for Xoms-files.
|
private |
File unit of files with observations (nvar,2).
|
private |
Number of stations (columns in file) (nvar,2).
|
private |
Date-time format of Xoms files (0 only date, 1 date and time).
| real, dimension(:,:), allocatable, public modeldata_module::xos |
Observations of current time step of variable summed over period (nvar,nobs).
|
private |
Index of observations of variable summed over period (nvar,subbasin).