HYPE
Functions/Subroutines
modelmodule Module Reference

Functions/Subroutines

subroutine, public define_model_parameters ()
 
subroutine, public set_parameters_region_division (nregpar)
 
subroutine, public get_special_model_parameters (velindex, dampindex)
 
subroutine, public calculate_special_model_parameters (nsubb, optrivvel, optdamp, dimriver)
 
subroutine, public model_specified_atmospheric_deposition ()
 
subroutine, public calculate_translation_time (rivlen, rivvel, damp, totaltime, transtime)
 
subroutine, public set_modelconfig_from_parameters ()
 
subroutine, public initiate_model_state (frozenstate, soilstate, aquiferstate, riverstate, lakestate, miscstate)
 
subroutine, public initiate_model (frozenstate, soilstate, aquiferstate, riverstate, lakestate, miscstate)
 
subroutine, public model (frozenstate, soilstate, aquiferstate, riverstate, lakestate, miscstate)
 
subroutine calculate_lake_volume_output (n, lakestate, wlakevol, ilakevol, olakevol, Milakevol, Molakevol)
 
subroutine initialize_class_outvar_to_zero ()
 
subroutine calculate_class_outvar_initialize (idindex, isb)
 
subroutine calculate_class_outvar_add (idindex, isb, jcl, fraction, value, fraction2)
 
subroutine calculate_class_outvar_add_amount (idindex, isb, jcl, fraction, value, value2)
 
subroutine calculate_class_outvar_add_accumulate (idindex, isb, jcl, fraction, value)
 
subroutine calculate_class_outvar_finish (idindex, isb, denominator)
 
subroutine calculate_class_outvar_finish_scale (idindex, isb, factor)
 
subroutine set_class_outvar_missing (idindex, isb)
 
subroutine calculate_outvar_watertemperature (idindex, isb, itype, lowerlimit, riverstate, lakestate)
 
subroutine set_outvar_xobs (idindex, isb)
 
subroutine set_outvar_xobs_scaled (idindex, isb, idxobs, factor)
 
subroutine set_outvar_xobsmean (idindex, isb, idxobs)
 
subroutine set_outvar_xobsstate (idindex, isb, idxobs)
 
subroutine calculate_regional_groundwaterflow_to_outside_system (isb, totflow, outflow)
 
real function wetland_wbstore (j, i, frozenstate, soilstate)
 
subroutine calculate_flow_from_undivided_lake (i, itype, qin, lakearea, flowreduction, hypodepth, olakewstold, outflowsim, lakeoutflow, mainflow, branchflow, concout, wstlakesim, lakewst, wcomaver, Lpathway, lakestate, miscstate)
 
subroutine calculate_flow_for_lakebasin_lake (ilast, itype, looplakes, qini2, lakeareai2, hypodepthi2, olakewstoldi2, resusp_downstream, outflowsimi2, lakeoutflowi2, mainflowi2, branchflowi2, accinflow, acccinflow, clakeoutflowi2, cmainflowi2, cbranchflowi2, qcinflii2, netroutload, wstlakesimi2, lakewsti2, wcomaveri2, Lpathwayi2, Lbranchi2, totaloutflow, ctotaloutflow, lakestate, miscstate)
 
subroutine accumulate_flow_to_downstream_subbasin (i, mainflow, branchflow, concout, accinflow, acccinflow, volumeflow)
 
subroutine calculate_internal_wetland (i, radext, cloud, added_water, precij, sfdist, q, conc, frozenstate, soilstate, miscstate, localoutvar, localwbflows, localLpathway)
 
subroutine calculate_outlet_wetland (i, radext, cloud, added_water, precij, sfdist, wetinflow, conc, frozenstate, soilstate, miscstate, wetoutflow, updatedoutflow, cwetoutflow, mainflow, branchflow, localoutvar, localwbflows, localLpathway)
 
subroutine calculate_local_river (i, lriverlen, radext, cloud, pobs, precij, sfdist, localpcorricep, qriver, criver, localeacti, localarea_water, localprec_water, localevap_water, frozenstate, miscstate, riverstate, lakestate, localoutvar, localwbflows, localwbstores, localLatmdep, localLruralb, localLpathway)
 
subroutine calculate_local_lake_model (i, radext, cloud, pobs, precij, sfdist, localpcorricep, qin, cin, hypodep, localeacti, localarea_water, localprec_water, localevap_water, frozenstate, riverstate, lakestate, surftemp, outflow, coutflow, outwst, localoutvar, localwbflows, localLatmdep, localLpathway)
 
subroutine compute_substance_load (load, flow, conc, conc2)
 

Detailed Description

Main module for hydrological model HYPE.

Function/Subroutine Documentation

◆ accumulate_flow_to_downstream_subbasin()

subroutine modelmodule::accumulate_flow_to_downstream_subbasin ( integer, intent(in)  i,
real, intent(in)  mainflow,
real, intent(in)  branchflow,
real, dimension(numsubstances), intent(in)  concout,
real, dimension(nsub), intent(inout)  accinflow,
real, dimension(numsubstances,nsub), intent(inout)  acccinflow,
real, dimension(:,:), intent(inout), allocatable  volumeflow 
)

Accumulate flow to downstream subbasins, and calculate volume flow for water balance.

Parameters
[in]iindex of current subbasin
[in]mainflowoutflow through main branch (m3/s)
[in]branchflowoutflow through second branch (m3/s)
[in]concoutconcentration of outflow
[in,out]accinflowinflow from upstream subbasins (m3/s)
[in,out]acccinflowconcentration of inflow
[in,out]volumeflowvolume outflow of subbasin (m3/ts) (and other flows)

Algorithm
Accumulate flow and load for downstream inflow from main outlet

Save main outlet flow for water balance output

Accumulate flow and load for downstream inflow from branch

Save branched flow for water balance output

+ Here is the caller graph for this function:

◆ calculate_class_outvar_add()

subroutine modelmodule::calculate_class_outvar_add ( integer, intent(in)  idindex,
integer, intent(in)  isb,
integer, intent(in)  jcl,
real, intent(in)  fraction,
real, intent(in)  value,
real, intent(in), optional  fraction2 
)

Add class value to the variables accumulating these for calculating output of subbasin mean values and classgroup mean values. This subroutine handle subbasin mean by accumulating directly, possibly with extra scaling factor, and class mean by saving datavalue and fraction.

Consequences Module modvar variable outvar, outvarclassdata, and outvarclassfraction may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
[in]jclindex of class
[in]fractionarea fraction of class
[in]valueclass value of output variable
[in]fraction2fraction of class area which should be included in subbasin mean
+ Here is the caller graph for this function:

◆ calculate_class_outvar_add_accumulate()

subroutine modelmodule::calculate_class_outvar_add_accumulate ( integer, intent(in)  idindex,
integer, intent(in)  isb,
integer, intent(in)  jcl,
real, intent(in)  fraction,
real, intent(in)  value 
)

Add class value to the variables accumulating these for calculating output of subbasin accumulated values and classgroup accumulated values. Add class value to calculate subbasin accumulated value and classgroup accumulated value.

Consequences Module modvar variable outvar, outvarclassdata, and outvarclassfraction may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
[in]jclindex of class
[in]fractionarea fraction of class
[in]valueclass value of output variable
+ Here is the caller graph for this function:

◆ calculate_class_outvar_add_amount()

subroutine modelmodule::calculate_class_outvar_add_amount ( integer, intent(in)  idindex,
integer, intent(in)  isb,
integer, intent(in)  jcl,
real, intent(in)  fraction,
real, intent(in)  value,
real, intent(in)  value2 
)

Add class value to the variables accumulating these for calculating output of subbasin mean values and classgroup mean values. Add amount for class value to outvar-array for subbasin mean value of concentration, and concentration to calculate classgroup mean value of concentrations.

Consequences Module modvar variable outvar, outvarclassdata, and outvarclassfraction may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
[in]jclindex of class
[in]fractionarea fraction of class
[in]valueclass value of output variable (amount)
[in]value2class value of output variable (concentration)
+ Here is the caller graph for this function:

◆ calculate_class_outvar_finish()

subroutine modelmodule::calculate_class_outvar_finish ( integer, intent(in)  idindex,
integer, intent(in)  isb,
real, intent(in)  denominator 
)

Finalize the calculation of output of subbasin mean values. The variables accumulating class values will be turned into subbasin mean values by dividing by the total area fraction or, for concentration, by the sum of runoff.

Consequences Module modvar variable outvar may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
[in]denominatorland area fraction (or other fraction) of subbasin area or total runoff
+ Here is the caller graph for this function:

◆ calculate_class_outvar_finish_scale()

subroutine modelmodule::calculate_class_outvar_finish_scale ( integer, intent(in)  idindex,
integer, intent(in)  isb,
real, intent(in)  factor 
)

Finalize the calculation of subbasin mean value and classgroup mean value by multiplying by factor.

Consequences Module modvar variables outvar, outvarclassdata may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
[in]factormultipying factor
+ Here is the caller graph for this function:

◆ calculate_class_outvar_initialize()

subroutine modelmodule::calculate_class_outvar_initialize ( integer, intent(in)  idindex,
integer, intent(in)  isb 
)

Initialize to zero the variables accumulating class values for calculating output of subbasin mean values and classgroup mean values for a specific variable and subbasin.

Consequences Module modvar variable outvar, outvarclassdata, and outvarclassfraction may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
+ Here is the caller graph for this function:

◆ calculate_flow_for_lakebasin_lake()

subroutine modelmodule::calculate_flow_for_lakebasin_lake ( integer, intent(in)  ilast,
integer, intent(in)  itype,
logical, dimension(nsub), intent(in)  looplakes,
real, dimension(nsub), intent(in)  qini2,
real, dimension(nsub), intent(in)  lakeareai2,
real, dimension(nsub), intent(in)  hypodepthi2,
real, dimension(nsub), intent(in)  olakewstoldi2,
real, dimension(numsubstances,nsub), intent(in)  resusp_downstream,
real, dimension(nsub), intent(inout)  outflowsimi2,
real, dimension(nsub), intent(inout)  lakeoutflowi2,
real, dimension(nsub), intent(inout)  mainflowi2,
real, dimension(nsub), intent(inout)  branchflowi2,
real, dimension(nsub), intent(inout)  accinflow,
real, dimension(numsubstances,nsub), intent(inout)  acccinflow,
real, dimension(numsubstances,nsub), intent(inout)  clakeoutflowi2,
real, dimension(numsubstances,nsub), intent(inout)  cmainflowi2,
real, dimension(numsubstances,nsub), intent(inout)  cbranchflowi2,
real, dimension(nsub), intent(inout)  qcinflii2,
real, dimension(numsubstances,nsub), intent(inout)  netroutload,
real, dimension(nsub), intent(inout)  wstlakesimi2,
real, dimension(nsub), intent(inout)  lakewsti2,
real, dimension(nsub), intent(inout)  wcomaveri2,
real, dimension(numsubstances,18:19,nsub), intent(inout)  Lpathwayi2,
real, dimension(numsubstances,nsub), intent(out)  Lbranchi2,
real, intent(out)  totaloutflow,
real, dimension(numsubstances), intent(out)  ctotaloutflow,
type(lakestatetype), intent(inout)  lakestate,
type(miscstatetype), intent(inout)  miscstate 
)

Calculate flow withing and out from each lakebasin of a lakebasin lake of the new type with equal water level. Subroutine called for "last" lakebasin.

Consequences Module hype_waterbalance variable wbflows may be set.

Reference ModelDescription Chapter Rivers and lakes (Basic assumptions, Lakes - Outlet lake as lake basin a part of a multi-basin lake with equal water level)

Parameters
[in]ilastindex of current subbasin (last lakebasin of current lake)
[in]itypelake type (internal or outlet) (only outlet allowed)
[in]looplakesflag for lakebasins belonging to this lake
[in]qini2inflow to lake basin from main river (incl. upstream subbasins but not other lakebasins) (m3/s)
[in]lakeareai2area of lakebasins (m2)
[in]hypodepthi2lake hypolimnion depth (m)
[in]olakewstoldi2lake water stage, end of last timestep (mm)
[in]resusp_downstreamflushing to downstream subbasin from lake last subbasin
[in,out]outflowsimi2flow to downstream subbasins/lakebasins (m3/s)
[in,out]lakeoutflowi2flow to downstream subbasins, after updating (m3/s)
[in,out]mainflowi2flow to main downstream subbasin, after updating (m3/s)
[in,out]branchflowi2flow to branch downstream subbasin, after updating (m3/s)
[in,out]accinflowupstream inflow to subbasin (m3/s)
[in,out]acccinflowload of substances in upstream inflow to subbasin
[in,out]clakeoutflowi2concentration of substances in flow to downstream subbasins
[in,out]cmainflowi2concentration of substances in main flow to downstream subbasins
[in,out]cbranchflowi2concentration of substances in branch flow to downstream subbasins
[in,out]qcinflii2net inflow to lake basin (incl. prec-evap etc) (m3/s)
[in,out]netroutloadnet load of main river and olake (outflow-(local and upstream)inflows)
[in,out]wstlakesimi2lake water stage (mm)
[in,out]lakewsti2lake water stage, after updating (mm)
[in,out]wcomaveri2average lake water stage over the time step (mm)
[in,out]lpathwayi2output loads for sourceapportionment calculations
[out]lbranchi2output loads for sourceapportionment calculations
[out]totaloutflowtotal outflow of multi-basin lake (m3/s)
[out]ctotaloutflowconcentration of total outflow of multi-basin lake
[in,out]lakestateLake states
[in,out]miscstateMiscstate states

Algoritm

Calculate lakebasinlake average waterstage

Calculate inflow to lake (needed for outflow calculation)

Calculate outflow of lakebasin lake (all outlets of lakebasin lake)

Calculate new lake water stage we want to reach, check if water available

Calculate flow between lakebasins to reach new wst; calculate net flow (first loop) and then total flow adding inflow from other upstream lakebasins (second loop)

Calculate where/when to take water at what concentration and move the water

Let calculated flows (clbinflow, m3/ts) move to recieving lakebasin (i2)

Set variables used for output of upstream lakebasins

Set output of last lakebasin

Update by/of water stage

Update modelled subbasin outflow with observations or nutrient concentrations, only for whole lake outflow

Accumulate flow to downstream subbasins, downstream of whole lakebasinlake

Set output of whole multi-basin lake outflow

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

◆ calculate_flow_from_undivided_lake()

subroutine modelmodule::calculate_flow_from_undivided_lake ( integer, intent(in)  i,
integer, intent(in)  itype,
real, intent(in)  qin,
real, intent(in)  lakearea,
real, intent(in)  flowreduction,
real, intent(in)  hypodepth,
real, intent(in)  olakewstold,
real, intent(out)  outflowsim,
real, intent(out)  lakeoutflow,
real, intent(out)  mainflow,
real, intent(out)  branchflow,
real, dimension(numsubstances), intent(out)  concout,
real, intent(out)  wstlakesim,
real, intent(out)  lakewst,
real, intent(out)  wcomaver,
real, dimension(:,:), intent(inout), allocatable  Lpathway,
type(lakestatetype), intent(inout)  lakestate,
type(miscstatetype), intent(inout)  miscstate 
)
private

Calculate flow from lake that is not a lakebasin lake. This include effect of damming floodplains, updating by flow or water level observations, and setting miscellaneous outputs.

Reference ModelDescription Chapter Rivers and lakes (Basic assumptions, Lakes - Simple outlet lake or dam)

Parameters
[in]iindex of current subbasin
[in]itypelake type (internal or outlet) (only outlet allowed)
[in]qinnet inflow to lake (m3/s)
[in]lakeareaarea of lake (m2)
[in]flowreductiondownstream dammed flow on olake (m3/s)
[in]hypodepthlake hypolimnion depth (m)
[in]olakewstoldlake water stage, end of last timestep (mm)
[out]outflowsimflow to downstream subbasins (m3/s)
[out]lakeoutflowflow to downstream subbasins, after updating (m3/s)
[out]mainflowflow to main downstream subbasin, after updating (m3/s)
[out]branchflowflow to branch downstream subbasin, after updating (m3/s)
[out]concoutconcentration of substances in flow to downstream subbasins
[out]wstlakesimlake water stage (mm)
[out]lakewstlake water stage, after updating (mm)
[out]wcomaveraverage lake water stage over the time step (mm)
[in,out]lpathwayoutput loads for sourceapportionment calculations
[in,out]lakestateLake states
[in,out]miscstateMiscstate states

Algorithm Initialisation

Calculate outflow from lake according to rating curve or regulation

For floodplain model, the lake outflow can be dammed and thus reduced

Remove water from lake and calculate T2 of outflow

Update lake outflow and lake water volume with waterstage observations

Update modelled subbasin outflow with flow observations or nutrient concentrations

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

◆ calculate_internal_wetland()

subroutine modelmodule::calculate_internal_wetland ( integer, intent(in)  i,
real, intent(in)  radext,
real, intent(in)  cloud,
real, intent(in)  added_water,
real, dimension(:,:), intent(in), allocatable  precij,
real, dimension(nclass), intent(in)  sfdist,
real, intent(inout)  q,
real, dimension(numsubstances), intent(inout)  conc,
type(snowicestatetype), intent(in)  frozenstate,
type(soilstatetype), intent(inout)  soilstate,
type(miscstatetype), intent(inout)  miscstate,
real, dimension(:,:), intent(inout), allocatable  localoutvar,
real, dimension(:,:), intent(inout), allocatable  localwbflows,
real, dimension(:,:), intent(inout), allocatable  localLpathway 
)

Calculate inflow, outflow and internal processes of an internal wetland (if present). Precipitation and soil related processes no included. They are calculated by the soilmodel earlier.

Reference ModelDescription Chapter Water management (Constructed wetlands with water regulation capability)

Parameters
[in]icurrent subbasin index
[in]radextextra terrestrial radiation for subbasin i
[in]cloudsubbasin cloudiness (-)
[in]added_waterwater already added to wetland (soil layer 1), eg. P-E (mm/ts)
[in]precijclass precipitation after downwind redistribution of snow (mm/timestep)
[in]sfdistsnow fall distribution factor for subbasin i
[in,out]qflow to local river
[in,out]concconcentration of flow to local river
[in]frozenstateFrozen states
[in,out]soilstateSoil states
[in,out]miscstateMisc states
[in,out]localoutvaroutvar; output for print out
[in,out]localwbflowswbflows; flow for water balance output (m3/ts)
[in,out]locallpathwayLpathway; load for print out

Algorithm
Check for internal wetland

If water temperature (T2) is simulated: calculate current temperature and solar radiation for surface heat exchange

Calculate inflow and outflow to wetland (and processes therein)

Set output variables of internal wetland

Set water balance flows for internal wetland (m3/ts)

Calculate resulting inflow to local river after passing internal wetland

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

◆ calculate_lake_volume_output()

subroutine modelmodule::calculate_lake_volume_output ( integer, intent(in)  n,
type(lakestatetype), intent(in)  lakestate,
real, dimension(n), intent(inout)  wlakevol,
real, dimension(n), intent(out)  ilakevol,
real, dimension(n), intent(out)  olakevol,
real, dimension(n), intent(out)  Milakevol,
real, dimension(n), intent(out)  Molakevol 
)

Calculate output variables for lake volumes.

Parameters
[in]nnumber of subbasins
[in]lakestateLake state, submodel
[in,out]wlakevolvolume of olake/volume for lake with basins in outlet basin (Mm3)
[out]ilakevolvolume of ilake (m3)
[out]olakevolvolume of olake (m3)
[out]milakevolvolume of ilake (Mm3), missing_value for no lake
[out]molakevolvolume of olake (Mm3), missing_value for no lake
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_local_lake_model()

subroutine modelmodule::calculate_local_lake_model ( integer, intent(in)  i,
real, intent(in)  radext,
real, intent(in)  cloud,
real, intent(in)  pobs,
real, dimension(:,:), intent(in), allocatable  precij,
real, dimension(nclass), intent(in)  sfdist,
real, intent(in)  localpcorricep,
real, intent(in)  qin,
real, dimension(numsubstances), intent(in)  cin,
real, intent(in)  hypodep,
real, intent(inout)  localeacti,
real, intent(inout)  localarea_water,
real, intent(inout)  localprec_water,
real, intent(inout)  localevap_water,
type(snowicestatetype), intent(inout)  frozenstate,
type(riverstatetype), intent(inout)  riverstate,
type(lakestatetype), intent(inout)  lakestate,
real, dimension(2), intent(inout)  surftemp,
real, intent(out)  outflow,
real, dimension(numsubstances), intent(out)  coutflow,
real, intent(out)  outwst,
real, dimension(:,:), intent(inout), allocatable  localoutvar,
real, dimension(:,:), intent(inout), allocatable  localwbflows,
real, dimension(:,:,:), intent(inout), allocatable  localLatmdep,
real, dimension(:,:), intent(inout), allocatable  localLpathway 
)

Almost all calculations related to local internal lake.

Calculate flow into local lake and resulting outflow. Calculates processes related to evaporation, ice, nutrients, and other substances. Calculate special output, e.g. for loads and waterbalance. Note that abstraction for irrigation is done outside (before) this subroutine.

Reference ModelDescription Chapter Rivers and lakes (Local lake (ilake))

Parameters
[in]icurrent subbasin index
[in]radextextra terrestrial radiation for subbasin i
[in]cloudsubbasin cloudiness (-)
[in]pobsprecipitation original from Pobs.txt (mm) for subbasin i
[in]precijclass precipitation after downwind redistribution of snow (mm/timestep)
[in]sfdistsnow fall distribution factor for subbasin i
[in]localpcorricepinterception evaporation due to negative preccorr-parameter [mm/timestep]
[in]qinflow into lake from local river (m3/s)
[in]cinconcentration of flow in local river
[in]hypodeplocal lake hypolimnion depth (m)
[in,out]localeactiaccumulation of actual evapotranspiration (mm)
[in,out]localarea_wateraccumulation of water area fraction (-)
[in,out]localprec_wateraccumulation of precipitation on water (mm)
[in,out]localevap_wateraccumulation of actual evapotranspiration on water (mm)
[in,out]frozenstateFrozen states
[in,out]riverstateRiver states
[in,out]lakestateLake states
[out]outflowflow from lake (m3/s)
[out]coutflowconcentration of flow from lake
[out]outwstlake water (mm)
[in,out]localoutvaroutvar; output for print out
[in,out]localwbflowswbflows; flow for water balance output (m3/ts)
[in,out]locallatmdepLatmdep; load for print out
[in,out]locallpathwayLpathway; load for print out

Algorithm
Initiation of lake calculations

Forcing data set precipitation concentration on local lake

Add precipitation and atmospheric deposition to lake water

Evaporation of lake, taking partial ice cover into account if lakeriverice model is enabled

Accumulate output variables for mean over subbasin (accumulation for cevapi)

Calculate and add inflow (including point source) to local lake

Calculate lake tracer (T1), temperature (T2) and ice processes

Calculate substances processes in lakes

Calculate and remove outflow from lake

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

◆ calculate_local_river()

subroutine modelmodule::calculate_local_river ( integer, intent(in)  i,
real, intent(in)  lriverlen,
real, intent(in)  radext,
real, intent(in)  cloud,
real, intent(in)  pobs,
real, dimension(:,:), intent(in), allocatable  precij,
real, dimension(nclass), intent(in)  sfdist,
real, intent(in)  localpcorricep,
real, intent(inout)  qriver,
real, dimension(numsubstances), intent(inout)  criver,
real, intent(inout)  localeacti,
real, intent(inout)  localarea_water,
real, intent(inout)  localprec_water,
real, intent(inout)  localevap_water,
type(snowicestatetype), intent(inout)  frozenstate,
type(miscstatetype), intent(in)  miscstate,
type(riverstatetype), intent(inout)  riverstate,
type(lakestatetype), intent(inout)  lakestate,
real, dimension(:,:), intent(inout), allocatable  localoutvar,
real, dimension(:,:), intent(inout), allocatable  localwbflows,
real, dimension(:,:), intent(inout), allocatable  localwbstores,
real, dimension(:,:,:), intent(inout), allocatable  localLatmdep,
real, dimension(:), intent(inout), allocatable  localLruralb,
real, dimension(:,:), intent(inout), allocatable  localLpathway 
)

Almost all calculations related to local river.

Calculate flow into local river and resulting outflow. Calculates processes related to river wetland, ice, nutrients, and other substances. Calculate special output, e.g. for loads and waterbalance. Note that abstraction for irrigation is done outside (before) this subroutine.

Reference ModelDescription Chapter Rivers and lakes (Local river)

Parameters
[in]icurrent subbasin index
[in]lriverlenlocal river length (m) !Only used to check if river is present
[in]radextextra terrestrial radiation for subbasin i
[in]cloudsubbasin cloudiness (-)
[in]pobsprecipitation original from Pobs.txt (mm) for subbasin i
[in]precijclass precipitation after downwind redistribution of snow (mm/timestep)
[in]sfdistsnow fall distribution factor for subbasin i
[in]localpcorricepinterception evaporation due to negative preccorr-parameter [mm/timestep]
[in,out]qriverflow into/out of local river (m3/s)
[in,out]criverconcentration of flow in local river
[in,out]localeactiaccumulation of actual evapotranspiration (mm)
[in,out]localarea_wateraccumulation of water area fraction (-)
[in,out]localprec_wateraccumulation of precipitation on water (mm)
[in,out]localevap_wateraccumulation of actual evapotranspiration on water (mm)
[in,out]frozenstateFrozen states
[in]miscstateMisc states
[in,out]riverstateRiver states
[in,out]lakestateLake states (is really only IN, but subroutine demande INOUT)
[in,out]localoutvaroutvar; output for print out
[in,out]localwbflowswbflows; flow for water balance output (m3/ts)
[in,out]localwbstoreswbstores; stores for water balance output (m3)
[in,out]locallatmdepLatmdep; load for print out
[in,out]locallruralbLruralb; load for print out
[in,out]locallpathwayLpathway; load for print out

Algorithm
Initiation of river calculations

Add local sources to local river flow

Check for presence of local river. If no river the above flow is directly passed on

Calculate river wetland

Translation (delay) in river inflow

Check if local river has been given class area

  • Forcing data and atmospheric deposition on local river area
  • Evaporation of river, taking partial ice-cover into account if icemodel is enabled
  • Accumulate output variables for mean over subbasin (accumulation for cevapi)

Calculate river ice and T2 processes of local river

Calculate substances processes in river (should they also use fractional river area?)

Calculate outflow of local river and remove from river water volume

Set output variables for local river

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

◆ calculate_outlet_wetland()

subroutine modelmodule::calculate_outlet_wetland ( integer, intent(in)  i,
real, intent(in)  radext,
real, intent(in)  cloud,
real, intent(in)  added_water,
real, dimension(:,:), intent(in), allocatable  precij,
real, dimension(nclass), intent(in)  sfdist,
real, intent(in)  wetinflow,
real, dimension(numsubstances), intent(in)  conc,
type(snowicestatetype), intent(in)  frozenstate,
type(soilstatetype), intent(inout)  soilstate,
type(miscstatetype), intent(inout)  miscstate,
real, intent(out)  wetoutflow,
real, intent(out)  updatedoutflow,
real, dimension(numsubstances), intent(out)  cwetoutflow,
real, intent(out)  mainflow,
real, intent(out)  branchflow,
real, dimension(:,:), intent(inout), allocatable  localoutvar,
real, dimension(:,:), intent(inout), allocatable  localwbflows,
real, dimension(:,:), intent(inout), allocatable  localLpathway 
)

Calculate inflow, outflow and internal processes of an outlet wetland (if present). Precipitation and soil related processes no included. They are calculated by the soilmodel earlier.

Reference ModelDescription Chapter Water management (Constructed wetlands with water regulation capability)

Parameters
[in]icurrent subbasin index
[in]radextextra terrestrial radiation for subbasin i
[in]cloudsubbasin cloudiness (-)
[in]added_waterwater already added to wetland (soil layer 1), eg. P-E (mm/ts)
[in]precijclass precipitation after downwind redistribution of snow (mm/timestep)
[in]sfdistsnow fall distribution factor for subbasin i
[in]wetinflowflow from main river (dampq) (m3/s)
[in]concconcentration of flow from main river
[in]frozenstateFrozen states
[in,out]soilstateSoil states
[in,out]miscstateMisc states
[out]wetoutflowflow from outlet wetland (originally simulated) (m3/s)
[out]updatedoutflowflow from outlet wetland after updating (m3/s)
[out]cwetoutflowconcentration of flow from outlet wetland
[out]mainflowflow from outlet wetland to main downstream subbasin (m3/s)
[out]branchflowflow from outlet wetland to branched downstream subbasin (m3/s)
[in,out]localoutvaroutvar; output for print out
[in,out]localwbflowswbflows; flow for water balance output (m3/ts)
[in,out]locallpathwayLpathway; load for print out

Algorithm
Check for outlet wetland

Calculate helpful variables for the outlet wetland

If water temperature (T2) is simulated: calculate current temperature and solar radiation for surface heat exchange

Calculate inflow and outflow to wetland

Set output variables of outlet wetland

Update modelled subbasin outflow with flow observations

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

◆ calculate_outvar_watertemperature()

subroutine modelmodule::calculate_outvar_watertemperature ( integer, intent(in)  idindex,
integer, intent(in)  isb,
integer, intent(in)  itype,
real, intent(in)  lowerlimit,
type(riverstatetype), intent(in)  riverstate,
type(lakestatetype), intent(in)  lakestate 
)

Calculate temperature of outflow from subbasin from river or lake outflow Consequences Module modvar variable outvar may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
[in]itypeindex of system (1=local, 2=main)
[in]lowerlimitlower limit of temperature
[in]riverstateRiver states
[in]lakestateLake states
+ Here is the caller graph for this function:

◆ calculate_regional_groundwaterflow_to_outside_system()

subroutine modelmodule::calculate_regional_groundwaterflow_to_outside_system ( integer, intent(in)  isb,
real, intent(in)  totflow,
real, intent(out)  outflow 
)

Calculate regional groundwater flow to outside model domain (for deepmodel 1)

Parameters
[in]isbindex of subbasin
[in]totflowtotal flow of regional groundwater (m3/ts)
[out]outflowflow to outside of model domain (m3/ts)
+ Here is the caller graph for this function:

◆ calculate_special_model_parameters()

subroutine, public modelmodule::calculate_special_model_parameters ( integer, intent(in)  nsubb,
real, intent(in)  optrivvel,
real, intent(in)  optdamp,
integer, intent(out)  dimriver 
)

Calculate special HYPE parameters needed by HYSS.

Parameters
[in]nsubbdimension, number of subbasins (submodel)
[in]optrivvellower river velocity boundary (optpar)
[in]optdamplower damp boundary (optpar)
[out]dimrivermaximum size river lag needed
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_translation_time()

subroutine, public modelmodule::calculate_translation_time ( real, intent(in)  rivlen,
real, intent(in)  rivvel,
real, intent(in)  damp,
real, intent(out)  totaltime,
real, intent(out)  transtime 
)

Calculate delay times in rivers.

Parameters
[in]rivlenriver length (m)
[in]rivvelriver velocity (m3/s)
[in]dampdamp parameter
[out]totaltimetotal delay time of river (timesteps)
[out]transtimetranslation time of river (timesteps)
+ Here is the caller graph for this function:

◆ compute_substance_load()

subroutine modelmodule::compute_substance_load ( real, intent(out)  load,
real, intent(in)  flow,
real, intent(in)  conc,
real, intent(in), optional  conc2 
)

Compute load from concentration and flow (matching units) while handling missing value of concentration at zero flow.

Parameters
[out]loadload=flow*conc or load=flow*(conc+conc2)
[in]concconcentration
[in]conc2concentration of second substance
+ Here is the caller graph for this function:

◆ define_model_parameters()

subroutine, public modelmodule::define_model_parameters

Set variable holding model parameter information of HYPE model.

Note that only small letters allowed in parameter names modparid structure: name, dependence type, index (defined in hypevar)

+ Here is the caller graph for this function:

◆ get_special_model_parameters()

subroutine, public modelmodule::get_special_model_parameters ( integer, intent(out)  velindex,
integer, intent(out)  dampindex 
)

Set special HYPE parameters needed by HYSS.

Parameters
[out]velindexindex of rivvel in modparid
[out]dampindexindex of damp in modparid
+ Here is the caller graph for this function:

◆ initialize_class_outvar_to_zero()

subroutine modelmodule::initialize_class_outvar_to_zero

Initialize to zero the variables accumulating class values for calculating output of subbasin mean values and classgroup mean values.

Consequences Module modvar variable outvar, outvarclassdata, and outvarclassfraction may change.

+ Here is the caller graph for this function:

◆ initiate_model()

subroutine, public modelmodule::initiate_model ( type(snowicestatetype), intent(inout)  frozenstate,
type(soilstatetype), intent(inout)  soilstate,
type(aquiferstatetype), intent(inout)  aquiferstate,
type(riverstatetype), intent(inout)  riverstate,
type(lakestatetype), intent(inout)  lakestate,
type(miscstatetype), intent(inout)  miscstate 
)

Initiates model variables and parameters for a simulation. This include calculating HYPE variables for holding model set-up information and more...

Consequences Module modvar variables soildepth and soilthick may change.

Parameters
[in,out]frozenstateSnow and ice states
[in,out]soilstateSoil states
[in,out]aquiferstateAquifer states
[in,out]riverstateRiver states
[in,out]lakestateLake states
[in,out]miscstateMisc states

Algorithm Set flags for radiation, humidity and wind calculations

Set flag for T1 simulation with typical soil leakage

Initiate soil layer and water processes help parameters.

Initialize glacier parameters and type

Initiate soil temperature parameters and variables

Initialize lake and river

Initialize internal landclass wetland (iwet).

Calculate floodplain reference level (deepest bottom of floodplain), if not set in file

Calculate river transport time parameters

Replace parameter values with regional parameter estimates

Set river bankful variables

Initialize lake parameters

Initiate regional groundwater flow/aquifer

Allocate and initiate output variable

Allocate nutrient (NP) load variables

Initiate irrigation

Initate calculations for water balance output

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

◆ initiate_model_state()

subroutine, public modelmodule::initiate_model_state ( type(snowicestatetype), intent(inout)  frozenstate,
type(soilstatetype), intent(inout)  soilstate,
type(aquiferstatetype), intent(inout)  aquiferstate,
type(riverstatetype), intent(inout)  riverstate,
type(lakestatetype), intent(inout)  lakestate,
type(miscstatetype), intent(inout)  miscstate 
)

Initiates the model state for a simulation with no saved states.

Parameters
[in,out]frozenstateSnow and ice states
[in,out]soilstateSoil states
[in,out]aquiferstateAquifer states
[in,out]riverstateRiver states
[in,out]lakestateLake states
[in,out]miscstateMisc states
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ model()

subroutine, public modelmodule::model ( type(snowicestatetype), intent(inout)  frozenstate,
type(soilstatetype), intent(inout)  soilstate,
type(aquiferstatetype), intent(inout)  aquiferstate,
type(riverstatetype), intent(inout)  riverstate,
type(lakestatetype), intent(inout)  lakestate,
type(miscstatetype), intent(inout)  miscstate 
)

Model subroutine for HYPE. Calculates what happen during one timestep.

Parameters
[in,out]frozenstateSnow and ice states
[in,out]soilstateSoil states
[in,out]aquiferstateAquifer states
[in,out]riverstateRiver states
[in,out]lakestateLake states
[in,out]miscstateMisc states

Algorithm

Initial calculation of regional groundwater

Initial calculation of regional floodplains

Get current observations for HYPE specific indata

Calculate and/or adjust subbasin average atmospheric forcing for all subbasins

Main subbasin-loop, subbasins calculated in flow order

Main class-loop for calculation of soil water and substances (land classes)

  • Calculate class forcing data
  • Calculate soil processes
  • Accumulate variables for mean over subbasin and soil layers

Calculations for soil leakage concentrations from input data

Routing in rivers and lakes

Internal wetland (routing part, soil processes already calculated)

Local river (itype=1)

Local internal lake (itype=1)

Main river (itype=2)

Outlet lake (itype=2) or outlet wetland (owet)

Update modelled subbasin outflow with observations

Update modelled subbasin outflow with nutrient concentrations

Accumulate flow to downstream subbasins, and calculate volume flow for water balance

Set observed subbasin output variables (outvar) for print out

Set subbasin output variables (outvar) for print out dependent on outlet lake/no lake or lakebasins, NEED TO HANDLE LAKEBASINS

Set subbasin output variables (outvar) for print out dependent on outlet lake

Set subbasin output variables (outvar) for print out dependent on outlet lake for all lakebasins when reach last lakebasin

End main subbasin-loop

+ Here is the caller graph for this function:

◆ model_specified_atmospheric_deposition()

subroutine, public modelmodule::model_specified_atmospheric_deposition

Set atmospheric deposition for model if no AtmdepData.txt file is used. HYPE uses model paraemters to be compatible with olde versions.

+ Here is the caller graph for this function:

◆ set_class_outvar_missing()

subroutine modelmodule::set_class_outvar_missing ( integer, intent(in)  idindex,
integer, intent(in)  isb 
)

Set the output of subbasin mean value from classe values to missing value in the cases when a variable is not calculated and could be miss used.

Consequences Module modvar variable outvar may change

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
+ Here is the caller graph for this function:

◆ set_modelconfig_from_parameters()

subroutine, public modelmodule::set_modelconfig_from_parameters

Set model configuration data from input parameters; lake depth and catchment area of ilake.

Algorithm

Calculate new soil layer thickness (m)

Set local lake depth from regional or general parameter

Replace local lake with hds model, if option set and depth value given.

Set local lake location (icatch) from parameters.

Set olake lakedepth from parameter inputs (if not set already by GeoData/LakeData/DamData input)

Set recharge and discharge model calculation

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

◆ set_outvar_xobs()

subroutine modelmodule::set_outvar_xobs ( integer, intent(in)  idindex,
integer, intent(in)  isb 
)
private

Set output variable from Xobs Consequences Module modvar variable outvar may change.

Parameters
[in]idindexindex in outvarid
[in]isbindex of subbasin
+ Here is the caller graph for this function:

◆ set_outvar_xobs_scaled()

subroutine modelmodule::set_outvar_xobs_scaled ( integer, intent(in)  idindex,
integer, intent(in)  isb,
integer, intent(in)  idxobs,
real, intent(in)  factor 
)
private

Set output variable from a scaled Xobs variable Consequences Module modvar variable outvar may change.

Parameters
[in]idindexindex in outvarid for output variable
[in]isbindex of subbasin
[in]idxobsindex in outvarid for xobs variable
[in]factorscale factor for output
+ Here is the caller graph for this function:

◆ set_outvar_xobsmean()

subroutine modelmodule::set_outvar_xobsmean ( integer, intent(in)  idindex,
integer, intent(in)  isb,
integer, intent(in)  idxobs 
)
private

Set output variable for a meantype Xobs/Xom variable Consequences Module modvar variable outvar may change.

Parameters
[in]idindexindex in outvarid for output variable
[in]isbindex of subbasin
[in]idxobsindex in outvarid for xom variable
+ Here is the caller graph for this function:

◆ set_outvar_xobsstate()

subroutine modelmodule::set_outvar_xobsstate ( integer, intent(in)  idindex,
integer, intent(in)  isb,
integer, intent(in)  idxobs 
)

Set output variable from a statetype Xobs/Xos variable Consequences Module modvar variable outvar may change.

Parameters
[in]idindexindex in outvarid for output variable
[in]isbindex of subbasin
[in]idxobsindex in outvarid for xos variable
+ Here is the caller graph for this function:

◆ set_parameters_region_division()

subroutine, public modelmodule::set_parameters_region_division ( integer, intent(in)  nregpar)

Allocate and set parameter region division.

Parameters
[in]nregparnumber of region parameters
+ Here is the caller graph for this function:

◆ wetland_wbstore()

real function modelmodule::wetland_wbstore ( integer, intent(in)  j,
integer, intent(in)  i,
type(snowicestatetype), intent(in)  frozenstate,
type(soilstatetype), intent(in)  soilstate 
)
private

Calculate current amount of water in wetland (iwet,owet) in m3.

Parameters
[in]jsoil landuse class
[in]isubbasin
[in]frozenstateSnow and ice states
[in]soilstateSoil states
+ Here is the call graph for this function:
+ Here is the caller graph for this function: