Line data Source code
1 : !> \file mo_init_states.f90
2 : !> \brief \copybrief mo_init_states
3 : !> \details \copydetails mo_init_states
4 :
5 : !> \brief Initialization of all state variables of mHM.
6 : !> \details This module initializes all state variables required to run mHM.
7 : !!
8 : !! Two options are provided:
9 : !! - (1) default values
10 : !! - (2) from nc file
11 : !> \authors Luis Samaniego & Rohini Kumar
12 : !> \date Dec 2012
13 : !> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
14 : !! mHM is released under the LGPLv3+ license \license_note
15 : !> \ingroup f_mhm
16 : MODULE mo_init_states
17 :
18 : USE mo_kind, ONLY : i4, dp
19 :
20 : IMPLICIT NONE
21 :
22 : PRIVATE
23 :
24 : PUBLIC :: variables_alloc ! allocation of space for state variables/fluxes/effective parameters
25 : PUBLIC :: variables_default_init ! initialization for state variables/fluxes/effective parameters
26 : PUBLIC :: fluxes_states_default_init ! initialization for state/fluxes variables
27 :
28 : CONTAINS
29 :
30 :
31 : !> \brief Allocation of space for mHM related L1 and L11 variables.
32 : !> \details Allocation of space for mHM related L1 and L11 variables (e.g., states,
33 : !! fluxes, and parameters) for a given domain. Variables allocated here is
34 : !! defined in them mo_global_variables.f90 file. After allocating any variable
35 : !! in this routine, initalize them in the following variables_default_init subroutine.
36 : !> \changelog
37 : !! - R. Kumar Sep 2013
38 : !! - documentation added according to the template
39 : !! - S. Thober Aug 2015
40 : !! - removed routing related variables
41 : !! - Zink M. Demirel C. Mar 2017
42 : !! - Init Jarvis soil water stress variable at SM process(3)
43 : !! - Robert Schweppe Dec 2017
44 : !! - restructured allocation in variables_alloc, expanded dimensions of effective parameters
45 : !! - Robert Schweppe Jun 2018
46 : !! - refactoring and reformatting
47 : !> \authors Rohini Kumar
48 : !> \date Jan 2013
49 86 : subroutine variables_alloc(ncells1)
50 :
51 : use mo_append, only : append
52 : use mo_common_constants, only : P1_InitStateFluxes
53 : use mo_global_variables, only : L1_Throughfall, L1_aETCanopy, L1_aETSealed, L1_aETSoil, L1_baseflow, &
54 : L1_fastRunoff, L1_infilSoil, L1_inter, L1_melt, L1_neutrons, L1_percol, &
55 : L1_pet_calc, L1_temp_calc, L1_prec_calc, &
56 : L1_preEffect, L1_rain, L1_runoffSeal, L1_satSTW, L1_sealSTW, &
57 : L1_slowRunoff, L1_snow, L1_snowPack, L1_soilMoist, L1_total_runoff, L1_unsatSTW
58 : use mo_mpr_constants, only : C1_InitStateSM, P2_InitStateFluxes, P3_InitStateFluxes, &
59 : P4_InitStateFluxes, P5_InitStateFluxes
60 : use mo_mpr_global_variables, only : HorizonDepth_mHM, nSoilHorizons_mHM
61 :
62 : implicit none
63 :
64 : integer(i4), intent(in) :: ncells1 !< number of level-1 cells
65 :
66 : integer(i4) :: i
67 :
68 26 : real(dp), dimension(:), allocatable :: dummy_1D
69 :
70 26 : real(dp), dimension(:, :), allocatable :: dummy_2D
71 :
72 :
73 : ! for appending and intialization
74 78 : allocate(dummy_1D(nCells1))
75 104 : allocate(dummy_2D(nCells1, nSoilHorizons_mHM))
76 :
77 1131 : dummy_1D = P1_InitStateFluxes
78 2262 : dummy_2D = P1_InitStateFluxes
79 :
80 : !-------------------------------------------
81 : ! FLUXES
82 : !-------------------------------------------
83 : ! calculated / corrected potential evapotranspiration
84 26 : call append(L1_pet_calc, dummy_1D)
85 : ! temperature for current time step
86 26 : call append(L1_temp_calc, dummy_1D)
87 : ! precipitation for current time step
88 26 : call append(L1_prec_calc, dummy_1D)
89 : ! soil actual ET
90 26 : call append(L1_aETSoil, dummy_2D)
91 : ! canopy actual ET
92 26 : call append(L1_aETCanopy, dummy_1D)
93 : ! sealed area actual ET
94 26 : call append(L1_aETSealed, dummy_1D)
95 : ! baseflow
96 26 : call append(L1_baseflow, dummy_1D)
97 : ! soil in-exfiltration
98 26 : call append(L1_infilSoil, dummy_2D)
99 : ! fast runoff
100 26 : call append(L1_fastRunoff, dummy_1D)
101 : ! snow melt
102 26 : call append(L1_melt, dummy_1D)
103 : ! percolation
104 26 : call append(L1_percol, dummy_1D)
105 : ! effective precip. depth (snow melt + rain)
106 26 : call append(L1_preEffect, dummy_1D)
107 : ! rain (liquid water)
108 26 : call append(L1_rain, dummy_1D)
109 : ! runoff from impervious area
110 26 : call append(L1_runoffSeal, dummy_1D)
111 : ! slow runoff
112 26 : call append(L1_slowRunoff, dummy_1D)
113 : ! snow (solid water)
114 26 : call append(L1_snow, dummy_1D)
115 : ! throughfall
116 26 : call append(L1_Throughfall, dummy_1D)
117 : ! throughfall
118 26 : call append(L1_total_runoff, dummy_1D)
119 :
120 : !-------------------------------------------
121 : ! STATE VARIABLES
122 : !-------------------------------------------
123 : ! Interception
124 26 : call append(L1_inter, dummy_1D)
125 : !Retention storage of impervious areas
126 26 : call append(L1_sealSTW, dummy_1D)
127 : ! ground albedo neutrons
128 26 : call append(L1_neutrons, dummy_1D)
129 : !Snowpack
130 1131 : dummy_1D = P2_InitStateFluxes
131 26 : call append(L1_snowPack, dummy_1D)
132 : ! upper soil storage
133 1131 : dummy_1D = P3_InitStateFluxes
134 26 : call append(L1_unsatSTW, dummy_1D)
135 : ! groundwater storage
136 1131 : dummy_1D = P4_InitStateFluxes
137 26 : call append(L1_satSTW, dummy_1D)
138 : ! Soil moisture of each horizon
139 52 : do i = 1, nSoilHorizons_mHM - 1
140 52 : if (i == 1) then
141 1105 : dummy_2D(:, i) = HorizonDepth_mHM(i) * C1_InitStateSM
142 : else
143 0 : dummy_2D(:, i) = (HorizonDepth_mHM(i) - HorizonDepth_mHM(i - 1)) * C1_InitStateSM
144 : end if
145 : end do
146 0 : dummy_2D(:, nSoilHorizons_mHM) = (P5_InitStateFluxes - &
147 1105 : HorizonDepth_mHM(nSoilHorizons_mHM - 1)) * C1_InitStateSM
148 26 : call append(L1_soilMoist, dummy_2D)
149 :
150 : ! free space
151 26 : if (allocated(dummy_1D)) deallocate(dummy_1D)
152 26 : if (allocated(dummy_2D)) deallocate(dummy_2D)
153 :
154 26 : end subroutine variables_alloc
155 :
156 :
157 : !> \brief Default initalization mHM related L1 variables
158 : !> \details Default initalization of mHM related L1 variables (e.g., states,
159 : !! fluxes, and parameters) as per given constant values given in mo_mhm_constants.
160 : !! Variables initalized here is defined in the mo_global_variables.f90 file.
161 : !! Only Variables that are defined in the variables_alloc subroutine are
162 : !! intialized here.
163 : !! If a variable is added or removed here, then it also has to be added or removed
164 : !! in the subroutine state_variables_set in the module mo_restart and in the
165 : !! subroutine set_state in the module mo_set_netcdf_restart.
166 : !> \changelog
167 : !! - R. Kumar Sep 2013
168 : !! - documentation added according to the template
169 : !! - Stephan Thober Aug 2015
170 : !! - moved routing variables to mRM
171 : !! - Robert Schweppe Jun 2018
172 : !! - refactoring and reformatting
173 : !! - Sebastian Müller Mar 2023
174 : !! - added separate fluxes_states_default_init
175 : !> \authors R. Kumar & J. Mai
176 : !> \date Sep 2013
177 60 : subroutine variables_default_init
178 :
179 26 : use mo_common_constants, only : P1_InitStateFluxes
180 : use mo_mpr_global_variables, only : L1_HarSamCoeff, L1_PrieTayAlpha, &
181 : L1_aeroResist, L1_alpha, L1_degDay, L1_degDayInc, L1_degDayMax,&
182 : L1_degDayNoPre, L1_fAsp, L1_fRoots, L1_fSealed, L1_jarvis_thresh_c1, &
183 : L1_kBaseFlow, L1_kPerco, L1_kSlowFlow, L1_karstLoss, L1_kfastFlow, &
184 : L1_maxInter, L1_petLAIcorFactor, L1_sealedThresh, L1_soilMoistExp, &
185 : L1_soilMoistFC, L1_soilMoistSat, L1_surfResist, L1_tempThresh, &
186 : L1_unsatThresh, L1_wiltingPoint
187 :
188 : implicit none
189 :
190 : ! init fluxes and states
191 60 : call fluxes_states_default_init()
192 :
193 : !-------------------------------------------
194 : ! EFFECTIVE PARAMETERS
195 : !-------------------------------------------
196 :
197 : ! sealed fraction of LCover
198 15576 : L1_fSealed = P1_InitStateFluxes
199 : ! exponent for the upper reservoir
200 15576 : L1_alpha = P1_InitStateFluxes
201 : ! increase of the Degree-day factor per mm of increase in precipitation
202 15576 : L1_degDayInc = P1_InitStateFluxes
203 : ! maximum degree-day factor
204 15576 : L1_degDayMax = P1_InitStateFluxes
205 : ! degree-day factor with no precipitation
206 15576 : L1_degDayNoPre = P1_InitStateFluxes
207 : ! degree-day factor
208 15576 : L1_degDay = P1_InitStateFluxes
209 : ! Karstic percolation loss
210 7848 : L1_karstLoss = P1_InitStateFluxes
211 : ! PET correction factor due to LAI
212 185508 : L1_petLAIcorFactor = P1_InitStateFluxes
213 : ! PET correction factor due to terrain aspect
214 7848 : L1_fAsp = P1_InitStateFluxes
215 : ! PET Hargreaves Samani Coefficient
216 7848 : L1_HarSamCoeff = P1_InitStateFluxes
217 : ! PET Priestley Taylor coefficient
218 92814 : L1_PrieTayAlpha = P1_InitStateFluxes
219 : ! PET aerodynamical resistance
220 185508 : L1_aeroResist = P1_InitStateFluxes
221 : ! PET bulk surface resistance
222 92814 : L1_surfResist = P1_InitStateFluxes
223 : ! Fraction of roots in soil horizons
224 30912 : L1_fRoots = P1_InitStateFluxes
225 : ! Maximum interception
226 92814 : L1_maxInter = P1_InitStateFluxes
227 : ! fast interflow recession coefficient
228 15576 : L1_kfastFlow = P1_InitStateFluxes
229 : ! slow interflow recession coefficient
230 15576 : L1_kSlowFlow = P1_InitStateFluxes
231 : ! baseflow recession coefficient
232 15576 : L1_kBaseFlow = P1_InitStateFluxes
233 : ! percolation coefficient
234 15576 : L1_kPerco = P1_InitStateFluxes
235 : ! Soil moisture below which actual ET is reduced linearly till PWP
236 30912 : L1_soilMoistFC = P1_InitStateFluxes
237 : ! Saturation soil moisture for each horizon [mm]
238 30912 : L1_soilMoistSat = P1_InitStateFluxes
239 : ! Exponential parameter to how non-linear is the soil water retention
240 30912 : L1_soilMoistExp = P1_InitStateFluxes
241 : ! jarvis critical value for normalized soil water content
242 7848 : L1_jarvis_thresh_c1 = P1_InitStateFluxes
243 : ! Threshold temperature for snow/rain
244 15576 : L1_tempThresh = P1_InitStateFluxes
245 : ! Threshhold water depth controlling fast interflow
246 7848 : L1_unsatThresh = P1_InitStateFluxes
247 : ! Threshhold water depth for surface runoff in sealed surfaces
248 7848 : L1_sealedThresh = P1_InitStateFluxes
249 : ! Permanent wilting point
250 30912 : L1_wiltingPoint = P1_InitStateFluxes
251 :
252 60 : end subroutine variables_default_init
253 :
254 :
255 : !> \brief initialize fluxes and states with default values
256 : !> \authors Sebastian Müller
257 : !> \date Mar 2023
258 60 : subroutine fluxes_states_default_init
259 :
260 60 : use mo_common_constants, only : P1_InitStateFluxes
261 : use mo_mpr_constants, only : C1_InitStateSM, P2_InitStateFluxes, P3_InitStateFluxes, &
262 : P4_InitStateFluxes, P5_InitStateFluxes
263 : use mo_global_variables, only : L1_Throughfall, L1_aETCanopy, L1_aETSealed, L1_aETSoil, L1_baseflow, &
264 : L1_fastRunoff, L1_infilSoil, &
265 : L1_inter, L1_melt, L1_neutrons, L1_percol, L1_pet_calc, L1_temp_calc, L1_prec_calc, &
266 : L1_preEffect, L1_rain, &
267 : L1_runoffSeal, L1_satSTW, L1_sealSTW, L1_slowRunoff, L1_snow, L1_snowPack, &
268 : L1_soilMoist, L1_total_runoff, L1_unsatSTW
269 : use mo_mpr_global_variables, only : HorizonDepth_mHM, nSoilHorizons_mHM
270 :
271 : implicit none
272 :
273 : integer(i4) :: i
274 :
275 : !-------------------------------------------
276 : ! STATE VARIABLES
277 : !-------------------------------------------
278 :
279 : ! Interception
280 7728 : L1_inter = P1_InitStateFluxes
281 : !Snowpack
282 7728 : L1_snowPack = P2_InitStateFluxes
283 : !Retention storage of impervious areas
284 7728 : L1_sealSTW = P1_InitStateFluxes
285 :
286 : ! Soil moisture of each horizon
287 120 : do i = 1, nSoilHorizons_mHM - 1
288 120 : if (i .eq. 1) then
289 7668 : L1_soilMoist(:, i) = HorizonDepth_mHM(i) * C1_InitStateSM
290 : else
291 0 : L1_soilMoist(:, i) = (HorizonDepth_mHM(i) - HorizonDepth_mHM(i - 1)) * C1_InitStateSM
292 : end if
293 : end do
294 0 : L1_soilMoist(:, nSoilHorizons_mHM) = (P5_InitStateFluxes - &
295 7668 : HorizonDepth_mHM(nSoilHorizons_mHM - 1)) * C1_InitStateSM
296 :
297 : ! upper soil storage
298 7728 : L1_unsatSTW = P3_InitStateFluxes
299 : ! groundwater storage
300 7728 : L1_satSTW = P4_InitStateFluxes
301 : ! ground albedo neutrons, initially zero
302 7728 : L1_neutrons = P1_InitStateFluxes
303 :
304 : !-------------------------------------------
305 : ! FLUXES
306 : !-------------------------------------------
307 :
308 : ! corrected / calculated potential ET
309 7728 : L1_pet_calc = P1_InitStateFluxes
310 : ! temperature for current time step
311 7728 : L1_temp_calc = P1_InitStateFluxes
312 : ! precipitation for current time step
313 7728 : L1_prec_calc = P1_InitStateFluxes
314 : ! soil actual ET
315 15456 : L1_aETSoil = P1_InitStateFluxes
316 : ! canopy actual ET
317 7728 : L1_aETCanopy = P1_InitStateFluxes
318 : ! sealed area actual ET
319 7728 : L1_aETSealed = P1_InitStateFluxes
320 : ! baseflow
321 7728 : L1_baseflow = P1_InitStateFluxes
322 : ! soil in-exfiltration
323 15456 : L1_infilSoil = P1_InitStateFluxes
324 : ! fast runoff
325 7728 : L1_fastRunoff = P1_InitStateFluxes
326 : ! snow melt
327 7728 : L1_melt = P1_InitStateFluxes
328 : ! percolation
329 7728 : L1_percol = P1_InitStateFluxes
330 : ! effective precip. depth (snow melt + rain)
331 7728 : L1_preEffect = P1_InitStateFluxes
332 : ! rain (liquid water)
333 7728 : L1_rain = P1_InitStateFluxes
334 : ! runoff from impervious area
335 7728 : L1_runoffSeal = P1_InitStateFluxes
336 : ! slow runoff
337 7728 : L1_slowRunoff = P1_InitStateFluxes
338 : ! snow (solid water)
339 7728 : L1_snow = P1_InitStateFluxes
340 : ! throughfall
341 7728 : L1_Throughfall = P1_InitStateFluxes
342 : ! total runoff
343 7728 : L1_total_runoff = P1_InitStateFluxes
344 :
345 60 : end subroutine fluxes_states_default_init
346 :
347 : END MODULE mo_init_states
|