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

Functions/Subroutines

subroutine, public calculate_landarea (nsub, larea)
 
subroutine, public calculate_riverlength (nsub, landarea, rivlength)
 
subroutine, public calculate_fractional_riverarea (i, pooltype, area, riverstate, fracarea, effdepth)
 
subroutine, public add_precipitation_to_river (i, pooltype, area, prec, cprec, dampadd, riverstate)
 
subroutine, public add_precipitation_to_floodplain (i, pooltype, area, prec, cprec, miscstate, load)
 
subroutine, public calculate_river_evaporation (i, j, pooltype, numsubst, area, temp, rh, cprec, epot, evap, cevapT1, dampe, riverstate)
 
subroutine, public calculate_floodplain_evaporation (i, j, pooltype, numsubst, area, temp, rh, cprec, epot, evap, cevap, miscstate)
 
subroutine, public get_rivertempvol (i, pooltype, riverstate, meanrivertemp, totrivervol)
 
subroutine set_rivertemp (i, pooltype, riverstate, meanrivertemp)
 
subroutine, public calculate_actual_lake_evaporation (i, j, itype, numsubst, temp, rh, cprec, epot, evap, cevap, lakestate)
 
subroutine, public set_general_rating_k (nl, n, locarea, areasum, rating)
 
subroutine, public calculate_water_temperature (i, airtemp, riverstate, lakestate)
 
subroutine, public set_water_temperature (waterbody, i, riverstate, lakestate)
 
subroutine, public calculate_river_characteristics (i, itype, flow, calcNPST, riverstate, depth, riverarea, qbank)
 
subroutine calc_qbank (flow, i, itype, riverq365, Qdayacc, Qbank)
 
subroutine update_qbank (q_array, qmax, q2, imax, i2)
 
subroutine, public translation_in_river (i, itype, qin, cin, qout, cout, riverstate)
 
subroutine, public point_abstraction_from_main_river_inflow (i, pooltype, q, riverstate, flow)
 
subroutine, public point_abstraction_from_main_river (i, pooltype, riverstate, flow, dampflow)
 
subroutine, public point_abstraction_from_outlet_lake (i, pooltype, qunitfactor, lakestate, removedflow)
 
subroutine, public point_abstraction_from_aquifer (aquiferstate, removedflow)
 
subroutine, public water_transfer_from_outlet_lake (i, pooltype, qunitfactor, miscstate, lakestate, removedflow)
 
subroutine, public add_water_transfer_to_main_river (i, qin, cin, watertransfer, ctransfer, addedflow)
 
subroutine, public change_current_dam_status (i)
 
subroutine get_current_lake_outflow_parameters (i, ioutlet, lakeareain, olakewst, have2outlets, ratck, ratcexp, w0Today, wmin, damProd, maxProd, minProd, out2ratck, out2ratcexp, out2w0Today, out2wmin, out2damProd, out2maxProd, out2minProd, qin)
 
subroutine get_current_production_flow (current_lake, current_elake, current_dam, current_outlet, wlmr, prodflow)
 
real function apply_seasonal_factor_on_production_flow (current_lake, current_elake, current_dam, current_outlet, prodflow, qampin)
 
subroutine adjust_threshold_for_seasonal_variation (i, current_lake, current_elake, current_outlet, w0)
 
subroutine get_current_rating_parameters (i, current_lake, current_elake, current_dam, current_outlet, ratck, ratcexp)
 
subroutine, public calculate_ilake_outflow (i, subid, ns, qin, lakearea, qunitfactor, outflowm3s, coutflow, load, volumeflow, wst, lakestate)
 
subroutine, public calculate_ilakesection_outflow (i, subid, ns, qin, pein, lakearea, qunitfactor, outflowm3s, coutflow, load, volumeflow, wst, fnca, fcon, lakestate)
 
subroutine, public calculate_outflow_from_lakebasin_lake (i, qin, oldwholelakewst, outlb, outflowm3s, outflow)
 
subroutine, public calculate_outflow_from_outlet_lake (i, qin, lakearea, lakewstmm, qunitfactor, outflowm3s, outflowmm, outflow1, outflow2, maxQprodOUT, minFlowOUT)
 
subroutine calculate_outlet_outflow_of_oneoutletpersubbasin_lake (i, ioutlet, qin, qout, lakearea, wlmr, ratingc, ratinge, w0Today, wmin, damProd, minflow, maxflow, qunitfactor, outflowm3s)
 
subroutine calculate_outlet_outflow_of_twooutletforsubbasin_lake (i, otype, qin, lakearea, wlmr, ratc, ratexp, w0Today, wmin, damProd, wcheck, outflow)
 
subroutine calculate_maxprod_outflow (outflow1, outflow2, maxQprod, minflow2)
 
subroutine, public calculate_flow_from_outlet_lake_waterstage (i, ioutlet, lakeareain, lakewstmm, outflowm3s)
 
subroutine, public remove_outflow_from_lake (i, itype, ns, outflowmm, subid, ldepthm, hypodepth, lakewstmm, coutflow, lakestate)
 
real function average_flow_rating_curve (qin, l_area, wst, k, p)
 
subroutine, public calculate_olake_waterstage (i, lakewatermm, lakewst, w0ref)
 
subroutine, public calculate_lakebasin_average_waterstage (ilast, lakearea, lakewst, w0ref, lakestate)
 
subroutine, public calculate_regamp_adjusted_waterstage (i, lakewst, lakewstadj)
 
subroutine, public calculate_non_regamp_adjusted_waterstage (i, lakewstadj, lakewst)
 
subroutine, public calculate_branched_flow (i, totflow, mainflow, branchflow)
 
subroutine, public recalculate_branched_flow (i, totflow, maxProdin, minflowin, mainflow, branchflow)
 
subroutine recalculate_branched_flow_two_outlets (cmethod, totflow, maxQprod, maxQprod2, minflow1, minflow2, simflow1, simflow2)
 
subroutine, public set_lake_outlets ()
 
subroutine, public calculate_lake_volume (itype, i, dim, a, lakewi, lakebasinvol, lakevol, lakevolsum)
 
subroutine, public t2_processes_in_river (i, itype, temp, swrad, riversurft, riverarea, frozenstate, riverstate, freezeupday, freezeuparea)
 
subroutine calculate_waterice_heatflow (vel, hw, Tw, Tm, Cwi, qhmin, qhmax, qhw)
 
subroutine, public ice_processes_in_river (i, itype, iluse, snowfall, temp, wind, riversurftemp, riverarea, swrad, frozenstate, riverstate, freezeupday, breakupday, freezeuparea)
 
subroutine riverice_riverwater_interaction (i, itype, riverstate, frozenstate, riverarea, breakupday, driverwidt)
 
subroutine, public calculate_lake_hypolimnion_depth (i, lakestate, hypodepth)
 
real function lake_epilimnion_depth (lakearea)
 
subroutine calculate_snow_on_ice (iluse, i, snowfall, temp, melt, swrad, snow, snowage)
 
subroutine, public ice_processes_in_lake (i, itype, iluse, snowfall, temp, wind, lakesurftemp, swrad, frozenstate, lakestate, freezeupday, breakupday, hypodepth, freezeuparea)
 
subroutine calculate_lakeice_lakewater_interaction (itype, i, frozenstate, lakestate, dlakewidt, hypodepth, breakupday)
 
subroutine, public t2_processes_in_lake (i, itype, temp, swrad, lakesurft, lakearea, hypodepth, frozenstate, lakestate, freezeup, freezeuparea)
 
subroutine calculate_icedepth (tsurf, iced, biced, icepor, snowm, snowd, Tair, dlakewidt, dsnowdt, ifreezeup, ibreakup, tf, kika, kexp, pm, ssmfT, ssmfR, bupo, sw, rm, qh)
 
subroutine calculate_t2_transfer (airtemp, watertemp, watervol, waterarea, T2transfer, freezeuparea, freezingpoint)
 
subroutine calculate_t2_transfer_upper2lower (uppertemp, lowertemp, uppervol, lowervol, waterarea, T2transfer)
 
subroutine calculate_watersurface_heatbalance (airtemp, swrad, watertemp, watervol, waterarea, tempcoef, radcoef, constcoef, lincoef, limt2exch, freezeuparea, freezingpoint, stabpar1, stabpar2, stabpar3)
 
subroutine, public calculate_floodplain_waterlevel (vol, amax, ymax, y, a)
 
subroutine calculate_floodplain_volume (y, amax, ymax, vol, a)
 
subroutine calculate_floodplain_equilibriumlevel (volp, volr, flr, flp, ar, amax, ymax, yeq, r2p)
 
subroutine calculate_two_floodplain_equilibriumlevel_dp (volp, wl1, wl2, amax, ymax, href, hwleq, flowdirection)
 
subroutine calculate_equilibrium_floodplain_level_eq1dp (volume, amax, ymax, href, hwleq)
 
subroutine calculate_equilibrium_floodplain_level_eq2dp (ifrom, iabove, ibelow, volume, level, amax, ymax, href, hwleq)
 
subroutine calculate_equilibrium_floodplain_level_eq3dp (volume, amax, ymax, href, hwleq)
 
integer function get_index_of_highest (value1, value2)
 
integer function get_index_of_lowest (value1, value2)
 
integer function get_matching_index (value1, value2, currentvalue)
 
subroutine, public calculate_waterbody_floodplain_interflow (i, fpamax, warea, ifpar, volp, concp, volw, concw, fpdepth, fpdegree, interflow)
 
subroutine, public calculate_regional_floodplain_flows (n, miscstate, dammedflow, dammedflow2, dammedflow3)
 
subroutine calculate_interflow_between_floodplains2 (isub1, iflood1, tflood1, volume1, isub2, iflood2, tflood2, volume2, flow)
 
subroutine, public wetland_watermodel (i, j, isoil, subid, classarea, temp, swrad, soilstate, miscstate, prev_inflow, inflow, cinflow, catcharea, outflow, coutflow)
 
subroutine t2_processes_in_wetland (i, j, temp, swrad, classarea, soilstate)
 
real function, public get_wetland_threshold (j)
 
real function, public river_water_level (itype, i, q, ice, frozenstate)
 
real function, public local_water_level (itype, i, wlm)
 
logical function, public ice_on_river (itype, i, frozenstate)
 
subroutine, public initiate_lakeriverice ()
 
subroutine, public calculate_hds_depressions_outflow (i, subid, ns, qin, pein, lakearea, basinarea, qunitfactor, outflowm3s, coutflow, load, volumeflow, wst, fnca, fcon, lakestate)
 
subroutine small_depressions_delta_water (current_depth, delta_depth, runoff_depth, contrib_frac, max_depth, max_water_area_frac, area_mult, area_power, vol_frac, area_frac, depth, outflow_depth, connectivity)
 
real function small_depression_water_frac_area (vol_frac, mult, power)
 
real function small_depression_contrib_frac (current_contrib_frac, current_depth, delta_depth, max_depth)
 

Variables

character(len=46), dimension(12) errstring
 

Detailed Description

Lake and river water related subroutines in HYPE.

Function/Subroutine Documentation

◆ add_precipitation_to_floodplain()

subroutine, public surfacewater_processes::add_precipitation_to_floodplain ( integer, intent(in)  i,
integer, intent(in)  pooltype,
real, intent(in)  area,
real, intent(in)  prec,
real, dimension(numsubstances), intent(in)  cprec,
type(miscstatetype), intent(inout)  miscstate,
real, dimension(numsubstances), intent(out)  load 
)

Add precipitation to river floodplain.

Parameters
[in]iindex of subbasin
[in]pooltypetype: 1=mriver, 2=olake
[in]areaflooded area (m2)
[in]precprecipitation (mm/timestep)
[in]cprecconcentration of precipitation
[in,out]miscstateFloodplain state
[out]loadload of precipitation
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_precipitation_to_river()

subroutine, public surfacewater_processes::add_precipitation_to_river ( integer, intent(in)  i,
integer, intent(in)  pooltype,
real, intent(in)  area,
real, intent(in)  prec,
real, dimension(numsubstances), intent(in)  cprec,
real, intent(out)  dampadd,
type(riverstatetype), intent(inout)  riverstate 
)

Add precipitation to river, according to volume of watercourse elements.

Parameters
[in]iindex of subbasin
[in]pooltyperivertype: 1=lriver, 2=mriver
[in]areariver area (m2)
[in]precprecipitation (mm/timestep)
[in]cprecconcentration of precipitation
[out]dampaddprecipitation added to riverboxi
[in,out]riverstateRiver state

Algorithm

Calculate fractions (of precipitation) to be added to river water compartments

Add precipitation to river watercourse for each compartment in relation to its volume fraction

If no river volume add all precipitation to river water compartment

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

◆ add_water_transfer_to_main_river()

subroutine, public surfacewater_processes::add_water_transfer_to_main_river ( integer, intent(in)  i,
real, intent(inout)  qin,
real, dimension(numsubstances), intent(inout)  cin,
real, dimension(:), intent(in), allocatable  watertransfer,
real, dimension(:,:), intent(in), allocatable  ctransfer,
real, intent(out)  addedflow 
)

Add water transfer by management data to main river inflow.

Reference ModelDescription Chapter Water management (Water transfer)

Parameters
[in]iindex of subbasin
[in,out]qinflow into main river (m3/s)
[in,out]cinconcentration of flow into main river (mg/L)
[in]watertransferwater transfer flow into main river (m3/s)
[in]ctransferconcentration of water transfer (mg/L)
[out]addedflowadded flow (m3/timestep)
+ Here is the caller graph for this function:

◆ adjust_threshold_for_seasonal_variation()

subroutine surfacewater_processes::adjust_threshold_for_seasonal_variation ( integer, intent(in)  i,
integer, intent(in)  current_lake,
integer, intent(in)  current_elake,
integer, intent(in)  current_outlet,
real, intent(inout)  w0 
)

Subroutine for calculation current threshold.

The threshold is gradually changed over a period of w0adjdays days.

Parameters
[in]iindex of current subbasin
[in]current_lakeindex of lake for current lake
[in]current_elakeindex of lake for current lake
[in]current_outletindex of outlet of current lake
[in,out]w0current threshold (m)
+ Here is the caller graph for this function:

◆ apply_seasonal_factor_on_production_flow()

real function surfacewater_processes::apply_seasonal_factor_on_production_flow ( integer, intent(in)  current_lake,
integer, intent(in)  current_elake,
integer, intent(in)  current_dam,
integer, intent(in)  current_outlet,
real, intent(in)  prodflow,
real, intent(in), optional  qampin 
)

Function for applying seasonal variation on production flow.

Parameters
[in]current_lakeindex of lake for current single lake
[in]current_elakeindex of lake for current multibasin lake
[in]current_damindex in dam for current dam
[in]current_outletindex of outlet in current elake
[in]prodflowcurrent production flow (m3/s)
[in]qampinamplitude of seasonal variation to be used instead of parameter value
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ average_flow_rating_curve()

real function surfacewater_processes::average_flow_rating_curve ( real, intent(in)  qin,
real, intent(in)  l_area,
real, intent(in)  wst,
real, intent(in)  k,
real, intent(in)  p 
)

Flow from rating curve. Estimates average lake outflow (m3/s) during one timestep by linearization of rating equation q = k*(w-w0)**p (further developed from Lindstr�m, G., 2016. Lake water levels for calibration of the S-HYPE model. Hydrology Research 47,4, pp. 672-682. doi: 10.2166/nh.2016.019).

Reference ModelDescription Chapter Rivers and lakes (Lakes - Common lake processes)

Parameters
[in]qininflow (m3/s)
[in]l_arealake area (m2)
[in]wstcurrent water level above threshold (m)
[in]krating curve coefficient (-)
[in]prating curve exponent (-)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_qbank()

subroutine surfacewater_processes::calc_qbank ( real, intent(in)  flow,
integer, intent(in)  i,
integer, intent(in)  itype,
real, dimension(366), intent(inout)  riverq365,
real, dimension(timesteps_per_day), intent(inout)  Qdayacc,
real, intent(out)  Qbank 
)

Estimates the bank full flow by the second highest q from the daily values of last year.

Consequences Module hypevariables variables qmax, q2mqx, iqmax, and iq2max may change.

Reference ModelDescription Chapter Rivers and lakes (Rivers - Common river processes)

Parameters
[in]flowflow current time step (m3/s)
[in]iindex of current subbasin
[in]ityperiver type 1=local, 2=main
[in,out]riverq365river flow last 365 days (m3/s)
[in,out]qdayaccriver flow last day (m3/s)
[out]qbankbankfull flow
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_actual_lake_evaporation()

subroutine, public surfacewater_processes::calculate_actual_lake_evaporation ( integer, intent(in)  i,
integer, intent(in)  j,
integer, intent(in)  itype,
integer, intent(in)  numsubst,
real, intent(in)  temp,
real, intent(in)  rh,
real, dimension(numsubst), intent(in)  cprec,
real, intent(in)  epot,
real, intent(out)  evap,
real, dimension(numsubst), intent(out)  cevap,
type(lakestatetype), intent(inout)  lakestate 
)

Calculate and remove evaporation from lake.

Reference ModelDescription Chapter Processes above ground (Evaporation)

Parameters
[in]isubbasin index
[in]jclass index
[in]itypelake type (ilake or olake)
[in]numsubstnumber of substances modelled
[in]tempair temperature
[in]rhrelative humuidity (-)
[in]cprecconcentration in precipitation
[in]epotpotential evapotranspiration (mm/timestep) (reduced for partly ice covered lake)
[out]evapactual evapotranspiration (mm/timestep)
[out]cevapconcentration in evapotranspiration (eg. mg/L)
[in,out]lakestateLake state

Algorithm
Set default values output variables

Set local parameter

Set actual evaporation to potential evaporation, which is the default for temperature above threshold

Remove evaporation from lake, check if enough water is available

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

◆ calculate_branched_flow()

subroutine, public surfacewater_processes::calculate_branched_flow ( integer, intent(in)  i,
real, intent(in)  totflow,
real, intent(out)  mainflow,
real, intent(out)  branchflow 
)

Calculate division of subbasin outlet flow into main channel and branch based on information in BranchData.

Reference ModelDescription Chapter Rivers and lakes (Basic assumptions, Rivers - Main river)

Parameters
[in]iindex of current subbasin
[in]totflowoutflow of subbasin
[out]mainflowflow in main channel
[out]branchflowflow in branch

Algorithm
Initialisation, default is all flow in main (single) channel

Check for branch existance and flow>0

Set current parameter values

Calculate flow in main channel and in branch

+ Here is the caller graph for this function:

◆ calculate_equilibrium_floodplain_level_eq1dp()

subroutine surfacewater_processes::calculate_equilibrium_floodplain_level_eq1dp ( double precision, dimension(2), intent(in)  volume,
double precision, dimension(2), intent(in)  amax,
double precision, dimension(2), intent(in)  ymax,
double precision, dimension(2), intent(in)  href,
double precision, intent(out)  hwleq 
)

Calculate equilibrium water level in floodplains for sloping floodplain with maximum extent amax and corresponding level ymax. The water level is below both ymax. The equilibrium level is given in the reference system.

Parameters
[in]volumewater volume in floodplain [m3]
[in]amaxarea at maximum areal extent [m2]
[in]ymaxwater level at maximum areal extent [m]
[in]hrefreference height of floodplain bottom [m]
[out]hwleqequilibrium water level (in href system) [m]
+ Here is the caller graph for this function:

◆ calculate_equilibrium_floodplain_level_eq2dp()

subroutine surfacewater_processes::calculate_equilibrium_floodplain_level_eq2dp ( integer, intent(in)  ifrom,
integer, intent(in)  iabove,
integer, intent(in)  ibelow,
double precision, dimension(2), intent(in)  volume,
double precision, dimension(2), intent(in)  level,
double precision, dimension(2), intent(in)  amax,
double precision, dimension(2), intent(in)  ymax,
double precision, dimension(2), intent(in)  href,
double precision, intent(out)  hwleq 
)
private

Calculate equilibrium water level in floodplains for sloping floodplain with maximum extent amax and corresponding level ymax. The water level is above and below ymax for the different flood plains. The equilibrium level is given in the reference system.

Parameters
[in]ifromindex of floodplain which has the highest water level, from which flow should leave, flowdirection
[in]iaboveindex of floodplain which reach its maximum extent
[in]ibelowindex of floodplain which not reach its maximum extent
[in]volumewater volume in floodplain [m3]
[in]levelwater level in ref system [m]
[in]amaxarea at maximum areal extent [m2]
[in]ymaxwater level at maximum areal extent [m] (not in href system)
[in]hrefreference height of floodplain bottom [m]
[out]hwleqequilibrium water level (in href system) [m]
+ Here is the caller graph for this function:

◆ calculate_equilibrium_floodplain_level_eq3dp()

subroutine surfacewater_processes::calculate_equilibrium_floodplain_level_eq3dp ( double precision, dimension(2), intent(in)  volume,
double precision, dimension(2), intent(in)  amax,
double precision, dimension(2), intent(in)  ymax,
double precision, dimension(2), intent(in)  href,
double precision, intent(out)  hwleq 
)
private

Calculate equilibrium water level in floodplains for sloping floodplain with maximum extent amax and corresponding level ymax. The water level is above both ymax. The equilibrium level is given in the reference system.

Parameters
[in]volumewater volume in floodplain [m3]
[in]amaxarea at maximum areal extent [m2]
[in]ymaxwater level at maximum areal extent [m]
[in]hrefreference height of floodplain bottom [m]
[out]hwleqequilibrium water level (in href system) [m]
+ Here is the caller graph for this function:

◆ calculate_floodplain_equilibriumlevel()

subroutine surfacewater_processes::calculate_floodplain_equilibriumlevel ( real, intent(in)  volp,
real, intent(in)  volr,
real, intent(in)  flr,
real, intent(in)  flp,
real, intent(in)  ar,
real, intent(in)  amax,
real, intent(in)  ymax,
real, intent(out)  yeq,
integer, intent(out)  r2p 
)
private

Calculate equilibrium water level in river(or lake) and flooded area for a sloping floodplain with maximum extent amax and corresponding level ymax. The equilibrium level is given in the reference system for the contributing water storage.

Parameters
[in]volpwater volume in floodplain [m3]
[in]volrwater volume in river (or lake) [m3]
[in]flrflooding level for the river (or lake) [m]
[in]flpflooding level for the floodplain [m]
[in]ararea of the river (or lake) [m2]
[in]amaxarea at maximum areal extent [m2]
[in]ymaxwater level at maximum areal extent [m]
[out]yeqequilibrium water level [m]
[out]r2pflow direction flag, 1=river2plain, 2=plain2river,0=no flow
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_floodplain_evaporation()

subroutine, public surfacewater_processes::calculate_floodplain_evaporation ( integer, intent(in)  i,
integer, intent(in)  j,
integer, intent(in)  pooltype,
integer, intent(in)  numsubst,
real, intent(in)  area,
real, intent(in)  temp,
real, intent(in)  rh,
real, dimension(numsubst), intent(in)  cprec,
real, intent(in)  epot,
real, intent(out)  evap,
real, dimension(numsubst), intent(out)  cevap,
type(miscstatetype), intent(inout)  miscstate 
)

Calculate and remove evaporation from floodplain.

Parameters
[in]isubbasin index
[in]jclass index
[in]pooltypetype 1= main river, 2=olake
[in]numsubstnumber of substances modelled
[in]areafloodplain area (m2)
[in]tempair temperature
[in]rhrelative humuidity (-)
[in]cprecconcentration in precipitation
[in]epotpotential evapotranspiration (mm/timestep)
[out]evapactual evapotranspiration (mm/timestep)
[out]cevapconcentration in evapotranspiration (eg. mg/L)
[in,out]miscstateFloodplain state
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_floodplain_volume()

subroutine surfacewater_processes::calculate_floodplain_volume ( real, intent(in)  y,
real, intent(in)  amax,
real, intent(in)  ymax,
real, intent(out)  vol,
real, intent(out)  a 
)
private

Calculate water volume and flooded area from water level for a sloping floodplain.

Parameters
[in]ywater level [m]
[in]ymaxwater level at maximum areal extent [m]
[in]amaxarea at maximum areal extent [m2]
[out]volwater volume in floodplain [m3]
[out]acalculated area [m2]
+ Here is the caller graph for this function:

◆ calculate_floodplain_waterlevel()

subroutine, public surfacewater_processes::calculate_floodplain_waterlevel ( real, intent(in)  vol,
real, intent(in)  amax,
real, intent(in)  ymax,
real, intent(out)  y,
real, intent(out)  a 
)

Calculate water level and flooded area from water volume for a sloping floodplain.

Parameters
[in]volwater volume in floodplain [m3]
[in]amaxarea at maximum areal extent [m2]
[in]ymaxwater level at maximum areal extent [m]
[out]ycalculated water level at volume volm3 [m]
[out]acalculated area [m2]
+ Here is the caller graph for this function:

◆ calculate_flow_from_outlet_lake_waterstage()

subroutine, public surfacewater_processes::calculate_flow_from_outlet_lake_waterstage ( integer, intent(in)  i,
integer, intent(in)  ioutlet,
real, intent(in)  lakeareain,
real, intent(in)  lakewstmm,
real, intent(out)  outflowm3s 
)

Momentanous flow by rating curve.

Subroutine for calculation momentanous outflow from lake from current lake water stage by simple lake rating curve equation. Does not work for upstream lakebasins.

Parameters
[in]iindex of current subbasin
[in]ioutletindex of outlet with main outflow which flow will be affected
[in]lakeareainlakearea (m2)
[in]lakewstmmlake water stage (mm)
[out]outflowm3soutflow of lake (m3/s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_fractional_riverarea()

subroutine, public surfacewater_processes::calculate_fractional_riverarea ( integer, intent(in)  i,
integer, intent(in)  pooltype,
real, intent(in)  area,
type(riverstatetype), intent(in)  riverstate,
real, intent(out)  fracarea,
real, intent(out)  effdepth 
)

Calculate Fractional River Area.

Parameters
[in]isubbasin index
[in]pooltyperiver type (local or main)
[in]areariver area (m2)
[in]riverstateRiver state
[out]fracareafractional river area (-)
[out]effdeptheffective river depth (m)

Algorithm
Set default output values

Get river volume

Calculate mean river water depth (x) assuming full river area

Calculate fractional river area with the sigmoid function

Calculate effective river water depth

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

◆ calculate_hds_depressions_outflow()

subroutine, public surfacewater_processes::calculate_hds_depressions_outflow ( integer, intent(in)  i,
integer, intent(in)  subid,
integer, intent(in)  ns,
real, intent(in)  qin,
real, intent(in)  pein,
real, intent(in)  lakearea,
real, intent(in)  basinarea,
real, intent(in)  qunitfactor,
real, intent(out)  outflowm3s,
real, dimension(ns), intent(out)  coutflow,
real, dimension(:,:), intent(inout), allocatable  load,
real, dimension(:,:), intent(inout), allocatable  volumeflow,
real, intent(out)  wst,
real, intent(inout)  fnca,
real, intent(inout)  fcon,
type(lakestatetype), intent(inout)  lakestate 
)

Subroutine for calculation and removal of outflow from prairie depressions. The HDS algorithm was developed by Kevin Shook and implemented in HYPE by M.I.Ahmed.

Parameters
[in]iindex of current subbasin
[in]subidsubid of current subbasin
[in]nsnumber of substances
[in]qinlateral inflow (runoff from upland) of lake (m3/s) - river discharge and point sources - distributed by icatch
[in]peinvertical inflow of lake (m3/s) - precipitation and evaporation - distributed by lake area
[in]lakearealakearea (m2)
[in]basinareacatchment area of prairie depressions (m2)
[in]qunitfactorfactor for transforming flow for lake from m3/s to mm/timestep and back based on lakearea
[out]outflowm3soutflow of lake (m3/s)
[out]coutflowconcentration of outflow of lake
[in,out]loadload of outflow of lake (and other flows)
[in,out]volumeflowvolume outflow of lake (m3/ts) (and other flows)
[out]wstlake water (mm)
[in,out]fncafraction of non-contributing area (per subbasin area)
[in,out]fconfraction of max water area connected (contributing to outflow)
[in,out]lakestateLake state

Algorithm
Initial values

Set HDS input parameters

Rescale inflows and calculate current water before inflows on catchment scale

Calculate inflows to depressions using HDS

Set variables needed by the HDS routine

Call HDS and calculate the outflow

Recalculate outflow units, check against lake volume, and remove from lake volume

Bookkeeping for the next time step

Set output variables

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

◆ calculate_icedepth()

subroutine surfacewater_processes::calculate_icedepth ( real, intent(inout)  tsurf,
real, intent(inout)  iced,
real, intent(inout)  biced,
real, intent(inout)  icepor,
real, intent(inout)  snowm,
real, intent(inout)  snowd,
real, intent(in)  Tair,
real, intent(out)  dlakewidt,
real, intent(out)  dsnowdt,
integer, intent(in)  ifreezeup,
integer, intent(out)  ibreakup,
real, intent(in)  tf,
real, intent(in)  kika,
real, intent(in)  kexp,
real, intent(in)  pm,
real, intent(in)  ssmfT,
real, intent(in)  ssmfR,
real, intent(in)  bupo,
real, intent(in)  sw,
real, intent(in)  rm,
real, intent(in)  qh 
)

Subroutine to calculate growth of ice on lakes and rivers (only after freezeup has been identified)

Parameters
[in,out]tsurflake surface temperature, when the lake is ice and/or snowcovered, Tsurf is back calculated from ice growth, unless its melting, then its set to 0
[in,out]icedice depth, cm (black ice + snowice)
[in,out]bicedblack ice, cm
[in,out]iceporice porosity, fraction
[in,out]snowmsnowmass, mm
[in,out]snowdsnowdepth, cm
[in]tairair temperature, C
[out]dlakewidttransformation of lake ice to lake water (positive direction from ice to water)
[out]dsnowdttransformation of snow to lake ice (positive direction from ice to snow)
[in]ifreezeupfreeze-up day flag (1=yes, 0=no)
[out]ibreakupbreak-up day flag (1=yes, 0=no)
[in]tftf (~0.) , freezing point temperature of the lake/river water, �C
[in]kikakika(~10.), ratio between thermal conductivity of ice and heat exchange coef in air
[in]kexpkiks(~10.), as above but for snow, actually dependent on snow density, but we use a fixed value
[in]pmpm (~0.5) , degree-day melt factor for ice, cm/�C
[in]ssmftssmfT (~0?), sub-surface melt fraction, fraction 0-1, air temperature driver melt
[in]ssmfrssmfR (~0.9?), sub-surface melt fraction, fraction 0-1, radiation driven melt
[in]bupobupo (~0.40?), breakup porosity, fraction 0-1
[in]swsw, incoming shortwave radiation, MJ/m2/timestep
[in]rmrm (?), radiation melt factor for ice, [-] = fraction of incoming radiation flux absorbed for ice melt (at air temperatures above 0C)
[in]qhqh, heat flow from water, MJ/m2/timestep
+ Here is the caller graph for this function:

◆ calculate_ilake_outflow()

subroutine, public surfacewater_processes::calculate_ilake_outflow ( integer, intent(in)  i,
integer, intent(in)  subid,
integer, intent(in)  ns,
real, intent(in)  qin,
real, intent(in)  lakearea,
real, intent(in)  qunitfactor,
real, intent(out)  outflowm3s,
real, dimension(ns), intent(out)  coutflow,
real, dimension(:,:), intent(inout), allocatable  load,
real, dimension(:,:), intent(inout), allocatable  volumeflow,
real, intent(out)  wst,
type(lakestatetype), intent(inout)  lakestate 
)

Subroutine for calculation and removal of outflow from local lake. General rating curve is used for ilakes.

Parameters
[in]iindex of current subbasin
[in]subidsubid of current subbasin
[in]nsnumber of substances
[in]qininflow of lake (m3/s)
[in]lakearealakearea (m2)
[in]qunitfactorfactor for transforming flow for lake from m3/s to mm/timestep and back
[out]outflowm3soutflow of lake (m3/s)
[out]coutflowconcentration of outflow of lake
[in,out]loadload of outflow of lake (and other flows)
[in,out]volumeflowvolume outflow of lake (m3/ts) (and other flows)
[out]wstlake water (mm)
[in,out]lakestateLake state

Algorithm

Calculate outflow from general rating curve

Check outflow against lake volume

Remove outflow from lake

Set output variables

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

◆ calculate_ilakesection_outflow()

subroutine, public surfacewater_processes::calculate_ilakesection_outflow ( integer, intent(in)  i,
integer, intent(in)  subid,
integer, intent(in)  ns,
real, intent(in)  qin,
real, intent(in)  pein,
real, intent(in)  lakearea,
real, intent(in)  qunitfactor,
real, intent(out)  outflowm3s,
real, dimension(ns), intent(out)  coutflow,
real, dimension(:,:), intent(inout), allocatable  load,
real, dimension(:,:), intent(inout), allocatable  volumeflow,
real, intent(out)  wst,
real, intent(out)  fnca,
real, intent(out)  fcon,
type(lakestatetype), intent(inout)  lakestate 
)

Subroutine for calculation and removal of outflow from local lake with lake sections (fill-and-spill connectivity model).

Fraction of volume in lake sections is updated. Rating curve for ilakes is used for lake section interflow and outflow.

Parameters
[in]iindex of current subbasin
[in]subidsubid of current subbasin
[in]nsnumber of substances
[in]qinlateral inflow of lake (m3/s) - river discharge and point sources - distributed by icatch
[in]peinvertical inflow of lake (m3/s) - precipitation and evaporation - distributed by lake area
[in]lakearealakearea (m2)
[in]qunitfactorfactor for transforming flow for lake from m3/s to mm/timestep and back
[out]outflowm3soutflow of lake (m3/s)
[out]coutflowconcentration of outflow of lake
[in,out]loadload of outflow of lake (and other flows)
[in,out]volumeflowvolume outflow of lake (m3/ts) (and other flows)
[out]wstlake water (mm)
[out]fncafraction of non-contributing area (per subbasin area)
[out]fconfraction of ilake connectivity (per ilake area)
[in,out]lakestateLake state

Algorithm

Current parameter values

1 Distribute inflows and derive water stage in lake sections after inflows, accumulate negative volumes for later handling.

2 Distribute negative water levels to lakesections with water

3 Loop over lakesections and calculate lakesection interflow

Check outflow against lake volume

4 Finalize output variables and update lakestate variable areafrac

Set other output variables

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

◆ calculate_interflow_between_floodplains2()

subroutine surfacewater_processes::calculate_interflow_between_floodplains2 ( integer, intent(in)  isub1,
integer, intent(in)  iflood1,
integer, intent(in)  tflood1,
real, intent(in)  volume1,
integer, intent(in)  isub2,
integer, intent(in)  iflood2,
integer, intent(in)  tflood2,
real, intent(in)  volume2,
real, intent(out)  flow 
)

Calculate equalising flow between floodplains of rivers and lakes.

Parameters
[in]isub1index of subbasin 1
[in]iflood1index of flooding for subbasin 1
[in]tflood1type of water for subbasin 1 (1=main river, 2=outlet lake)
[in]volume1floodplain 1 water volume (m3)
[in]isub2index of subbasin 2
[in]iflood2index of flooding for subbasin 2
[in]tflood2type of water for subbasin 2 (1=main river, 2=outlet lake)
[in]volume2floodplain 2 water volume (m3)
[out]flowwanted flow between floodplain 1 and 2 (m3/timestep) (negative for flow from 2 to 1)

Algorithm
Check if flooding

Initalize local variables

Calculate floodplain water levels

Calculate equilibrium water level

Calculate wanted interflow

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

◆ calculate_lake_hypolimnion_depth()

subroutine, public surfacewater_processes::calculate_lake_hypolimnion_depth ( integer, intent(in)  i,
type(lakestatetype), intent(inout)  lakestate,
real, dimension(2), intent(out)  hypodepth 
)

Calculate lake hypolimnion depth.

Parameters
[in]icurrent subbasin
[in,out]lakestateLake states
[out]hypodepthlake hypolimnion depth (m)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_lake_volume()

subroutine, public surfacewater_processes::calculate_lake_volume ( integer, intent(in)  itype,
integer, intent(in)  i,
integer, intent(in)  dim,
real, intent(in)  a,
real, intent(in)  lakewi,
real, dimension(2), intent(inout)  lakebasinvol,
real, intent(inout)  lakevol,
real, dimension(dim), intent(inout)  lakevolsum 
)

Calculate different volumes of lakes for print out. Volume for ilakes, volume for olakes, and volume for whole lakes (basin divided).

Parameters
[in]itypelake type; ilake=1, olake=2
[in]iindex of current subbasin
[in]dimsize of variable
[in]alake area (m2)
[in]lakewilake water stage (mm)
[in,out]lakebasinvolvolume of olake and ilake
[in,out]lakevolvolume of olake/volume for lake with basins in outlet basin
[in,out]lakevolsumto sum lakebasins to outlet basin (big enough)

Algoritm
Calculate lake volume for current lake

If outlet lake

+ Here is the caller graph for this function:

◆ calculate_lakebasin_average_waterstage()

subroutine, public surfacewater_processes::calculate_lakebasin_average_waterstage ( integer, intent(in)  ilast,
real, intent(out)  lakearea,
real, intent(out)  lakewst,
real, intent(out)  w0ref,
type(lakestatetype), intent(in)  lakestate 
)

Calculate average lake water stage (m) of a lakebasin lake in local reference system. Subroutine called for "last" lakebasin.

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)
[out]lakeareaoutlet lake area (of whole lakebasin lake) (m2)
[out]lakewstoutlet lake water stage (m) above threshold/local ref-system
[out]w0reflevel to be added for w-ref outlet lake water stage (m)
[in]lakestateLake state

Algoritm
Collect whole lake data; lake water reference at threshold and area

Calculate volume of lake water in lakebasins above threshold

Calculate average water stage for whole lake (negative if below "w0")

+ Here is the caller graph for this function:

◆ calculate_lakeice_lakewater_interaction()

subroutine surfacewater_processes::calculate_lakeice_lakewater_interaction ( integer, intent(in)  itype,
integer, intent(in)  i,
type(snowicestatetype), intent(inout)  frozenstate,
type(lakestatetype), intent(inout)  lakestate,
real, intent(in)  dlakewidt,
real, intent(in)  hypodepth,
integer, intent(inout)  breakupday 
)

Calculate lake ice melt from heat from lake water, as well as influence of ice surface melt on lake water temperature.

Parameters
[in]iindex of subbasin
[in]itypeindex of lake type (ilake = 1, olake = 2)
[in,out]frozenstateSnow and ice states
[in,out]lakestateLake state
[in]dlakewidtprevious surface melt water (mm?)
[in]hypodepthhypolimnion depth (m)
+ Here is the caller graph for this function:

◆ calculate_landarea()

subroutine, public surfacewater_processes::calculate_landarea ( integer, intent(in)  nsub,
real, dimension(nsub), intent(out)  larea 
)

Calculate land area of subbasins. The landarea include floodplains (dry or flooded). The land area does not include wetlands (iwet and owet).

Parameters
[in]nsubNumber of subbasins
[out]lareaLand area [m2]

Algorithm
Calculate land area of subbasin

+ Here is the caller graph for this function:

◆ calculate_maxprod_outflow()

subroutine surfacewater_processes::calculate_maxprod_outflow ( real, intent(inout)  outflow1,
real, intent(inout)  outflow2,
real, intent(in)  maxQprod,
real, intent(in)  minflow2 
)

Subroutine for increasing production flow to maximum before using overflow branch.

Parameters
[in,out]outflow1outflow of first outlet (m3/s)
[in,out]outflow2outflow of second outlet (m3/s)
[in]maxqprodmaximum production (m3/s), second priority
[in]minflow2minimum flow (m3/s), first priority

Redistribute flow for maximum production

+ Here is the caller graph for this function:

◆ calculate_non_regamp_adjusted_waterstage()

subroutine, public surfacewater_processes::calculate_non_regamp_adjusted_waterstage ( integer, intent(in)  i,
real, intent(in)  lakewstadj,
real, intent(out)  lakewst 
)

Calculate outlet lake water level (m) in HYPE sense (volume) adjusted from "real" regulation amplitude (in local reference system)

Parameters
[in]iindex of current subbasin
[in]lakewstadjoutlet lake water stage (above threshold) (m) (considering "real" amplitude of regulation volume)
[out]lakewstoutlet lake water stage readjusted for "real" amplitud to be "HYPE volume" (m)

Algoritm

Get regulation amplitude adjustment factor

Calculate adjusted lake water stage

+ Here is the caller graph for this function:

◆ calculate_olake_waterstage()

subroutine, public surfacewater_processes::calculate_olake_waterstage ( integer, intent(in)  i,
real, intent(in)  lakewatermm,
real, intent(out)  lakewst,
real, intent(out)  w0ref 
)

Calculate outlet lake water stage (m) in local reference system and for w-reference system.

Reference ModelDescription Chapter Rivers and lakes (Basic assumptions, Lakes - Outlet lake (olake) as a lake basin)

Parameters
[in]iindex of current subbasin
[in]lakewatermmoutlet lake water content (mm)
[out]lakewstoutlet lake water stage above threshold (m)
[out]w0reflevel to be added for w-ref outlet lake water stage (m)

Algoritm

Calculate lake water stage in local reference system

+ Here is the caller graph for this function:

◆ calculate_outflow_from_lakebasin_lake()

subroutine, public surfacewater_processes::calculate_outflow_from_lakebasin_lake ( integer, intent(in)  i,
real, intent(in)  qin,
real, intent(in)  oldwholelakewst,
logical, dimension(nsub), intent(out)  outlb,
real, intent(out)  outflowm3s,
real, dimension(nsub,2), intent(out)  outflow 
)

Subroutine for calculation outflow from last/only outlet of new lakebasin lake.

For outlet lakes several options exist: Specific rating curve, general rating curve, regulation with spill by rating curve, constant production flow depending on date or two separate rating curves for olake.

Parameters
[in]iindex of current subbasin (last lakebasin)
[in]qinnet inflow of whole lake (m3/s)
[in]oldwholelakewstlake wst above theshold (average of lake)
[out]outlbstatus of subbasin with lakebasin with outflow of the lake (m3/s)
[out]outflowm3sall outflow of lake (m3/s)
[out]outflowoutflow of main and second outlet (m3/s) and from which subbasin they comes

Algorithm
Set initial values

Set water level for lake

Calculate outflow main outlet (last lakebasin)

Get current parameter values

Outflow determination for one outlet lake

Calculate flow in main channel and in branch from BranchData fractions

Calculate outflow of other outlets

Find subbasin index that outlet originated from

Get current parameter values

Outflow determination for this outlet (outflow in branch)

Set calculated outlet outflow to branch and add to total outflow

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

◆ calculate_outflow_from_outlet_lake()

subroutine, public surfacewater_processes::calculate_outflow_from_outlet_lake ( integer, intent(in)  i,
real, intent(in)  qin,
real, intent(in)  lakearea,
real, intent(in)  lakewstmm,
real, intent(in)  qunitfactor,
real, intent(out)  outflowm3s,
real, intent(out)  outflowmm,
real, intent(out)  outflow1,
real, intent(out)  outflow2,
real, intent(out)  maxQprodOUT,
real, intent(out)  minFlowOUT 
)

Subroutine for calculation outflow from outlet lake. Use for single lakes and dams, not for lakebasinlakes.

For outlet lakes several options exist: Specific rating curve, general rating curve, all water above threshold for upstream lake basin, regulation with spill by rating curve, constant production flow depending on date or two separate rating curves for olake.

Parameters
[in]iindex of current subbasin
[in]qinnet inflow of lake (m3/s)
[in]lakearealakearea (m2)
[in]lakewstmmlake water stage (mm)
[in]qunitfactorfactor for transforming flow for lake from m3/s to mm/timestep and back
[out]outflowm3soutflow of lake (m3/s)
[out]outflowmmoutflow of lake (mm)
[out]outflow1outflow of first outlet (m3/s) or all outflow if not lake with 2 outlets in LD
[out]outflow2outflow of second outlet (m3/s)
[out]maxqprodouttemporary maximum production for updated flow (m3/s)
[out]minflowoutcurrent minimum flow for updated flow (m3/s)

Algorithm
Set initial values

Calculate water level for outlet lake

Get current parameter values

Outflow determination (and check) for two outlet lake

Outflow determination for one outlet lake

Check outflow against lake volume (bad rating curve parameters or numerical problems)

  • Calculate threshold for checking
  • Check against lowest water level allowed and lake volume

Calculate flow in main channel and in branch from BranchData fractions

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

◆ calculate_outlet_outflow_of_oneoutletpersubbasin_lake()

subroutine surfacewater_processes::calculate_outlet_outflow_of_oneoutletpersubbasin_lake ( integer, intent(in)  i,
integer, intent(in)  ioutlet,
real, intent(in)  qin,
real, intent(in)  qout,
real, intent(in)  lakearea,
real, intent(in)  wlmr,
real, intent(in)  ratingc,
real, intent(in)  ratinge,
real, intent(in)  w0Today,
real, intent(in)  wmin,
real, intent(in)  damProd,
real, intent(in)  minflow,
real, intent(in)  maxflow,
real, intent(in)  qunitfactor,
real, intent(out)  outflowm3s 
)

Subroutine for calculating current outflow of one lake outlet of an "Outlet lake with two outlets".

Parameters
[in]icurrent subbasin
[in]ioutletlake outlet index
[in]qinnet inflow of lake (m3/s)
[in]qoutoutflow from other outlets of this lake (m3/s)
[in]lakearealakearea (m2)
[in]wlmrlake water stage (m)
[in]ratingcrating curve coefficient
[in]ratingerating curve exponent
[in]w0todayupper threshold (m)
[in]wminlower threshold (m)
[in]damprodcurrent production flow (m3/s)
[in]minflowminimum allowed flow (m3/s)
[in]maxflowmaximum allowed flow (m3/s)
[in]qunitfactorfactor for transforming flow for lake from m3/s to mm/timestep and back
[out]outflowm3scurrent outflow of this outlet (m3/s)

Outflow determination for one outlet lake

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

◆ calculate_outlet_outflow_of_twooutletforsubbasin_lake()

subroutine surfacewater_processes::calculate_outlet_outflow_of_twooutletforsubbasin_lake ( integer, intent(in)  i,
integer, intent(in)  otype,
real, intent(in)  qin,
real, intent(in)  lakearea,
real, intent(in)  wlmr,
real, intent(in)  ratc,
real, intent(in)  ratexp,
real, intent(in)  w0Today,
real, intent(in)  wmin,
real, intent(in)  damProd,
real, intent(out)  wcheck,
real, intent(out)  outflow 
)

Subroutine for calculating current outflow of one lake outlet of an "Outlet lake with two outlets".

Parameters
[in]icurrent subbasin
[in]otypeoutlet type as defined in lakeoutlet (1-7)
[in]qinnet inflow of lake (m3/s)
[in]lakearealakearea (m2)
[in]wlmrlake water stage (m)
[in]ratcrating curve coefficient
[in]ratexprating curve exponent
[in]w0todayupper threshold (m)
[in]wminlower threshold (m)
[in]damprodcurrent production flow (m3/s)
[out]wcheckcurrent outflow threshold (m)
[out]outflowcurrent outflow (m3/s)

Calculate outflow for current outlet type

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

◆ calculate_regamp_adjusted_waterstage()

subroutine, public surfacewater_processes::calculate_regamp_adjusted_waterstage ( integer, intent(in)  i,
real, intent(in)  lakewst,
real, intent(out)  lakewstadj 
)

Calculate outlet lake water stage (m) in local reference system adjusted to "real" regulation amplitude.

Parameters
[in]iindex of current subbasin
[in]lakewstoutlet lake water stage (above threshold) (m)
[out]lakewstadjoutlet lake water stage adjusted for "real" amplitude of regulation volume (m)

Algoritm

Get regulation amplitude adjustment factor

Calculate adjusted lake water stage

+ Here is the caller graph for this function:

◆ calculate_regional_floodplain_flows()

subroutine, public surfacewater_processes::calculate_regional_floodplain_flows ( integer, intent(in)  n,
type(miscstatetype), intent(inout)  miscstate,
real, dimension(n), intent(out)  dammedflow,
real, dimension(n), intent(out)  dammedflow2,
real, dimension(n), intent(out)  dammedflow3 
)

Calculate regional floodplain flows.

Calculate flow between floodplains of rivers and lakes within a subbasin or between subbasins within a regional floodplain for leveling out the water level.

Parameters
[in]nnumber of subbasins
[in,out]miscstateFloodplain states
[out]dammedflowpotentially dammed flow within subbasin by floodplains (m3/timestep)
[out]dammedflow2potentially dammed flow of olake from downstream subbasin by floodplains (m3/timestep)
[out]dammedflow3potentially dammed flow of main river from downstream subbasin by floodplains (m3/timestep)

Algorithm

Calculate wanted flow between floodplains in the same subbasin

Calculate flow between a floodplain and its downstream floodplain in the maindown subbasin

Calculate flow between a floodplain and its downstream floodplain in the branched subbasin

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

◆ calculate_river_characteristics()

subroutine, public surfacewater_processes::calculate_river_characteristics ( integer, intent(in)  i,
integer, intent(in)  itype,
real, intent(in)  flow,
logical, intent(in)  calcNPST,
type(riverstatetype), intent(inout)  riverstate,
real, intent(out)  depth,
real, intent(out)  riverarea,
real, intent(out)  qbank 
)

Calculate river characteristics River characteristics include depth, area, bankful flow and 365-day-average-Q.

Parameters
[in]iindex of current subbasin
[in]itypelake type (ilake or olake)
[in]flowriver flow (m3/s)
[in]calcnpststatus of N,P,S,T1 simulation (to calculate bankful flow)
[in,out]riverstateRiver states
[out]depthriver depth (m)
[out]riverareariver surface area (m2)
[out]qbankflow at bank-ful river channel (m3/s)

Algorithm
Set parameter values

Update state variable 365-day mean river discharge (m3/s)

River length,depth and width, depend on velocity

River (surface/bottom) area

Calculate new bankfull flow, stored in Q2max.

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

◆ calculate_river_evaporation()

subroutine, public surfacewater_processes::calculate_river_evaporation ( integer, intent(in)  i,
integer, intent(in)  j,
integer, intent(in)  pooltype,
integer, intent(in)  numsubst,
real, intent(in)  area,
real, intent(in)  temp,
real, intent(in)  rh,
real, dimension(numsubst), intent(in)  cprec,
real, intent(in)  epot,
real, intent(out)  evap,
real, intent(out)  cevapT1,
real, intent(out)  dampe,
type(riverstatetype), intent(inout)  riverstate 
)

Calculate and remove evaporation from river.

Reference ModelDescription Chapters Rivers and lakes (Rivers - Common river processes) and Processes above ground (Evaporation)

Parameters
[in]isubbasin index
[in]jclass index
[in]pooltyperiver type (local or main)
[in]numsubstnumber of substances modelled
[in]areariver area (m2)
[in]tempair temperature
[in]rhrelative humuidity (-)
[in]cprecconcentration in precipitation
[in]epotpotential evapotranspiration (mm/timestep)
[out]evapactual evapotranspiration (mm/timestep)
[out]cevapt1concentration of T1 in evapotranspiration
[out]dampeactual evapotranspiration from riverboxi (m3)
[in,out]riverstateLake state

Algorithm
Set default values output variables (zero evaporation)

If temperature is above threshold river evaporation is potential

Calculate fractions of river water compartments

Check if enough water is available for evaporation in each compartment

Remove evaporation from river watercourse compartments

Set concentration of evaporation from damping box

Set concentration of evaporation from queue

Set concentration of evaporation from queue

If less water than wanted, remove last traces of substance with the evaporation

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

◆ calculate_riverlength()

subroutine, public surfacewater_processes::calculate_riverlength ( integer, intent(in)  nsub,
real, dimension(nsub), intent(in)  landarea,
real, dimension(2,nsub), intent(out)  rivlength 
)

Calculate riverlength for local streams and main rivers.

Parameters
[in]nsubNumber of subbasins
[in]landarealand area [m2]
[out]rivlengthriver length [m]

Algorithm

Set river length from GeoData, or if zero use default value, i.e. square root of land area

+ Here is the caller graph for this function:

◆ calculate_snow_on_ice()

subroutine surfacewater_processes::calculate_snow_on_ice ( integer, intent(in)  iluse,
integer, intent(in)  i,
real, intent(in)  snowfall,
real, intent(in)  temp,
real, intent(out)  melt,
real, intent(in)  swrad,
real, intent(inout)  snow,
real, intent(inout)  snowage 
)
private

Subroutine for calculation of snow on ice changes; snowfall addition and snow pack melting.

Parameters
[in]iluseindex of landuse
[in]iindex of subbasin
[in]snowfallprecipitation as snow (mm/timestep)
[in]tempair temperature (C)
[out]meltsnow melt (mm/timestep)
[in]swradshortwave radiation (MJ/m2/ts)
[in,out]snowsnow pack (mm)
[in,out]snowagesnowage (timesteps)

Algorithm
Set parameter values

Calculate snow melt

Update the snow pack with snowfall and melting

+ Here is the caller graph for this function:

◆ calculate_t2_transfer()

subroutine surfacewater_processes::calculate_t2_transfer ( real, intent(in)  airtemp,
real, intent(inout)  watertemp,
real, intent(in)  watervol,
real, intent(in)  waterarea,
real, intent(in)  T2transfer,
real, intent(out)  freezeuparea,
real, intent(in)  freezingpoint 
)

Subroutine to calculate transfer of heat from air to water.

Parameters
[in]airtempair temperature (deg Celsius)
[in,out]watertempwater temperature (deg Celsius)
[in]watervolsurface water volume (m3 or mm)
[in]waterareasurface water area (m2)
[in]t2transferheat transfer parmeter from air to water (J/m2/s/deg)
+ Here is the caller graph for this function:

◆ calculate_t2_transfer_upper2lower()

subroutine surfacewater_processes::calculate_t2_transfer_upper2lower ( real, intent(inout)  uppertemp,
real, intent(inout)  lowertemp,
real, intent(in)  uppervol,
real, intent(in)  lowervol,
real, intent(in)  waterarea,
real, intent(in)  T2transfer 
)

Subroutine to calculate transfer of heat(temperature) between upper and lower layer in lakes.

Parameters
[in,out]uppertempupper water temperature (deg Celsius)
[in,out]lowertemplower water temperature (deg Celsius)
[in]uppervolupper layer water volume (m3)
[in]lowervollower layer water volume (m3)
[in]waterareasurface water area (m2)
[in]t2transferheat transfer parmeter from water to water (J/m2/s/deg)
+ Here is the caller graph for this function:

◆ calculate_two_floodplain_equilibriumlevel_dp()

subroutine surfacewater_processes::calculate_two_floodplain_equilibriumlevel_dp ( real, dimension(2), intent(in)  volp,
real, intent(in)  wl1,
real, intent(in)  wl2,
real, dimension(2), intent(in)  amax,
real, dimension(2), intent(in)  ymax,
real, dimension(2), intent(in)  href,
real, intent(out)  hwleq,
integer, intent(out)  flowdirection 
)
private

Calculate equilibrium water level between two floodplains with sloping floodplain with maximum extent amax and corresponding level ymax.

Parameters
[in]volpwater volume in floodplain [m3]
[in]wl1water level for floodplain 1 [m]
[in]wl2water level for floodplain 2 [m]
[in]amaxarea at maximum areal extent [m2]
[in]ymaxwater level at maximum areal extent [m]
[in]hrefreference height of floodplain bottom [m]
[out]hwleqequilibrium water level (in href system) [m]
[out]flowdirectionflow direction flag, 1=fp1tofp2, 2=fp2tofp1,0=no flow
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_water_temperature()

subroutine, public surfacewater_processes::calculate_water_temperature ( integer, intent(in)  i,
real, intent(in)  airtemp,
type(riverstatetype), intent(inout)  riverstate,
type(lakestatetype), intent(inout)  lakestate 
)

Calculates temperature of rivers and lakes and other temperature variables.

These calculations is for modeloption swtemperature 0, the default. River temperature is calculated as a 20-day moving average of air temperature. Lake temperature is calculated as a 5-day moving average of air temperature. Also 10- and 20-day moving average of lake- and river temperature is calculated for determining rising or decreasing temperature (season).

Parameters
[in]iindex of current subbasin
[in]airtempair temperature for subbasin
[in,out]riverstateRiver states
[in,out]lakestateLake states

Algorithm
Calculate river temperature, same for local and main river

Calculate lake temperature, same for internal and outlet lake (if exist)

  • If parameter not set: as 5-day moving average
  • Elseif parameter set: as a moving average of a period determined by lake depth

Calculate 10- and 20-day mean of water temperature for N,P,C,S or Si processes

+ Here is the caller graph for this function:

◆ calculate_waterbody_floodplain_interflow()

subroutine, public surfacewater_processes::calculate_waterbody_floodplain_interflow ( integer, intent(in)  i,
real, intent(in)  fpamax,
real, intent(in)  warea,
real, dimension(5), intent(in)  ifpar,
real, intent(inout)  volp,
real, dimension(numsubstances), intent(inout)  concp,
real, intent(inout)  volw,
real, dimension(numsubstances), intent(inout)  concw,
real, intent(out)  fpdepth,
real, intent(out)  fpdegree,
real, intent(out)  interflow 
)

Calculate interflow between water body and floodplain.

Parameters
[in]iindex of subbasin
[in]fpamaxmaximum area of the flood plain [m2]
[in]warea(maximum=constant) area of the water body [m2]
[in]ifparcurrent interflow parameters (flmrr/floll,flmrp/flolp,fymmr/fymol,rcr2fp/rcl2fp,rcfp2r/rcfp2l
[in,out]volpwater volume in floodplain [m3]
[in,out]concpfloodplain concentrations
[in,out]volwwater volume in water body (river or lake) [m3]
[in,out]concwwater body (river or lake) concentration
[out]fpdepthflood plain water depth [m]
[out]fpdegreeflood plain degree of flood [%]
[out]interflowflow from waterbody to floodplain [m3/timestep] (can be negative)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculate_waterice_heatflow()

subroutine surfacewater_processes::calculate_waterice_heatflow ( real, intent(in)  vel,
real, intent(in)  hw,
real, intent(in)  Tw,
real, intent(in)  Tm,
real, intent(in)  Cwi,
real, intent(in)  qhmin,
real, intent(in)  qhmax,
real, intent(out)  qhw 
)

Subroutine to calculate heat flow from water to ice.

Parameters
[in]velriver velocity (m/s)
[in]hwwater depth (m)
[in]twwater temperature (C)
[in]tmriver freezing temperature (C)
[in]cwiheat exchange coefficient (suggested values 1622 W/s^0.8/C^2.6)
[in]qhminminimum heat flow (W/m2/s)
[in]qhmaxmaximum heat flow (W/m2/s)
[out]qhwheat flow (MJ/m2/timestep)
+ Here is the caller graph for this function:

◆ calculate_watersurface_heatbalance()

subroutine surfacewater_processes::calculate_watersurface_heatbalance ( real, intent(in)  airtemp,
real, intent(in)  swrad,
real, intent(inout)  watertemp,
real, intent(in)  watervol,
real, intent(in)  waterarea,
real, intent(in)  tempcoef,
real, intent(in)  radcoef,
real, intent(in)  constcoef,
real, intent(in)  lincoef,
real, intent(in)  limt2exch,
real, intent(out)  freezeuparea,
real, intent(in)  freezingpoint,
real, intent(in)  stabpar1,
real, intent(in)  stabpar2,
real, intent(in)  stabpar3 
)

Subroutine to calculate transfer of heat from air to water including a solar radiation term and a residual term.

The routine is based on the model sugested by Piccolroaz et al (2013), with modifications to use real (or estimated) shortwave radiation. Partly ice covered situations can be taken into account by reducing the input waterarea If the heat balance is negative enough to lower temperature below freezing, a reduction in the surface area is estimated, which shows at how large area the ice is forming. Works for sub-daily timestep by taking a timestep length fraction of the (daily) heat transfer equations

Parameters
[in]airtempair temperature (deg Celsius)
[in]swradshortwave radiation (MJ/m2/ts)
[in,out]watertempwater temperature (deg Celsius)
[in]watervolwater volume (m3)
[in]waterareawater surface area (m2)
[in]tempcoefheat transfer parameter from air to water (J/m2/s/deg)
[in]radcoefheat transfer parameter from radiation to water (fraction, 0-1)
[in]constcoefheat transfer parameter, constant residual term (J/m2/s)
[in]lincoefheat transfer parameter, linear residualterm (J/m2/s/deg)
[in]limt2exchheat transfer parameter, limit depth for only temperature exchange (m)
[out]freezeupareafractional area were ice formation is trigered (fraction, 0-1)
[in]freezingpointfreezingpoint temperature, deg C
[in]stabpar1Stability parameter, affects both heating and cooling. No correction if set to zero
[in]stabpar2Stability parameter, affects cooling. No correction if set to zero
[in]stabpar3Stability parameter, affects heating. No correction if set to zero

Algorithm

Calculate stability correction for heat exchange between air and water

Add the air temperature term

Add the radiation term, MJ/m2/ts => J/m2/ts

Add the residual term, same units as temperature equation

Evaluate ice formation conditions (new temperature<freezing point) and calculate new water temperature

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

◆ change_current_dam_status()

subroutine, public surfacewater_processes::change_current_dam_status ( integer, intent(in)  i)

Subroutine for finding changed lake/dam status, and apply it to lake parameters.

Parameters
[in]iindex of current subbasin
+ Here is the caller graph for this function:

◆ get_current_lake_outflow_parameters()

subroutine surfacewater_processes::get_current_lake_outflow_parameters ( integer, intent(in)  i,
integer, intent(in)  ioutlet,
real, intent(in)  lakeareain,
real, intent(in)  olakewst,
logical, intent(out)  have2outlets,
real, intent(out)  ratck,
real, intent(out)  ratcexp,
real, intent(out)  w0Today,
real, intent(out)  wmin,
real, intent(out)  damProd,
real, intent(out)  maxProd,
real, intent(out)  minProd,
real, intent(out)  out2ratck,
real, intent(out)  out2ratcexp,
real, intent(out)  out2w0Today,
real, intent(out)  out2wmin,
real, intent(out)  out2damProd,
real, intent(out)  out2maxProd,
real, intent(out)  out2minProd,
real, intent(in), optional  qin 
)

Subroutine for finding current lake outflow parameters.

Parameters
[in]iindex of current subbasin
[in]ioutletindex of outlet for elake
[in]lakeareainlakearea (m2) (from GeoData)
[in]olakewstoutlet lake water stage (m)
[out]have2outletsLake with two outlets?
[out]ratckcurrent rating curve parameter rate
[out]ratcexpcurrent rating curve parameter exponent
[out]w0todaycurrent water level threshold in w-reference system (m)
[out]wminminimum water level threshold (s�nkningsgr�ns) (m)
[out]damprodcurrent dam production flow (m3/s)
[out]maxprod(current) maximum production flow (m3/s)
[out]minprod(current) minimum flow (m3/s)
[out]out2ratckcurrent rating curve parameter rate of outlet 2
[out]out2ratcexpcurrent rating curve parameter exponent of outlet 2
[out]out2w0todaycurrent water level threshold in w-reference system (m) of outlet 2
[out]out2wminminimum water level threshold (s�nkningsgr�ns) (m) of outlet 2
[out]out2damprodcurrent dam production flow (m3/s) of outlet 2
[out]out2maxprod(current) maximum production flow (m3/s) of outlet 2
[out]out2minprod(current) minimum flow (m3/s) of outlet 2
[in]qincurrent net inflow to lake (m3/s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_production_flow()

subroutine surfacewater_processes::get_current_production_flow ( integer, intent(in)  current_lake,
integer, intent(in)  current_elake,
integer, intent(in)  current_dam,
integer, intent(in)  current_outlet,
real, intent(in)  wlmr,
real, intent(out)  prodflow 
)

Subroutine for finding current production flow.

Parameters
[in]current_lakeindex of slake for current lake
[in]current_elakeindex of elake for current lake
[in]current_damindex in dam for current dam
[in]current_outletindex of outlet of current elake
[in]wlmroutlet lake water stage (m)
[out]prodflowcurrent production flow (m3/s)
+ Here is the caller graph for this function:

◆ get_current_rating_parameters()

subroutine surfacewater_processes::get_current_rating_parameters ( integer, intent(in)  i,
integer, intent(in)  current_lake,
integer, intent(in)  current_elake,
integer, intent(in)  current_dam,
integer, intent(in)  current_outlet,
real, intent(out)  ratck,
real, intent(out)  ratcexp 
)

Subroutine for finding current rating curve parameters for outlet lake.

Parameters
[in]iindex of current subbasin
[in]current_lakeindex of lake for current lake in slake
[in]current_elakeindex of lake for current lake in elake
[in]current_damindex in dam for current dam in damdata
[in]current_outletindex of outlet of current lake
[out]ratckcurrent rating curve parameter rate
[out]ratcexpcurrent rating curve parameter exponent
+ Here is the caller graph for this function:

◆ get_index_of_highest()

integer function surfacewater_processes::get_index_of_highest ( real, intent(in)  value1,
real, intent(in)  value2 
)
private

Find highest value of two.

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

◆ get_index_of_lowest()

integer function surfacewater_processes::get_index_of_lowest ( real, intent(in)  value1,
real, intent(in)  value2 
)
private

Find lowest value of two.

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

◆ get_matching_index()

integer function surfacewater_processes::get_matching_index ( real, intent(in)  value1,
real, intent(in)  value2,
real, intent(in)  currentvalue 
)
private

Find matching value of two.

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

◆ get_rivertempvol()

subroutine, public surfacewater_processes::get_rivertempvol ( integer, intent(in)  i,
integer, intent(in)  pooltype,
type(riverstatetype), intent(in)  riverstate,
real, intent(out)  meanrivertemp,
real, intent(out)  totrivervol 
)

Calculate total volume and mean T2 temperature concentration in river.

Parameters
[in]isubbasin index
[in]pooltyperiver type (local or main)
[in]riverstateRiver state
[out]meanrivertemptemperature of river water
[out]totrivervolvolume of river water
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_wetland_threshold()

real function, public surfacewater_processes::get_wetland_threshold ( integer, intent(in)  j)

Threshold for wetland with regulated flow is set from class or parameters.

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

◆ ice_on_river()

logical function, public surfacewater_processes::ice_on_river ( integer, intent(in)  itype,
integer, intent(in)  i,
type(snowicestatetype), intent(inout)  frozenstate 
)

Check if there is ice on the river.

Parameters
[in]itypetype of river; 1=local, 2=main
[in]isubbasin
[in,out]frozenstateSnow and ice states
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ice_processes_in_lake()

subroutine, public surfacewater_processes::ice_processes_in_lake ( integer, intent(in)  i,
integer, intent(in)  itype,
integer, intent(in)  iluse,
real, intent(in)  snowfall,
real, intent(in)  temp,
real, intent(in)  wind,
real, dimension(2), intent(inout)  lakesurftemp,
real, intent(in)  swrad,
type(snowicestatetype), intent(inout)  frozenstate,
type(lakestatetype), intent(inout)  lakestate,
integer, intent(in)  freezeupday,
integer, intent(out)  breakupday,
real, intent(in)  hypodepth,
real, intent(in)  freezeuparea 
)

Calculate lake ice processes.

Parameters
[in]iindex of subbasin
[in]itypeindex of lake/river type
[in]iluseindex of landuse
[in]tempair temp
[in]windwind speed (m/s)
[in,out]lakesurftempwater surface temperature (IN: open water, OUT: average for lake surface)
[in]swradshortwave radiation (MJ/m2/ts)
[in,out]frozenstateSnow and ice states
[in,out]lakestateLake state
[in]freezeupdaystatus freeze-up this time step
[out]breakupdaystatus ice break-up this time step
[in]hypodepthhypolimnion depth (m)
[in]freezeupareafractional water surface area with newice formation, given by temperature routine
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ice_processes_in_river()

subroutine, public surfacewater_processes::ice_processes_in_river ( integer, intent(in)  i,
integer, intent(in)  itype,
integer, intent(in)  iluse,
real, intent(in)  snowfall,
real, intent(in)  temp,
real, intent(in)  wind,
real, dimension(2), intent(inout)  riversurftemp,
real, intent(in)  riverarea,
real, intent(in)  swrad,
type(snowicestatetype), intent(inout)  frozenstate,
type(riverstatetype), intent(inout)  riverstate,
integer, intent(in)  freezeupday,
integer, intent(out)  breakupday,
real, intent(in)  freezeuparea 
)

Calculate ice processes in rivers.

Parameters
[in]iindex of subbasin
[in]itypeindex of lake/river type
[in]iluseindex of landuse
[in]tempair temperature
[in]windwind speed (m/s)
[in,out]riversurftempwater surface temperature
[in]riverareariver area, m2
[in]swradshortwave radiation (MJ/m2/ts)
[in,out]frozenstateSnow and ice states
[in,out]riverstateRiver states
[in]freezeupdaystatus freeze-up day
[out]breakupdaystatus ice break-up day
[in]freezeupareafraction of river area with newice formation (calculated by surface heat balance function)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initiate_lakeriverice()

subroutine, public surfacewater_processes::initiate_lakeriverice

Initialise lake and river ice model.

+ Here is the caller graph for this function:

◆ lake_epilimnion_depth()

real function surfacewater_processes::lake_epilimnion_depth ( real, intent(in)  lakearea)

Calculate lake typical epilimnion depth.

Reference Hanna (1990) Evaluation of models predicting mixing depth. Can. J. Fish. Aquat. Sci. 47:940-947.

Parameters
[in]lakearealake area (m2)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ local_water_level()

real function, public surfacewater_processes::local_water_level ( integer, intent(in)  itype,
integer, intent(in)  i,
real, intent(in)  wlm 
)

River water level in local reference system calculated from the river water level in reference system used by model set up (e.g. masl.) wl_local = (wl_meter - gaugezero)*height unit transformation Parameters given by RiverRatingCurveData.txt.

Parameters
[in]itypetype of river; 1=local, 2=main
[in]isubbasin
[in]wlmriver water level in reference system (m)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ point_abstraction_from_aquifer()

subroutine, public surfacewater_processes::point_abstraction_from_aquifer ( type(aquiferstatetype), intent(inout)  aquiferstate,
real, dimension(naquifers), intent(out)  removedflow 
)

Abstraction of water from aquifer.

Reference ModelDescription Chapter Water management (Point sources - Negative point source)

Parameters
[in,out]aquiferstateAquifer states
[out]removedflowremoved flow (m3/timestep)

Algoritm

Constant abstraction from aquifer below subbasin

  • Sum up all abstractions from the same aquifer

Timeseries abstraction from aquifer

  • Sum up all abstractions from the same aquifer
  • Remove abstraction water from each aquifer (m3)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ point_abstraction_from_main_river()

subroutine, public surfacewater_processes::point_abstraction_from_main_river ( integer, intent(in)  i,
integer, intent(in)  pooltype,
type(riverstatetype), intent(inout)  riverstate,
real, intent(inout)  flow,
real, intent(out)  dampflow 
)

Abstraction of water from main river. Abstraction is taken from main river volume and queue after inflow from local and upstream rivers.

Reference ModelDescription Chapter Water management (Point sources - Negative point source)

Parameters
[in]iindex of current subbasin
[in]pooltyperiver type (local or main)
[in,out]riverstateriver states
[in,out]flowremoved flow (m3/timestep)
[out]dampflowremoved flow from riverboxi (m3/timestep)

Algoritm

Check if abstraction of water

Calculate volume fractions of river water compartments

Calculate volume of water to be abstracted

Remove abstraction water proportionally from river and queue

Calculate volume fractions of river water compartments

If abstraction of water: Calculate amount

Remove abstraction water proportionally from river and queue

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

◆ point_abstraction_from_main_river_inflow()

subroutine, public surfacewater_processes::point_abstraction_from_main_river_inflow ( integer, intent(in)  i,
integer, intent(in)  pooltype,
real, intent(inout)  q,
type(riverstatetype), intent(inout)  riverstate,
real, intent(inout)  flow 
)

Abstraction of water from main river inflow and river Abstraction is taken from main river (before adding current inflow) and local and upstream river inflow.

Reference ModelDescription Chapter Water management (Point sources - Negative point source)

Parameters
[in]iindex of current subbasin
[in]pooltyperiver type (local or main)
[in,out]qinflow (m3/s)
[in,out]riverstateriver states
[in,out]flowremoved flow (m3/timestep)

Algoritm

Calculate volume fractions of river water compartments

If abstraction of water: Calculate amount

Remove abstraction water proportionally from river and queue

Calculate volume fractions of river water compartments

If abstraction of water: Calculate amount

Remove abstraction water proportionally from river and queue

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

◆ point_abstraction_from_outlet_lake()

subroutine, public surfacewater_processes::point_abstraction_from_outlet_lake ( integer, intent(in)  i,
integer, intent(in)  pooltype,
real, intent(in)  qunitfactor,
type(lakestatetype), intent(inout)  lakestate,
real, intent(out)  removedflow 
)

Abstraction of water from outlet lake.

Reference ModelDescription Chapter Water management (Point sources - Negative point source)

Parameters
[in]iindex of current subbasin
[in]pooltypelake type (local or outlet)
[in]qunitfactortransformation factor m3/s->mm/timestep
[in,out]lakestateLake states
[out]removedflowremoved flow (m3/timestep)

Algoritm

If abstraction of water: Calculate amount

Remove abstraction water proportionally from fast and slow lake part

If abstraction of water: Calculate amount

Remove abstraction water proportionally from fast and slow lake part

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

◆ recalculate_branched_flow()

subroutine, public surfacewater_processes::recalculate_branched_flow ( integer, intent(in)  i,
real, intent(in)  totflow,
real, intent(in)  maxProdin,
real, intent(in)  minflowin,
real, intent(inout)  mainflow,
real, intent(inout)  branchflow 
)

Recalculate subbasin outlet flow division into main channel and branch if total flow has changed.

Reference ModelDescription Chapter Rivers and lakes (Basic assumptions, Rivers - Main river)

Parameters
[in]iindex of current subbasin
[in]totflowoutflow of subbasin (updated)
[in]maxprodintemporary maximum production flow for recalculating flow
[in]minflowincurrent minimum flow for recalculating flow
[in,out]mainflowflow in main channel
[in,out]branchflowflow in branch

Algorithm
Check for changed total flow, otherwise keep main- and branchflow

Check for branch existance, otherwise set new mainflow

Set current parameter values for two outlet lake

Recalculate main and branched flow for lake/dam with two outlets

or from BranchData fractions.

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

◆ recalculate_branched_flow_two_outlets()

subroutine surfacewater_processes::recalculate_branched_flow_two_outlets ( integer, intent(in)  cmethod,
real, intent(in)  totflow,
real, intent(in)  maxQprod,
real, intent(in)  maxQprod2,
real, intent(in)  minflow1,
real, intent(in)  minflow2,
real, intent(inout)  simflow1,
real, intent(inout)  simflow2 
)

Recalculate two outlet lake outflow division after total outflow has been changed.

Reference ModelDescription Chapter Rivers and lakes (Basic assumptions, Rivers - Main river)

Parameters
[in]cmethodcode for change flow method
[in]totflowoutflow of subbasin (updated)
[in]maxqprodmaximum production flow, outlet 1
[in]maxqprod2maximum production flow, outlet 2
[in]minflow1minimum flow, outlet 1
[in]minflow2minimum flow, outlet 2
[in,out]simflow1outflow of outlet 1
[in,out]simflow2outflow of outlet 2

Algorithm
Simple case; new flow is zero

Initialisation Set current parameter values

Recalculate main and branched flow for lake/dam with two outlets

  • Hydropower plant with production flow and spill in different branches: check for maximum/current production flow
  • Minimum flow together with production flow and spill in different branches
  • Other outflow division: keep relation between flow in the different branches
+ Here is the caller graph for this function:

◆ remove_outflow_from_lake()

subroutine, public surfacewater_processes::remove_outflow_from_lake ( integer, intent(in)  i,
integer, intent(in)  itype,
integer, intent(in)  ns,
real, intent(in)  outflowmm,
integer, intent(in)  subid,
real, intent(in)  ldepthm,
real, intent(in)  hypodepth,
real, intent(in)  lakewstmm,
real, dimension(ns), intent(out)  coutflow,
type(lakestatetype), intent(inout)  lakestate 
)

Removal of outflow from lake and setting of concentration of outflow.

Reference ModelDescription Chapter Rivers and lakes (Basic assumptions)

Parameters
[in]iindex of current subbasin
[in]itypelake type (local or main)
[in]nsnumber of substances
[in]outflowmmoutflow of lake (mm/timestep)
[in]subidsubid of current subbasin, for error output
[in]ldepthmlake depth (m)
[in]hypodepthlake hypolimnion depth (m)
[in]lakewstmmlake water stage (mm)
[out]coutflowconcentration of outflow of lake
[in,out]lakestateLake state

Algorithm
Preparations: default values

Preparations: T2-simulation with special outflow temperature of outlet lakes

Remove outflow and set outflow concentrations:

  • Outflow is removed from lake
+ Here is the caller graph for this function:

◆ river_water_level()

real function, public surfacewater_processes::river_water_level ( integer, intent(in)  itype,
integer, intent(in)  i,
real, intent(in)  q,
logical, intent(in)  ice,
type(snowicestatetype), intent(in)  frozenstate 
)

River water level calculated from inverse function of a rating curve. q=k*(w-w0)**p -> w=a*q**b+w0, a=(1/k)**b, b=1/p Parameters given by RiverRatingCurveData.txt. Water level is measures in meter in the reference system used for w0ref.

Parameters
[in]itypetype of river; 1=local, 2=main
[in]isubbasin
[in]qriver flow (m3/s)
[in]icestatus of ice on river
[in]frozenstateSnow and ice states
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ riverice_riverwater_interaction()

subroutine surfacewater_processes::riverice_riverwater_interaction ( integer, intent(in)  i,
integer, intent(in)  itype,
type(riverstatetype), intent(inout)  riverstate,
type(snowicestatetype), intent(inout)  frozenstate,
real, intent(in)  riverarea,
integer, intent(inout)  breakupday,
real, intent(in)  driverwidt 
)

Calculate interaction between river water and river ice.

Parameters
[in]icurrent subbasin index
[in]ityperiver type
[in,out]riverstateRiver state
[in,out]frozenstateSnow and ice states
[in]riverareariver area (m2)
[in,out]breakupdaystatus of river ice break up
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_general_rating_k()

subroutine, public surfacewater_processes::set_general_rating_k ( integer, intent(in)  nl,
integer, intent(in)  n,
real, dimension(n), intent(in)  locarea,
real, dimension(n), intent(in)  areasum,
real, dimension(nl,n), intent(out)  rating 
)

Subroutine for calculation of general rating curve k-value for each lake.

Parameters
[in]nlnumber of lake types
[in]nnumber of subbasins
[in]locarealandarea of subbasin [m2] !TODO: here should land+iwt+lriver be used
[in]areasumupstream area [m2] !TODO: here olake area should not be
[out]ratingk-value of rating curve
+ Here is the caller graph for this function:

◆ set_lake_outlets()

subroutine, public surfacewater_processes::set_lake_outlets

Find information about how to calculate subbasin outlet flows and flow division into main channel and branch.

Consequences Module hypevariable structure lakeoutlet will be allocated and set

Algorithm
Initialisation; check and allocate

Find lake outlet type, outlet 1

Find lake outlet type, outlet 2

Set method for changing flow (after updating totalflow).

+ Here is the caller graph for this function:

◆ set_rivertemp()

subroutine surfacewater_processes::set_rivertemp ( integer, intent(in)  i,
integer, intent(in)  pooltype,
type(riverstatetype), intent(inout)  riverstate,
real, intent(in)  meanrivertemp 
)

Set a T2 temperature concentration to all river elements.

Parameters
[in]isubbasin index
[in]pooltyperiver type (local or main)
[in,out]riverstateRiver state
[in]meanrivertemptemperature of river
+ Here is the caller graph for this function:

◆ set_water_temperature()

subroutine, public surfacewater_processes::set_water_temperature ( integer, intent(in)  waterbody,
integer, intent(in)  i,
type(riverstatetype), intent(inout)  riverstate,
type(lakestatetype), intent(inout)  lakestate 
)

Set temperature of rivers and lakes from T2 and calculate other temperature variables.

These calculations is for modeloption swtemperature 1. River and lake temperature is set to calculated T2 temperature of each water body. Also 10- and 20-day moving average of lake- and river temperature is calculated for determining rising or decreasing temperature (season).

Parameters
[in]waterbodyflag for waterbody, 1=lstream,2=ilake,3=main river,4=olake
[in]iindex of current subbasin
[in,out]riverstateRiver states
[in,out]lakestateLake states

Algorithm
Set river temperature to T2 temperature

Set lake temperature (if exist)

Calculate 10- and 20-day mean of water temperature for N,P,C,S or Si processes

+ Here is the caller graph for this function:

◆ small_depression_contrib_frac()

real function surfacewater_processes::small_depression_contrib_frac ( real, intent(in)  current_contrib_frac,
real, intent(in)  current_depth,
real, intent(in)  delta_depth,
real, intent(in)  max_depth 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ small_depression_water_frac_area()

real function surfacewater_processes::small_depression_water_frac_area ( real, intent(in)  vol_frac,
real, optional  mult,
real, optional  power 
)
private
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ small_depressions_delta_water()

subroutine surfacewater_processes::small_depressions_delta_water ( real  current_depth,
real  delta_depth,
real  runoff_depth,
real  contrib_frac,
real  max_depth,
real  max_water_area_frac,
real  area_mult,
real  area_power,
real  vol_frac,
real  area_frac,
real  depth,
real  outflow_depth,
real  connectivity 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ t2_processes_in_lake()

subroutine, public surfacewater_processes::t2_processes_in_lake ( integer, intent(in)  i,
integer, intent(in)  itype,
real, intent(in)  temp,
real, intent(in)  swrad,
real, dimension(2), intent(inout)  lakesurft,
real, intent(in)  lakearea,
real, intent(in)  hypodepth,
type(snowicestatetype), intent(in)  frozenstate,
type(lakestatetype), intent(inout)  lakestate,
integer, intent(out)  freezeup,
real, intent(out)  freezeuparea 
)

Calculate lake T2 temperature processes.

Parameters
[in]iindex of subbasin
[in]itypeindex of lake type (ilake = 1, olake = 2)
[in]tempair temp
[in]swradshortwave radiation, (MJ/m2/ts)
[in,out]lakesurftwater surface temperature (for icefree conditions)
[in]lakearealake area (m2)
[in]hypodepthhypolimnion depth (m)
[in]frozenstateSnow and ice states
[in,out]lakestateLake state
[out]freezeupis water cooling below freezing point (1 yes, 0 no)?
[out]freezeupareafraction of lake area with newice formation
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ t2_processes_in_river()

subroutine, public surfacewater_processes::t2_processes_in_river ( integer, intent(in)  i,
integer, intent(in)  itype,
real, intent(in)  temp,
real, intent(in)  swrad,
real, dimension(2), intent(inout)  riversurft,
real, intent(in)  riverarea,
type(snowicestatetype), intent(in)  frozenstate,
type(riverstatetype), intent(inout)  riverstate,
integer, intent(out)  freezeupday,
real, intent(inout)  freezeuparea 
)

Calculate temperature(T2) processes in rivers.

Parameters
[in]iindex of subbasin
[in]itypeindex of river type (local = 1, main = 2)
[in]tempair temperature
[in]swradsolar radiation (MJ/m2/ts)
[in,out]riversurftwater surface temperature
[in]riverareariver area (m2)
[in]frozenstateSnow and ice states
[in,out]riverstateRiver states
[in,out]freezeupareafraction of riverarea with newice formation
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ t2_processes_in_wetland()

subroutine surfacewater_processes::t2_processes_in_wetland ( integer, intent(in)  i,
integer, intent(in)  j,
real, intent(in)  temp,
real, intent(in)  swrad,
real, intent(in)  classarea,
type(soilstatetype), intent(inout)  soilstate 
)

Calculate temperature(T2) processes in wetlands.

Parameters
[in]iindex of subbasin
[in]jindex of class
[in]tempair temperature
[in]swradsolar radiation (MJ/m2/ts)
[in]classareawetland area (m2)
[in,out]soilstateSoil states
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translation_in_river()

subroutine, public surfacewater_processes::translation_in_river ( integer, intent(in)  i,
integer, intent(in)  itype,
real, intent(in)  qin,
real, dimension(numsubstances), intent(in)  cin,
real, intent(out)  qout,
real, dimension(numsubstances), intent(out)  cout,
type(riverstatetype), intent(inout)  riverstate 
)

Translation (delay) in river

Reference ModelDescription Chapter Rivers and lakes (Rivers - Common river processes)

Parameters
[in]iindex of current subbasin
[in]ityperiver type (local or main)
[in]qininflow to river train (m3/s)
[in]cinconcentration of inflow to river train
[out]qoutoutflow of river train (m3/s)
[out]coutconcentration of outflow of river train
[in,out]riverstateRiver states

Algoritm
Add new inflow to translation variable (river train)

Calculate outflow from river train

Translate the flows in the river train

+ Here is the caller graph for this function:

◆ update_qbank()

subroutine surfacewater_processes::update_qbank ( real, dimension(366), intent(in)  q_array,
real, intent(out)  qmax,
real, intent(out)  q2,
integer, intent(out)  imax,
integer, intent(out)  i2 
)

Update highest and second highest flow when one of them reach retiring age.

Parameters
[in]q_arrayflow all days last year
[out]qmaxhighest flow all days last year
[out]q2second highest flow all days last year
[out]imaxindex of highest flow all days last year
[out]i2index of second highest flow all days last year
+ Here is the caller graph for this function:

◆ water_transfer_from_outlet_lake()

subroutine, public surfacewater_processes::water_transfer_from_outlet_lake ( integer, intent(in)  i,
integer, intent(in)  pooltype,
real, intent(in)  qunitfactor,
type(miscstatetype), intent(inout)  miscstate,
type(lakestatetype), intent(inout)  lakestate,
real, intent(out)  removedflow 
)

Abstraction of water from outlet lake for transfer to other subbasin.

Reference ModelDescription Chapter Water management (Water transfer)

Parameters
[in]iindex of current subbasin
[in]pooltypelake type (local or outlet)
[in]qunitfactortransformation factor m3/s->mm/timestep
[in,out]miscstatemiscellaneous states
[in,out]lakestateLake states
[out]removedflowremoved flow (m3/timestep)

Algoritm

If abstraction of water: Calculate amount

Remove transfer water from lake

Save abstracted water for next timestep

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

◆ wetland_watermodel()

subroutine, public surfacewater_processes::wetland_watermodel ( integer, intent(in)  i,
integer, intent(in)  j,
integer, intent(in)  isoil,
integer, intent(in)  subid,
real, intent(in)  classarea,
real, intent(in)  temp,
real, intent(in)  swrad,
type(soilstatetype), intent(inout)  soilstate,
type(miscstatetype), intent(inout)  miscstate,
real, intent(in)  prev_inflow,
real, intent(in)  inflow,
real, dimension(numsubstances), intent(in)  cinflow,
real, intent(in)  catcharea,
real, intent(out)  outflow,
real, dimension(numsubstances), intent(out)  coutflow 
)

Wetland model for the standing water, including inflow and outflow.

Parameters
[in]iindex for current subbasin
[in]jindex for current class
[in]isoilindex of soil type
[in]subidsubbasin id
[in]classareaclass area [m2]
[in]tempclass forcing air temperature
[in]swradclass forcing solar radiation (MJ/m2/ts)
[in,out]soilstateSoil states
[in,out]miscstateMisc states
[in]prev_inflowinflow to wetland already added (eg. P-E) (m3/s)
[in]inflowinflow to wetland from catchment (m3/s)
[in]cinflowconcentration of inflow (mg/L)
[in]catchareacatchment area of wetland (m2)
[out]outflowoutflow from wetland (m3/s)
[out]coutflowconcentration of outflow (mg/L)

Algorithm
Set output default values

Add inflow

Percolation down through the soil layers, including N,P,OC-reduction (safe for more than one soillayer)

NP processes in wetland

T2 processes in wetland; heat exchange (no ice modelled)

Calculate wetland outflow from standing water of uppermost soil layer

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

Variable Documentation

◆ errstring

character(len=46), dimension(12) surfacewater_processes::errstring
private