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 |
Lake and river water related subroutines in HYPE.
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.
[in] | i | index of subbasin |
[in] | pooltype | type: 1=mriver, 2=olake |
[in] | area | flooded area (m2) |
[in] | prec | precipitation (mm/timestep) |
[in] | cprec | concentration of precipitation |
[in,out] | miscstate | Floodplain state |
[out] | load | load of precipitation |
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.
[in] | i | index of subbasin |
[in] | pooltype | rivertype: 1=lriver, 2=mriver |
[in] | area | river area (m2) |
[in] | prec | precipitation (mm/timestep) |
[in] | cprec | concentration of precipitation |
[out] | dampadd | precipitation added to riverboxi |
[in,out] | riverstate | River 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
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)
[in] | i | index of subbasin |
[in,out] | qin | flow into main river (m3/s) |
[in,out] | cin | concentration of flow into main river (mg/L) |
[in] | watertransfer | water transfer flow into main river (m3/s) |
[in] | ctransfer | concentration of water transfer (mg/L) |
[out] | addedflow | added flow (m3/timestep) |
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.
[in] | i | index of current subbasin |
[in] | current_lake | index of lake for current lake |
[in] | current_elake | index of lake for current lake |
[in] | current_outlet | index of outlet of current lake |
[in,out] | w0 | current threshold (m) |
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.
[in] | current_lake | index of lake for current single lake |
[in] | current_elake | index of lake for current multibasin lake |
[in] | current_dam | index in dam for current dam |
[in] | current_outlet | index of outlet in current elake |
[in] | prodflow | current production flow (m3/s) |
[in] | qampin | amplitude of seasonal variation to be used instead of parameter value |
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)
[in] | qin | inflow (m3/s) |
[in] | l_area | lake area (m2) |
[in] | wst | current water level above threshold (m) |
[in] | k | rating curve coefficient (-) |
[in] | p | rating curve exponent (-) |
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)
[in] | flow | flow current time step (m3/s) |
[in] | i | index of current subbasin |
[in] | itype | river type 1=local, 2=main |
[in,out] | riverq365 | river flow last 365 days (m3/s) |
[in,out] | qdayacc | river flow last day (m3/s) |
[out] | qbank | bankfull flow |
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)
[in] | i | subbasin index |
[in] | j | class index |
[in] | itype | lake type (ilake or olake) |
[in] | numsubst | number of substances modelled |
[in] | temp | air temperature |
[in] | rh | relative humuidity (-) |
[in] | cprec | concentration in precipitation |
[in] | epot | potential evapotranspiration (mm/timestep) (reduced for partly ice covered lake) |
[out] | evap | actual evapotranspiration (mm/timestep) |
[out] | cevap | concentration in evapotranspiration (eg. mg/L) |
[in,out] | lakestate | Lake 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
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)
[in] | i | index of current subbasin |
[in] | totflow | outflow of subbasin |
[out] | mainflow | flow in main channel |
[out] | branchflow | flow 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
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.
[in] | volume | water volume in floodplain [m3] |
[in] | amax | area at maximum areal extent [m2] |
[in] | ymax | water level at maximum areal extent [m] |
[in] | href | reference height of floodplain bottom [m] |
[out] | hwleq | equilibrium water level (in href system) [m] |
|
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.
[in] | ifrom | index of floodplain which has the highest water level, from which flow should leave, flowdirection |
[in] | iabove | index of floodplain which reach its maximum extent |
[in] | ibelow | index of floodplain which not reach its maximum extent |
[in] | volume | water volume in floodplain [m3] |
[in] | level | water level in ref system [m] |
[in] | amax | area at maximum areal extent [m2] |
[in] | ymax | water level at maximum areal extent [m] (not in href system) |
[in] | href | reference height of floodplain bottom [m] |
[out] | hwleq | equilibrium water level (in href system) [m] |
|
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.
[in] | volume | water volume in floodplain [m3] |
[in] | amax | area at maximum areal extent [m2] |
[in] | ymax | water level at maximum areal extent [m] |
[in] | href | reference height of floodplain bottom [m] |
[out] | hwleq | equilibrium water level (in href system) [m] |
|
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.
[in] | volp | water volume in floodplain [m3] |
[in] | volr | water volume in river (or lake) [m3] |
[in] | flr | flooding level for the river (or lake) [m] |
[in] | flp | flooding level for the floodplain [m] |
[in] | ar | area of the river (or lake) [m2] |
[in] | amax | area at maximum areal extent [m2] |
[in] | ymax | water level at maximum areal extent [m] |
[out] | yeq | equilibrium water level [m] |
[out] | r2p | flow direction flag, 1=river2plain, 2=plain2river,0=no flow |
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.
[in] | i | subbasin index |
[in] | j | class index |
[in] | pooltype | type 1= main river, 2=olake |
[in] | numsubst | number of substances modelled |
[in] | area | floodplain area (m2) |
[in] | temp | air temperature |
[in] | rh | relative humuidity (-) |
[in] | cprec | concentration in precipitation |
[in] | epot | potential evapotranspiration (mm/timestep) |
[out] | evap | actual evapotranspiration (mm/timestep) |
[out] | cevap | concentration in evapotranspiration (eg. mg/L) |
[in,out] | miscstate | Floodplain state |
|
private |
Calculate water volume and flooded area from water level for a sloping floodplain.
[in] | y | water level [m] |
[in] | ymax | water level at maximum areal extent [m] |
[in] | amax | area at maximum areal extent [m2] |
[out] | vol | water volume in floodplain [m3] |
[out] | a | calculated area [m2] |
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.
[in] | vol | water volume in floodplain [m3] |
[in] | amax | area at maximum areal extent [m2] |
[in] | ymax | water level at maximum areal extent [m] |
[out] | y | calculated water level at volume volm3 [m] |
[out] | a | calculated area [m2] |
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.
[in] | i | index of current subbasin |
[in] | ioutlet | index of outlet with main outflow which flow will be affected |
[in] | lakeareain | lakearea (m2) |
[in] | lakewstmm | lake water stage (mm) |
[out] | outflowm3s | outflow of lake (m3/s) |
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.
[in] | i | subbasin index |
[in] | pooltype | river type (local or main) |
[in] | area | river area (m2) |
[in] | riverstate | River state |
[out] | fracarea | fractional river area (-) |
[out] | effdepth | effective 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
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.
[in] | i | index of current subbasin |
[in] | subid | subid of current subbasin |
[in] | ns | number of substances |
[in] | qin | lateral inflow (runoff from upland) of lake (m3/s) - river discharge and point sources - distributed by icatch |
[in] | pein | vertical inflow of lake (m3/s) - precipitation and evaporation - distributed by lake area |
[in] | lakearea | lakearea (m2) |
[in] | basinarea | catchment area of prairie depressions (m2) |
[in] | qunitfactor | factor for transforming flow for lake from m3/s to mm/timestep and back based on lakearea |
[out] | outflowm3s | outflow of lake (m3/s) |
[out] | coutflow | concentration of outflow of lake |
[in,out] | load | load of outflow of lake (and other flows) |
[in,out] | volumeflow | volume outflow of lake (m3/ts) (and other flows) |
[out] | wst | lake water (mm) |
[in,out] | fnca | fraction of non-contributing area (per subbasin area) |
[in,out] | fcon | fraction of max water area connected (contributing to outflow) |
[in,out] | lakestate | Lake 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
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)
[in,out] | tsurf | lake 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] | iced | ice depth, cm (black ice + snowice) |
[in,out] | biced | black ice, cm |
[in,out] | icepor | ice porosity, fraction |
[in,out] | snowm | snowmass, mm |
[in,out] | snowd | snowdepth, cm |
[in] | tair | air temperature, C |
[out] | dlakewidt | transformation of lake ice to lake water (positive direction from ice to water) |
[out] | dsnowdt | transformation of snow to lake ice (positive direction from ice to snow) |
[in] | ifreezeup | freeze-up day flag (1=yes, 0=no) |
[out] | ibreakup | break-up day flag (1=yes, 0=no) |
[in] | tf | tf (~0.) , freezing point temperature of the lake/river water, �C |
[in] | kika | kika(~10.), ratio between thermal conductivity of ice and heat exchange coef in air |
[in] | kexp | kiks(~10.), as above but for snow, actually dependent on snow density, but we use a fixed value |
[in] | pm | pm (~0.5) , degree-day melt factor for ice, cm/�C |
[in] | ssmft | ssmfT (~0?), sub-surface melt fraction, fraction 0-1, air temperature driver melt |
[in] | ssmfr | ssmfR (~0.9?), sub-surface melt fraction, fraction 0-1, radiation driven melt |
[in] | bupo | bupo (~0.40?), breakup porosity, fraction 0-1 |
[in] | sw | sw, incoming shortwave radiation, MJ/m2/timestep |
[in] | rm | rm (?), radiation melt factor for ice, [-] = fraction of incoming radiation flux absorbed for ice melt (at air temperatures above 0C) |
[in] | qh | qh, heat flow from water, MJ/m2/timestep |
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.
[in] | i | index of current subbasin |
[in] | subid | subid of current subbasin |
[in] | ns | number of substances |
[in] | qin | inflow of lake (m3/s) |
[in] | lakearea | lakearea (m2) |
[in] | qunitfactor | factor for transforming flow for lake from m3/s to mm/timestep and back |
[out] | outflowm3s | outflow of lake (m3/s) |
[out] | coutflow | concentration of outflow of lake |
[in,out] | load | load of outflow of lake (and other flows) |
[in,out] | volumeflow | volume outflow of lake (m3/ts) (and other flows) |
[out] | wst | lake water (mm) |
[in,out] | lakestate | Lake state |
Algorithm
Calculate outflow from general rating curve
Check outflow against lake volume
Remove outflow from lake
Set output variables
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.
[in] | i | index of current subbasin |
[in] | subid | subid of current subbasin |
[in] | ns | number of substances |
[in] | qin | lateral inflow of lake (m3/s) - river discharge and point sources - distributed by icatch |
[in] | pein | vertical inflow of lake (m3/s) - precipitation and evaporation - distributed by lake area |
[in] | lakearea | lakearea (m2) |
[in] | qunitfactor | factor for transforming flow for lake from m3/s to mm/timestep and back |
[out] | outflowm3s | outflow of lake (m3/s) |
[out] | coutflow | concentration of outflow of lake |
[in,out] | load | load of outflow of lake (and other flows) |
[in,out] | volumeflow | volume outflow of lake (m3/ts) (and other flows) |
[out] | wst | lake water (mm) |
[out] | fnca | fraction of non-contributing area (per subbasin area) |
[out] | fcon | fraction of ilake connectivity (per ilake area) |
[in,out] | lakestate | Lake 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
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.
[in] | isub1 | index of subbasin 1 |
[in] | iflood1 | index of flooding for subbasin 1 |
[in] | tflood1 | type of water for subbasin 1 (1=main river, 2=outlet lake) |
[in] | volume1 | floodplain 1 water volume (m3) |
[in] | isub2 | index of subbasin 2 |
[in] | iflood2 | index of flooding for subbasin 2 |
[in] | tflood2 | type of water for subbasin 2 (1=main river, 2=outlet lake) |
[in] | volume2 | floodplain 2 water volume (m3) |
[out] | flow | wanted 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
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.
[in] | i | current subbasin |
[in,out] | lakestate | Lake states |
[out] | hypodepth | lake hypolimnion depth (m) |
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).
[in] | itype | lake type; ilake=1, olake=2 |
[in] | i | index of current subbasin |
[in] | dim | size of variable |
[in] | a | lake area (m2) |
[in] | lakewi | lake water stage (mm) |
[in,out] | lakebasinvol | volume of olake and ilake |
[in,out] | lakevol | volume of olake/volume for lake with basins in outlet basin |
[in,out] | lakevolsum | to sum lakebasins to outlet basin (big enough) |
Algoritm
Calculate lake volume for current lake
If outlet lake
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)
[in] | ilast | index of current subbasin (last lakebasin) |
[out] | lakearea | outlet lake area (of whole lakebasin lake) (m2) |
[out] | lakewst | outlet lake water stage (m) above threshold/local ref-system |
[out] | w0ref | level to be added for w-ref outlet lake water stage (m) |
[in] | lakestate | Lake 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")
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.
[in] | i | index of subbasin |
[in] | itype | index of lake type (ilake = 1, olake = 2) |
[in,out] | frozenstate | Snow and ice states |
[in,out] | lakestate | Lake state |
[in] | dlakewidt | previous surface melt water (mm?) |
[in] | hypodepth | hypolimnion depth (m) |
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).
[in] | nsub | Number of subbasins |
[out] | larea | Land area [m2] |
Algorithm
Calculate land area of subbasin
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.
[in,out] | outflow1 | outflow of first outlet (m3/s) |
[in,out] | outflow2 | outflow of second outlet (m3/s) |
[in] | maxqprod | maximum production (m3/s), second priority |
[in] | minflow2 | minimum flow (m3/s), first priority |
Redistribute flow for maximum production
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)
[in] | i | index of current subbasin |
[in] | lakewstadj | outlet lake water stage (above threshold) (m) (considering "real" amplitude of regulation volume) |
[out] | lakewst | outlet lake water stage readjusted for "real" amplitud to be "HYPE volume" (m) |
Algoritm
Get regulation amplitude adjustment factor
Calculate adjusted lake water stage
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)
[in] | i | index of current subbasin |
[in] | lakewatermm | outlet lake water content (mm) |
[out] | lakewst | outlet lake water stage above threshold (m) |
[out] | w0ref | level to be added for w-ref outlet lake water stage (m) |
Algoritm
Calculate lake water stage in local reference system
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.
[in] | i | index of current subbasin (last lakebasin) |
[in] | qin | net inflow of whole lake (m3/s) |
[in] | oldwholelakewst | lake wst above theshold (average of lake) |
[out] | outlb | status of subbasin with lakebasin with outflow of the lake (m3/s) |
[out] | outflowm3s | all outflow of lake (m3/s) |
[out] | outflow | outflow 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
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.
[in] | i | index of current subbasin |
[in] | qin | net inflow of lake (m3/s) |
[in] | lakearea | lakearea (m2) |
[in] | lakewstmm | lake water stage (mm) |
[in] | qunitfactor | factor for transforming flow for lake from m3/s to mm/timestep and back |
[out] | outflowm3s | outflow of lake (m3/s) |
[out] | outflowmm | outflow of lake (mm) |
[out] | outflow1 | outflow of first outlet (m3/s) or all outflow if not lake with 2 outlets in LD |
[out] | outflow2 | outflow of second outlet (m3/s) |
[out] | maxqprodout | temporary maximum production for updated flow (m3/s) |
[out] | minflowout | current 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 flow in main channel and in branch from BranchData fractions
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".
[in] | i | current subbasin |
[in] | ioutlet | lake outlet index |
[in] | qin | net inflow of lake (m3/s) |
[in] | qout | outflow from other outlets of this lake (m3/s) |
[in] | lakearea | lakearea (m2) |
[in] | wlmr | lake water stage (m) |
[in] | ratingc | rating curve coefficient |
[in] | ratinge | rating curve exponent |
[in] | w0today | upper threshold (m) |
[in] | wmin | lower threshold (m) |
[in] | damprod | current production flow (m3/s) |
[in] | minflow | minimum allowed flow (m3/s) |
[in] | maxflow | maximum allowed flow (m3/s) |
[in] | qunitfactor | factor for transforming flow for lake from m3/s to mm/timestep and back |
[out] | outflowm3s | current outflow of this outlet (m3/s) |
Outflow determination for one outlet 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".
[in] | i | current subbasin |
[in] | otype | outlet type as defined in lakeoutlet (1-7) |
[in] | qin | net inflow of lake (m3/s) |
[in] | lakearea | lakearea (m2) |
[in] | wlmr | lake water stage (m) |
[in] | ratc | rating curve coefficient |
[in] | ratexp | rating curve exponent |
[in] | w0today | upper threshold (m) |
[in] | wmin | lower threshold (m) |
[in] | damprod | current production flow (m3/s) |
[out] | wcheck | current outflow threshold (m) |
[out] | outflow | current outflow (m3/s) |
Calculate outflow for current outlet type
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.
[in] | i | index of current subbasin |
[in] | lakewst | outlet lake water stage (above threshold) (m) |
[out] | lakewstadj | outlet lake water stage adjusted for "real" amplitude of regulation volume (m) |
Algoritm
Get regulation amplitude adjustment factor
Calculate adjusted lake water stage
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.
[in] | n | number of subbasins |
[in,out] | miscstate | Floodplain states |
[out] | dammedflow | potentially dammed flow within subbasin by floodplains (m3/timestep) |
[out] | dammedflow2 | potentially dammed flow of olake from downstream subbasin by floodplains (m3/timestep) |
[out] | dammedflow3 | potentially 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
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.
[in] | i | index of current subbasin |
[in] | itype | lake type (ilake or olake) |
[in] | flow | river flow (m3/s) |
[in] | calcnpst | status of N,P,S,T1 simulation (to calculate bankful flow) |
[in,out] | riverstate | River states |
[out] | depth | river depth (m) |
[out] | riverarea | river surface area (m2) |
[out] | qbank | flow 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.
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)
[in] | i | subbasin index |
[in] | j | class index |
[in] | pooltype | river type (local or main) |
[in] | numsubst | number of substances modelled |
[in] | area | river area (m2) |
[in] | temp | air temperature |
[in] | rh | relative humuidity (-) |
[in] | cprec | concentration in precipitation |
[in] | epot | potential evapotranspiration (mm/timestep) |
[out] | evap | actual evapotranspiration (mm/timestep) |
[out] | cevapt1 | concentration of T1 in evapotranspiration |
[out] | dampe | actual evapotranspiration from riverboxi (m3) |
[in,out] | riverstate | Lake 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
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.
[in] | nsub | Number of subbasins |
[in] | landarea | land area [m2] |
[out] | rivlength | river length [m] |
Algorithm
Set river length from GeoData, or if zero use default value, i.e. square root of land area
|
private |
Subroutine for calculation of snow on ice changes; snowfall addition and snow pack melting.
[in] | iluse | index of landuse |
[in] | i | index of subbasin |
[in] | snowfall | precipitation as snow (mm/timestep) |
[in] | temp | air temperature (C) |
[out] | melt | snow melt (mm/timestep) |
[in] | swrad | shortwave radiation (MJ/m2/ts) |
[in,out] | snow | snow pack (mm) |
[in,out] | snowage | snowage (timesteps) |
Algorithm
Set parameter values
Calculate snow melt
Update the snow pack with snowfall and melting
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.
[in] | airtemp | air temperature (deg Celsius) |
[in,out] | watertemp | water temperature (deg Celsius) |
[in] | watervol | surface water volume (m3 or mm) |
[in] | waterarea | surface water area (m2) |
[in] | t2transfer | heat transfer parmeter from air to water (J/m2/s/deg) |
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.
[in,out] | uppertemp | upper water temperature (deg Celsius) |
[in,out] | lowertemp | lower water temperature (deg Celsius) |
[in] | uppervol | upper layer water volume (m3) |
[in] | lowervol | lower layer water volume (m3) |
[in] | waterarea | surface water area (m2) |
[in] | t2transfer | heat transfer parmeter from water to water (J/m2/s/deg) |
|
private |
Calculate equilibrium water level between two floodplains with sloping floodplain with maximum extent amax and corresponding level ymax.
[in] | volp | water volume in floodplain [m3] |
[in] | wl1 | water level for floodplain 1 [m] |
[in] | wl2 | water level for floodplain 2 [m] |
[in] | amax | area at maximum areal extent [m2] |
[in] | ymax | water level at maximum areal extent [m] |
[in] | href | reference height of floodplain bottom [m] |
[out] | hwleq | equilibrium water level (in href system) [m] |
[out] | flowdirection | flow direction flag, 1=fp1tofp2, 2=fp2tofp1,0=no flow |
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).
[in] | i | index of current subbasin |
[in] | airtemp | air temperature for subbasin |
[in,out] | riverstate | River states |
[in,out] | lakestate | Lake states |
Algorithm
Calculate river temperature, same for local and main river
Calculate lake temperature, same for internal and outlet lake (if exist)
Calculate 10- and 20-day mean of water temperature for N,P,C,S or Si processes
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.
[in] | i | index of subbasin |
[in] | fpamax | maximum area of the flood plain [m2] |
[in] | warea | (maximum=constant) area of the water body [m2] |
[in] | ifpar | current interflow parameters (flmrr/floll,flmrp/flolp,fymmr/fymol,rcr2fp/rcl2fp,rcfp2r/rcfp2l |
[in,out] | volp | water volume in floodplain [m3] |
[in,out] | concp | floodplain concentrations |
[in,out] | volw | water volume in water body (river or lake) [m3] |
[in,out] | concw | water body (river or lake) concentration |
[out] | fpdepth | flood plain water depth [m] |
[out] | fpdegree | flood plain degree of flood [%] |
[out] | interflow | flow from waterbody to floodplain [m3/timestep] (can be negative) |
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.
[in] | vel | river velocity (m/s) |
[in] | hw | water depth (m) |
[in] | tw | water temperature (C) |
[in] | tm | river freezing temperature (C) |
[in] | cwi | heat exchange coefficient (suggested values 1622 W/s^0.8/C^2.6) |
[in] | qhmin | minimum heat flow (W/m2/s) |
[in] | qhmax | maximum heat flow (W/m2/s) |
[out] | qhw | heat flow (MJ/m2/timestep) |
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
[in] | airtemp | air temperature (deg Celsius) |
[in] | swrad | shortwave radiation (MJ/m2/ts) |
[in,out] | watertemp | water temperature (deg Celsius) |
[in] | watervol | water volume (m3) |
[in] | waterarea | water surface area (m2) |
[in] | tempcoef | heat transfer parameter from air to water (J/m2/s/deg) |
[in] | radcoef | heat transfer parameter from radiation to water (fraction, 0-1) |
[in] | constcoef | heat transfer parameter, constant residual term (J/m2/s) |
[in] | lincoef | heat transfer parameter, linear residualterm (J/m2/s/deg) |
[in] | limt2exch | heat transfer parameter, limit depth for only temperature exchange (m) |
[out] | freezeuparea | fractional area were ice formation is trigered (fraction, 0-1) |
[in] | freezingpoint | freezingpoint temperature, deg C |
[in] | stabpar1 | Stability parameter, affects both heating and cooling. No correction if set to zero |
[in] | stabpar2 | Stability parameter, affects cooling. No correction if set to zero |
[in] | stabpar3 | Stability 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
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.
[in] | i | index of current subbasin |
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.
[in] | i | index of current subbasin |
[in] | ioutlet | index of outlet for elake |
[in] | lakeareain | lakearea (m2) (from GeoData) |
[in] | olakewst | outlet lake water stage (m) |
[out] | have2outlets | Lake with two outlets? |
[out] | ratck | current rating curve parameter rate |
[out] | ratcexp | current rating curve parameter exponent |
[out] | w0today | current water level threshold in w-reference system (m) |
[out] | wmin | minimum water level threshold (s�nkningsgr�ns) (m) |
[out] | damprod | current dam production flow (m3/s) |
[out] | maxprod | (current) maximum production flow (m3/s) |
[out] | minprod | (current) minimum flow (m3/s) |
[out] | out2ratck | current rating curve parameter rate of outlet 2 |
[out] | out2ratcexp | current rating curve parameter exponent of outlet 2 |
[out] | out2w0today | current water level threshold in w-reference system (m) of outlet 2 |
[out] | out2wmin | minimum water level threshold (s�nkningsgr�ns) (m) of outlet 2 |
[out] | out2damprod | current 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] | qin | current net inflow to lake (m3/s) |
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.
[in] | current_lake | index of slake for current lake |
[in] | current_elake | index of elake for current lake |
[in] | current_dam | index in dam for current dam |
[in] | current_outlet | index of outlet of current elake |
[in] | wlmr | outlet lake water stage (m) |
[out] | prodflow | current production flow (m3/s) |
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.
[in] | i | index of current subbasin |
[in] | current_lake | index of lake for current lake in slake |
[in] | current_elake | index of lake for current lake in elake |
[in] | current_dam | index in dam for current dam in damdata |
[in] | current_outlet | index of outlet of current lake |
[out] | ratck | current rating curve parameter rate |
[out] | ratcexp | current rating curve parameter exponent |
|
private |
Find highest value of two.
|
private |
Find lowest value of two.
|
private |
Find matching value of two.
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.
[in] | i | subbasin index |
[in] | pooltype | river type (local or main) |
[in] | riverstate | River state |
[out] | meanrivertemp | temperature of river water |
[out] | totrivervol | volume of river water |
real function, public surfacewater_processes::get_wetland_threshold | ( | integer, intent(in) | j | ) |
Threshold for wetland with regulated flow is set from class or parameters.
[in] | j | class |
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.
[in] | itype | type of river; 1=local, 2=main |
[in] | i | subbasin |
[in,out] | frozenstate | Snow and ice states |
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.
[in] | i | index of subbasin |
[in] | itype | index of lake/river type |
[in] | iluse | index of landuse |
[in] | temp | air temp |
[in] | wind | wind speed (m/s) |
[in,out] | lakesurftemp | water surface temperature (IN: open water, OUT: average for lake surface) |
[in] | swrad | shortwave radiation (MJ/m2/ts) |
[in,out] | frozenstate | Snow and ice states |
[in,out] | lakestate | Lake state |
[in] | freezeupday | status freeze-up this time step |
[out] | breakupday | status ice break-up this time step |
[in] | hypodepth | hypolimnion depth (m) |
[in] | freezeuparea | fractional water surface area with newice formation, given by temperature routine |
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.
[in] | i | index of subbasin |
[in] | itype | index of lake/river type |
[in] | iluse | index of landuse |
[in] | temp | air temperature |
[in] | wind | wind speed (m/s) |
[in,out] | riversurftemp | water surface temperature |
[in] | riverarea | river area, m2 |
[in] | swrad | shortwave radiation (MJ/m2/ts) |
[in,out] | frozenstate | Snow and ice states |
[in,out] | riverstate | River states |
[in] | freezeupday | status freeze-up day |
[out] | breakupday | status ice break-up day |
[in] | freezeuparea | fraction of river area with newice formation (calculated by surface heat balance function) |
subroutine, public surfacewater_processes::initiate_lakeriverice |
Initialise lake and river ice model.
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.
[in] | lakearea | lake area (m2) |
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.
[in] | itype | type of river; 1=local, 2=main |
[in] | i | subbasin |
[in] | wlm | river water level in reference system (m) |
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)
[in,out] | aquiferstate | Aquifer states |
[out] | removedflow | removed flow (m3/timestep) |
Algoritm
Constant abstraction from aquifer below subbasin
Timeseries abstraction from aquifer
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)
[in] | i | index of current subbasin |
[in] | pooltype | river type (local or main) |
[in,out] | riverstate | river states |
[in,out] | flow | removed flow (m3/timestep) |
[out] | dampflow | removed 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
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)
[in] | i | index of current subbasin |
[in] | pooltype | river type (local or main) |
[in,out] | q | inflow (m3/s) |
[in,out] | riverstate | river states |
[in,out] | flow | removed 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
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)
[in] | i | index of current subbasin |
[in] | pooltype | lake type (local or outlet) |
[in] | qunitfactor | transformation factor m3/s->mm/timestep |
[in,out] | lakestate | Lake states |
[out] | removedflow | removed 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
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)
[in] | i | index of current subbasin |
[in] | totflow | outflow of subbasin (updated) |
[in] | maxprodin | temporary maximum production flow for recalculating flow |
[in] | minflowin | current minimum flow for recalculating flow |
[in,out] | mainflow | flow in main channel |
[in,out] | branchflow | flow 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.
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)
[in] | cmethod | code for change flow method |
[in] | totflow | outflow of subbasin (updated) |
[in] | maxqprod | maximum production flow, outlet 1 |
[in] | maxqprod2 | maximum production flow, outlet 2 |
[in] | minflow1 | minimum flow, outlet 1 |
[in] | minflow2 | minimum flow, outlet 2 |
[in,out] | simflow1 | outflow of outlet 1 |
[in,out] | simflow2 | outflow 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
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)
[in] | i | index of current subbasin |
[in] | itype | lake type (local or main) |
[in] | ns | number of substances |
[in] | outflowmm | outflow of lake (mm/timestep) |
[in] | subid | subid of current subbasin, for error output |
[in] | ldepthm | lake depth (m) |
[in] | hypodepth | lake hypolimnion depth (m) |
[in] | lakewstmm | lake water stage (mm) |
[out] | coutflow | concentration of outflow of lake |
[in,out] | lakestate | Lake state |
Algorithm
Preparations: default values
Preparations: T2-simulation with special outflow temperature of outlet lakes
Remove outflow and set outflow concentrations:
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.
[in] | itype | type of river; 1=local, 2=main |
[in] | i | subbasin |
[in] | q | river flow (m3/s) |
[in] | ice | status of ice on river |
[in] | frozenstate | Snow and ice states |
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.
[in] | i | current subbasin index |
[in] | itype | river type |
[in,out] | riverstate | River state |
[in,out] | frozenstate | Snow and ice states |
[in] | riverarea | river area (m2) |
[in,out] | breakupday | status of river ice break up |
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.
[in] | nl | number of lake types |
[in] | n | number of subbasins |
[in] | locarea | landarea of subbasin [m2] !TODO: here should land+iwt+lriver be used |
[in] | areasum | upstream area [m2] !TODO: here olake area should not be |
[out] | rating | k-value of rating curve |
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).
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.
[in] | i | subbasin index |
[in] | pooltype | river type (local or main) |
[in,out] | riverstate | River state |
[in] | meanrivertemp | temperature of river |
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).
[in] | waterbody | flag for waterbody, 1=lstream,2=ilake,3=main river,4=olake |
[in] | i | index of current subbasin |
[in,out] | riverstate | River states |
[in,out] | lakestate | Lake 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
|
private |
|
private |
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 | ||
) |
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.
[in] | i | index of subbasin |
[in] | itype | index of lake type (ilake = 1, olake = 2) |
[in] | temp | air temp |
[in] | swrad | shortwave radiation, (MJ/m2/ts) |
[in,out] | lakesurft | water surface temperature (for icefree conditions) |
[in] | lakearea | lake area (m2) |
[in] | hypodepth | hypolimnion depth (m) |
[in] | frozenstate | Snow and ice states |
[in,out] | lakestate | Lake state |
[out] | freezeup | is water cooling below freezing point (1 yes, 0 no)? |
[out] | freezeuparea | fraction of lake area with newice formation |
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.
[in] | i | index of subbasin |
[in] | itype | index of river type (local = 1, main = 2) |
[in] | temp | air temperature |
[in] | swrad | solar radiation (MJ/m2/ts) |
[in,out] | riversurft | water surface temperature |
[in] | riverarea | river area (m2) |
[in] | frozenstate | Snow and ice states |
[in,out] | riverstate | River states |
[in,out] | freezeuparea | fraction of riverarea with newice formation |
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.
[in] | i | index of subbasin |
[in] | j | index of class |
[in] | temp | air temperature |
[in] | swrad | solar radiation (MJ/m2/ts) |
[in] | classarea | wetland area (m2) |
[in,out] | soilstate | Soil states |
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)
[in] | i | index of current subbasin |
[in] | itype | river type (local or main) |
[in] | qin | inflow to river train (m3/s) |
[in] | cin | concentration of inflow to river train |
[out] | qout | outflow of river train (m3/s) |
[out] | cout | concentration of outflow of river train |
[in,out] | riverstate | River states |
Algoritm
Add new inflow to translation variable (river train)
Calculate outflow from river train
Translate the flows in the river train
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.
[in] | q_array | flow all days last year |
[out] | qmax | highest flow all days last year |
[out] | q2 | second highest flow all days last year |
[out] | imax | index of highest flow all days last year |
[out] | i2 | index of second highest flow all days last year |
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)
[in] | i | index of current subbasin |
[in] | pooltype | lake type (local or outlet) |
[in] | qunitfactor | transformation factor m3/s->mm/timestep |
[in,out] | miscstate | miscellaneous states |
[in,out] | lakestate | Lake states |
[out] | removedflow | removed flow (m3/timestep) |
Algoritm
If abstraction of water: Calculate amount
Remove transfer water from lake
Save abstracted water for next timestep
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.
[in] | i | index for current subbasin |
[in] | j | index for current class |
[in] | isoil | index of soil type |
[in] | subid | subbasin id |
[in] | classarea | class area [m2] |
[in] | temp | class forcing air temperature |
[in] | swrad | class forcing solar radiation (MJ/m2/ts) |
[in,out] | soilstate | Soil states |
[in,out] | miscstate | Misc states |
[in] | prev_inflow | inflow to wetland already added (eg. P-E) (m3/s) |
[in] | inflow | inflow to wetland from catchment (m3/s) |
[in] | cinflow | concentration of inflow (mg/L) |
[in] | catcharea | catchment area of wetland (m2) |
[out] | outflow | outflow from wetland (m3/s) |
[out] | coutflow | concentration 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
|
private |