HYPE
All Classes Namespaces Files Functions Variables Pages
Functions/Subroutines
datamodule Module Reference

Functions/Subroutines

subroutine, public load_observations (dir, odir, ns, bdate, edate, ndt, status)
 
subroutine, public load_ascii_forcing (dir, ns, bdate, edate, ndt, status)
 
subroutine load_one_forcing_variabel (ns, ndt, bdate, edate, forcobs, status)
 
integer function get_forcing_index (name)
 
subroutine load_netcdf_observations (dir, ns, bdate, edate, ndt, n_Result)
 
subroutine, public load_ascii_qx_observations (dir, ns, ndt, bdate, edate, status)
 
subroutine load_netcdf_qx_observations (dir, ns, ndt, bdate, edate, status)
 
subroutine save_xoreginformation (n, var2, nr)
 
subroutine, public reset_observations (dir, mdir, odir, status)
 
subroutine, public close_observations (odir, reset)
 
subroutine, public get_current_forcing (idt, ns, current_date)
 
subroutine get_one_current_forcing_data (i, n, forcobs, current_date, current_value)
 
real function, dimension(n) get_current_flow (i, cd, n, no)
 
real function, dimension(no) get_current_wst (i, cd, no)
 
real function, dimension(no) get_current_wst_from_xobs (readxobs, no)
 
real function, dimension(xcol) get_current_otherobs (i, cd)
 
real function, dimension(xorcol) get_current_oregobs (i, cd)
 
real function, dimension(xcgcol) get_current_classobs (i, cd)
 
subroutine, public prepare_for_update (dir, locupall, locupnone, nsfile, ns, status)
 
subroutine set_update_nutrientcorr (dim, ns, nrow, icorr, dataarray)
 
subroutine get_current_time_pointsource (cd)
 
subroutine, public load_basindata (dir, fdir, n, status)
 
subroutine, public load_classdata (funit, infile, status)
 
subroutine, public load_geoclass (fname, geoclassdata, numslc, maxluse, maxsoil, maxrotation)
 
subroutine, public set_model_base_configuration (basemodel, idir, idir2, dim, status)
 
subroutine, public set_model_configuration (config, simconfig)
 
subroutine, public initiate_model_parameters (ns_base, status)
 
subroutine, public load_branchdata (dir, status)
 
subroutine find_connected_lakebasins (ndim, basins, downbasins, upbasin)
 
subroutine, public load_aquiferdata (dir, nsub, numaqu, status)
 
subroutine, public load_glacierdata (dir, nsb, status)
 
subroutine load_lakedata (funit, dir, n, lakedataid, status)
 
subroutine load_damdata (funit, dir, n, status)
 
subroutine load_flooddata (funit, dir, n, status)
 
subroutine start_lakedata_table (maxcol, ncols, nrows, str, xi, xr, iindex, rindex, ns, lakedataid)
 
subroutine, public finish_lakedata_table (ns)
 
subroutine, public read_and_calc_basindata (funit, infile, nskip, n, maxcol, lakedataid, status)
 
subroutine load_deposition (funit, dir, n, status)
 
subroutine, public reload_deposition (funit, dir, basemodel, n, status, filedate)
 
subroutine, public finish_atmdep_file_deposition (dir)
 
subroutine load_rrcurvedata (funit, dir, n, status)
 
subroutine, public load_pointsourcedata (dir, infile, n, status)
 
subroutine read_pointsourcedata (dir, infile, nrows, status, fexist, readsubid, readpsid, readpstype, readlocation, pointsource, readdate1, readdate2)
 
subroutine, public get_current_pointsources (dir, infile, ns, time, status)
 
subroutine, public load_permanent_soilleakage (dir, n, bd, status)
 
subroutine, public get_current_soilleakage (dir, n, time, status)
 
subroutine find_seasonal_division_of_leakage (dir, infile, nleak, status)
 
subroutine read_seasonal_leakage (dir, infile, n, geoid, nleak, status, leakage)
 
subroutine read_first_monthly_leakage (dir, infile, bd, n, geoid, status, leakage)
 
subroutine read_one_year_monthly_leakage (dir, infile, cd, n, geoid, status, leakage)
 
subroutine load_management_data (funit, dir, n, status)
 
subroutine load_forcing_information_data (funit, dir, ns, status)
 
subroutine load_forcing_information_data_from_txt_file (funit, dir, ns, status)
 
subroutine read_update_data (funit, infile, ns, nqsub, qupdsub, nqarsub, nwarsub, qarupdsub, warupdsub, qarupdar, warupdar, nwsub, wendsub, nrow, tpcorrarr, tncorrarr, tploccorrarr, tnloccorrarr, ncsub, cupdsub)
 
subroutine, public calculate_path (ns)
 
subroutine, public reform_inputdata_for_submodel (basemodel, ns)
 
integer function get_subid_index (id, ns)
 
subroutine, public load_cropdata (dir, n, status)
 
subroutine, public get_hyss_arguments (dir, iseq, pflag)
 
subroutine, public load_coded_info (dir, status, date1, date2, date3, skip, step, nsubst, rsmax, rsnum, readstatedate, mdir, rdir, fdir, odir, lldir, ldir, conductinibin, locupall, locupnone, subincrit)
 
subroutine set_yesno_variable_from_line (linelen, linepos, line, errstr, onoff, status)
 
integer function count_number_of_output (dim1, dim2, arr1, arr2, arr3, arr4, arr5, arr6, arr7)
 
subroutine check_output_variables (dimout, n, varid, aggarea)
 
subroutine, public set_outvar (nout, noutvar, noutvarclass)
 
subroutine set_outvar_output (nout, noutvar, noutvarclass)
 
subroutine set_outvar_crit (noutvar, noutvarclass)
 
subroutine, public load_submodel_information (dir, submodelrun, basemodel, msub, status)
 
subroutine, public set_outvar_for_variable_new (varid, areaagg, ovindex, noutvar, noutvarclass, cgname)
 
subroutine, public prepare_subbasin_output (critbasins, status)
 
subroutine, public load_output_regions (dir, nreg, status)
 
subroutine check_outputfiles_for_illegal_input (status)
 
subroutine, public load_otest (dir, name, status)
 
subroutine, public load_parameters (dir, basemodel, status, seqflag, iens)
 
subroutine, public load_optpar (dir)
 
subroutine read_parameter_ensemble_task (dir, taskAS, taskBS)
 
subroutine calculate_special_optpar_parameters (dir, velindex, dampindex, rivvel, damp)
 
subroutine calculate_special_partxt_parameters (dir, nruns, velindex, dampindex, rivvel, damp)
 
subroutine, public initiate_output_routines ()
 
subroutine, public set_outvar_test_information (n)
 
subroutine, public count_ensemble_simulations (use_bestsims, use_allsim, nens)
 
subroutine count_parfile_simulations (nens)
 
subroutine, public load_ensemble_simulations (dir, fname, numpar, nperf, numcrit, nsim, parameters)
 
subroutine read_simulation_perf_and_par (funit, i, mpar, numpar, nperf, numcrit, optcrit, performance, parameters, status)
 

Detailed Description

Read and process model input from files, both static data and forcing.

Procedures for observations, and for reading and preparing input data.

Function/Subroutine Documentation

◆ calculate_path()

subroutine, public datamodule::calculate_path ( integer, intent(in)  ns)

Calculate the coupling between subbasins by index from the existing coupling by subid. In addition set the flag for upstream lakebasins flowing to downstream lakebasin and branches that are secondary outlets of lakebasin lake.

Consequences Module modvar variables path, branchdata and branchindex may be allocated and set. Module modvar variables pathsubid and branchsubid is deallocated.

Parameters
[in]nsNumber of subbasins (of submodel)

Algorithm
Set main path and groundwater flow path

Check for connected lakebasins in main flow path

Set branch path and data, if present

Check for connected lakebasins in branched flow path

Check for secondary outlet of lakebasins in branched flow path

Find subbasin index that outlet originated from

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_special_optpar_parameters()

subroutine datamodule::calculate_special_optpar_parameters ( character(len=*), intent(in)  dir,
integer, intent(in)  velindex,
integer, intent(in)  dampindex,
real, intent(inout)  rivvel,
real, intent(inout)  damp 
)

Reads parameters to be calibrated to find maximum dimension of river states.

Parameters
[in]dirfile directory
[in]velindexindex of rivvel in modparid
[in]dampindexindex of damp in modparid
[in,out]rivvellower river velocity boundary
[in,out]damplower damp boundary
+ Here is the caller graph for this function:

◆ calculate_special_partxt_parameters()

subroutine datamodule::calculate_special_partxt_parameters ( character(len=*), intent(in)  dir,
integer, intent(in)  nruns,
integer, intent(in)  velindex,
integer, intent(in)  dampindex,
real, intent(inout)  rivvel,
real, intent(inout)  damp 
)

Reads parameters of ensemble simulation to find maximum dimension of river states.

Parameters
[in]dirfile directory
[in]nrunsnumber of ensembles
[in]velindexindex of rivvel in modparid
[in]dampindexindex of damp in modparid
[in,out]rivvellower river velocity boundary
[in,out]damplower damp boundary

Check whole ensemble's par files

Read each parameter from file

Find rivvel and damp values

+ Here is the caller graph for this function:

◆ check_output_variables()

subroutine datamodule::check_output_variables ( integer, intent(in)  dimout,
integer, intent(inout)  n,
integer, dimension(dimout), intent(inout)  varid,
integer, dimension(dimout), intent(inout)  aggarea 
)
private

Checks for incompatible output.

Parameters
[in]dimoutdimension of variable arrays
[in,out]nnumber of output variables of this type
[in,out]varidvariables for output
[in,out]aggareaarea aggregation type of variable (subbasin=0,upstream=1,region=2)

Algorithm
Check outvar information for non-calculatable upstream variables

Change output variable information

Set output

+ Here is the caller graph for this function:

◆ check_outputfiles_for_illegal_input()

subroutine datamodule::check_outputfiles_for_illegal_input ( integer, intent(out)  status)

Check output files for illegal variables.

Parameters
[out]statusstatus returned from function
+ Here is the caller graph for this function:

◆ close_observations()

subroutine, public datamodule::close_observations ( character(len=*), intent(in)  odir,
logical, intent(in), optional  reset 
)

Close files with observations used for forcing and calibration.

Parameters
[in]odirFile directory (otherobsdir for Xobs)
[in]resetflag that subroutine is used for reset
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ count_ensemble_simulations()

subroutine, public datamodule::count_ensemble_simulations ( logical, intent(in)  use_bestsims,
logical, intent(in)  use_allsim,
integer, intent(out)  nens 
)

Count number of parameter sets used for ensemble simulation.

Parameters
[in]use_bestsimsTask count bestsims.txt
[in]use_allsimTask count allsim.txt
[out]nensNumber of parameter ensembles

Algorithm
Find file with parameter set(s)

If file with parameter ensemble sets

  • Open file and skip heading
  • Read number of lines
  • End routine
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ count_number_of_output()

integer function datamodule::count_number_of_output ( integer, intent(in)  dim1,
integer, intent(in)  dim2,
integer, dimension(dim1), intent(in)  arr1,
integer, dimension(dim1), intent(in)  arr2,
integer, dimension(dim1), intent(in)  arr3,
integer, dimension(dim1), intent(in)  arr4,
integer, dimension(dim2), intent(in)  arr5,
integer, dimension(dim2), intent(in)  arr6,
integer, dimension(dim1), intent(in)  arr7 
)
private

Count number of outputs / output types and output periods.

Consequences Module worldvar variable noutput is set by return value

Parameters
[in]dim1dimension of array (meanperiod)
[in]dim2dimension of array (groups)
[in]arr1array with number of variables for output of type 1
[in]arr2array with number of variables for output of type 2
[in]arr3array with number of variables for output of type 3
[in]arr4array with number of variables for output of type 4
[in]arr5array with number of variables for output of type 5 or 6
[in]arr6array with number of variables for output of type 5 or 6
[in]arr7array with number of variables for output of type 7

Algorithm
Count number of outputs with set variables, i.e. used for this simulation

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ count_parfile_simulations()

subroutine datamodule::count_parfile_simulations ( integer, intent(out)  nens)

Count number of parameter files ensemble simulation.

Parameters
[out]nensNumber of parameter ensembles

Algorithm
Find file with parameter set(s)

+ Here is the caller graph for this function:

◆ find_connected_lakebasins()

subroutine datamodule::find_connected_lakebasins ( integer, intent(in)  ndim,
integer, dimension(ndim), intent(in)  basins,
integer, dimension(ndim), intent(in)  downbasins,
logical, dimension(ndim), intent(out)  upbasin 
)

Check for connected lakebasins.

Parameters
[in]ndimNumber of subbasins to be checked
[in]basinsSubid of all subbasins to be checked; basin(i)subid, branchsubid(i)source
[in]downbasinsSubid of their downstream subbasins; pathsubid(i)main or branchsubid(i)branch
[out]upbasinFlag for lakebasins upstream of other lakebasins

Check for connected lakebasins

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_seasonal_division_of_leakage()

subroutine datamodule::find_seasonal_division_of_leakage ( character (len=*), intent(in)  dir,
character (len=*), intent(in)  infile,
integer, intent(out)  nleak,
integer, intent(out)  status 
)

Checks a file for seasonal leakage for the seasonal division of the file The file can have seasonality as (daily or) monthly values or be constant.

Parameters
[in]dirFile directory
[in]infileName of leakage file
[out]nleakSeasonal division; number of values to be read for each subbasin (1, 12 or 366)
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finish_atmdep_file_deposition()

subroutine, public datamodule::finish_atmdep_file_deposition ( character (len=*), intent(in)  dir)

Set deposition to model specified values if no AtmdepData.txt file is used.

Parameters
[in]dirFile directory

Algorithm

Check for file

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finish_lakedata_table()

subroutine, public datamodule::finish_lakedata_table ( integer, intent(in)  ns)

Set lakedatapar values to those specified in HYPE parameter variables.

Parameters
[in]nsnumber of subbasins

Algorithm

+ Here is the caller graph for this function:

◆ get_current_classobs()

real function, dimension(xcgcol) datamodule::get_current_classobs ( integer, intent(in)  i,
type(datetype), intent(in)  cd 
)

Get current value of class observations from files or memory.

Parameters
[in]icurrent time step
[in]cdcurrent date
Returns
current observations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_flow()

real function, dimension(n) datamodule::get_current_flow ( integer, intent(in)  i,
type(datetype), intent(in)  cd,
integer, intent(in)  n,
integer, intent(in)  no 
)

Get current discharge from file or memory.

Parameters
[in]icurrent time step
[in]cdcurrent date
[in]nnumber of subbasins
[in]nonumber of observation stations
Returns
current flow
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_forcing()

subroutine, public datamodule::get_current_forcing ( integer, intent(in)  idt,
integer, intent(in)  ns,
type(datetype), intent(out)  current_date 
)

Get current forcing from file or memory.

Parameters
[in]idtcurrent timestep index
[in]nsnumber of subbasins
[out]current_datecurrent date
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_oregobs()

real function, dimension(xorcol) datamodule::get_current_oregobs ( integer, intent(in)  i,
type(datetype), intent(in)  cd 
)

Get current value of other observations from file or memory.

Parameters
[in]icurrent time step
[in]cdcurrent date
Returns
current observations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_otherobs()

real function, dimension(xcol) datamodule::get_current_otherobs ( integer, intent(in)  i,
type(datetype), intent(in)  cd 
)

Get current value of other observations from file or memory.

Parameters
[in]icurrent time step
[in]cdcurrent date
Returns
current observations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_pointsources()

subroutine, public datamodule::get_current_pointsources ( character (len=*), intent(in)  dir,
character (len=*), intent(in)  infile,
integer, intent(in)  ns,
type(datetype), intent(in)  time,
integer, intent(out)  status 
)

Gets the information about temporary point sources from PointSourceData.txt. Recalculate into form suitable for model.

Consequences Module modvar variable load and t1load are changed

Reference ModelDescription Chapter 5 (Point sources)

Parameters
[in]dirFile directory
[in]infileName of pointsource file to be read (PointSourceData.txt)
[in]nsNumber of subbasins (submodel)
[in]timeCurrent time (e.g. 2005-01-26 18:00)
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_soilleakage()

subroutine, public datamodule::get_current_soilleakage ( character (len=*), intent(in)  dir,
integer, intent(in)  n,
type(datetype), intent(in)  time,
integer, intent(out)  status 
)

Gets the information about nutrient soil leakage from file.

Alternative 3: Soil nutrient leakage load is read from file. A simlified soil routine is used. Alternative 6: Soil nutrient leakage load and conc is read from files.

Consequences Module modvar variable soilleak is set.

Reference ModelDescription Chapter Nitrogen and phosphorus in land routines (Nutrient soil leakage from outer source)

Parameters
[in]dirFile directory
[in]nNumber of subbasins, submodel
[in]timeCurrent time (e.g. 2005-01-26 18:00)
[out]statusError status

Algorithm

Load current soilleakage load from files

  • Allocate and initiate variables
  • Read data files

Load current soilleakage from files

  • Allocate and initiate variables
  • Read data files
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_time_pointsource()

subroutine datamodule::get_current_time_pointsource ( type(datetype), intent(in)  cd)

Get current value of time series pointsource from file and set modvar variable psload.

Parameters
[in]cdcurrent date
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_wst()

real function, dimension(no) datamodule::get_current_wst ( integer, intent(in)  i,
type(datetype), intent(in)  cd,
integer, intent(in)  no 
)

Get current water level from file or memory.

Parameters
[in]icurrent time step
[in]cdcurrent date
[in]nonumber of observation stations
Returns
current water stage of lake
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_wst_from_xobs()

real function, dimension(no) datamodule::get_current_wst_from_xobs ( real, dimension(xcol), intent(in)  readxobs,
integer, intent(in)  no 
)

Get current water level from xobsi array.

Parameters
[in]readxobscurrent xobs observations
[in]nonumber of observation stations
Returns
current water stage of lake
+ Here is the caller graph for this function:

◆ get_forcing_index()

integer function datamodule::get_forcing_index ( character(len=10), intent(in)  name)

Find index of forcing based on filename.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_hyss_arguments()

subroutine, public datamodule::get_hyss_arguments ( character(len=maxcharpath), intent(out)  dir,
integer, intent(out)  iseq,
logical, intent(out)  pflag 
)

Get command line argument: directory of info.txt and simulation sequence, or read them from filedir.txt (old variant).

Parameters
[out]dirDirectory for information about simulation (infodir)
[out]iseqSequence number (simsequence)
[out]pflagSequence number to be used on par-file (parseq)

Algorithm

If no command line argument, read information from filedir.txt

Get command line argument

+ Here is the caller graph for this function:

◆ get_one_current_forcing_data()

subroutine datamodule::get_one_current_forcing_data ( integer, intent(in)  i,
integer, intent(in)  n,
type(forcingdatatype), intent(in)  forcobs,
type(datetype), intent(out)  current_date,
real, dimension(n), intent(out)  current_value 
)

Get current forcing data for one variable for selected subbasins from file or memory.

Parameters
[in]icurrent time step
[in]nnumber of subbasins
[in]forcobsdata/information for one forcing variable
[out]current_datecurrent date
[out]current_valuecurrent value of the forcing variable
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_subid_index()

integer function datamodule::get_subid_index ( integer, intent(in)  id,
integer, intent(in)  ns 
)

Finds the corresponding index for a subid.

Parameters
[in]idsubid
[in]nsnumber of subbasins

Algorithm
Loop through subbasin id: to find the index of the current one.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initiate_model_parameters()

subroutine, public datamodule::initiate_model_parameters ( integer, intent(in)  ns_base,
integer, intent(out)  status 
)

Allocate model parameters and set their region division coupling.

Consequences Module modvar arrays related to parameters are allocated and set.

Parameters
[in]ns_basenumber of subbasin
[out]statuserror status of subroutine
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initiate_output_routines()

subroutine, public datamodule::initiate_output_routines

Initiate accumulation variables for printout.

Consequences Module worldvar variables maptime,
tmap, output, and accload are set.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_aquiferdata()

subroutine, public datamodule::load_aquiferdata ( character (len=*), intent(in)  dir,
integer, intent(in)  nsub,
integer, intent(out)  numaqu,
integer, intent(out)  status 
)

Get the information about aquifers from AquiferData.txt.

Consequences Module modvar variable aquifer and pathsubid will be set. Module modvar varible nregions may be increased.

Parameters
[in]dirFile directory
[in]nsubNumber of subbasins (basemodel)
[out]numaquNumber of aquifers
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_ascii_forcing()

subroutine, public datamodule::load_ascii_forcing ( character(len=*), intent(in)  dir,
integer, intent(in)  ns,
type(datetype), intent(in)  bdate,
type(datetype), intent(in)  edate,
integer, intent(in)  ndt,
integer, intent(out)  status 
)

Reads forcing data from file. Also checks data.

Consequences Module worldvar variables forcingdata and dates may change. Module modvar variables preci, tempi, snowfraci, shortwavei, windi, humidi, tmini, tmaxi, uwindi, vwindi may be allocated.

Parameters
[in]dirFile directory (forcingdir)
[in]nsNumber of subbasins, basemodel
[in]bdateBegin simulation date=bdate
[in]edateEnd simulation date=sdate
[in]ndtNumber of timesteps in simulation
[out]statusError number
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_ascii_qx_observations()

subroutine, public datamodule::load_ascii_qx_observations ( character(len=*), intent(in)  dir,
integer, intent(in)  ns,
integer, intent(in)  ndt,
type(datetype), intent(in)  bdate,
type(datetype), intent(in)  edate,
integer, intent(out)  status 
)

Reads Qobs, Wobs, Xobs and Xoregobs data values in file.

Consequences Module worldvar variables qobs, wobs, xobs, xoregobs, xcol, xorcol, qobsdata, wobsindex, wobsindex, numwobsstn, bwdate, ewdate, bxdate, exdate, bxrdate and exrdate may change. Module modvar variables qobsi, xobsi, wobsi and xoregobsi may be allocated, and xobsindex and xoregindex may change.

Parameters
[in]dirFile directory (otherobsdir, earlier forcingdir)
[in]nsNumber of subbasins, basemodel
[in]ndtNumber of timesteps in simulation
[in]bdateBegin simulation date
[in]edateEnd simulation date
[out]statusError number
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_basindata()

subroutine, public datamodule::load_basindata ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  fdir,
integer, intent(out)  n,
integer, intent(out)  status 
)

Gets the basic information about soil-landuse-classes and subbasins from GeoClass and GeoData. Additional geographical data for lakes, dams and floodplains are also collected as well as data on water management (e.g. irrigation) and forcing data location.

Consequences Module worldvar variables atmdepvegreset may be set. Module modvar variables basin, classdata, wetland, nclass, nluse, nsoil, modeloption, conductdamconstruction, conductriverwetland and numrotations are set.

Parameters
[in]dirFile directory (model files)
[in]fdirFile directory (forcing data)
[out]nNumber of subbasins
[out]statusError status

Algorithm

Read the class characteristics; either from ClassData or GeoClass

Count data in GeoData.txt

Initiate subbasin data

Read the description of the basins (GeoData.txt)

Read irrigation information of the basins (MgmtData.txt)

Read observation coupling and elevation from separate file (ForcKey.txt)

Read additional description of important lakes (LakeData.txt) (possibly overwrite GeoData information)

Read additional description of important dams (DamData.txt)

Read additional description of flooding areas (FloodData.txt)

Read additional description of river water level (RRCurveData.txt, RiverRatingCurveData.txt)

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_branchdata()

subroutine, public datamodule::load_branchdata ( character (len=*), intent(in)  dir,
integer, intent(out)  status 
)

Get the information about branches from BranchData.txt.

Consequences Module modvar variable branchsubid will be set

Parameters
[in]dirFile directory
[out]statusError status

Algorithm
Check if file exist

Initiate branch data

Read BranchData-file

Save loaded branch data temporary

Check for illegal combinations of branch data and other illegal values

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_classdata()

subroutine, public datamodule::load_classdata ( integer, intent(in)  funit,
character (len=*), intent(in)  infile,
integer, intent(out)  status 
)

Gets the information about classes from ClassData.txt Reads the file with column headings.

Consequences Module variables will be allocated and set

Parameters
[in]funitUnit for file
[in]infileName of characteristics file to be read
[out]statusFile found and read

Algoritm
Check for file.

Count number of classes (actually all rows)

Allocate vari,able for holding class information

Read information of ClassData.txt

  • Skip comment lines in the beginning of the file
  • Read column headings
  • Read class information (requires slc in order in file NOT)

Sort class information

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_coded_info()

subroutine, public datamodule::load_coded_info ( character(len=maxcharpath), intent(in)  dir,
integer, intent(out)  status,
type(datetype), intent(out)  date1,
type(datetype), intent(out)  date2,
type(datetype), intent(out)  date3,
integer, intent(out)  skip,
integer, intent(out)  step,
integer, intent(out)  nsubst,
integer, intent(in)  rsmax,
integer, intent(out)  rsnum,
type(datetype), dimension(rsmax), intent(out)  readstatedate,
character(len=maxcharpath), intent(out)  mdir,
character(len=maxcharpath), intent(out)  rdir,
character(len=maxcharpath), intent(out)  fdir,
character(len=maxcharpath), intent(out)  odir,
character(len=maxcharpath), intent(out)  lldir,
character(len=maxcharpath), intent(out)  ldir,
logical, intent(out)  conductinibin,
logical, dimension(dim_update), intent(out)  locupall,
logical, dimension(dim_update), intent(out)  locupnone,
integer, dimension(:), intent(inout), allocatable  subincrit 
)

Consequences The following worldvar module variables is set: readdaily, readobsid, readpstime, writeload, accload, writematlab, weightsub,
usestop84, ncrit, readformat, readoutregion, simsubmodel, resultseq, steplen, forcingdata, indtacheckonoff, indatachecklevel, doassimilation, resetstate, outstate, instate. The following modvar module variables is set: index for substances, simulate, simulatesubstances, conduct, conductxoms, conductwb, conductload, conductregest, conductwarnon, classgroup2, soiliniwet and modeloption.

Parameters
[in]dirFile directory
[out]statusStatus of subroutine
[out]date1Begin date of simulation
[out]date2End date of simulation
[out]date3Begin date for criteria/output date
[out]skipLength of warm-up period
[out]stepLength of simulation period
[out]nsubstNumber of substances simulated
[in]rsmaxDimension dates for reading soil state
[out]rsnumNumber of dates for reading soil state
[out]readstatedateDates for reading soil state variables
[out]mdirFile directory model
[out]rdirFile directory result
[out]fdirFile directory forcing
[out]odirFile directory other observation (evaluation)
[out]lldirFile directory load leak
[out]ldirFile directory log
[out]locupallFlag for update for all stations
[out]locupnoneFlag for update on no stations
[in,out]subincritSubbasins to be included in criteria calculations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_cropdata()

subroutine, public datamodule::load_cropdata ( character (len=*), intent(in)  dir,
integer, intent(out)  n,
integer, intent(out)  status 
)

Reads information about crops from file.

Consequences Module modvar variables cropdata, cropirrdata and cropdataindex may be allocated and set.

Parameters
[in]dirFile directory
[out]nNumber of rows in file
[out]statusError status

Algorithm

Check if file exist and if it is required

Count number of crops and data columns

Allocate and initiate cropdata variables

Read column headings from file

Code variables for easy finding of variable type

Read the data of the crops to matrix, first column is string which is skipped

Set cropdata variables according to matrix with read data

Check if cropdata is needed?

Calculate index variable to find crops

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_damdata()

subroutine datamodule::load_damdata ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  n,
integer, intent(out)  status 
)

Collects the information about dams from DamData.txt.

Consequences Module modvar variables dam, damindex may be allocated and set. Module modvar variable basin and conductdamconstruction may be changed (lake_depth).

Parameters
[in]funitFile unit, temporary file open
[in]dirFile directory
[in]nNumber of subbasins (base model)
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_deposition()

subroutine datamodule::load_deposition ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  n,
integer, intent(out)  status 
)

Gets the information about atmospheric deposition from AtmdepData.

Consequences Module variables deposition,deposition2 may be allocated and set

Parameters
[in]funitUnit for file
[in]dirFile directory
[in]nNumber of subbasins
[out]statuserror status

Check for substance simulation

Check for file and return if no file

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_ensemble_simulations()

subroutine, public datamodule::load_ensemble_simulations ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  fname,
integer, intent(in)  numpar,
integer, intent(in)  nperf,
integer, intent(in)  numcrit,
integer, intent(in)  nsim,
real, dimension(nsim,numpar), intent(inout)  parameters 
)

Load parameters used for ensemble simulation from file.

Parameters
[in]dirFile directory
[in]fnameFile name
[in]numparNumber of optimised parameters
[in]nperfNumber of performance measures
[in]numcritNumber of optimised variables
[in]nsimNumber of simulations to be saved
[in,out]parametersParameter values for simulations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_flooddata()

subroutine datamodule::load_flooddata ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  n,
integer, intent(out)  status 
)

Collects the information about flooding areas from FloodData.txt.

Consequences Module modvar variables conduct,flooding,floodindex may be allocated and set.

Parameters
[in]funitFile unit, temporary file open
[in]dirFile directory
[in]nNumber of subbasins (base model)
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_forcing_information_data()

subroutine datamodule::load_forcing_information_data ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  ns,
integer, intent(out)  status 
)

Gets information about forcing data coupling to subbasin and other information on forcing.

Consequences Module worldvar variable forcingdata's stationid are set. Module modvar variable tobselevation is allocated and set (in subroutine).

Parameters
[in]funitUnit number for file
[in]dirFile directory
[in]nsNumber of subbasins (base model)
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_forcing_information_data_from_txt_file()

subroutine datamodule::load_forcing_information_data_from_txt_file ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  ns,
integer, intent(out)  status 
)

Gets information about forcing data coupling to subbasin and other information from ForcKey.txt.

Consequences Module worldvar variable focringdata may change. Module modvar variable tobselevation is allocated and set.

Parameters
[in]funitUnit number for file
[in]dirFile directory
[in]nsNumber of subbasins (base model)
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_geoclass()

subroutine, public datamodule::load_geoclass ( character(len=*), intent(in)  fname,
type(classtype), dimension(:), intent(inout), allocatable  geoclassdata,
integer, intent(out)  numslc,
integer, intent(out)  maxluse,
integer, intent(out)  maxsoil,
integer, intent(out)  maxrotation 
)

Read class characteristics file GeoClass.txt.

Consequences Module modvar variables classdata, classgroup, nclass, nluse, nsoil, numrotations and vegtypereset will be allocated and changed by the argument output of this subroutine. Module modvar variables for special classes will be set by a subroutine call.

Parameters
[in]fnameFile path/name
[in,out]geoclassdataclass characteristics
[out]numslcNumber of land-soil use combination in GeoClass.txt
[out]maxluseNumber of landuses
[out]maxsoilNumber of soiltypes
[out]maxrotationNumber of groups of classes that exchange crops between years

Algorithm
Read the file with key to class characteristics (GeoClass.txt)

Set read data to class characteristic structure

Find coded classes

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_glacierdata()

subroutine, public datamodule::load_glacierdata ( character (len=*), intent(in)  dir,
integer, intent(in)  nsb,
integer, intent(out)  status 
)

Get the information about glaciers from GlacierData.txt.

Consequences Module modvar variables glacier and glacierindex will be set.

Parameters
[in]dirFile directory
[in]nsbNumber of subbasins (basemodel)
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_lakedata()

subroutine datamodule::load_lakedata ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  n,
integer, dimension(n), intent(in)  lakedataid,
integer, intent(out)  status 
)

Collects the information about special lakes from LakeData.txt.

Consequences Module modvar variables elake, slake, lakebasin, lakeindex, lakebasinindex may be allocated and set. Module modvar variables basin and conductdamconstruction may be changed.

Parameters
[in]funitFile unit, temporary file open
[in]dirFile directory
[in]nNumber of subbasins (base model)
[in]lakedataidlakedataid from GeoData
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_management_data()

subroutine datamodule::load_management_data ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  n,
integer, intent(out)  status 
)

Gets the information about irrigation and water transfer from MgmtData.

Parameters
[in]funitUnit for file
[in]dirFile directory
[in]nNumber of subbasins
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_netcdf_observations()

subroutine datamodule::load_netcdf_observations ( character(len=*), intent(in)  dir,
integer, intent(in)  ns,
type(datetype), intent(in)  bdate,
type(datetype), intent(in)  edate,
integer, intent(in)  ndt,
integer, intent(out)  n_Result 
)
Parameters
[in]bdateBegin simulation date
[in]edateEnd simulation date
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_netcdf_qx_observations()

subroutine datamodule::load_netcdf_qx_observations ( character(len=*), intent(in)  dir,
integer, intent(in)  ns,
integer, intent(in)  ndt,
type(datetype), intent(in)  bdate,
type(datetype), intent(in)  edate,
integer, intent(out)  status 
)

Reads Qobs.nc, NNNNobs.nc, RGNNNNobs.nc data values in file.

Consequences Module worldvar variables qobs, xobs, xoregobs, xcol, xorcol, qobsdata, wobsindex, numwobsstn, bxdate, exdate, bxrdate and exrdate may change. Module modvar variables qobsi, xobsi, wobsi and xoregobsi may be allocated, and xobsindex and xoregindex may change.

Parameters
[in]dirFile directory (forcingdir)
[in]nsNumber of subbasins, basemodel
[in]ndtNumber of timesteps in simulation
[in]bdateBegin simulation date
[in]edateEnd simulation date
[out]statusError number
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_observations()

subroutine, public datamodule::load_observations ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  odir,
integer, intent(in)  ns,
type(datetype), intent(in)  bdate,
type(datetype), intent(in)  edate,
integer, intent(in)  ndt,
integer, intent(out)  status 
)

Load forcing data files and other observations into the program.

Parameters
[in]dirFile directory (forcingdir)
[in]odirFile directory (otherobsdir)
[in]nsNumber of subbasins, basemodel
[in]bdateBegin time for simulation
[in]edateEnd time for simulation
[in]ndtNumber of timesteps
[out]statusError status of subroutine

Algorithm
Load observations from files

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_one_forcing_variabel()

subroutine datamodule::load_one_forcing_variabel ( integer, intent(in)  ns,
integer, intent(in)  ndt,
type(datetype), intent(in)  bdate,
type(datetype), intent(in)  edate,
type(forcingdatatype), intent(inout)  forcobs,
integer, intent(out)  status 
)

Load one observation forcing file; check file, saves data or prepare to read continously.

Parameters
[in]nsNumber of subbasins, basemodel
[in]ndtNumber of timesteps in simulation
[in]bdateBegin simulation date=bdate
[in]edateEnd simulation date=sdate
[in,out]forcobsForcing data information and values
[out]statusError number
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_optpar()

subroutine, public datamodule::load_optpar ( character(len=*), intent(in)  dir)

Reads file with intructions on calibration and parameters to be calibrated and saves them in worldvar-arrays. Also reads file for instructions and parameters for parameter ensemble simulation.

Consequences Module worldvar variables optparmin, optparmax, optparprecision, optparid, parindex, optim, dimpar, numoptimpar will be allocated and set.

Parameters
[in]dirFile directory

Algorithm
Check for file

Initiation of variables for optimization parameters

Open and read simulation settings from optpar.txt

Set tasks for calibration

Set tasks for parameter ensemble simulation

Continue to read parameters

Sort min and max values

Set and check worldvar numoptimpar = amount of model parameters to be optimized

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_otest()

subroutine, public datamodule::load_otest ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  name,
integer, intent(out)  status 
)

Read output test values from file.

Parameters
[in]dirFile directory
[in]nameFile name
[out]statusError status of subroutine

Open file and read heading

Read parameter values from file

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_output_regions()

subroutine, public datamodule::load_output_regions ( character (len=*), intent(in)  dir,
integer, intent(out)  nreg,
integer, intent(out)  status 
)

Load file with information on output regions; Outregions.txt.

Consequences Module worldvar variable outregion is allocated and set, and variable noutreg is set.

Parameters
[in]dirFile directory
[out]nregNumber of output regions
[out]statusError status

If not allocated: allocate and initialize outregion

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_parameters()

subroutine, public datamodule::load_parameters ( character(len=*), intent(in)  dir,
type(basemodeltype), intent(in)  basemodel,
integer, intent(out)  status,
logical, intent(in), optional  seqflag,
integer, intent(in), optional  iens 
)

Read parameter values from file par.txt.

Consequences The modvar module variables soilpar, landpar, genpar, basinpar, regpar, lakedatapar and monthpar will be (re)set.

Parameters
[in]dirFile directory
[in]basemodelInformation on basemodel
[out]statusError status of subroutine
[in]seqflagFlag for using sequence number in par-file name (parseq)
[in]iensIndex of ensemble simulation, 0 for ordinary par.txt

Algorithm

Get filename and open par-file

Allocate and initiate parameter variables

Read parameter values from file

Handle submodel for basin parameters

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_permanent_soilleakage()

subroutine, public datamodule::load_permanent_soilleakage ( character (len=*), intent(in)  dir,
integer, intent(in)  n,
type(datetype), intent(in)  bd,
integer, intent(out)  status 
)

Gets the information about nutrient soil leakage from file.

Alternative 1: Soil nutrient leakage concentration is read from file and will replace the concentration calculated by HYPE soil routines. The runoff from classes gets the new concentration.

Alternative 2: Soil nutrient leakage load is read from file. A simplified soil routine is used.

Consequences Module modvar variable soilleak is allocated and set.

Reference ModelDescription Chapter 4 (Nutrient soil leakage from outer source)

Parameters
[in]dirfile directory
[in]nnumber of subbasins
[in]bdsimulation begin date
[out]statuserror status

Algorithm

Load monthly soilleakage concentrations for subbasins (SMED-HYPE)

  • Allocate and initiate variables
  • Read data files

Load monthly soilleakage loads per class

  • Allocate and initiate variables
  • Read data files

Load first year of monthly soilleakage loads per class

  • Allocate and initiate variables
  • Read data files

Load constant soilleakage loads or concentrations, depending on classmodel (5 or 6)

  • Allocate and initiate variables
  • Read data files

Load constant or monthly loads or concentrations, depending on classmodel (5 or 6 or 10 or 9)

  • Allocate and initiate variables
  • Read data files

Monthly time series of loads or concentrations, depending on classmodel (5 or 6 or 10 or 9)

  • Allocate and initiate variables
  • Read data files
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_pointsourcedata()

subroutine, public datamodule::load_pointsourcedata ( character (len=*), intent(in)  dir,
character (len=*), intent(in)  infile,
integer, intent(in)  n,
integer, intent(out)  status 
)

Gets the information about nutrient point sources from PointSourceData.txt Recalculate into form suitable for model. Set permanent loads.

Consequences Module modvar variable psinfo or load is set. Module worldvar variable psdates may be allocated and set.

Reference ModelDescription Chapter 5 (Point sources)

Parameters
[in]dirFile directory (modeldir)
[in]infileName of pointsource file to be read (PointSourceData.txt)
[in]nNumber of subbasins
[out]statusError status

If periodically constant pointsources are used

  • Allocate and initiate variables
  • Collect dates where point source load changes; fromdata and todate+1
  • Calculate permanent point source loads
  • Deallocate load variable for subbasins without point sources

If timeseries of pointsources is used:

  • Check if PointSourceTimeSerie.txt exist as assumed from read_pointsourcedata.
  • Allocate find corresponding index for subid
  • Calculate the number of used positive and negative pointsources, and allocate variable to hold pointsource information
  • Set pointsource information variable

Check if timeseries are correct and present, and calculate their index coupling

  • Check time periods of pointsource time series
  • Prepare PointSourceTimeSeries.txt to be read.
  • Prepare PSMonthlySeries.txt to be read.
  • Prepare PSYearlySeries.txt to be read.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_rrcurvedata()

subroutine datamodule::load_rrcurvedata ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
integer, intent(in)  n,
integer, intent(out)  status 
)

Gets the information about parameters to use for calculating main river water level from RiverRatingCurveData.txt.

Consequences Module variables will be allocated and set

Parameters
[in]funitUnit for file
[in]dirFile directory
[in]nNumber of subbasins
[out]statuserror status

Algorithm
Check for file and if no file do turn off calc of corl

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_submodel_information()

subroutine, public datamodule::load_submodel_information ( character(len=*), intent(in)  dir,
logical, intent(in)  submodelrun,
type(basemodeltype), intent(inout)  basemodel,
integer, intent(out)  msub,
integer, intent(out)  status 
)

Reads file with information about submodel for the current.

Parameters
[in]dirFile directory
[in]submodelrunSubmodel is supposed to be run
[in,out]basemodelInformation on basemodel
[out]msubNumber of subbasins of submodel
[out]statusError status
+ Here is the caller graph for this function:

◆ prepare_for_update()

subroutine, public datamodule::prepare_for_update ( character(len=*), intent(in)  dir,
logical, dimension(dim_update), intent(in)  locupall,
logical, dimension(dim_update), intent(in)  locupnone,
integer, intent(in)  nsfile,
integer, intent(in)  ns,
integer, intent(out)  status 
)

Read information for basins to update.

Consequences Module modvar variables conduct, doupdate, useinupdate may change.

Parameters
[in]dirFile directory
[in]locupallFlag for update on all stations
[in]locupnoneFlag for no update on any stations
[in]nsfileNumber of subbasins of basemodel
[in]nsNumber of subbasins
[out]statusError number

Algorithm
Read update-file if available

Prepare discharge data stations to use for replacing flow (quseobs)

Prepare dicharge data stations and AR-coefficient to use for AR-updating flow (qar)

Prepare waterstage data stations and AR-coefficient to use for AR-updating flow (war)

Prepare for correction of phosphorus concentration by a factor (tpcorr,tploccorr)

Prepare for correction of nitrogen concentration by a factor (tncorr,tnloccorr)

Prepare concentration data stations to use for replacing simulated concentrations (cuseobs)

Prepare for updating lake waterstage at end of time step (wendupd)

Check for incompatible update methods (war not to be used with qar or wendupd)

Write information about used updating methods to logg-file

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepare_subbasin_output()

subroutine, public datamodule::prepare_subbasin_output ( integer, dimension(:), intent(inout), allocatable  critbasins,
integer, intent(out)  status 
)

Preparation for subbasin and regional output files Preparation of outputs regarding subbasins and regions. Selected subbasins/regions for subbasin and regional output files and criteria calculations.

Parameters
[in,out]critbasinsSubid of subbasins selected for criteria calculations
[out]statusError status

Find and set index of areas to be written as subbasin- or region-files (areas was given as ids) and reduce them to only those in (sub-)model

Find and set index of subbasins to be excluded from criteria calculation

+ Here is the caller graph for this function:

◆ read_and_calc_basindata()

subroutine, public datamodule::read_and_calc_basindata ( integer, intent(in)  funit,
character (len=*), intent(in)  infile,
integer, intent(in)  nskip,
integer, intent(in)  n,
integer, intent(in)  maxcol,
integer, dimension(n), intent(out)  lakedataid,
integer, intent(out)  status 
)

Gets the information about subbasins from GeoData. Reads the matrix of basin data values from the file vith mcols columns.

Consequences Module variables will be allocated and set

Parameters
[in]funitUnit for file
[in]infileName of characteristics file to be read
[in]nskipNumber of comment rows
[in]nNumber of subbasins
[in]maxcolMaximum number of data columns
[out]lakedataidlakedataid from GeoData
[out]statusError status
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_first_monthly_leakage()

subroutine datamodule::read_first_monthly_leakage ( character (len=*), intent(in)  dir,
character (len=*), intent(in)  infile,
type(datetype), intent(in)  bd,
integer, intent(in)  n,
integer, dimension(n), intent(in)  geoid,
integer, intent(out)  status,
real, dimension(12,n), intent(inout)  leakage 
)

Reads monthly time series of soil leakage, first year.

Reference ModelDescription Chapter Nitrogen and phosphorus in land routines (Nutrient soil leakage from outer source)

Parameters
[in]dirFile directory
[in]infileName of leakage file
[in]bdSimulation begin date
[in]nNumber of subbasins (base)
[in]geoidSubid of subbasins (base)
[out]statusError status
[in,out]leakageSoil leakage concentrations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_one_year_monthly_leakage()

subroutine datamodule::read_one_year_monthly_leakage ( character (len=*), intent(in)  dir,
character (len=*), intent(in)  infile,
type(datetype), intent(in)  cd,
integer, intent(in)  n,
integer, dimension(n), intent(in)  geoid,
integer, intent(out)  status,
real, dimension(12,n), intent(inout)  leakage 
)

Reads monthly time series of soil leakage, one year.

Reduce the data for submodel.

Reference ModelDescription Chapter Nitrogen and phosphorus in land routines (Nutrient soil leakage from outer source)

Parameters
[in]dirfile directory
[in]infilename of leakage file
[in]cdcurrent date
[in]nnumber of subbasins
[in]geoidsubid of subbasins
[out]statuserror status
[in,out]leakagesoil leakage concentrations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_parameter_ensemble_task()

subroutine datamodule::read_parameter_ensemble_task ( character(len=*), intent(in)  dir,
logical, intent(out)  taskAS,
logical, intent(out)  taskBS 
)

Reads file with intructions on parameter ensemble simulation.

Parameters
[in]dirFile directory
[out]taskastask parameter ensemble with allsim.txt
[out]taskbstask parameter ensemble with bestsims.txt

Algorithm
Default values

Check for file

Open and read simulation settings from optpar.txt

+ Here is the caller graph for this function:

◆ read_pointsourcedata()

subroutine datamodule::read_pointsourcedata ( character (len=*), intent(in)  dir,
character (len=*), intent(in)  infile,
integer, intent(out)  nrows,
integer, intent(out)  status,
logical, intent(out)  fexist,
integer, dimension(:), intent(inout), allocatable  readsubid,
integer, dimension(:), intent(inout), allocatable  readpsid,
integer, dimension(:), intent(inout), allocatable  readpstype,
integer, dimension(:), intent(inout), allocatable  readlocation,
real, dimension(:,:), intent(inout), allocatable  pointsource,
character(len=50), dimension(:), intent(inout), allocatable  readdate1,
character(len=50), dimension(:), intent(inout), allocatable  readdate2 
)

Reads the matrix of point source data from the file.

Reference ModelDescription Chapter 5 (Point sources)

Parameters
[in]dirFile directory
[in]infileName of pointsource file to be read (PointSourceData.txt)
[out]nrowsNumber of rows in file
[out]statusError status
[out]fexistStatus of file exist
[in,out]readsubidsubid if point sources
[in,out]readpsidpointsource id
[in,out]readpstypetype of point source
[in,out]readlocationlocation of abstraction/tracer outlet
[in,out]pointsourceRead pointsource info (subbasins,column)
[in,out]readdate1From date of point source
[in,out]readdate2To date of point source
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_seasonal_leakage()

subroutine datamodule::read_seasonal_leakage ( character (len=*), intent(in)  dir,
character (len=*), intent(in)  infile,
integer, intent(in)  n,
integer, dimension(n), intent(in)  geoid,
integer, intent(in)  nleak,
integer, intent(out)  status,
real, dimension(nleak,n), intent(inout)  leakage 
)

Reads the matrix of soil leakage concentrations or loads from file. The file can have seasonality as daily or monthly values or be constant.

Reads the typical soil leakage and checks them (>=0).

Reference ModelDescription Chapter Nitrogen and phosphorus in land routines (Nutrient soil leakage from outer source)

Parameters
[in]dirFile directory
[in]infileName of leakage file
[in]nNumber of subbasins (basemodel)
[in]geoidSubid of subbasins
[in]nleakNumber of values to read for each subbasin (1, 12 (or 366))
[out]statusError status
[in,out]leakageSoil leakage concentrations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_simulation_perf_and_par()

subroutine datamodule::read_simulation_perf_and_par ( integer, intent(in)  funit,
integer, intent(in)  i,
integer, intent(in)  mpar,
integer, intent(in)  numpar,
integer, intent(in)  nperf,
integer, intent(in)  numcrit,
real, intent(inout)  optcrit,
real, dimension(nperf,numcrit), intent(inout)  performance,
real, dimension(mpar), intent(out)  parameters,
integer, intent(out)  status 
)

Read the performance result and used parameter values from the one simulation (one row) from a file.

Parameters
[in]funitFile unit
[in]iSimulation number
[in]mparDimension of parameters
[in]numparNumber of optimised parameters
[in]nperfNumber of performance measures
[in]numcritNumber of optimised variables
[in,out]optcritValue of optimation criterion for the simulation
[in,out]performanceperformance criteria for the simulation
[out]parametersParameter values for the simulation
[out]statusflag for subroutine status
+ Here is the caller graph for this function:

◆ read_update_data()

subroutine datamodule::read_update_data ( integer, intent(in)  funit,
character (len=*), intent(in)  infile,
integer, intent(in)  ns,
integer, intent(out)  nqsub,
integer, dimension(ns), intent(out)  qupdsub,
integer, intent(out)  nqarsub,
integer, intent(out)  nwarsub,
integer, dimension(ns), intent(out)  qarupdsub,
integer, dimension(ns), intent(out)  warupdsub,
real, dimension(ns), intent(out)  qarupdar,
real, dimension(ns), intent(out)  warupdar,
integer, intent(out)  nwsub,
integer, dimension(ns), intent(out)  wendsub,
integer, intent(out)  nrow,
real, dimension(ns,2), intent(out)  tpcorrarr,
real, dimension(ns,2), intent(out)  tncorrarr,
real, dimension(ns,2), intent(out)  tploccorrarr,
real, dimension(ns,2), intent(out)  tnloccorrarr,
integer, intent(out)  ncsub,
integer, dimension(ns), intent(out)  cupdsub 
)

Gets the information about update from update.txt.

Parameters
[in]funitUnit for file
[in]infileName of characteristics file to be read
[in]nsNumber of subbasins (basemodel)
[out]nqsubNumber of subbasins with quseobs update
[out]qupdsubSubid of subbasins with quseobs update
[out]nqarsubNumber of subbasins with qAR date
[out]nwarsubNumber of subbasins with wAR date
[out]qarupdsubSubid of subbasins with qAR update
[out]warupdsubSubid of subbasins with wAR update
[out]qarupdarAR-factor for qAR-update
[out]warupdarAR-factor for wAR-update
[out]nwsubNumber of subbasins with wendupd update
[out]wendsubSubid of subbasins with wendupd update
[out]nrowNumber of data rows in file
[out]tpcorrarrSubid,value of subbasins with tpcorr update
[out]tncorrarrSubid,value of subbasins with tncorr update
[out]tploccorrarrSubid,value of subbasins with tploccorr update
[out]tnloccorrarrSubid,value of subbasins with tnloccorr update
[out]ncsubNumber of subbasins with cuseobs update
[out]cupdsubSubid of subbasins with cuseobs update
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reform_inputdata_for_submodel()

subroutine, public datamodule::reform_inputdata_for_submodel ( type(basemodeltype), intent(in)  basemodel,
integer, intent(in)  ns 
)

Reform the information about subbasins to arrays for submodel.

Parameters
[in]basemodelInformation on basemodel
[in]nsnumber of subbasins to be simulated
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reload_deposition()

subroutine, public datamodule::reload_deposition ( integer, intent(in)  funit,
character (len=*), intent(in)  dir,
type(basemodeltype), intent(inout)  basemodel,
integer, intent(in)  n,
integer, intent(out)  status,
type(datetype), intent(in), optional  filedate 
)

Gets the information about atmospheric deposition from AtmdepData.

Consequences Module variables deposition2 may be reallocated and reset

Parameters
[in]funitUnit for file
[in]dirFile directory
[in,out]basemodelInformation on basemodel
[in]nNumber of subbasins
[out]statuserror status
[in]filedatedate of start of this file

Check for substance simulation

Check for file and return if no file

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_observations()

subroutine, public datamodule::reset_observations ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  mdir,
character(len=*), intent(in)  odir,
integer, intent(out)  status 
)

Prepare forcingdata, point source time series and other observations for another simulation in case they are read each time step.

Parameters
[in]dirFile directory (forcingdir)
[in]mdirFile directory (modeldir)
[in]odirFile directory (otherobsdir)
[out]statusError number

Algorithm
Reset observation files

Reset model defined observations

Reset point sources time files

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save_xoreginformation()

subroutine datamodule::save_xoreginformation ( integer, intent(in)  n,
integer, dimension(n,2), intent(in)  var2,
integer, intent(in)  nr 
)

Save information about finding other observation series.

Consequences Module index array (xoregindex) is set.

Parameters
[in]nNumber of columns in Xoregobs
[in]var2Variables and subid for Xoregobs columns
[in]nrNumber of outregions
+ Here is the caller graph for this function:

◆ set_model_base_configuration()

subroutine, public datamodule::set_model_base_configuration ( type(basemodeltype), intent(in)  basemodel,
character(len=*), intent(in)  idir,
character(len=*), intent(in)  idir2,
type(statedimensiontype), intent(inout)  dim,
integer, intent(out)  status 
)

Set model base configuration.

Handle dimension of river queue state; the queue length may be different for current model, initial state file, submodel and for optimization. Set structure holding state dimensions. Transform crop information for southern hemisphere.

Consequences Module modvar variables cropdata and cropirrdata may be changed.

Parameters
[in]basemodelInformation on basemodel
[in]idirfile directory (modeldir)
[in]idir2file directory (otherobsdir)
[in,out]dimsimulation dimensions
[out]statuserror status of subroutine

Algorithm
Initialisations

Find maximum dimension of river queue variables

Set state dimension variable

Check maximum number of lakesections to set for connectivity fill-and-spill ilake or HDS model

Set current substances minimum and maximum concentration limits

Check if river queue variables is compatible with initial state and calibration

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_model_configuration()

subroutine, public datamodule::set_model_configuration ( type(stateconfigurationtype), intent(inout)  config,
type(simulationconfigurationtype), intent(inout)  simconfig 
)

Set model choice configuration and state dimensions.

Parameters
[in,out]configsimulation configuration
[in,out]simconfigsimulation configuration
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_outvar()

subroutine, public datamodule::set_outvar ( integer, intent(in)  nout,
integer, intent(out)  noutvar,
integer, intent(out)  noutvarclass 
)

Saves information on variables to calculate for output.

Parameters
[in]noutnumber of output file type to be set
[out]noutvarnumber of output variables (so far)
[out]noutvarclassnumber of output variables for class output (so far)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_outvar_crit()

subroutine datamodule::set_outvar_crit ( integer, intent(inout)  noutvar,
integer, intent(out)  noutvarclass 
)

Saves information on output variables to calculate for use in criteria calculations.

Consequences Module variable acccalvar, outvarinfotemp, noutvar and outvarindex is changed.

Parameters
[in,out]noutvarnumber of output variables to be set (so far)
[out]noutvarclassnumber of output variables for class output (so far)

Algorithm

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_outvar_for_variable_new()

subroutine, public datamodule::set_outvar_for_variable_new ( integer, intent(in)  varid,
integer, intent(in)  areaagg,
integer, intent(out)  ovindex,
integer, intent(inout)  noutvar,
integer, intent(inout), optional  noutvarclass,
character(len=6), intent(in), optional  cgname 
)

Turns on calculation of choosen variable.

Parameters
[in]varidindex in outvarid of current variable
[in]areaaggaggregation of variable (0=subbasin average, 1=upstream, 2=region)
[out]ovindexindex of current variable in outvar
[in,out]noutvarnumber of output variables to be set (so far)
[in,out]noutvarclassnumber of class output variables to be calculated (so far)
[in]cgnameclass group name

Algorithm

Increase the counter of number of output variables to calculate

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_outvar_output()

subroutine datamodule::set_outvar_output ( integer, intent(in)  nout,
integer, intent(out)  noutvar,
integer, intent(out)  noutvarclass 
)

Saves information on variables to write to output files.

Consequences Module variable outvarinfotemp and outvarindex is allocated.

Parameters
[in]noutnumber of output file type to be set
[out]noutvarnumber of output variables (so far)
[out]noutvarclassnumber of output variables for class output (so far)

Algorithm

Count number of classoutputs

Initialize and allocate variables holding outvar information

For every output file type...

and every variable..

  • Set outvar information
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_outvar_test_information()

subroutine, public datamodule::set_outvar_test_information ( integer, intent(in)  n)

Add information of test of output.

Parameters
[in]nnumber of output variables
+ Here is the caller graph for this function:

◆ set_update_nutrientcorr()

subroutine datamodule::set_update_nutrientcorr ( integer, intent(in)  dim,
integer, intent(in)  ns,
integer, intent(in)  nrow,
integer, intent(in)  icorr,
real, dimension(dim,2), intent(in)  dataarray 
)

Set variable for phosphorus and nitrogen correction/updating.

Consequences Module variables doupdate and useinupdate are allocated and set.

Parameters
[in]dimnumber of subbasins of base model
[in]nsnumber of subbasins
[in]nrownumber of data
[in]icorrindex for type of updating/correction
[in]dataarrayread data

Algorithm
For each subbasin and data point: If equal set correction value for this subbasin

If no correction value are found: turn off updating and deallocate array

+ Here is the caller graph for this function:

◆ set_yesno_variable_from_line()

subroutine datamodule::set_yesno_variable_from_line ( integer, intent(in)  linelen,
integer, intent(inout)  linepos,
character(len=linelen), intent(in)  line,
character(len=*), intent(in)  errstr,
logical, intent(out)  onoff,
integer, intent(out)  status 
)

Read Y/J/N code from line to set logical variable.

Parameters
[in]linelenlength of line
[in,out]lineposcurrent position on line
[in]lineline to be read
[in]errstrvalue of str if error
[out]onoffvalue of yesno variable
[out]statuserror statur of subroutine
+ Here is the caller graph for this function:

◆ start_lakedata_table()

subroutine datamodule::start_lakedata_table ( integer, intent(in)  maxcol,
integer, intent(in)  ncols,
integer, intent(in)  nrows,
character(len=10), dimension(maxcol), intent(in)  str,
integer, dimension(nrows,maxcol), intent(in)  xi,
real, dimension(nrows,maxcol), intent(in)  xr,
integer, dimension(maxcol), intent(in)  iindex,
integer, dimension(maxcol), intent(in)  rindex,
integer, intent(in)  ns,
integer, dimension(ns), intent(in)  lakedataid 
)

Set lakedatapar values to those model variable values specified in LakeData.txt.

Consequences Module modvar variables lakedatapar_ini,lakedatapar, lakedataparindex may be allocated and set.

Parameters
[in]maxcolMaximum possible amount of columns on LakeData.txt
[in]ncolsNumber of columns effectively used in LakeData.txt
[in]nrowsNumber of rows effectively used in LakeData.txt
[in]strCharacter array with labels of ALL columns given in LakeData.txt (column headers)
[in]xiInteger values aquired by reading LakeData.txt
[in]xrFloat values aquired by reading LakeData.txt
[in]iindexIndex for column real variables
[in]rindexIndex for column integer variables
[in]nsNumber of subbasins (base model)
[in]lakedataidlakedataid from GeoData.txt
+ Here is the caller graph for this function: