| 
    HYPE
    
   | 
 
Functions/Subroutines | |
| subroutine, public | add_water_to_bottom_lake_layer (i, itype, numsubst, qin, cqin, lakestate) | 
| subroutine, public | add_water_to_layered_lake_from_above (i, itype, numsubst, qin, cqin, lakestate) | 
| subroutine, public | change_water_volume_of_top_lake_layer (i, itype, deltaw, lakestate) | 
| subroutine | add_water_to_lake_layer_based_on_density (i, itype, numsubst, qin, cqin, lakestate) | 
| real function, public | lake_epilimnion_depth (lakearea) | 
| real function, public | lake_area_at_depthz (i, itype, depthz) | 
| real function | lake_area_at_depthx (i, itype, depthx) | 
| real function | lake_volume_at_depthz (i, itype, depthz) | 
| real function | lake_volume_at_depthx (i, itype, depthx) | 
| real function | lake_voldepth_at_depthz (i, itype, depthz) | 
| real function | lake_voldepth_at_depthx (i, itype, depthx) | 
| integer function, public | layer_at_depthz (isb, itype, depthz, lakestate) | 
| real function, public | lake_depthx_at_voldepth (i, itype, volumemm) | 
| real function, public | lake_depthz_at_voldepth (i, itype, volumemm) | 
| subroutine, public | layered_lake_average_concentration (itype, i, ns, lakestate, conc) | 
| subroutine, public | layered_lake_sinking_and_settling (ktop, i, substance, watertype, lakearea, sedrate, limsedpar, lakestate, netchange, sedpooladd) | 
| real function, public | max_lake_depth (i, itype) | 
| subroutine, public | mix_lake_layers (i, itype, k1in, k2in, lakestate, rhodiff, mixall) | 
| subroutine, public | move_water_volume_between_lake_layers (i, itype, kfrom, kto, qin, lakestate) | 
| subroutine | move_water_flow_between_lake_layers (i, itype, kfrom, kto, qin, lakestate) | 
| subroutine | move_water_between_lake_layers (i, itype, kfrom, kto, qinmm, lakestate) | 
| real function, public | lake_bottomarea_below_depthz (i, itype, depthz) | 
| real function | lake_bottomarea_below_depthx (i, itype, depthx) | 
| real function, public | lake_bottomarea_in_layerz (i, itype, depthz1, depthz2) | 
| real function | lake_bottomarea_in_layerx (i, itype, depthx2, depthx1) | 
| subroutine, public | remove_lake_water_from_top (i, itype, numsubst, qwant, qout, cqout, lakestate, cqlayer_in) | 
| subroutine | remove_lake_water_specified_by_layer (i, itype, ns, qwant, qfraction, qout, cqout, lakestate) | 
| subroutine, public | remove_outflow_from_layered_lake (i, itype, ns, outflowmm, ldepthm, lakewstmm, coutflow, lakestate) | 
| subroutine, public | reset_lake_layers (itype, isb, lakearea, lakestate) | 
| subroutine, public | set_lake_layervolumes (itype, isb, epidepth, maxdepth, currentdepth, volldepth) | 
| integer function, public | top_lake_layer (itype, isb, lakestate) | 
Variables | |
| character(len=46), dimension(2) | errstring | 
Layered lake water related subroutines in HYPE.
| subroutine, public layeredlake_processes::add_water_to_bottom_lake_layer | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | numsubst, | ||
| real, intent(in) | qin, | ||
| real, dimension(numsubst), intent(in) | cqin, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Add water to bottom of layered lake.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | numsubst | number of substances modelled | 
| [in] | qin | water volume added (based on lake surface area) (mm/timestep) | 
| [in] | cqin | concentration of water added (eg. mg/L) | 
| [in,out] | lakestate | Lake state | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| subroutine layeredlake_processes::add_water_to_lake_layer_based_on_density | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | numsubst, | ||
| real, intent(in) | qin, | ||
| real, dimension(numsubst), intent(in) | cqin, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Add inflow to layered lake based on water density. Water is mixed with the water of the layer above a layer with higher density than the inflowing water. If all lake layers has higher density and there is no more than two layers, a new layer is created with the incoming water.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | numsubst | number of substances modelled | 
| [in] | qin | water volume added (based on lake surface area) (mm/timestep) | 
| [in] | cqin | concentration of water added (eg. mg/L) | 
| [in,out] | lakestate | Lake state | 
 Here is the call graph for this function:| subroutine, public layeredlake_processes::add_water_to_layered_lake_from_above | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | numsubst, | ||
| real, intent(in) | qin, | ||
| real, dimension(numsubst), intent(in) | cqin, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Add water to top of layered lake. Add to first layer or if that is empty create a new layer on top of the existing ones.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | numsubst | number of substances modelled | 
| [in] | qin | water volume added (based on lake surface area) (mm/timestep) | 
| [in] | cqin | concentration of water added (eg. mg/L) | 
| [in,out] | lakestate | Lake state | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| subroutine, public layeredlake_processes::change_water_volume_of_top_lake_layer | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | deltaw, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Add water to top of layered lake, without affecting the substances. Add to first layer that is not empty.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | deltaw | water volume immediate change (based on lake surface area) (mm) | 
| [in,out] | lakestate | Lake state | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function layeredlake_processes::lake_area_at_depthx | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthx | ||
| ) | 
Calculate layered lake area at specified depth x (m above deepest bottom)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthx | height above bottom [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function, public layeredlake_processes::lake_area_at_depthz | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthz | ||
| ) | 
Calculate layered lake area at specified depth z (m below threshold)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthz | depth below threshold [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function layeredlake_processes::lake_bottomarea_below_depthx | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthx | ||
| ) | 
Calculate layered lake bottom area (m2) below "real" depth (m above bottom)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthx | height above bottom [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function, public layeredlake_processes::lake_bottomarea_below_depthz | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthz | ||
| ) | 
Calculate layered lake bottom area (m2) below "real" depth (m below threshold)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthz | depth below threshold [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function layeredlake_processes::lake_bottomarea_in_layerx | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthx2, | ||
| real, intent(in) | depthx1 | ||
| ) | 
Calculate layered lake bottom area (m2)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthx2 | height above bottom [m], upper limit of layer | 
| [in] | depthx1 | height above bottom [m], lower limit of layer, depthx1<depthx2 | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function, public layeredlake_processes::lake_bottomarea_in_layerz | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthz1, | ||
| real, intent(in) | depthz2 | ||
| ) | 
Calculate layered lake bottom area (m2) of layer.
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthz1 | depth below threshold [m], upper limit of layer, depthz1<depthz2 | 
| [in] | depthz2 | depth below threshold [m], lower limit of layer | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function, public layeredlake_processes::lake_depthx_at_voldepth | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | volumemm | ||
| ) | 
Calculate layered lake depth (in meter above bottom) from volume defined depth.
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | volumemm | water depth (bathtub) as volume [mm] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function, public layeredlake_processes::lake_depthz_at_voldepth | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | volumemm | ||
| ) | 
Calculate layered lake depth (below threshold) from volume defined depth.
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | volumemm | water depth (bathtub) as volume [mm] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function, public layeredlake_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) | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function layeredlake_processes::lake_voldepth_at_depthx | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthx | ||
| ) | 
Calculate layered lake volume depth (mm) corresponding to "real" depth (m above bottom)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthx | height above bottom [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function layeredlake_processes::lake_voldepth_at_depthz | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthz | ||
| ) | 
Calculate layered lake volume depth (mm) corresponding to "real" depth (m below threshold)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthz | depth below threshold [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function layeredlake_processes::lake_volume_at_depthx | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthx | ||
| ) | 
Calculate layered lake volume (m3) below depth (m above bottom)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthx | height above bottom [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function layeredlake_processes::lake_volume_at_depthz | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthz | ||
| ) | 
Calculate layered lake volume (m3) below a specified depth (m below threshold)
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthz | depth [m] | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| integer function, public layeredlake_processes::layer_at_depthz | ( | integer, intent(in) | isb, | 
| integer, intent(in) | itype, | ||
| real, intent(in) | depthz, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Calculate which layer hold the depth given, "real" depth (m below threshold)
| [in] | isb | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
| [in] | depthz | depth below threshold [m] | 
| [in,out] | lakestate | Lake state | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| subroutine, public layeredlake_processes::layered_lake_average_concentration | ( | integer, intent(in) | itype, | 
| integer, intent(in) | i, | ||
| integer, intent(in) | ns, | ||
| type(lakestatetype), intent(in) | lakestate, | ||
| real, dimension(ns), intent(out) | conc | ||
| ) | 
Subroutine for calculation of average concentration of layered lake.
| [in] | itype | type of lake | 
| [in] | i | index of current subbasin (last lakebasin) | 
| [in] | ns | number of substances | 
| [in] | lakestate | Lake state | 
| [out] | conc | average concentration of layered lake | 
 Here is the caller graph for this function:| subroutine, public layeredlake_processes::layered_lake_sinking_and_settling | ( | integer, intent(in) | ktop, | 
| integer, intent(in) | i, | ||
| integer, intent(in) | substance, | ||
| integer, intent(in) | watertype, | ||
| real, intent(in) | lakearea, | ||
| real, intent(in) | sedrate, | ||
| real, intent(in) | limsedpar, | ||
| type(lakestatetype), intent(in) | lakestate, | ||
| real, dimension(3), intent(out) | netchange, | ||
| real, intent(out), optional | sedpooladd | ||
| ) | 
Calculate sinking and settling of substance through a lake layer lake.
| [in] | ktop | index of top lake layer | 
| [in] | i | current index of subbasin | 
| [in] | substance | current index of substance (PP,ON,SS,AE,OC,SI or T1) | 
| [in] | watertype | Lake type (1=local, 2=outlet) | 
| [in] | lakearea | lake surface area (slc) (m2) | 
| [in] | sedrate | sedimentation rate (lakes) (m/ts) | 
| [in] | limsedpar | concentration limit for sedimentation (mg/L) | 
| [in] | lakestate | Lake state | 
| [out] | netchange | amount of (net) substance leaving the layer (g/ts) (negative is an addition) | 
| [out] | sedpooladd | amount of substance to be added to the sediment pool (kg/m2/ts) | 
Algoritm Initialisation
For each lake layer, starting from top:
Calculate water volume, and the amount leaving the layer
 Here is the call graph for this function:
 Here is the caller graph for this function:| real function, public layeredlake_processes::max_lake_depth | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype | ||
| ) | 
Calculate layered lake maximum depth from threshold.
| [in] | i | subbasin | 
| [in] | itype | type of lake; 1=internal, 2=outlet | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| subroutine, public layeredlake_processes::mix_lake_layers | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | k1in, | ||
| integer, intent(in) | k2in, | ||
| type(lakestatetype), intent(inout) | lakestate, | ||
| real, intent(in) | rhodiff, | ||
| logical, intent(inout), optional | mixall | ||
| ) | 
Mix the water of two (or more) lake layers if the density difference is small or inverse.
| [in] | i | index of subbasin | 
| [in] | itype | index of lake type (ilake = 1, olake = 2) | 
| [in] | k1in | index of lake layer (upper) | 
| [in] | k2in | index of lake layer (lower) | 
| [in,out] | lakestate | Lake state | 
| [in] | rhodiff | density difference | 
| [in,out] | mixall | status of mixing all layers | 
 Here is the call graph for this function:| subroutine layeredlake_processes::move_water_between_lake_layers | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | kfrom, | ||
| integer, intent(in) | kto, | ||
| real, intent(in) | qinmm, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Move water from one lake layer to another.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | kfrom | layer to move water from | 
| [in] | kto | layer to move water to | 
| [in] | qinmm | water to be moved (based on lake surface area) (mm/timestep) | 
| [in,out] | lakestate | Lake state | 
Algorithm 
Set concentration of water to move
Remove the water
Handle erronous removal
Add the water to the other layer
 Here is the caller graph for this function:
      
  | 
  private | 
Move water from one lake layer to another based on flow rate.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | kfrom | layer to move water from | 
| [in] | kto | layer to move water to | 
| [in] | qin | water volume to be moved (m3/s) | 
| [in,out] | lakestate | Lake state | 
Algorithm 
Calculate flow volume and check available water
Remove water from one layer and add to the other
 Here is the call graph for this function:| subroutine, public layeredlake_processes::move_water_volume_between_lake_layers | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | kfrom, | ||
| integer, intent(in) | kto, | ||
| real, intent(in) | qin, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Move water from one lake layer to another. The moved water is limited to the layer volume.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | kfrom | layer to move water from | 
| [in] | kto | layer to move water to | 
| [in] | qin | water volume to be moved (based on lake surface area) (mm/timestep) | 
| [in,out] | lakestate | Lake state | 
Algorithm 
Check available water
Remove water from one layer and add to the other
 Here is the call graph for this function:| subroutine, public layeredlake_processes::remove_lake_water_from_top | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | numsubst, | ||
| real, intent(in) | qwant, | ||
| real, intent(out) | qout, | ||
| real, dimension(numsubst), intent(out) | cqout, | ||
| type(lakestatetype), intent(inout) | lakestate, | ||
| real, dimension(numsubst,3), intent(in), optional | cqlayer_in | ||
| ) | 
Remove water from layered lake, unit mm of water volume. The water is removed from upper layers first.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | numsubst | number of substances modelled | 
| [in] | qwant | water volume to be removed (based on lake surface area) (mm/timestep) | 
| [out] | qout | actual water volume removed (based on lake surface area) (mm/timestep) | 
| [out] | cqout | concentration of water removed (eg. mg/L) | 
| [in,out] | lakestate | Lake state | 
| [in] | cqlayer_in | concentration of water to be removed form layer | 
Algorithm 
Set default values output variables
Set actual evaporation to potential evaporation, which is the default for temperature above threshold
Remove water from layer of lake
Set output variables; actually removed water and its concentration
 Here is the caller graph for this function:| subroutine layeredlake_processes::remove_lake_water_specified_by_layer | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | ns, | ||
| real, intent(in) | qwant, | ||
| real, dimension(3), intent(in) | qfraction, | ||
| real, intent(out) | qout, | ||
| real, dimension(ns), intent(out) | cqout, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Remove water from layered lake, unit mm of water volume. The water is removed from upper layers first.
| [in] | i | subbasin index | 
| [in] | itype | lake type (ilake or olake) | 
| [in] | ns | number of substances modelled | 
| [in] | qwant | water volume to be removed (based on lake surface area) (mm/timestep) | 
| [in] | qfraction | wanted outflow fraction from layers (-) | 
| [out] | qout | actual water volume removed (based on lake surface area) (mm/timestep) | 
| [out] | cqout | concentration of water removed (eg. mg/L) | 
| [in,out] | lakestate | Lake state | 
Algorithm 
Set default values output variables
Calculate layer outflow variables
Set output variables; actually removed water and its concentration
Check if all water was possible to remove
 Here is the caller graph for this function:| subroutine, public layeredlake_processes::remove_outflow_from_layered_lake | ( | integer, intent(in) | i, | 
| integer, intent(in) | itype, | ||
| integer, intent(in) | ns, | ||
| real, intent(in) | outflowmm, | ||
| real, intent(in) | ldepthm, | ||
| real, intent(in) | lakewstmm, | ||
| real, dimension(ns), intent(out) | coutflow, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Removal of outflow from layered lake and calculation of the concentration of outflow. Outflow is removed proportional to the depth of water layers above the threshold ("real depth").
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 volume | 
| [in] | ldepthm | lake depth (m) | 
| [in] | lakewstmm | lake water volume (mm) in volume | 
| [out] | coutflow | concentration of outflow of lake | 
| [in,out] | lakestate | Lake state | 
Algorithm 
Preparations: default values
Preparations: Calculate the fraction of the outflow that will be taken from different lake parts
Remove outflow and set outflow concentrations:
 Here is the call graph for this function:
 Here is the caller graph for this function:| subroutine, public layeredlake_processes::reset_lake_layers | ( | integer, intent(in) | itype, | 
| integer, intent(in) | isb, | ||
| real, intent(in) | lakearea, | ||
| type(lakestatetype), intent(inout) | lakestate | ||
| ) | 
Reset lake layer thicknesses for new season. Upper layer is set to half the value of estimated epiliminon.
| [in] | itype | type of lake | 
| [in] | isb | index of current subbasin | 
| [in] | lakearea | lake area (m2) | 
| [in,out] | lakestate | Lake state | 
Find the wanted new layer thicknesses (mm water)
 Here is the call graph for this function:| subroutine, public layeredlake_processes::set_lake_layervolumes | ( | integer, intent(in) | itype, | 
| integer, intent(in) | isb, | ||
| real, intent(in) | epidepth, | ||
| real, intent(in) | maxdepth, | ||
| real, intent(in) | currentdepth, | ||
| real, dimension(3), intent(out) | volldepth | ||
| ) | 
Set lake layer volumes based on total water volume and wanted depth to third layer. The first and second layer is 80% resp 20% of the above layer.
| [in] | itype | type of lake | 
| [in] | isb | index of current subbasin | 
| [in] | epidepth | depth to wanted epilimnion+metalimnion depth (m) | 
| [in] | maxdepth | depth to maximum area (m) | 
| [in] | currentdepth | current lake water depth (mm) | 
| [out] | volldepth | water volume (mm) in the lake layers | 
 Here is the call graph for this function:
 Here is the caller graph for this function:| integer function, public layeredlake_processes::top_lake_layer | ( | integer, intent(in) | itype, | 
| integer, intent(in) | isb, | ||
| type(lakestatetype), intent(in) | lakestate | ||
| ) | 
Find the top lake layer; ktop=4 means no water in lake.
| [in] | itype | type of lake | 
| [in] | isb | index of current subbasin | 
| [in] | lakestate | Lake state | 
| top_lake_layer | is index of top lake layer | 
 Here is the call graph for this function:
 Here is the caller graph for this function:
      
  | 
  private |