5.13.2-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mo_mrm_global_variables.f90
Go to the documentation of this file.
1!> \dir mRM
2!> \brief \copybrief f_mrm
3!> \details \copydetails f_mrm
4
5!> \defgroup f_mrm mRM - Fortran modules
6!> \brief Core modules of mRM.
7!> \details These modules provide the core components of mRM.
8
9!> \file mo_mrm_global_variables.f90
10!> \brief \copybrief mo_mrm_global_variables
11!> \details \copydetails mo_mrm_global_variables
12
13!> \brief Global variables for mRM only
14!> \details Global variables used to run mRM for mHM.
15!> \changelog
16!! - Robert Schweppe Dec 2017
17!! - merged duplicated variables with mhm into common variables
18!! - Robert Schweppe Jun 2018
19!! - refactoring and reformatting
20!> \authors Luis Samaniego, Stephan Thober
21!> \date Aug 2015
22!> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
23!! mHM is released under the LGPLv3+ license \license_note
24!> \ingroup f_mrm
26
27 use mo_kind, only : i4, i8, dp
31
32 implicit none
33
34 PUBLIC :: gaugingstation
35
36 ! -------------------------------------------------------------------
37 ! General variables
38 ! -------------------------------------------------------------------
39 logical :: is_start ! flag for first timestep for mpr
40
41 ! -------------------------------------------------------------------
42 ! DEFINE OUTPUTS
43 ! -------------------------------------------------------------------
44 !
45 integer(i4) :: output_deflate_level_mrm !< compression of output nc files
46 integer(i4) :: output_time_reference_mrm !< time reference point location in output nc files
47 logical :: output_double_precision_mrm !< float precision in output nc files
48 integer(i4) :: timestep_model_outputs_mrm !< timestep for writing model outputs
49 logical, dimension(nOutFlxState) :: outputflxstate_mrm !< Define model outputs see "mhm_outputs.nml"
50 ! dim1 = number of output variables to be written
51 logical :: readlatlon
52
53 ! ------------------------------------------------------------------
54 ! DIRECTORIES
55 ! ------------------------------------------------------------------
56 ! has the dimension of nDomains
57 character(256), dimension(:), allocatable, public :: dirgauges ! Directory where discharge files are located
58 character(256), dimension(:), allocatable, public :: dirtotalrunoff ! Directory where simulated total runoff files are located
59 character(256), public :: filenametotalrunoff ! Filename of simulated total runoff file
60 character(256), public :: varnametotalrunoff ! variable name of total runoff
61 character(256), dimension(:), allocatable, public :: dirbankfullrunoff ! Dir. where simulated bankfull runoff files are located
62
63 ! ------------------------------------------------------------------
64 ! CONSTANT
65 ! ------------------------------------------------------------------
66 integer(i4), public :: ntstepday ! Number of time intervals per day
67 ! ! (was previously NAGG)
68
69 ! -------------------------------------------------------------------
70 ! GRID description
71 ! -------------------------------------------------------------------
72 type(grid), dimension(:), allocatable, target, public :: level11 ! Reference of the routing variables
73 type(gridremapper), dimension(:), allocatable, public :: l0_l11_remap ! grid information at runoff level
74
75
76 ! -----------------------------------------------------------------
77 ! RUNOFF variable
78 ! -----------------------------------------------------------------
79 real(dp), dimension(:, :), allocatable, public :: mrm_runoff ! variable containing runoff for each domain and gauge
80
81 ! -----------------------------------------------------------------
82 ! GAUGED station data
83 ! -----------------------------------------------------------------
84 integer(i4), public :: ngaugestotal ! Number of evaluation gauges for all domains
85 integer(i4), public :: ngaugeslocal ! Number of evaluation gauges for all domains on a subprocess
86 integer(i4), public :: ninflowgaugestotal ! Number of evaluation gauges for all domains
87 integer(i4), public :: nmeasperday ! Number of observations per day,
88 ! ! e.g. 24 -> hourly discharge, 1 -> daily discharge
90 integer(i4), dimension(:), allocatable :: domainid ! domain Id
91 integer(i4), dimension(:), allocatable :: gaugeid ! Gauge Id (e.g. 0000444)
92 character(256), dimension(:), allocatable :: fname ! Name runoff file
93 real(dp), dimension(:, :), allocatable :: q ! [m3 s-1] observed daily mean discharge (simPer)
94 ! ! dim1=number observations, dim2=number of gauges
95 real(dp), dimension(:, :), allocatable :: t ! [K] observed daily mean temperature (simPer)
96 end type gaugingstation
97 type(gaugingstation), public :: gauge ! Gauging station information
98 type(gaugingstation), public :: inflowgauge ! inflow gauge information
99
100 ! -------------------------------------------------------------------
101 ! DOMAIN general description
102 ! -------------------------------------------------------------------
104 ! dim1 = maximum number of gauges in a given domain
105 ! discharge measurement gauges
106 integer(i4) :: ngauges ! Number of gauges within a domain
107 integer(i4), dimension(:), allocatable :: gaugeidlist ! Gauge Id list (e.g. 0000444 0000445)
108 integer(i4), dimension(:), allocatable :: gaugeindexlist ! Gauge index list (e.g. 1 for 00444, 2 for 00445)
109 integer(i4), dimension(:), allocatable :: gaugenodelist ! Gauge node list at L11
110
111 ! discharge inflow gauges (e.g if headwar bsins are missing)
112 integer(i4) :: ninflowgauges ! Number of gauges within a domain
113 integer(i4), dimension(:), allocatable :: inflowgaugeidlist ! Gauge Id list (e.g. 0000444 0000445)
114 integer(i4), dimension(:), allocatable :: inflowgaugeindexlist ! Gauge index list (e.g. 1 for 00444, 2 for 00445)
115 integer(i4), dimension(:), allocatable :: inflowgaugenodelist ! Gauge node list at L11
116 logical, dimension(:), allocatable :: inflowgaugeheadwater ! if headwater cells of inflow gauge will be considered
117
118 ! domain outlet
119 ! TODO: move this out of here since it is mrm_net_startup relevant only for domain0
120 integer(i4) :: l0_noutlet
121 integer(i4), dimension(:), allocatable :: l0_rowoutlet ! Outlet locations in L0
122 integer(i4), dimension(:), allocatable :: l0_coloutlet ! Outlet locations in L0
123 end type domaininfo_mrm
124
125 ! dim1 = domainId
126 type(domaininfo_mrm), dimension(:), allocatable, public, target :: domain_mrm ! domain structure
127 ! -------------------------------------------------------------------
128 ! L0 DOMAIN description -> those are needed within the mrm_net_startup routines only
129 ! TODO: deallocate when net_startup is done
130 ! -------------------------------------------------------------------
131 ! dim1 = number grid cells
132 ! input data - morphological variables
133 integer(i4), public, dimension(:), allocatable :: l0_gaugeloc ! Location of gauges within the catchment
134 integer(i4), public, dimension(:), allocatable :: l0_inflowgaugeloc ! Location of inflow gauges within catchment
135 integer(i4), public, dimension(:), allocatable :: l0_facc ! Flow accumulation
136 integer(i4), public, dimension(:), allocatable :: l0_fdir ! Flow direction (standard ArcGIS)
137 !
138 ! mRM derived variables
139 ! dim1 = number grid cells L0
140 integer(i4), public, dimension(:), allocatable :: l0_drasc ! Index of draining cell of each sub catchment
141 ! ! i.e. a routing cell L11
142 integer(i4), public, dimension(:), allocatable :: l0_dracell ! Draining cell id at L11 of ith cell of L0
143 integer(i4), public, dimension(:), allocatable :: l0_streamnet ! Stream network
144 integer(i4), public, dimension(:), allocatable :: l0_floodplain ! Floodplains of stream i
145 integer(i4), public, dimension(:), allocatable :: l0_noutlet ! number of river outlets at level 0
146 real(dp), public, dimension(:), allocatable :: l0_celerity ! celerity at level 0
147
148 ! -------------------------------------------------------------------
149 ! L1 DOMAIN description
150 ! -------------------------------------------------------------------
151 ! dim1 = number grid cells L1
152 integer(i4), public, dimension(:), allocatable :: l11_l1_id ! Mapping of L11 Id on L1
153 ! -------------------------------------------------------------------
154 ! L1 variables
155 ! -------------------------------------------------------------------
156 ! dim1 = number grid cells L1
157 ! dim2 = number of timesteps
158 real(dp), public, dimension(:, :), allocatable :: l1_total_runoff_in
159
160 ! -------------------------------------------------------------------
161 ! L11 DOMAIN description
162 ! -------------------------------------------------------------------
163 ! dim1 = number grid cells L11
164 ! dim2 = 2
165 integer(i4), public, dimension(:,:), allocatable :: l11_cellcoor ! Cell coordinates (row,col)
166 ! ! -> <only domain> Routing
167 integer(i4), public, dimension(:), allocatable :: l1_l11_id ! Mapping of L1 Id on L11
168 real(dp), public, dimension(:), allocatable :: l11_areacell ! [km2] Effective area of cell at this level
169 real(dp), public, dimension(:), allocatable :: l11_facc ! [km2] flow Accumulation of cell at this level
170 integer(i4), public, dimension(:), allocatable :: l11_fdir ! Flow direction (standard notation)
171 integer(i4), public, dimension(:), allocatable :: l11_noutlets
172 real(dp), public, dimension(:), allocatable :: l11_celerity ! [m/s] celerity per grid-cell, only for
173 ! routing-case = 3
174 real(dp), public, dimension(:), allocatable :: l11_meandering ! Proxy: L11_length/Lopt
175 ! Lopt := shortest possible way of stream
176 real(dp), public, dimension(:), allocatable :: l11_linkin_facc ! fAcc inflow per Link
177
178 ! Constants
179 ! dim1 = number grid cells L11
180 integer(i4), public, dimension(:), allocatable :: l11_rowout ! Grid vertical location of the Outlet
181 integer(i4), public, dimension(:), allocatable :: l11_colout ! Grid horizontal location of the Outlet
182
183 ! -------------------------------------------------------------------
184 ! L11 NETWORK description
185 ! -------------------------------------------------------------------
186 ! Fluxes
187 ! dim1 = number grid cells L11
188 ! dim2 = 2
189 real(dp), public, dimension(:), allocatable :: l11_qmod ! [m3 s-1] Simulated discharge
190 real(dp), public, dimension(:), allocatable :: l11_qout ! [m3 s-1] Total outflow from cells L11 at time tt
191 real(dp), public, dimension(:, :), allocatable :: l11_qtin ! Total discharge inputs at t-1 and t
192 real(dp), public, dimension(:, :), allocatable :: l11_qtr ! Routed outflow leaving a node
193
194 integer(i4), public, dimension(:), allocatable :: l11_fromn ! From node (sinks are at the end)
195 integer(i4), public, dimension(:), allocatable :: l11_ton ! To node (sinks are at the end)
196 integer(i4), public, dimension(:), allocatable :: l11_netperm ! Routing sequence (permutation of L11_rOrder)
197 integer(i4), public, dimension(:), allocatable :: l11_frow ! From row in L0 grid
198 integer(i4), public, dimension(:), allocatable :: l11_fcol ! From col in L0 grid
199 integer(i4), public, dimension(:), allocatable :: l11_trow ! To row in L0 grid
200 integer(i4), public, dimension(:), allocatable :: l11_tcol ! To col in L0 grid
201 integer(i4), public, dimension(:), allocatable :: l11_rorder ! Network routing order
202 integer(i4), public, dimension(:), allocatable :: l11_label ! Label Id [0='', 1=HeadWater, 2=Sink]
203 logical, public, dimension(:), allocatable :: l11_sink ! .true. if sink node reached
204 real(dp), public, dimension(:), allocatable :: l11_length ! [m] Total length of river link
205 real(dp), public, dimension(:), allocatable, target :: l11_afloodplain ! [m2] Area of the flood plain
206 ! ! impervious cover
207 real(dp), public, dimension(:), allocatable :: l11_slope ! [1] Average slope of river link
208
209 ! Parameters
210 ! dim1 = number grid cells L11
211 real(dp), public, dimension(:, :), allocatable :: l11_nlinkfracfpimp ! fraction of impervious lcover at the floodplain
212 ! dims: nLink, LCYearID
213
214 real(dp), public, dimension(:), allocatable :: l11_k ! [d] kappa: Muskingum travel time parameter.
215 real(dp), public, dimension(:), allocatable :: l11_xi ! [1] xi: Muskingum diffusion parameter
216 ! ! (attenuation).
217 real(dp), public, dimension(:), allocatable :: l11_tsrout ! [s] Routing timestep
218 real(dp), public, dimension(:), allocatable :: l11_c1 ! [-] Routing parameter C1=f(K,xi, DT) (Chow, 25-41)
219 real(dp), public, dimension(:), allocatable :: l11_c2 ! [-] Routing parameter C2 (")
220
221 ! -------------------------------------------------------------------
222 ! GROUNDWATER COUPLING VARIABLES
223 ! -------------------------------------------------------------------
224 ! TODO this must be read from nml
225 logical :: gw_coupling
226 ! dim1 = number grid cells L1
227 real(dp), public, dimension(:), allocatable :: l11_bankfull_runoff_in
228 ! dim2 = number grid cells L0
229 real(dp), public, dimension(:), allocatable :: l0_channel_depth
230 real(dp), public, dimension(:), allocatable :: l0_channel_elevation
231 ! the cumulated river heads, for monthly average
232 real(dp), public, dimension(:), allocatable :: l0_river_head_mon_sum
233 real(dp), public, dimension(:), allocatable :: l0_slope
234
235 ! -------------------------------------------------------------------
236 ! RIVER TEMPERATURE VARIABLES
237 ! -------------------------------------------------------------------
238 !> This is a container for the river temperature routing process (pcs)
Provides common types needed by mHM, mRM and/or mpr.
Provides mRM specific constants.
integer(i4), parameter, public noutflxstate
Global variables for mRM only.
type(gaugingstation), public inflowgauge
integer(i4), dimension(:,:), allocatable, public l11_cellcoor
real(dp), dimension(:, :), allocatable, public l11_qtin
type(gridremapper), dimension(:), allocatable, public l0_l11_remap
integer(i4), dimension(:), allocatable, public l0_floodplain
real(dp), dimension(:), allocatable, public l11_facc
integer(i4), dimension(:), allocatable, public l11_netperm
real(dp), dimension(:), allocatable, public l11_qout
real(dp), dimension(:, :), allocatable, public l11_nlinkfracfpimp
integer(i4), dimension(:), allocatable, public l11_l1_id
integer(i4), dimension(:), allocatable, public l1_l11_id
logical output_double_precision_mrm
float precision in output nc files
real(dp), dimension(:), allocatable, public l0_celerity
type(riv_temp_type), public riv_temp_pcs
This is a container for the river temperature routing process (pcs)
real(dp), dimension(:), allocatable, target, public l11_afloodplain
integer(i4), dimension(:), allocatable, public l0_fdir
integer(i4), dimension(:), allocatable, public l0_noutlet
integer(i4), dimension(:), allocatable, public l11_fcol
character(256), dimension(:), allocatable, public dirbankfullrunoff
real(dp), dimension(:), allocatable, public l11_xi
integer(i4), dimension(:), allocatable, public l0_dracell
integer(i4), dimension(:), allocatable, public l11_label
real(dp), dimension(:), allocatable, public l0_channel_depth
integer(i4), dimension(:), allocatable, public l0_streamnet
real(dp), dimension(:, :), allocatable, public mrm_runoff
character(256), dimension(:), allocatable, public dirgauges
integer(i4) output_time_reference_mrm
time reference point location in output nc files
type(gaugingstation), public gauge
integer(i4), dimension(:), allocatable, public l11_fromn
logical, dimension(noutflxstate) outputflxstate_mrm
Define model outputs see "mhm_outputs.nml".
real(dp), dimension(:), allocatable, public l11_length
integer(i4), dimension(:), allocatable, public l11_rowout
real(dp), dimension(:), allocatable, public l11_qmod
integer(i4), dimension(:), allocatable, public l11_ton
type(domaininfo_mrm), dimension(:), allocatable, target, public domain_mrm
integer(i4), dimension(:), allocatable, public l11_trow
type(grid), dimension(:), allocatable, target, public level11
character(256), public varnametotalrunoff
integer(i4), dimension(:), allocatable, public l11_fdir
integer(i4), dimension(:), allocatable, public l0_facc
integer(i4) timestep_model_outputs_mrm
timestep for writing model outputs
real(dp), dimension(:), allocatable, public l11_c1
integer(i4), dimension(:), allocatable, public l11_tcol
integer(i4), dimension(:), allocatable, public l11_frow
real(dp), dimension(:), allocatable, public l0_slope
real(dp), dimension(:), allocatable, public l11_slope
logical, dimension(:), allocatable, public l11_sink
integer(i4), dimension(:), allocatable, public l0_inflowgaugeloc
character(256), dimension(:), allocatable, public dirtotalrunoff
real(dp), dimension(:, :), allocatable, public l1_total_runoff_in
real(dp), dimension(:), allocatable, public l11_celerity
real(dp), dimension(:), allocatable, public l11_bankfull_runoff_in
integer(i4), dimension(:), allocatable, public l11_noutlets
integer(i4), public ninflowgaugestotal
real(dp), dimension(:), allocatable, public l11_k
integer(i4), dimension(:), allocatable, public l0_drasc
integer(i4), dimension(:), allocatable, public l11_rorder
real(dp), dimension(:), allocatable, public l11_tsrout
real(dp), dimension(:), allocatable, public l11_linkin_facc
integer(i4), dimension(:), allocatable, public l0_gaugeloc
real(dp), dimension(:), allocatable, public l0_river_head_mon_sum
real(dp), dimension(:), allocatable, public l0_channel_elevation
integer(i4), dimension(:), allocatable, public l11_colout
real(dp), dimension(:, :), allocatable, public l11_qtr
real(dp), dimension(:), allocatable, public l11_areacell
real(dp), dimension(:), allocatable, public l11_meandering
integer(i4) output_deflate_level_mrm
compression of output nc files
real(dp), dimension(:), allocatable, public l11_c2
character(256), public filenametotalrunoff
Class for the river temperature calculations.
This is a container to define the river temperature routing in the current time step.