|
HYPE
|
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_of_set_concentration (vol, n, conc, q, cq, err) |
| subroutine, public | remove_water (vol, q, err) |
| subroutine, public | error_remove_water (rstring, subid, i, j) |
| subroutine, public | add_water (n, vol, conc, q, cq) |
| 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 |
Routines handling water and concentration in HYPE.
| 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.
| [in] | vol | water body |
| [in] | n | numsubstance = size of conc-array |
| [in,out] | conc | conc of water body |
| [in] | source | amount to be added |
| 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 concentration) to a water body (with concentration).
| [in] | n | numsubstance = size of conc-array |
| [in,out] | vol | water body |
| [in,out] | conc | conc of water body |
| [in] | q | water to be added |
| [in] | cq | conc of water to be added |
| 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).
| [in] | m | dimension (length of river queue) |
| [in] | lastpart | fraction of last queued compartment (m+1) that is active |
| [in] | water1 | primary water compartment (m3) |
| [in] | water2 | secondary water compartment (m3) |
| [in] | wqueue | queued water compartments (m3) |
| [out] | totvol | total volume in river (m3) |
| [out] | fractionw1 | primary water compartment's fraction of total volume |
| [out] | fractionw2 | secondary water compartment's fraction of total volume |
| [out] | fractionqueue | queued water compartments' fractions of total volume |
| [out] | fractionlast | for 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
| 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.
| [in] | rstring | error location in code |
| [in] | subid | current subid |
| [in] | i | current subbasin |
| [in] | j | current class or current laketype |
| 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.
| [in] | n | number of substances |
| [in] | nl | maximum number of soil layers |
| [in] | sl | Lowest soil layer |
| [in] | cin | concentration of inflow |
| [in] | qin | inflow (mm) |
| [in] | maxwc | maximum soil moisture (mm) |
| [in,out] | soil | soil moisture (mm) |
| [in,out] | csoil | concentration of soil |
| [out] | upwardflow | Upwelling due to overflowing lower soil layers (mm/timestep) |
| [out] | addedflow | Added flow (mm/timestep) |
| 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.
| [in] | pool | amount (eg. kg/km2) |
| [in] | vol | volume (eg. mm) |
| [in,out] | conc | concentation (eg. mg/L) |
| 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!).
| [in] | n | number of soillayers = size of pool-array |
| [in,out] | pool | soil pool array |
| [in] | source | amount to be added |
| subroutine, public general_water_concentration::remove_water | ( | real, intent(inout) | vol, |
| real, intent(in) | q, | ||
| integer, intent(out) | err ) |
Subroutine remove a water amount from a water body with the same concentration.
| [in,out] | vol | water body |
| [in] | q | water to be removed |
| [out] | err | error code |
| subroutine, public general_water_concentration::remove_water_of_set_concentration | ( | 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).
| [in,out] | vol | water body |
| [in] | n | numsubstance = size of conc-array |
| [in,out] | conc | concentration of water body |
| [in] | q | water to be removed |
| [in] | cq | concentration of water to be removed |
| [out] | err | error code |
| 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.
| [in] | n | number of soillayers = size of pool-array |
| [in,out] | pool | soil pool array |
| [in,out] | sink | amount to be removed |
|
private |
Value of zero in real.