Line data Source code
1 : !------------------------------------------------------------------------------
2 : ! Harmonized Emissions Component (HEMCO) !
3 : !------------------------------------------------------------------------------
4 : !BOP
5 : !
6 : ! !MODULE: hco_vertgrid_mod.F90
7 : !
8 : ! !DESCRIPTION: Module HCO\_VERTGRID\_Mod contains routines and
9 : ! variables for the definition of the vertical grid and related
10 : ! calculations.
11 : ! \\
12 : ! !INTERFACE:
13 : !
14 : MODULE HCO_VertGrid_Mod
15 : !
16 : ! !USES:
17 : !
18 : USE HCO_Error_Mod
19 : USE HCO_Arr_Mod
20 : USE HCO_Types_Mod, ONLY : VertGrid
21 :
22 : IMPLICIT NONE
23 : PRIVATE
24 : !
25 : ! !PUBLIC MEMBER FUNCTIONS:
26 : !
27 : PUBLIC :: HCO_VertGrid_Init
28 : PUBLIC :: HCO_VertGrid_Define
29 : PUBLIC :: HCO_VertGrid_Cleanup
30 : !
31 : ! !PRIVATE MEMBER FUNCTIONS:
32 : !
33 : !
34 : ! !PARAMETERS:
35 : !
36 : INTEGER, PARAMETER, PUBLIC :: HCO_ZTYPE_HYBSIG = 1
37 :
38 : ! Ap [Pa] for 47 levels (48 edges)
39 : REAL(hp), PARAMETER :: Ap47(48) = (/ &
40 : 0.000000e+00_hp, 4.804826e-00_hp, 6.593752e+02_hp, 1.313480e+03_hp, &
41 : 1.961311e+03_hp, 2.609201e+03_hp, 3.257081e+03_hp, 3.898201e+03_hp, &
42 : 4.533901e+03_hp, 5.169611e+03_hp, 5.805321e+03_hp, 6.436264e+03_hp, &
43 : 7.062198e+03_hp, 7.883422e+03_hp, 8.909992e+03_hp, 9.936521e+03_hp, &
44 : 1.091817e+04_hp, 1.189586e+04_hp, 1.286959e+04_hp, 1.429100e+04_hp, &
45 : 1.562600e+04_hp, 1.696090e+04_hp, 1.816190e+04_hp, 1.930970e+04_hp, &
46 : 2.032590e+04_hp, 2.121500e+04_hp, 2.187760e+04_hp, 2.238980e+04_hp, &
47 : 2.243630e+04_hp, 2.168650e+04_hp, 2.011920e+04_hp, 1.769300e+04_hp, &
48 : 1.503930e+04_hp, 1.278370e+04_hp, 1.086630e+04_hp, 9.236572e+03_hp, &
49 : 7.851231e+03_hp, 5.638791e+03_hp, 4.017541e+03_hp, 2.836781e+03_hp, &
50 : 1.979160e+03_hp, 9.292942e+02_hp, 4.076571e+02_hp, 1.650790e+02_hp, &
51 : 6.167791e+01_hp, 2.113490e+01_hp, 6.600001e+00_hp, 1.000000e+00_hp &
52 : /)
53 :
54 : ! Bp [unitless] for 47 levels (48 edges)
55 : REAL(hp), PARAMETER :: Bp47(48) = (/ &
56 : 1.000000e+00_hp, 9.849520e-01_hp, 9.634060e-01_hp, 9.418650e-01_hp, &
57 : 9.203870e-01_hp, 8.989080e-01_hp, 8.774290e-01_hp, 8.560180e-01_hp, &
58 : 8.346609e-01_hp, 8.133039e-01_hp, 7.919469e-01_hp, 7.706375e-01_hp, &
59 : 7.493782e-01_hp, 7.211660e-01_hp, 6.858999e-01_hp, 6.506349e-01_hp, &
60 : 6.158184e-01_hp, 5.810415e-01_hp, 5.463042e-01_hp, 4.945902e-01_hp, &
61 : 4.437402e-01_hp, 3.928911e-01_hp, 3.433811e-01_hp, 2.944031e-01_hp, &
62 : 2.467411e-01_hp, 2.003501e-01_hp, 1.562241e-01_hp, 1.136021e-01_hp, &
63 : 6.372006e-02_hp, 2.801004e-02_hp, 6.960025e-03_hp, 8.175413e-09_hp, &
64 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
65 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
66 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
67 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp &
68 : /)
69 :
70 : ! Ap [Pa] for 72 levels (73 edges)
71 : REAL(hp), PARAMETER :: Ap72(73) = (/ &
72 : 0.000000e+00_hp, 4.804826e+00_hp, 6.593752e+02_hp, 1.313480e+03_hp, &
73 : 1.961311e+03_hp, 2.609201e+03_hp, 3.257081e+03_hp, 3.898201e+03_hp, &
74 : 4.533901e+03_hp, 5.169611e+03_hp, 5.805321e+03_hp, 6.436264e+03_hp, &
75 : 7.062198e+03_hp, 7.883422e+03_hp, 8.909992e+03_hp, 9.936521e+03_hp, &
76 : 1.091817e+04_hp, 1.189586e+04_hp, 1.286959e+04_hp, 1.429100e+04_hp, &
77 : 1.562600e+04_hp, 1.696090e+04_hp, 1.816190e+04_hp, 1.930970e+04_hp, &
78 : 2.032590e+04_hp, 2.121500e+04_hp, 2.187760e+04_hp, 2.238980e+04_hp, &
79 : 2.243630e+04_hp, 2.168650e+04_hp, 2.011920e+04_hp, 1.769300e+04_hp, &
80 : 1.503930e+04_hp, 1.278370e+04_hp, 1.086630e+04_hp, 9.236572e+03_hp, &
81 : 7.851231e+03_hp, 6.660341e+03_hp, 5.638791e+03_hp, 4.764391e+03_hp, &
82 : 4.017541e+03_hp, 3.381001e+03_hp, 2.836781e+03_hp, 2.373041e+03_hp, &
83 : 1.979160e+03_hp, 1.645710e+03_hp, 1.364340e+03_hp, 1.127690e+03_hp, &
84 : 9.292942e+02_hp, 7.619842e+02_hp, 6.216801e+02_hp, 5.046801e+02_hp, &
85 : 4.076571e+02_hp, 3.276431e+02_hp, 2.620211e+02_hp, 2.084970e+02_hp, &
86 : 1.650790e+02_hp, 1.300510e+02_hp, 1.019440e+02_hp, 7.951341e+01_hp, &
87 : 6.167791e+01_hp, 4.758061e+01_hp, 3.650411e+01_hp, 2.785261e+01_hp, &
88 : 2.113490e+01_hp, 1.594950e+01_hp, 1.197030e+01_hp, 8.934502e+00_hp, &
89 : 6.600001e+00_hp, 4.758501e+00_hp, 3.270000e+00_hp, 2.000000e+00_hp, &
90 : 1.000000e+00_hp /)
91 :
92 : ! Bp [unitless] for 72 levels (73 edges)
93 : REAL(hp), PARAMETER :: Bp72(73) = (/ &
94 : 1.000000e+00_hp, 9.849520e-01_hp, 9.634060e-01_hp, 9.418650e-01_hp, &
95 : 9.203870e-01_hp, 8.989080e-01_hp, 8.774290e-01_hp, 8.560180e-01_hp, &
96 : 8.346609e-01_hp, 8.133039e-01_hp, 7.919469e-01_hp, 7.706375e-01_hp, &
97 : 7.493782e-01_hp, 7.211660e-01_hp, 6.858999e-01_hp, 6.506349e-01_hp, &
98 : 6.158184e-01_hp, 5.810415e-01_hp, 5.463042e-01_hp, 4.945902e-01_hp, &
99 : 4.437402e-01_hp, 3.928911e-01_hp, 3.433811e-01_hp, 2.944031e-01_hp, &
100 : 2.467411e-01_hp, 2.003501e-01_hp, 1.562241e-01_hp, 1.136021e-01_hp, &
101 : 6.372006e-02_hp, 2.801004e-02_hp, 6.960025e-03_hp, 8.175413e-09_hp, &
102 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
103 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
104 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
105 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
106 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
107 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
108 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
109 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
110 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
111 : 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, 0.000000e+00_hp, &
112 : 0.000000e+00_hp /)
113 : !
114 : ! PUBLIC TYPES:
115 : !
116 : !
117 : ! !REVISION HISTORY:
118 : ! 28 Sep 2015 - C. Keller - Initialization
119 : ! See https://github.com/geoschem/hemco for complete history
120 : !EOP
121 : !------------------------------------------------------------------------------
122 : !BOC
123 : CONTAINS
124 : !EOC
125 : !------------------------------------------------------------------------------
126 : ! Harmonized Emissions Component (HEMCO) !
127 : !------------------------------------------------------------------------------
128 : !BOP
129 : !
130 : ! !FUNCTION: HCO_VertGrid_Init
131 : !
132 : ! !DESCRIPTION: Function HCO\_VertGrid\_Init initializes the vertical
133 : ! grid.
134 : !\\
135 : !\\
136 : ! !INTERFACE:
137 : !
138 0 : SUBROUTINE HCO_VertGrid_Init( zGrid, RC )
139 : !
140 : ! !INPUT/OUTPUT PARAMETERS:
141 : !
142 : TYPE(VertGrid), POINTER :: zGrid ! vertical grid
143 : INTEGER, INTENT(INOUT) :: RC ! Return code
144 : !
145 : ! !REVISION HISTORY:
146 : ! 28 Sep 2015 - C. Keller - Initial version
147 : ! See https://github.com/geoschem/hemco for complete history
148 : !EOP
149 : !------------------------------------------------------------------------------
150 : !BOC
151 : !
152 : ! !DEFINED PARAMETERS:
153 : !
154 : !=====================================================================
155 : ! HCO_VertGrid_Init begins here!
156 : !=====================================================================
157 :
158 : ! Initialize
159 0 : IF ( .NOT. ASSOCIATED(zGrid) ) ALLOCATE( zGrid )
160 :
161 : ! Initialize vertical grid type. For now, always assume to be hybrid
162 : ! sigma coordinates
163 0 : zGrid%ZTYPE = HCO_ZTYPE_HYBSIG
164 0 : zGrid%Ap => NULL()
165 0 : zGrid%Bp => NULL()
166 :
167 : ! Return w/ success
168 0 : RC = HCO_SUCCESS
169 :
170 0 : END SUBROUTINE HCO_VertGrid_Init
171 : !EOC
172 : !------------------------------------------------------------------------------
173 : ! Harmonized Emissions Component (HEMCO) !
174 : !------------------------------------------------------------------------------
175 : !BOP
176 : !
177 : ! !FUNCTION: HCO_VertGrid_Define
178 : !
179 : ! !DESCRIPTION: Function HCO\_VertGrid\_Define initializes the vertical
180 : ! grid.
181 : !\\
182 : !\\
183 : ! !INTERFACE:
184 : !
185 0 : SUBROUTINE HCO_VertGrid_Define( HcoConfig, zGrid, nz, Ap, Bp, RC )
186 : !
187 : ! !USES:
188 : !
189 : USE HCO_TYPES_MOD, ONLY : ConfigObj
190 : !
191 : ! !INPUT PARAMETERS:
192 : !
193 : INTEGER, INTENT(IN ) :: nz ! # of vertical levels
194 : REAL(hp), INTENT(IN ), OPTIONAL :: Ap(nz+1) ! Ap values
195 : REAL(hp), INTENT(IN ), OPTIONAL :: Bp(nz+1) ! Bp values
196 : !
197 : ! !INPUT/OUTPUT PARAMETERS:
198 : !
199 : TYPE(ConfigObj),POINTER :: HcoConfig ! HEMCO config obj
200 : TYPE(VertGrid), POINTER :: zGrid ! vertical grid
201 : INTEGER, INTENT(INOUT) :: RC ! Return code
202 : !
203 : ! !REVISION HISTORY:
204 : ! 28 Sep 2015 - C. Keller - Initial version
205 : ! See https://github.com/geoschem/hemco for complete history
206 : !EOP
207 : !------------------------------------------------------------------------------
208 : !BOC
209 : !
210 : ! !LOCAL VARIABLES:
211 : !
212 : INTEGER :: I, AS
213 : CHARACTER(LEN=255) :: MSG
214 : CHARACTER(LEN=255) :: LOC = 'HCO_VertGrid_Define (hco_vertgrid_mod.F90)'
215 :
216 : !=====================================================================
217 : ! HCO_VertGrid_Define begins here!
218 : !=====================================================================
219 :
220 : ! Allocate AP and BP
221 0 : ALLOCATE(zGrid%Ap(nz+1), zGrid%Bp(nz+1), STAT=AS )
222 0 : IF ( AS /= 0 ) THEN
223 0 : CALL HCO_ERROR( 'Cannot allocate Ap / Bp', RC, THISLOC=LOC )
224 0 : RETURN
225 : ENDIF
226 0 : zGrid%Ap = 0.0_hp
227 0 : zGrid%Bp = 0.0_hp
228 :
229 : ! Set Ap
230 0 : IF ( PRESENT(Ap) ) THEN
231 0 : zGrid%Ap(:) = Ap(:)
232 : ELSE
233 0 : IF ( nz > 72 ) THEN
234 0 : WRITE(MSG,*) 'Vertical grid has more than 72 vertical levels', &
235 0 : '- please provide Ap values in configuration file.'
236 0 : CALL HCO_ERROR( MSG, RC, THISLOC=LOC )
237 0 : RETURN
238 0 : ELSEIF ( nz > 47 ) THEN
239 0 : zGrid%Ap(:) = Ap72(1:(nz+1))
240 : ELSE
241 0 : zGrid%Ap(:) = Ap47(1:(nz+1))
242 : ENDIF
243 : ENDIF
244 :
245 : ! Set Bp
246 0 : IF ( PRESENT(Bp) ) THEN
247 0 : zGrid%Bp(:) = Bp(:)
248 : ELSE
249 0 : IF ( nz > 72 ) THEN
250 0 : WRITE(MSG,*) 'Vertical grid has more than 72 vertical levels', &
251 0 : '- please provide Bp values in configuration file.'
252 0 : CALL HCO_ERROR( MSG, RC, THISLOC=LOC )
253 0 : RETURN
254 0 : ELSEIF ( nz > 47 ) THEN
255 0 : zGrid%Bp(:) = Bp72(1:(nz+1))
256 : ELSE
257 0 : zGrid%Bp(:) = Bp47(1:(nz+1))
258 : ENDIF
259 : ENDIF
260 :
261 : ! Verbose
262 0 : IF ( HcoConfig%amIRoot .AND. HCO_IsVerb( HcoConfig%Err ) ) THEN
263 0 : WRITE(MSG,*) ' HEMCO vertical sigma-hybrid coordinates: '
264 0 : CALL HCO_MSG(HcoConfig%Err,MSG)
265 0 : WRITE(MSG,*) 'Ap [Pa] (first and last): ', zGrid%Ap(1), zGrid%Ap(nz+1)
266 0 : CALL HCO_MSG(HcoConfig%Err,MSG)
267 0 : WRITE(MSG,*) 'Bp [unitless] (first and last): ', zGrid%Bp(1), zGrid%Bp(nz+1)
268 0 : CALL HCO_MSG(HcoConfig%Err,MSG,SEP2='-')
269 : ENDIF
270 :
271 : ! Return w/ success
272 0 : RC = HCO_SUCCESS
273 :
274 0 : END SUBROUTINE HCO_VertGrid_Define
275 : !EOC
276 : !------------------------------------------------------------------------------
277 : ! Harmonized Emissions Component (HEMCO) !
278 : !------------------------------------------------------------------------------
279 : !BOP
280 : !
281 : ! !FUNCTION: HCO_VertGrid_Cleanup
282 : !
283 : ! !DESCRIPTION: Function HCO\_VertGrid\_Cleanup cleans up the vertical
284 : ! grid.
285 : !\\
286 : !\\
287 : ! !INTERFACE:
288 : !
289 0 : SUBROUTINE HCO_VertGrid_Cleanup( zGrid )
290 : !
291 : ! !INPUT/OUTPUT PARAMETERS:
292 : !
293 : TYPE(VertGrid), POINTER :: zGrid ! vertical grid
294 : !
295 : ! !REVISION HISTORY:
296 : ! 28 Sep 2015 - C. Keller - Initial version
297 : ! See https://github.com/geoschem/hemco for complete history
298 : !EOP
299 : !------------------------------------------------------------------------------
300 : !BOC
301 : !
302 0 : IF( ASSOCIATED( zGrid%Ap ) ) THEN
303 0 : DEALLOCATE( zGrid%Ap )
304 : ENDIF
305 0 : zGrid%Ap => NULL()
306 :
307 0 : IF( ASSOCIATED( zGrid%Bp ) ) THEN
308 0 : DEALLOCATE( zGrid%Bp )
309 : ENDIF
310 0 : zGrid%Bp => NULL()
311 :
312 0 : IF ( ASSOCIATED( zGrid ) ) THEN
313 0 : DEALLOCATE( zGrid )
314 : ENDIF
315 0 : zGrid => NULL()
316 :
317 0 : END SUBROUTINE HCO_VertGrid_Cleanup
318 : !EOC
319 : END MODULE HCO_VertGrid_Mod
320 : !EOM
|