HYPE
Functions/Subroutines | Variables
layeredlake_processes Module Reference

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
 

Detailed Description

Layered lake water related subroutines in HYPE.

Function/Subroutine Documentation

◆ add_water_to_bottom_lake_layer()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]numsubstnumber of substances modelled
[in]qinwater volume added (based on lake surface area) (mm/timestep)
[in]cqinconcentration of water added (eg. mg/L)
[in,out]lakestateLake state
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_water_to_lake_layer_based_on_density()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]numsubstnumber of substances modelled
[in]qinwater volume added (based on lake surface area) (mm/timestep)
[in]cqinconcentration of water added (eg. mg/L)
[in,out]lakestateLake state
+ Here is the call graph for this function:

◆ add_water_to_layered_lake_from_above()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]numsubstnumber of substances modelled
[in]qinwater volume added (based on lake surface area) (mm/timestep)
[in]cqinconcentration of water added (eg. mg/L)
[in,out]lakestateLake state
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_water_volume_of_top_lake_layer()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]deltawwater volume immediate change (based on lake surface area) (mm)
[in,out]lakestateLake state
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_area_at_depthx()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthxheight above bottom [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_area_at_depthz()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthzdepth below threshold [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_bottomarea_below_depthx()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthxheight above bottom [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_bottomarea_below_depthz()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthzdepth below threshold [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_bottomarea_in_layerx()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthx2height above bottom [m], upper limit of layer
[in]depthx1height 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:

◆ lake_bottomarea_in_layerz()

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.

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthz1depth below threshold [m], upper limit of layer, depthz1<depthz2
[in]depthz2depth below threshold [m], lower limit of layer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_depthx_at_voldepth()

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.

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]volumemmwater depth (bathtub) as volume [mm]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_depthz_at_voldepth()

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.

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]volumemmwater depth (bathtub) as volume [mm]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_epilimnion_depth()

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.

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

◆ lake_voldepth_at_depthx()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthxheight above bottom [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_voldepth_at_depthz()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthzdepth below threshold [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_volume_at_depthx()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthxheight above bottom [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lake_volume_at_depthz()

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)

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthzdepth [m]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ layer_at_depthz()

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)

Parameters
[in]isbsubbasin
[in]itypetype of lake; 1=internal, 2=outlet
[in]depthzdepth below threshold [m]
[in,out]lakestateLake state
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ layered_lake_average_concentration()

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.

Parameters
[in]itypetype of lake
[in]iindex of current subbasin (last lakebasin)
[in]nsnumber of substances
[in]lakestateLake state
[out]concaverage concentration of layered lake
+ Here is the caller graph for this function:

◆ layered_lake_sinking_and_settling()

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.

Parameters
[in]ktopindex of top lake layer
[in]icurrent index of subbasin
[in]substancecurrent index of substance (PP,ON,SS,AE,OC,SI or T1)
[in]watertypeLake type (1=local, 2=outlet)
[in]lakearealake surface area (slc) (m2)
[in]sedratesedimentation rate (lakes) (m/ts)
[in]limsedparconcentration limit for sedimentation (mg/L)
[in]lakestateLake state
[out]netchangeamount of (net) substance leaving the layer (g/ts) (negative is an addition)
[out]sedpooladdamount 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

  • Calculate bottom area of layer
  • Amount of substance added to sediment pool kg/m2/ts (lakearea)
  • Prepare for next layer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ max_lake_depth()

real function, public layeredlake_processes::max_lake_depth ( integer, intent(in)  i,
integer, intent(in)  itype 
)

Calculate layered lake maximum depth from threshold.

Parameters
[in]isubbasin
[in]itypetype of lake; 1=internal, 2=outlet
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mix_lake_layers()

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.

Parameters
[in]iindex of subbasin
[in]itypeindex of lake type (ilake = 1, olake = 2)
[in]k1inindex of lake layer (upper)
[in]k2inindex of lake layer (lower)
[in,out]lakestateLake state
[in]rhodiffdensity difference
[in,out]mixallstatus of mixing all layers
+ Here is the call graph for this function:

◆ move_water_between_lake_layers()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]kfromlayer to move water from
[in]ktolayer to move water to
[in]qinmmwater to be moved (based on lake surface area) (mm/timestep)
[in,out]lakestateLake 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:

◆ move_water_flow_between_lake_layers()

subroutine layeredlake_processes::move_water_flow_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 
)
private

Move water from one lake layer to another based on flow rate.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]kfromlayer to move water from
[in]ktolayer to move water to
[in]qinwater volume to be moved (m3/s)
[in,out]lakestateLake 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:

◆ move_water_volume_between_lake_layers()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]kfromlayer to move water from
[in]ktolayer to move water to
[in]qinwater volume to be moved (based on lake surface area) (mm/timestep)
[in,out]lakestateLake state

Algorithm

Check available water

Remove water from one layer and add to the other

+ Here is the call graph for this function:

◆ remove_lake_water_from_top()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]numsubstnumber of substances modelled
[in]qwantwater volume to be removed (based on lake surface area) (mm/timestep)
[out]qoutactual water volume removed (based on lake surface area) (mm/timestep)
[out]cqoutconcentration of water removed (eg. mg/L)
[in,out]lakestateLake state
[in]cqlayer_inconcentration 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:

◆ remove_lake_water_specified_by_layer()

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.

Parameters
[in]isubbasin index
[in]itypelake type (ilake or olake)
[in]nsnumber of substances modelled
[in]qwantwater volume to be removed (based on lake surface area) (mm/timestep)
[in]qfractionwanted outflow fraction from layers (-)
[out]qoutactual water volume removed (based on lake surface area) (mm/timestep)
[out]cqoutconcentration of water removed (eg. mg/L)
[in,out]lakestateLake 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:

◆ remove_outflow_from_layered_lake()

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)

Parameters
[in]iindex of current subbasin
[in]itypelake type (local or main)
[in]nsnumber of substances
[in]outflowmmoutflow of lake (mm/timestep) in volume
[in]ldepthmlake depth (m)
[in]lakewstmmlake water volume (mm) in volume
[out]coutflowconcentration of outflow of lake
[in,out]lakestateLake 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:

◆ reset_lake_layers()

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.

Parameters
[in]itypetype of lake
[in]isbindex of current subbasin
[in]lakearealake area (m2)
[in,out]lakestateLake state

Find the wanted new layer thicknesses (mm water)

+ Here is the call graph for this function:

◆ set_lake_layervolumes()

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.

Parameters
[in]itypetype of lake
[in]isbindex of current subbasin
[in]epidepthdepth to wanted epilimnion+metalimnion depth (m)
[in]maxdepthdepth to maximum area (m)
[in]currentdepthcurrent lake water depth (mm)
[out]volldepthwater volume (mm) in the lake layers
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ top_lake_layer()

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.

Parameters
[in]itypetype of lake
[in]isbindex of current subbasin
[in]lakestateLake state
Return values
top_lake_layeris index of top lake layer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ errstring

character(len=46), dimension(2) layeredlake_processes::errstring
private