Diversions Module

History

current version 1.1 - 2nd September 2024

version date comment
1.0 25/Jan/2024 module split from reservoirs
1.1 02/Sep/2024 routine DiversioSaveStatus to save discharge for starting next simulation
1.2 04/Mar/2025 no more need to assign weir-change-doy in diversion configuration file

License

license: GNU GPL http://www.gnu.org/licenses/

Module Description

This module includes data and routines to manage diversions along the river network in the distributed model. The module can manage both bypass channels (diverted flow from a point upstream is discharged back to the same river), and diversion channels (diverted flow is discharged into another natural drainage system nearby).



Variables

Type Visibility Attributes Name Initial
type(Diversion), public, POINTER :: diversionChannels
integer(kind=short), public :: dtDiversion
integer(kind=short), public :: dtOutDiversion
integer(kind=short), private :: nDiversions

total number of diversions


Derived Types

type, public ::  Diversion

Components

Type Visibility Attributes Name Initial
real(kind=float), public :: PinChannel

Input discharge into diversion at time t (m3/s)

real(kind=float), public :: PoutChannel

Output discharge into diversion at time t (m3/s)

real(kind=float), public :: QinChannel

Input discharge into diversion at time t+dt (m3/s)

real(kind=float), public :: Qout

discharge flowing in the natural river downstream diversion (m3/s)

real(kind=float), public :: QoutChannel

Output discharge into diversion at time t+dt (m3/s)

integer(kind=short), public :: c

cell column j

real(kind=float), public :: channelBankSlope

diversion channel section bank slope (deg)

real(kind=float), public :: channelLenght

diversion channel lenght (m)

real(kind=float), public :: channelManning

diversion channel Manning roughness [s m^-1/3]

real(kind=float), public :: channelSlope

diversion channel slope (m/m)

real(kind=float), public :: channelWidth

diversion channel bottom width (m)

integer(kind=short), public :: cout

cell column where off-stream pool outflow is discharged

real(kind=float), public :: eFlow(365)

daily environmental flow [m3/s]

integer(kind=short), public :: fileunitOut

file unit for writing results

integer(kind=short), public :: id

diversion id

character(len=100), public :: name

diversion name

type(Diversion), public, POINTER :: next

dynamic list

integer(kind=short), public :: r

cell row i

integer(kind=short), public :: rout

cell row where off-stream pool outflow is discharged

type(Table), public :: weir

stream-diverted flow relationship

integer(kind=short), public :: weirDOY(365)

weir function used daily

real(kind=float), public :: xout

x coordinate where diverted flow is discharged

type(Coordinate), public :: xyz

easting, northing and elevation in real world

real(kind=float), public :: yout

y coordinate where diverted flow is discharged


Functions

public function GetDiversionById(list, id) result(p)

given a list of diversion channels, returns a pointer to one diversion by id

Arguments

Type IntentOptional Attributes Name
type(Diversion), intent(in), POINTER :: list
integer(kind=short), intent(in) :: id

Return Value type(Diversion), POINTER

private function SetDailyArray(value) result(array)

populate array of daily values

Arguments

Type IntentOptional Attributes Name
character(len=*) :: value

Return Value real(kind=float), (365)


Subroutines

public subroutine DiversionSaveStatus(pathOut, time)

save diversion state variables on file

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pathOut
type(DateTime), intent(in), optional :: time

public subroutine InitDiversions(fileIni)

Initialize diversions

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: fileIni

diversion configuration file

public subroutine OutDiversions(list, time, Qin, Qout)

write results on files

Arguments

Type IntentOptional Attributes Name
type(Diversion), intent(in), POINTER :: list
type(DateTime), intent(in) :: time
type(grid_real), intent(in) :: Qin
type(grid_real), intent(in) :: Qout

public subroutine OutDiversionsInit(pathOut)

initialise files for output

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pathOut

private subroutine ReadWeir(iniDB, k, div)

read weir table

Arguments

Type IntentOptional Attributes Name
type(IniList), intent(in) :: iniDB
integer(kind=short), intent(in) :: k
type(Diversion), intent(inout), POINTER :: div