Line data Source code
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
25 : module mo_mrm_global_variables
26 :
27 : use mo_kind, only : i4, i8, dp
28 : use mo_mrm_constants, only : nOutFlxState
29 : use mo_common_types, only : Grid, GridRemapper
30 : use mo_mrm_riv_temp_class, only : riv_temp_type
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
89 : type gaugingStation
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 : ! -------------------------------------------------------------------
103 : type domainInfo_mRM
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)
239 : type(riv_temp_type), public :: riv_temp_pcs
240 0 : end module mo_mrm_global_variables
|