HYPE
Functions/Subroutines | Variables
general_water_concentration Module Reference

Functions/Subroutines

subroutine, public retention_pool (n, pool, sink)
 
subroutine, public production_pool (n, pool, source)
 
subroutine, public new_concentration (pool, vol, conc)
 
subroutine, public remove_water (vol, n, conc, q, cq, err)
 
subroutine, public add_water (n, vol, conc, q, cq)
 
subroutine, public error_remove_water (rstring, subid, i, j)
 
subroutine, public add_source_to_water (vol, n, conc, source)
 
subroutine, public inflow_lowest_soillayer (n, nl, sl, cin, qin, maxwc, soil, csoil, upwardflow, addedflow)
 
subroutine, public calculate_water_fractions (m, lastpart, water1, water2, wqueue, totvol, fractionw1, fractionw2, fractionqueue, fractionlast)
 

Variables

real, parameter realzero = 1.E-37
 

Detailed Description

Routines handling water and concentration in HYPE.

Function/Subroutine Documentation

◆ add_source_to_water()

subroutine, public general_water_concentration::add_source_to_water ( real, intent(in)  vol,
integer, intent(in)  n,
real, dimension(n), intent(inout)  conc,
real, dimension(n), intent(in)  source 
)

Subroutine add an amount of substance to a water body and recalculate the concentration.

Parameters
[in]volwater body
[in]nnumsubstance = size of conc-array
[in,out]concconc of water body
[in]sourceamount to be added
+ Here is the caller graph for this function:

◆ add_water()

subroutine, public general_water_concentration::add_water ( integer, intent(in)  n,
real, intent(inout)  vol,
real, dimension(n), intent(inout)  conc,
real, intent(in)  q,
real, dimension(n), intent(in)  cq 
)

Subroutine add a flow/volume (with substances) to a water body (with concentration)

Parameters
[in]nnumsubstance = size of conc-array
[in,out]volwater body
[in,out]concconc of water body
[in]qwater to be added
[in]cqconc of water to be added
+ Here is the caller graph for this function:

◆ calculate_water_fractions()

subroutine, public general_water_concentration::calculate_water_fractions ( integer, intent(in)  m,
real, intent(in)  lastpart,
real, intent(in)  water1,
real, intent(in)  water2,
real, dimension(m+1), intent(in)  wqueue,
real, intent(out)  totvol,
real, intent(out)  fractionw1,
real, intent(out)  fractionw2,
real, dimension(m), intent(out)  fractionqueue,
real, intent(out)  fractionlast 
)

Calculate volume fractions of water compartments (used for rivers)

Parameters
[in]mdimension (length of river queue)
[in]lastpartfraction of last queued compartment (m+1) that is active
[in]water1primary water compartment (m3)
[in]water2secondary water compartment (m3)
[in]wqueuequeued water compartments (m3)
[out]totvoltotal volume in river (m3)
[out]fractionw1primary water compartment's fraction of total volume
[out]fractionw2secondary water compartment's fraction of total volume
[out]fractionqueuequeued water compartments' fractions of total volume
[out]fractionlastfor the last queued water compartment, the fraction is based on whole volume

Algorithm
Initialization

Calculate total volume as a baseline for checking fractions of water in different compartment

Calculate which water compartments that is positive and thus included in the total volume

Calculate fractions of water compartments

+ Here is the caller graph for this function:

◆ error_remove_water()

subroutine, public general_water_concentration::error_remove_water ( character(len=*), intent(in)  rstring,
integer, intent(in)  subid,
integer, intent(in)  i,
integer, intent(in)  j 
)

Handle error in remove_water subroutine.

Parameters
[in]rstringerror location in code
[in]subidcurrent subid
[in]icurrent subbasin
[in]jcurrent class or current laketype
+ Here is the caller graph for this function:

◆ inflow_lowest_soillayer()

subroutine, public general_water_concentration::inflow_lowest_soillayer ( integer, intent(in)  n,
integer, intent(in)  nl,
integer, intent(in)  sl,
real, dimension(n), intent(in)  cin,
real, intent(in)  qin,
real, dimension(nl), intent(in)  maxwc,
real, dimension(nl), intent(inout)  soil,
real, dimension(n,nl), intent(inout)  csoil,
real, dimension(nl-1), intent(out)  upwardflow,
real, dimension(nl), intent(out)  addedflow 
)

Subroutine for adding inflow to lowest soillayer including substances. May result in flow upward through layers.

Parameters
[in]nnumber of substances
[in]nlmaximum number of soil layers
[in]slLowest soil layer
[in]cinconcentration of inflow
[in]qininflow (mm)
[in]maxwcmaximum soil moisture (mm)
[in,out]soilsoil moisture (mm)
[in,out]csoilconcentration of soil
[out]upwardflowUpwelling due to overflowing lower soil layers (mm/timestep)
[out]addedflowAdded flow (mm/timestep)
+ Here is the caller graph for this function:

◆ new_concentration()

subroutine, public general_water_concentration::new_concentration ( real, intent(in)  pool,
real, intent(in)  vol,
real, intent(inout)  conc 
)

Calculates concentration based on water volume and amount of one substance.

Parameters
[in]poolamount (eg. kg/km2)
[in]volvolume (eg. mm)
[in,out]concconcentation (eg. mg/L)
+ Here is the caller graph for this function:

◆ production_pool()

subroutine, public general_water_concentration::production_pool ( integer, intent(in)  n,
real, dimension(n), intent(inout)  pool,
real, dimension(n), intent(in)  source 
)

Add an amount of substances to a pool. If source is negative it is removed (without checking pool size!).

Parameters
[in]nnumber of soillayers = size of pool-array
[in,out]poolsoil pool array
[in]sourceamount to be added
+ Here is the caller graph for this function:

◆ remove_water()

subroutine, public general_water_concentration::remove_water ( real, intent(inout)  vol,
integer, intent(in)  n,
real, dimension(n), intent(inout)  conc,
real, intent(in)  q,
real, dimension(n), intent(in)  cq,
integer, intent(out)  err 
)

Subroutine remove a flow (with substances) from a water body (with concentration)

Parameters
[in,out]volwater body
[in]nnumsubstance = size of conc-array
[in,out]concconc of water body
[in]qwater to be removed
[in]cqconc of water to be removed
[out]errerror code
+ Here is the caller graph for this function:

◆ retention_pool()

subroutine, public general_water_concentration::retention_pool ( integer, intent(in)  n,
real, dimension(n), intent(inout)  pool,
real, dimension(n), intent(inout)  sink 
)

Removes an amount of substances from a pool. If the sink is larger than the pool it removes all of the pool and changes the sink to what was actually removed. If sink is negativ it is added.

Parameters
[in]nnumber of soillayers = size of pool-array
[in,out]poolsoil pool array
[in,out]sinkamount to be removed
+ Here is the caller graph for this function:

Variable Documentation

◆ realzero

real, parameter general_water_concentration::realzero = 1.E-37
private

Value of zero in real.