5.13.3-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mo_mpr_neutrons.f90
Go to the documentation of this file.
1!> \file mo_mpr_neutrons.f90
2!> \brief \copybrief mo_mpr_neutrons
3!> \details \copydetails mo_mpr_neutrons
4
5!> \brief Multiscale parameter regionalization (MPR) for neutrons
6!> \details This module contains all routines required for parametrizing neutrons processes.
7!> \author Maren Kaluza
8!> \date Dec 2017
9!> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
10!! mHM is released under the LGPLv3+ license \license_note
11!> \ingroup f_mpr
13
14 use mo_kind, only: i4, dp
15
16 implicit none
17
18 public :: mpr_neutrons
19
20 private
21
22contains
23 ! ----------------------------------------------------------------------------
24
25 ! NAME
26 ! mpr_neutrons
27
28 !> \brief multiscale parameter regionalization for neutrons
29
30 !> \details calculates neutron variables on L0
31 !> Global parameters needed (see mhm_parameter.nml):\n
32 !> - param( 1) = Desilets_N0 \n
33 !> - param( 2) = COSMIC_N0 \n
34 !> - param( 3) = COSMIC_N1 \n
35 !> - param( 4) = COSMIC_N2 \n
36 !> - param( 5) = COSMIC_alpha0 \n
37 !> - param( 6) = COSMIC_alpha1 \n
38 !> - param( 7) = COSMIC_L30 \n
39 !> - param( 8) = COSMIC_L31 \n
40 !> - param( 9) = COSMIC_LW0 \n
41 !> - param(10) = COSMIC_LW1 \n
42
43 ! INTENT(IN)
44 !> \param[in] "real(dp) :: param(10)" - global parameters
45 !> \param[in] "integer(i4) :: is_present(:)" - indicates whether soiltype is present
46 !> \param[in] "integer(i4) :: nHorizons(:)" - Number of Horizons per soiltype2
47 !> \param[in] "integer(i4) :: nTillHorizons(:)" - Number of Tillage Horizons
48 !> \param[in] "integer(i4) :: LCover0(:)" - land cover ids at level 0
49 !> \param[in] "real(dp) :: clay(:,:)" - clay content
50 !> \param[in] "real(dp) :: DbM(:,:)" - mineral Bulk density
51 !> \param[in] "real(dp) :: Db(:,:)" - Bulk density
52
53 ! INTENT(INOUT)
54 ! None
55
56 !> INTENT(OUT)
57 !> \param[out] "real(dp) :: COSMIC_L3_till(:,:,:)" - COSMIC paramter L3 tillage layer
58 !> \param[out] "real(dp) :: latWat_till(:,:,:)" - lattice water content tillage layer
59 !> \param[out] "real(dp) :: COSMIC_L3(:,:)" - COSMIC paramter L3 tillage layer
60 !> \param[out] "real(dp) :: latWat(:,:)" - lattice water contente
61
62 ! INTENT(IN), OPTIONAL
63 ! None
64
65 ! INTENT(INOUT), OPTIONAL
66 ! None
67
68 ! INTENT(OUT), OPTIONAL
69 ! None
70
71 ! RETURN
72 ! None
73
74 ! RESTRICTIONS
75 ! None
76
77 ! EXAMPLE
78 ! None
79
80 ! LITERATURE
81 ! None
82
83 ! HISTORY
84 !> \author Maren Kaluza
85 !> \date Dec 2017
86
87
88 subroutine mpr_neutrons( process_case, & ! IN: process case
89 param , & ! IN: global parameter set
90 is_present , & ! IN: flag indicating presence of soil
91 nHorizons , & ! IN: Number of Horizons of Soiltype
92 nTillHorizons , & ! IN: Number of tillage Horizons
93 LCover0 , & ! IN: land cover ids at level 0
94 clay , & ! IN: clay content
95 DbM , & ! IN: mineral Bulk density
96 Db , & ! IN: Bulk density
97 COSMIC_L3_till , & ! OUT: COSMIC paramter L3 tillage layer
98 latWat_till , & ! OUT: lattice water content tillage layer
99 COSMIC_L3 , & ! OUT: COSMIC paramter L3 tillage layer
100 latWat & ! OUT: lattice water contente
101 )
102
103 ! lots of lines copy-pasted from mo_mpr_soilmoist.f90
104 use mo_message, only: error_message
106 !$ use omp_lib
107
108 implicit none
109
110 ! Input --------------------------------------------------------------------
111 integer(i4), intent(in) :: process_case ! process case
112 real(dp), dimension(:), intent(in) :: param ! global parameters !! dim = 3 for case 1 and 9 for case 2
113 integer(i4), dimension(:), intent(in) :: is_present ! indicates whether soiltype is present
114 integer(i4), dimension(:), intent(in) :: nhorizons ! Number of Horizons per soiltype
115 integer(i4), dimension(:), intent(in) :: ntillhorizons! Number of Tillage Horizons
116 real(dp), dimension(:,:), intent(in) :: dbm ! mineral Bulk density
117 real(dp), dimension(:,:,:), intent(in) :: db ! Bulk density
118 integer(i4), dimension(:), intent(in) :: lcover0 ! land cover ids at level 0
119 real(dp), dimension(:,:), intent(in) :: clay ! clay content
120
121 ! Output -------------------------------------------------------------------
122 real(dp), dimension(:,:,:), intent(out) :: cosmic_l3_till ! COSMIC parameter L3 tillage layer
123 real(dp), dimension(:,:,:), intent(out) :: latwat_till ! lattice water content tillage layer
124 real(dp), dimension(:,:), intent(out) :: cosmic_l3 ! COSMIC parameter L3
125 real(dp), dimension(:,:), intent(out) :: latwat ! lattice water content
126
127 ! Local variables
128 integer(i4) :: i ! loop index
129 integer(i4) :: j ! loop index
130 integer(i4) :: l ! loop index
131 integer(i4) :: tmp_minsoilhorizon
132
133
134 !min soil horizon
135 tmp_minsoilhorizon = minval(ntillhorizons(:))
136
137 ! with zero there will be problem with
138 ! upscaling with harmonic mean for the COMSIC_L3
139 ! in case of process_case .EQ. 1
140 cosmic_l3_till = 0.000001_dp
141 cosmic_l3 = 0.000001_dp
142 latwat_till = 0.000001_dp
143 latwat = 0.000001_dp
144
145 ! select case according to a given soil database flag
146 SELECT CASE(iflag_soildb)
147
148 ! classical mHM soil database format
149 CASE(0)
150 do i = 1, size(is_present)
151 if ( is_present(i) .lt. 1 ) cycle
152 horizon: do j = 1, nhorizons(i)
153 ! calculating other soil hydraulic properties
154 ! tillage horizons
155 if ( j .le. ntillhorizons(i) ) then
156 ! LC class
157 do l = 1, maxval( lcover0 )
158 if(process_case .EQ. 1) call latticewater(param(2:3), clay(i,j), latwat_till(i,j,l))
159 if(process_case .EQ. 2) then
160 call calcl3(param(6:7), db(i,j,l), cosmic_l3_till(i,j,l))
161 call latticewater(param(8:9), clay(i,j), latwat_till(i,j,l))
162 end if
163 end do
164 ! deeper layers
165 else
166 if(process_case .EQ. 1) call latticewater(param(2:3), clay(i,j), latwat(i,j-tmp_minsoilhorizon))
167 if(process_case .EQ. 2) then
168 call calcl3(param(6:7), dbm(i,j), cosmic_l3(i,j-tmp_minsoilhorizon))
169 call latticewater(param(8:9), clay(i,j), latwat(i,j-tmp_minsoilhorizon))
170 end if
171 end if
172 end do horizon
173 end do
174
175 ! to handle multiple soil horizons with unique soil class
176 CASE(1)
177 do i = 1, size(is_present)
178 if ( is_present(i) .lt. 1 ) cycle
179 ! **** FOR THE TILLAGE TYPE OF SOIL *****
180 ! there is actually no soil horizons/soil type in this case
181 ! but we assign of j = 1 to use variables as defined in the classical option (iFlag_soil = 0)
182 do j = 1, 1
183 ! tillage horizons properties depending on the LC class
184 do l = 1, maxval( lcover0 )
185 if(process_case .EQ. 1) call latticewater(param(2:3), clay(i,j), latwat_till(i,j,l))
186 if(process_case .EQ. 2) then
187 call calcl3(param(6:7), db(i,j,l), cosmic_l3_till(i,j,l))
188 call latticewater(param(8:9), clay(i,j), latwat_till(i,j,l))
189 end if
190 end do
191
192 ! *** FOR NON-TILLAGE TYPE OF SOILS ***
193 ! note j = 1
194 if(process_case .EQ. 1) call latticewater(param(2:3), clay(i,j), latwat(i,j))
195 if(process_case .EQ. 2) then
196 call calcl3(param(6:7), dbm(i,j), cosmic_l3(i,j))
197 call latticewater(param(8:9), clay(i,j), latwat(i,j))
198 end if
199
200 end do ! >> HORIZON
201 end do ! >> SOIL TYPE
202
203 CASE DEFAULT
204 call error_message('***ERROR: iFlag_soilDB option given does not exist. Only 0 and 1 is taken at the moment.')
205 END SELECT
206 !
207
208 end subroutine
209
210
211 !! >> L3 parameter
212 subroutine calcl3(param, bulkDensity, L3)
213 ! param(1) = COSMIC_L30
214 ! param(2) = COSMIC_L31
215 implicit none
216 real(dp), dimension(2), intent(in) :: param
217 real(dp), intent(in) :: bulkDensity
218 real(dp), intent(inout) :: L3
219
220 l3 = bulkdensity*param(1) - param(2)
221 if( bulkdensity .LT. 0.4_dp ) then ! bulkDensity<0.39 yields negative L3, bulkDensity=0.39 yields L3=0
222 l3 = 1.0_dp ! Prevent division by zero later on; added by joost Iwema to COSMIC 1.13, Feb. 2017
223 endif
224
225 end subroutine calcl3
226
227
228 !! >>>> lattice water
229 subroutine latticewater( param, clay, latWat )
230 ! param(1) = COSMIC_LW0 or deslet_LW0
231 ! param(2) = COSMIC_LW1 or deslet_LW0
232 implicit none
233 ! Input
234 real(dp), dimension(2), intent(in) :: param
235 real(dp), intent(in) :: clay
236 ! Output
237 real(dp), intent(out) :: latWat
238
239 !Martin Schroen's dissertation
240 latwat = ( param(1)*clay/100.0_dp + param(2) )
241
242 end subroutine latticewater
243
244end module mo_mpr_neutrons
Global variables for mpr only.
Multiscale parameter regionalization (MPR) for neutrons.
subroutine, public mpr_neutrons(process_case, param, is_present, nhorizons, ntillhorizons, lcover0, clay, dbm, db, cosmic_l3_till, latwat_till, cosmic_l3, latwat)
multiscale parameter regionalization for neutrons
subroutine latticewater(param, clay, latwat)
subroutine calcl3(param, bulkdensity, l3)