5.13.3-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 !> \class sink_cells_t
129 !> \brief container to hold all sink cell ids for a domain
130 type, public :: sink_cells_t
131 integer(i4), dimension(:), allocatable :: ids ! cell ids of sinks
132 end type sink_cells_t
133 type(sink_cells_t), dimension(:), allocatable :: sink_cells !< sink cell ids for each domain
134
135 ! -------------------------------------------------------------------
136 ! L0 DOMAIN description -> those are needed within the mrm_net_startup routines only
137 ! TODO: deallocate when net_startup is done
138 ! -------------------------------------------------------------------
139 ! dim1 = number grid cells
140 ! input data - morphological variables
141 integer(i4), public, dimension(:), allocatable :: l0_gaugeloc ! Location of gauges within the catchment
142 integer(i4), public, dimension(:), allocatable :: l0_inflowgaugeloc ! Location of inflow gauges within catchment
143 integer(i4), public, dimension(:), allocatable :: l0_facc ! Flow accumulation
144 integer(i4), public, dimension(:), allocatable :: l0_fdir ! Flow direction (standard ArcGIS)
145 !
146 ! mRM derived variables
147 ! dim1 = number grid cells L0
148 integer(i4), public, dimension(:), allocatable :: l0_drasc ! Index of draining cell of each sub catchment
149 ! ! i.e. a routing cell L11
150 integer(i4), public, dimension(:), allocatable :: l0_dracell ! Draining cell id at L11 of ith cell of L0
151 integer(i4), public, dimension(:), allocatable :: l0_streamnet ! Stream network
152 integer(i4), public, dimension(:), allocatable :: l0_floodplain ! Floodplains of stream i
153 integer(i4), public, dimension(:), allocatable :: l0_noutlet ! number of river outlets at level 0
154 real(dp), public, dimension(:), allocatable :: l0_celerity ! celerity at level 0
155
156 ! -------------------------------------------------------------------
157 ! L1 DOMAIN description
158 ! -------------------------------------------------------------------
159 ! dim1 = number grid cells L1
160 integer(i4), public, dimension(:), allocatable :: l11_l1_id ! Mapping of L11 Id on L1
161 ! -------------------------------------------------------------------
162 ! L1 variables
163 ! -------------------------------------------------------------------
164 ! dim1 = number grid cells L1
165 ! dim2 = number of timesteps
166 real(dp), public, dimension(:, :), allocatable :: l1_total_runoff_in
167
168 ! -------------------------------------------------------------------
169 ! L11 DOMAIN description
170 ! -------------------------------------------------------------------
171 ! dim1 = number grid cells L11
172 ! dim2 = 2
173 integer(i4), public, dimension(:,:), allocatable :: l11_cellcoor ! Cell coordinates (row,col)
174 ! ! -> <only domain> Routing
175 integer(i4), public, dimension(:), allocatable :: l1_l11_id ! Mapping of L1 Id on L11
176 real(dp), public, dimension(:), allocatable :: l11_areacell ! [km2] Effective area of cell at this level
177 real(dp), public, dimension(:), allocatable :: l11_facc ! [km2] flow Accumulation of cell at this level
178 integer(i4), public, dimension(:), allocatable :: l11_fdir ! Flow direction (standard notation)
179 integer(i4), public, dimension(:), allocatable :: l11_noutlets
180 real(dp), public, dimension(:), allocatable :: l11_celerity ! [m/s] celerity per grid-cell, only for
181 ! routing-case = 3
182 real(dp), public, dimension(:), allocatable :: l11_meandering ! Proxy: L11_length/Lopt
183 ! Lopt := shortest possible way of stream
184 real(dp), public, dimension(:), allocatable :: l11_linkin_facc ! fAcc inflow per Link
185
186 ! Constants
187 ! dim1 = number grid cells L11
188 integer(i4), public, dimension(:), allocatable :: l11_rowout ! Grid vertical location of the Outlet
189 integer(i4), public, dimension(:), allocatable :: l11_colout ! Grid horizontal location of the Outlet
190
191 ! -------------------------------------------------------------------
192 ! L11 NETWORK description
193 ! -------------------------------------------------------------------
194 ! Fluxes
195 ! dim1 = number grid cells L11
196 ! dim2 = 2
197 real(dp), public, dimension(:), allocatable :: l11_qmod ! [m3 s-1] Simulated discharge
198 real(dp), public, dimension(:), allocatable :: l11_qout ! [m3 s-1] Total outflow from cells L11 at time tt
199 real(dp), public, dimension(:, :), allocatable :: l11_qtin ! Total discharge inputs at t-1 and t
200 real(dp), public, dimension(:, :), allocatable :: l11_qtr ! Routed outflow leaving a node
201
202 integer(i4), public, dimension(:), allocatable :: l11_fromn ! From node (sinks are at the end)
203 integer(i4), public, dimension(:), allocatable :: l11_ton ! To node (sinks are at the end)
204 integer(i4), public, dimension(:), allocatable :: l11_netperm ! Routing sequence (permutation of L11_rOrder)
205 integer(i4), public, dimension(:), allocatable :: l11_frow ! From row in L0 grid
206 integer(i4), public, dimension(:), allocatable :: l11_fcol ! From col in L0 grid
207 integer(i4), public, dimension(:), allocatable :: l11_trow ! To row in L0 grid
208 integer(i4), public, dimension(:), allocatable :: l11_tcol ! To col in L0 grid
209 integer(i4), public, dimension(:), allocatable :: l11_rorder ! Network routing order
210 integer(i4), public, dimension(:), allocatable :: l11_label ! Label Id [0='', 1=HeadWater, 2=Sink]
211 logical, public, dimension(:), allocatable :: l11_sink ! .true. if sink node reached
212 real(dp), public, dimension(:), allocatable :: l11_length ! [m] Total length of river link
213 real(dp), public, dimension(:), allocatable, target :: l11_afloodplain ! [m2] Area of the flood plain
214 ! ! impervious cover
215 real(dp), public, dimension(:), allocatable :: l11_slope ! [1] Average slope of river link
216
217 ! Parameters
218 ! dim1 = number grid cells L11
219 real(dp), public, dimension(:, :), allocatable :: l11_nlinkfracfpimp ! fraction of impervious lcover at the floodplain
220 ! dims: nLink, LCYearID
221
222 real(dp), public, dimension(:), allocatable :: l11_k ! [d] kappa: Muskingum travel time parameter.
223 real(dp), public, dimension(:), allocatable :: l11_xi ! [1] xi: Muskingum diffusion parameter
224 ! ! (attenuation).
225 real(dp), public, dimension(:), allocatable :: l11_tsrout ! [s] Routing timestep
226 real(dp), public, dimension(:), allocatable :: l11_c1 ! [-] Routing parameter C1=f(K,xi, DT) (Chow, 25-41)
227 real(dp), public, dimension(:), allocatable :: l11_c2 ! [-] Routing parameter C2 (")
228
229 ! -------------------------------------------------------------------
230 ! GROUNDWATER COUPLING VARIABLES
231 ! -------------------------------------------------------------------
232 ! TODO this must be read from nml
233 logical :: gw_coupling
234 ! dim1 = number grid cells L1
235 real(dp), public, dimension(:), allocatable :: l11_bankfull_runoff_in
236 ! dim2 = number grid cells L0
237 real(dp), public, dimension(:), allocatable :: l0_channel_depth
238 real(dp), public, dimension(:), allocatable :: l0_channel_elevation
239 ! the cumulated river heads, for monthly average
240 real(dp), public, dimension(:), allocatable :: l0_river_head_mon_sum
241 real(dp), public, dimension(:), allocatable :: l0_slope
242
243 ! -------------------------------------------------------------------
244 ! RIVER TEMPERATURE VARIABLES
245 ! -------------------------------------------------------------------
246 !> 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
type(sink_cells_t), dimension(:), allocatable sink_cells
sink cell ids for each domain
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.
container to hold all sink cell ids for a domain
This is a container to define the river temperature routing in the current time step.