56 private :: get_fact_fct
63 real(RP),
allocatable :: cnz3(:,:,:)
64 real(RP),
allocatable :: cnx3(:,:,:)
65 real(RP),
allocatable :: cny3(:,:,:)
66 real(RP),
allocatable :: cnz4(:,:,:)
67 real(RP),
allocatable :: cnx4(:,:,:)
68 real(RP),
allocatable :: cny4(:,:,:)
70 integer :: i_comm_dens_z = 1
71 integer :: i_comm_dens_x = 2
72 integer :: i_comm_dens_y = 3
73 integer :: i_comm_momz_z = 4
74 integer :: i_comm_momz_x = 5
75 integer :: i_comm_momz_y = 6
76 integer :: i_comm_momx_z = 7
77 integer :: i_comm_momx_x = 8
78 integer :: i_comm_momx_y = 9
79 integer :: i_comm_momy_z = 10
80 integer :: i_comm_momy_x = 11
81 integer :: i_comm_momy_y = 12
82 integer :: i_comm_rhot_z = 13
83 integer :: i_comm_rhot_x = 14
84 integer :: i_comm_rhot_y = 15
85 integer :: i_comm_qtrc_z = 1
86 integer :: i_comm_qtrc_x = 2
87 integer :: i_comm_qtrc_y = 3
93 num_diff, num_diff_q, &
94 CDZ, CDX, CDY, FDZ, FDX, FDY )
100 real(RP),
intent(inout) :: num_diff(
ka,
ia,
ja,5,3)
101 real(RP),
intent(inout) :: num_diff_q(
ka,
ia,
ja,3)
102 real(RP),
intent(in) :: CDZ(
ka)
103 real(RP),
intent(in) :: CDX(
ia)
104 real(RP),
intent(in) :: CDY(
ja)
105 real(RP),
intent(in) :: FDZ(
ka-1)
106 real(RP),
intent(in) :: FDX(
ia-1)
107 real(RP),
intent(in) :: FDY(
ja-1)
113 log_error(
"ATMOS_DYN_filter_setup",*)
'number of HALO must be at least 2 for numrical filter' 118 allocate( cnz3(3,
ka,2) )
119 allocate( cnx3(3,
ia,2) )
120 allocate( cny3(3,
ja,2) )
121 allocate( cnz4(5,
ka,2) )
122 allocate( cnx4(5,
ia,2) )
123 allocate( cny4(5,
ja,2) )
157 cnz3(1,k,1) = 1.0_rp / ( fdz(k ) * cdz(k ) * fdz(k-1) )
158 cnz3(2,k,1) = 1.0_rp / ( fdz(k ) * cdz(k ) * fdz(k-1) ) &
159 + 1.0_rp / ( fdz(k-1) * cdz(k ) * fdz(k-1) ) &
160 + 1.0_rp / ( fdz(k-1) * cdz(k-1) * fdz(k-1) )
163 cnz3(3,k,1) = 1.0_rp / ( fdz(k-1) * cdz(k ) * fdz(k-1) ) &
164 + 1.0_rp / ( fdz(k-1) * cdz(k-1) * fdz(k-1) ) &
165 + 1.0_rp / ( fdz(k-1) * cdz(k-1) * fdz(k-2) )
167 cnz3(1,
ks-1,1) = 1.0_rp / ( fdz(
ks ) * cdz(
ks+1) * fdz(
ks ) )
168 cnz3(1,
ks ,1) = 1.0_rp / ( fdz(
ks ) * cdz(
ks ) * fdz(
ks ) )
169 cnz3(2,
ks ,1) = 1.0_rp / ( fdz(
ks ) * cdz(
ks ) * fdz(
ks ) ) &
170 + 1.0_rp / ( fdz(
ks ) * cdz(
ks ) * fdz(
ks ) ) &
171 + 1.0_rp / ( fdz(
ks ) * cdz(
ks+1) * fdz(
ks ) )
172 cnz3(3,
ks ,1) = 1.0_rp / ( fdz(
ks ) * cdz(
ks ) * fdz(
ks ) ) &
173 + 1.0_rp / ( fdz(
ks ) * cdz(
ks+1) * fdz(
ks ) ) &
174 + 1.0_rp / ( fdz(
ks ) * cdz(
ks+1) * fdz(
ks+1) )
175 cnz3(3,
ks+1,1) = 1.0_rp / ( fdz(
ks ) * cdz(
ks+1) * fdz(
ks ) ) &
176 + 1.0_rp / ( fdz(
ks ) * cdz(
ks ) * fdz(
ks ) ) &
177 + 1.0_rp / ( fdz(
ks ) * cdz(
ks ) * fdz(
ks ) )
178 cnz3(1,
ke ,1) = 1.0_rp / ( fdz(
ke-1) * cdz(
ke ) * fdz(
ke-1) )
179 cnz3(2,
ke ,1) = 1.0_rp / ( fdz(
ke-1) * cdz(
ke ) * fdz(
ke-1) ) &
180 + 1.0_rp / ( fdz(
ke-1) * cdz(
ke ) * fdz(
ke-1) ) &
181 + 1.0_rp / ( fdz(
ke-1) * cdz(
ke-1) * fdz(
ke-1) )
182 cnz3(1,
ke+1,1) = 1.0_rp / ( fdz(
ke-2) * cdz(
ke-1) * fdz(
ke-1) )
183 cnz3(2,
ke+1,1) = 1.0_rp / ( fdz(
ke-2) * cdz(
ke-1) * fdz(
ke-1) ) &
184 + 1.0_rp / ( fdz(
ke-1) * cdz(
ke-1) * fdz(
ke-1) ) &
185 + 1.0_rp / ( fdz(
ke-1) * cdz(
ke ) * fdz(
ke-1) )
186 cnz3(3,
ke+1,1) = 1.0_rp / ( fdz(
ke-1) * cdz(
ke+1) * fdz(
ke-1) ) &
187 + 1.0_rp / ( fdz(
ke-1) * cdz(
ke ) * fdz(
ke-1) ) &
188 + 1.0_rp / ( fdz(
ke-1) * cdz(
ke ) * fdz(
ke-1) )
191 cnz4(1,k,1) = ( cnz3(1,k+1,1) ) / cdz(k)
192 cnz4(2,k,1) = ( cnz3(2,k+1,1) + cnz3(1,k,1) ) / cdz(k)
193 cnz4(3,k,1) = ( cnz3(3,k+1,1) + cnz3(2,k,1) ) / cdz(k)
194 cnz4(4,k,1) = ( cnz3(1,k ,1) + cnz3(3,k,1) ) / cdz(k)
195 cnz4(5,k,1) = ( cnz3(1,k-1,1) ) / cdz(k)
199 cnz3(1,k,2) = 1.0_rp / ( cdz(k+1) * fdz(k ) * cdz(k ) )
200 cnz3(2,k,2) = 1.0_rp / ( cdz(k+1) * fdz(k ) * cdz(k ) ) &
201 + 1.0_rp / ( cdz(k ) * fdz(k ) * cdz(k ) ) &
202 + 1.0_rp / ( cdz(k ) * fdz(k-1) * cdz(k ) )
203 cnz3(3,k,2) = 1.0_rp / ( cdz(k ) * fdz(k ) * cdz(k ) ) &
204 + 1.0_rp / ( cdz(k ) * fdz(k-1) * cdz(k ) ) &
205 + 1.0_rp / ( cdz(k ) * fdz(k-1) * cdz(k-1) )
207 cnz3(1,
ks-1,2) = 1.0_rp / ( cdz(
ks ) * fdz(
ks ) * cdz(
ks ) )
208 cnz3(1,
ks ,2) = 1.0_rp / ( cdz(
ks+1) * fdz(
ks ) * cdz(
ks ) )
209 cnz3(2,
ks ,2) = 1.0_rp / ( cdz(
ks+1) * fdz(
ks ) * cdz(
ks ) ) &
210 + 1.0_rp / ( cdz(
ks ) * fdz(
ks ) * cdz(
ks ) ) &
211 + 1.0_rp / ( cdz(
ks ) * fdz(
ks ) * cdz(
ks ) )
212 cnz3(3,
ks ,2) = 1.0_rp / ( cdz(
ks ) * fdz(
ks ) * cdz(
ks ) ) &
213 + 1.0_rp / ( cdz(
ks ) * fdz(
ks ) * cdz(
ks ) ) &
214 + 1.0_rp / ( cdz(
ks ) * fdz(
ks ) * cdz(
ks+1) )
215 cnz3(1,
ke ,2) = 1.0_rp / ( cdz(
ke-1) * fdz(
ke-1) * cdz(
ke ) )
216 cnz3(2,
ke ,2) = 1.0_rp / ( cdz(
ke-1) * fdz(
ke-1) * cdz(
ke ) ) &
217 + 1.0_rp / ( cdz(
ke ) * fdz(
ke-1) * cdz(
ke ) ) &
218 + 1.0_rp / ( cdz(
ke ) * fdz(
ke-1) * cdz(
ke ) )
219 cnz3(3,
ke ,2) = 1.0_rp / ( cdz(
ke ) * fdz(
ke-1) * cdz(
ke ) ) &
220 + 1.0_rp / ( cdz(
ke ) * fdz(
ke-1) * cdz(
ke ) ) &
221 + 1.0_rp / ( cdz(
ke ) * fdz(
ke-1) * cdz(
ke-1) )
222 cnz3(1,
ke+1,2) = 1.0_rp / ( cdz(
ke-2) * fdz(
ke-2) * cdz(
ke-1) )
223 cnz3(2,
ke+1,2) = 1.0_rp / ( cdz(
ke-2) * fdz(
ke-2) * cdz(
ke-1) ) &
224 + 1.0_rp / ( cdz(
ke-1) * fdz(
ke-2) * cdz(
ke-1) ) &
225 + 1.0_rp / ( cdz(
ke-1) * fdz(
ke-1) * cdz(
ke-1) )
226 cnz3(3,
ke+1,2) = 1.0_rp / ( cdz(
ke-1) * fdz(
ke-2) * cdz(
ke-1) ) &
227 + 1.0_rp / ( cdz(
ke-1) * fdz(
ke-1) * cdz(
ke-1) ) &
228 + 1.0_rp / ( cdz(
ke-1) * fdz(
ke-1) * cdz(
ke ) )
231 cnz4(1,k,2) = ( cnz3(1,k+1,2) ) / fdz(k)
232 cnz4(2,k,2) = ( cnz3(2,k+1,2) + cnz3(1,k,2) ) / fdz(k)
233 cnz4(3,k,2) = ( cnz3(3,k+1,2) + cnz3(2,k,2) ) / fdz(k)
234 cnz4(4,k,2) = ( cnz3(1,k ,2) + cnz3(3,k,2) ) / fdz(k)
235 cnz4(5,k,2) = ( cnz3(1,k-1,2) ) / fdz(k)
238 cnz4(2,
ke,2) = ( cnz3(2,
ke+1,2) + cnz3(1,
ke,2) ) / fdz(
ke-1)
239 cnz4(3,
ke,2) = ( cnz3(3,
ke+1,2) + cnz3(2,
ke,2) ) / fdz(
ke-1)
240 cnz4(4,
ke,2) = ( cnz3(1,
ke ,2) + cnz3(3,
ke,2) ) / fdz(
ke-1)
243 cnx3(1,
is-1,1) = 1.0_rp / ( fdx(
is-1) * cdx(
is-1) * fdx(
is-2) )
245 cnx3(1,i,1) = 1.0_rp / ( fdx(i ) * cdx(i ) * fdx(i-1) )
246 cnx3(2,i,1) = 1.0_rp / ( fdx(i ) * cdx(i ) * fdx(i-1) ) &
247 + 1.0_rp / ( fdx(i-1) * cdx(i ) * fdx(i-1) ) &
248 + 1.0_rp / ( fdx(i-1) * cdx(i-1) * fdx(i-1) )
249 cnx3(3,i,1) = 1.0_rp / ( fdx(i-1) * cdx(i ) * fdx(i-1) ) &
250 + 1.0_rp / ( fdx(i-1) * cdx(i-1) * fdx(i-1) ) &
251 + 1.0_rp / ( fdx(i-1) * cdx(i-1) * fdx(i-2) )
255 cnx4(1,i,1) = ( cnx3(1,i+1,1) ) / cdx(i)
256 cnx4(2,i,1) = ( cnx3(2,i+1,1) + cnx3(1,i,1) ) / cdx(i)
257 cnx4(3,i,1) = ( cnx3(3,i+1,1) + cnx3(2,i,1) ) / cdx(i)
258 cnx4(4,i,1) = ( cnx3(1,i ,1) + cnx3(3,i,1) ) / cdx(i)
259 cnx4(5,i,1) = ( cnx3(1,i-1,1) ) / cdx(i)
263 cnx3(1,i,2) = 1.0_rp / ( cdx(i+1) * fdx(i ) * cdx(i ) )
264 cnx3(2,i,2) = 1.0_rp / ( cdx(i+1) * fdx(i ) * cdx(i ) ) &
265 + 1.0_rp / ( cdx(i ) * fdx(i ) * cdx(i ) ) &
266 + 1.0_rp / ( cdx(i ) * fdx(i-1) * cdx(i ) )
267 cnx3(3,i,2) = 1.0_rp / ( cdx(i ) * fdx(i ) * cdx(i ) ) &
268 + 1.0_rp / ( cdx(i ) * fdx(i-1) * cdx(i ) ) &
269 + 1.0_rp / ( cdx(i ) * fdx(i-1) * cdx(i-1) )
273 cnx4(1,i,2) = ( cnx3(1,i+1,2) ) / fdx(i)
274 cnx4(2,i,2) = ( cnx3(2,i+1,2) + cnx3(1,i,2) ) / fdx(i)
275 cnx4(3,i,2) = ( cnx3(3,i+1,2) + cnx3(2,i,2) ) / fdx(i)
276 cnx4(4,i,2) = ( cnx3(1,i ,2) + cnx3(3,i,2) ) / fdx(i)
277 cnx4(5,i,2) = ( cnx3(1,i-1,2) ) / fdx(i)
281 cny3(1,
js-1,1) = 1.0_rp / ( fdy(
js-1) * cdy(
js-1) * fdy(
js-2) )
283 cny3(1,j,1) = 1.0_rp / ( fdy(j ) * cdy(j ) * fdy(j-1) )
284 cny3(2,j,1) = 1.0_rp / ( fdy(j ) * cdy(j ) * fdy(j-1) ) &
285 + 1.0_rp / ( fdy(j-1) * cdy(j ) * fdy(j-1) ) &
286 + 1.0_rp / ( fdy(j-1) * cdy(j-1) * fdy(j-1) )
287 cny3(3,j,1) = 1.0_rp / ( fdy(j-1) * cdy(j ) * fdy(j-1) ) &
288 + 1.0_rp / ( fdy(j-1) * cdy(j-1) * fdy(j-1) ) &
289 + 1.0_rp / ( fdy(j-1) * cdy(j-1) * fdy(j-2) )
293 cny4(1,j,1) = ( cny3(1,j+1,1) ) / cdy(j)
294 cny4(2,j,1) = ( cny3(2,j+1,1) + cny3(1,j,1) ) / cdy(j)
295 cny4(3,j,1) = ( cny3(3,j+1,1) + cny3(2,j,1) ) / cdy(j)
296 cny4(4,j,1) = ( cny3(1,j ,1) + cny3(3,j,1) ) / cdy(j)
297 cny4(5,j,1) = ( cny3(1,j-1,1) ) / cdy(j)
301 cny3(1,j,2) = 1.0_rp / ( cdy(j+1) * fdy(j ) * cdy(j ) )
302 cny3(2,j,2) = 1.0_rp / ( cdy(j+1) * fdy(j ) * cdy(j ) ) &
303 + 1.0_rp / ( cdy(j ) * fdy(j ) * cdy(j ) ) &
304 + 1.0_rp / ( cdy(j ) * fdy(j-1) * cdy(j ) )
305 cny3(3,j,2) = 1.0_rp / ( cdy(j ) * fdy(j ) * cdy(j ) ) &
306 + 1.0_rp / ( cdy(j ) * fdy(j-1) * cdy(j ) ) &
307 + 1.0_rp / ( cdy(j ) * fdy(j-1) * cdy(j-1) )
311 cny4(1,j,2) = ( cny3(1,j+1,2) ) / fdy(j)
312 cny4(2,j,2) = ( cny3(2,j+1,2) + cny3(1,j,2) ) / fdy(j)
313 cny4(3,j,2) = ( cny3(3,j+1,2) + cny3(2,j,2) ) / fdy(j)
314 cny4(4,j,2) = ( cny3(1,j ,2) + cny3(3,j,2) ) / fdy(j)
315 cny4(5,j,2) = ( cny3(1,j-1,2) ) / fdy(j)
325 wdamp_tau, wdamp_height, &
332 real(RP),
intent(inout) :: wdamp_coef(
ka)
333 real(RP),
intent(in) :: wdamp_tau
334 real(RP),
intent(in) :: wdamp_height
335 real(RP),
intent(in) :: FZ(0:
ka)
337 real(RP) :: alpha, sw
342 if ( wdamp_height < 0.0_rp )
then 343 wdamp_coef(:) = 0.0_rp
344 elseif( fz(
ke)-wdamp_height < eps )
then 345 wdamp_coef(:) = 0.0_rp
347 alpha = 1.0_rp / wdamp_tau
350 sw = 0.5_rp + sign( 0.5_rp, fz(k)-wdamp_height )
352 wdamp_coef(k) = alpha * sw &
353 * 0.5_rp * ( 1.0_rp - cos( pi * (fz(k)-wdamp_height) / (fz(
ke)-wdamp_height)) )
355 wdamp_coef( 1:
ks-1) = wdamp_coef(
ks)
356 wdamp_coef(
ke+1:
ka ) = wdamp_coef(
ke)
359 log_info(
"ATMOS_DYN_wdamp_setup",*)
'Setup Rayleigh damping coefficient' 360 log_info_cont(
'(1x,A)')
'|=== Rayleigh Damping Coef ===|' 361 log_info_cont(
'(1x,A)')
'| k zh[m] coef[/s] |' 363 log_info_cont(
'(1x,A,I5,F10.2,ES12.4,A)')
'| ',k, fz(k), wdamp_coef(k),
' |' 366 log_info_cont(
'(1x,A,I5,F10.2,ES12.4,A)')
'| ',k, fz(k), wdamp_coef(k),
' | KE = TOA' 368 log_info_cont(
'(1x,A,I5,F10.2,ES12.4,A)')
'| ',k, fz(k), wdamp_coef(k),
' |' 371 log_info_cont(
'(1x,A,I5,F10.2,ES12.4,A)')
'| ',k, fz(k), wdamp_coef(k),
' | KS-1 = surface' 373 log_info_cont(
'(1x,A,I5,F10.2,ES12.4,A)')
'| ',k, fz(k), wdamp_coef(k),
' |' 376 log_info_cont(
'(1x,A,I5,F10.2,12x,A)')
'| ',k, fz(k),
' |' 377 log_info_cont(
'(1x,A)')
'|=============================|' 387 DENS, MOMZ, MOMX, MOMY, RHOT, &
388 CDZ, CDX, CDY, FDZ, FDX, FDY, DT, &
389 REF_dens, REF_pott, &
390 ND_COEF, ND_ORDER, ND_SFC_FACT, ND_USE_RS )
396 real(RP),
intent(out) :: num_diff(
ka,
ia,
ja,5,3)
398 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
399 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
400 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
401 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
402 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
404 real(RP),
intent(in) :: CDZ(
ka)
405 real(RP),
intent(in) :: CDX(
ia)
406 real(RP),
intent(in) :: CDY(
ja)
407 real(RP),
intent(in) :: FDZ(
ka-1)
408 real(RP),
intent(in) :: FDX(
ia-1)
409 real(RP),
intent(in) :: FDY(
ja-1)
411 real(RP),
intent(in) :: DT
413 real(RP),
intent(in) :: REF_dens(
ka,
ia,
ja)
414 real(RP),
intent(in) :: REF_pott(
ka,
ia,
ja)
416 real(RP),
intent(in) :: ND_COEF
417 integer,
intent(in) :: ND_ORDER
418 real(RP),
intent(in) :: ND_SFC_FACT
419 logical,
intent(in) :: ND_USE_RS
422 real(RP) :: VELZ (
ka,
ia,
ja)
423 real(RP) :: VELX (
ka,
ia,
ja)
424 real(RP) :: VELY (
ka,
ia,
ja)
425 real(RP) :: POTT (
ka,
ia,
ja)
427 real(RP) :: dens_diff(
ka,
ia,
ja)
428 real(RP) :: pott_diff(
ka,
ia,
ja)
430 real(RP) :: work(
ka,
ia,
ja,3,2)
435 real(RP) :: nd_coef_cdz(
ka)
436 real(RP) :: nd_coef_cdx(
ia)
437 real(RP) :: nd_coef_cdy(
ja)
438 real(RP) :: nd_coef_fdz(
ka-1)
439 real(RP) :: nd_coef_fdx(
ia-1)
440 real(RP) :: nd_coef_fdy(
ja-1)
446 nd_order4 = nd_order * 4
447 diff4 = nd_coef / ( 2**(nd_order4) * dt )
449 nd_coef_cdz(k) = diff4 * cdz(k)**nd_order4
452 nd_coef_fdz(k) = diff4 * fdz(k)**nd_order4
455 nd_coef_cdx(i) = diff4 * cdx(i)**nd_order4
456 nd_coef_fdx(i) = diff4 * fdx(i)**nd_order4
459 nd_coef_cdy(j) = diff4 * cdy(j)**nd_order4
460 nd_coef_fdy(j) = diff4 * fdy(j)**nd_order4
468 if ( .NOT. nd_use_rs )
then 475 pott(k,i,j) = rhot(k,i,j) / dens(k,i,j)
484 dens_diff(k,i,j) = ( ( dens(k,i,j) ) * 3.0_rp &
485 + ( dens(k,i+1,j)+dens(k,i-1,j)+dens(k,i,j+1)+dens(k,i,j-1) ) * 2.0_rp &
486 + ( dens(k,i+2,j)+dens(k,i-2,j)+dens(k,i,j+2)+dens(k,i,j-2) ) &
487 + ( dens(k+1,i,j)+dens(k-1,i,j) ) * 2.0_rp &
490 pott_diff(k,i,j) = ( ( pott(k,i,j) ) * 3.0_rp &
491 + ( pott(k,i+1,j)+pott(k,i-1,j)+pott(k,i,j+1)+pott(k,i,j-1) ) * 2.0_rp &
492 + ( pott(k,i+2,j)+pott(k,i-2,j)+pott(k,i,j+2)+pott(k,i,j-2) ) &
493 + ( pott(k+1,i,j)+pott(k-1,i,j) ) * 2.0_rp &
501 dens_diff(
ks,i,j) = ( ( dens(
ks,i,j) ) * 3.0_rp &
502 + ( dens(
ks,i+1,j)+dens(
ks,i-1,j)+dens(
ks,i,j+1)+dens(
ks,i,j-1) ) * 2.0_rp &
503 + ( dens(
ks,i+2,j)+dens(
ks,i-2,j)+dens(
ks,i,j+2)+dens(
ks,i,j-2) ) &
504 + ( dens(
ks+1,i,j) ) * 2.0_rp &
506 dens_diff(
ke,i,j) = ( ( dens(
ke,i,j) ) * 3.0_rp &
507 + ( dens(
ke,i+1,j)+dens(
ke,i-1,j)+dens(
ke,i,j+1)+dens(
ke,i,j-1) ) * 2.0_rp &
508 + ( dens(
ke,i+2,j)+dens(
ke,i-2,j)+dens(
ke,i,j+2)+dens(
ke,i,j-2) ) &
509 + ( dens(
ke-1,i,j) ) * 2.0_rp &
512 pott_diff(
ks,i,j) = ( ( pott(
ks,i,j) ) * 3.0_rp &
513 + ( pott(
ks,i+1,j)+pott(
ks,i-1,j)+pott(
ks,i,j+1)+pott(
ks,i,j-1) ) * 2.0_rp &
514 + ( pott(
ks,i+2,j)+pott(
ks,i-2,j)+pott(
ks,i,j+2)+pott(
ks,i,j-2) ) &
515 + ( pott(
ks+1,i,j) ) * 2.0_rp &
517 pott_diff(
ke,i,j) = ( ( pott(
ke,i,j) ) * 3.0_rp &
518 + ( pott(
ke,i+1,j)+pott(
ke,i-1,j)+pott(
ke,i,j+1)+pott(
ke,i,j-1) ) * 2.0_rp &
519 + ( pott(
ke,i+2,j)+pott(
ke,i-2,j)+pott(
ke,i,j+2)+pott(
ke,i,j-2) ) &
520 + ( pott(
ke-1,i,j) ) * 2.0_rp &
529 call comm_vars8( dens_diff, 1 )
530 call comm_vars8( pott_diff, 2 )
532 call comm_wait ( dens_diff, 1 )
533 call comm_wait ( pott_diff, 2 )
542 if ( nd_use_rs )
then 550 dens_diff(k,i,j) = dens(k,i,j) - ref_dens(k,i,j)
559 call calc_numdiff( work, iwork, &
572 num_diff(k,i,j,
i_dens,
zdir) = work(k,i,j,
zdir,iwork) * nd_coef_cdz(k)
586 num_diff(k,i,j,
i_dens,
xdir) = work(k,i,j,
xdir,iwork) * nd_coef_cdx(i)
602 num_diff(k,i,j,
i_dens,
ydir) = work(k,i,j,
ydir,iwork) * nd_coef_cdy(j)
619 call comm_vars8( num_diff(:,:,:,
i_dens,
zdir), i_comm_dens_z )
620 call comm_vars8( num_diff(:,:,:,
i_dens,
xdir), i_comm_dens_x )
621 call comm_vars8( num_diff(:,:,:,
i_dens,
ydir), i_comm_dens_y )
634 velz(k,i,j) = 2.0_rp * momz(k,i,j) / ( dens(k+1,i,j)+dens(k,i,j) )
641 call calc_numdiff( work, iwork, &
652 num_diff(k,i,j,
i_momz,
zdir) = work(k,i,j,
zdir,iwork) * nd_coef_fdz(k) &
667 num_diff(k,i,j,
i_momz,
xdir) = work(k,i,j,
xdir,iwork) * nd_coef_cdx(i) &
668 * 0.25_rp * ( dens(k+1,i+1,j)+dens(k+1,i,j)+dens(k,i+1,j)+dens(k,i,j) )
684 num_diff(k,i,j,
i_momz,
ydir) = work(k,i,j,
ydir,iwork) * nd_coef_cdy(j) &
685 * 0.25_rp * ( dens(k+1,i,j+1)+dens(k+1,i,j)+dens(k,i,j+1)+dens(k,i,j) )
703 call comm_vars8( num_diff(:,:,:,
i_momz,
zdir), i_comm_momz_z )
704 call comm_vars8( num_diff(:,:,:,
i_momz,
xdir), i_comm_momz_x )
705 call comm_vars8( num_diff(:,:,:,
i_momz,
ydir), i_comm_momz_y )
718 velx(k,i,j) = 2.0_rp * momx(k,i,j) / ( dens(k,i+1,j)+dens(k,i,j) )
725 call calc_numdiff( work, iwork, &
737 num_diff(k,i,j,
i_momx,
zdir) = work(k,i,j,
zdir,iwork) * nd_coef_cdz(k) &
738 * 0.25_rp * ( dens(k+1,i+1,j)+dens(k+1,i,j)+dens(k,i+1,j)+dens(k,i,j) )
752 num_diff(k,i,j,
i_momx,
xdir) = work(k,i,j,
xdir,iwork) * nd_coef_fdx(i) &
770 num_diff(k,i,j,
i_momx,
ydir) = work(k,i,j,
ydir,iwork) * nd_coef_cdy(j) &
771 * 0.25_rp * ( dens(k,i+1,j+1)+dens(k,i+1,j)+dens(k,i,j+1)+dens(k,i,j) )
788 call comm_vars8( num_diff(:,:,:,
i_momx,
zdir), i_comm_momx_z )
789 call comm_vars8( num_diff(:,:,:,
i_momx,
xdir), i_comm_momx_x )
790 call comm_vars8( num_diff(:,:,:,
i_momx,
ydir), i_comm_momx_y )
803 vely(k,i,j) = 2.0_rp * momy(k,i,j) / ( dens(k,i,j+1)+dens(k,i,j) )
810 call calc_numdiff( work, iwork, &
821 num_diff(k,i,j,
i_momy,
zdir) = work(k,i,j,
zdir,iwork) * nd_coef_cdz(k) &
822 * 0.25_rp * ( dens(k+1,i,j+1)+dens(k+1,i,j)+dens(k,i,j+1)+dens(k,i,j) )
836 num_diff(k,i,j,
i_momy,
xdir) = work(k,i,j,
xdir,iwork) * nd_coef_cdx(i) &
837 * 0.25_rp * ( dens(k,i+1,j+1)+dens(k,i,j+1)+dens(k,i+1,j)+dens(k,i,j) )
853 num_diff(k,i,j,
i_momy,
ydir) = work(k,i,j,
ydir,iwork) * nd_coef_fdy(j) &
871 call comm_vars8( num_diff(:,:,:,
i_momy,
zdir), i_comm_momy_z )
872 call comm_vars8( num_diff(:,:,:,
i_momy,
xdir), i_comm_momy_x )
873 call comm_vars8( num_diff(:,:,:,
i_momy,
ydir), i_comm_momy_y )
881 if ( nd_use_rs )
then 886 pott_diff(k,i,j) = rhot(k,i,j) / dens(k,i,j) - ref_pott(k,i,j)
894 call calc_numdiff( work, iwork, &
905 num_diff(k,i,j,
i_rhot,
zdir) = work(k,i,j,
zdir,iwork) * nd_coef_cdz(k) &
906 * 0.5_rp * ( dens(k+1,i,j)+dens(k,i,j) )
927 num_diff(k,i,j,
i_rhot,
xdir) = work(k,i,j,
xdir,iwork) * nd_coef_cdx(i) &
928 * 0.5_rp * ( dens(k,i+1,j)+dens(k,i,j) )
944 num_diff(k,i,j,
i_rhot,
ydir) = work(k,i,j,
ydir,iwork) * nd_coef_cdy(j) &
945 * 0.5_rp * ( dens(k,i,j+1)+dens(k,i,j) )
962 call comm_vars8( num_diff(:,:,:,
i_rhot,
zdir), i_comm_rhot_z )
963 call comm_vars8( num_diff(:,:,:,
i_rhot,
xdir), i_comm_rhot_x )
964 call comm_vars8( num_diff(:,:,:,
i_rhot,
ydir), i_comm_rhot_y )
966 call comm_wait ( num_diff(:,:,:,
i_dens,
zdir), i_comm_dens_z )
967 call comm_wait ( num_diff(:,:,:,
i_dens,
xdir), i_comm_dens_x )
968 call comm_wait ( num_diff(:,:,:,
i_dens,
ydir), i_comm_dens_y )
969 call comm_wait ( num_diff(:,:,:,
i_momz,
zdir), i_comm_momz_z )
970 call comm_wait ( num_diff(:,:,:,
i_momz,
xdir), i_comm_momz_x )
971 call comm_wait ( num_diff(:,:,:,
i_momz,
ydir), i_comm_momz_y )
972 call comm_wait ( num_diff(:,:,:,
i_momx,
zdir), i_comm_momx_z )
973 call comm_wait ( num_diff(:,:,:,
i_momx,
xdir), i_comm_momx_x )
974 call comm_wait ( num_diff(:,:,:,
i_momx,
ydir), i_comm_momx_y )
975 call comm_wait ( num_diff(:,:,:,
i_momy,
zdir), i_comm_momy_z )
976 call comm_wait ( num_diff(:,:,:,
i_momy,
xdir), i_comm_momy_x )
977 call comm_wait ( num_diff(:,:,:,
i_momy,
ydir), i_comm_momy_y )
978 call comm_wait ( num_diff(:,:,:,
i_rhot,
zdir), i_comm_rhot_z )
979 call comm_wait ( num_diff(:,:,:,
i_rhot,
xdir), i_comm_rhot_x )
980 call comm_wait ( num_diff(:,:,:,
i_rhot,
ydir), i_comm_rhot_y )
994 ND_COEF, ND_ORDER, ND_SFC_FACT, ND_USE_RS )
1000 real(RP),
intent(out) :: num_diff_q(
ka,
ia,
ja,3)
1002 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
1003 real(RP),
intent(in) :: QTRC(
ka,
ia,
ja)
1004 logical,
intent(in) :: is_qv
1006 real(RP),
intent(in) :: CDZ(
ka)
1007 real(RP),
intent(in) :: CDX(
ia)
1008 real(RP),
intent(in) :: CDY(
ja)
1010 real(RP),
intent(in) :: dt
1012 real(RP),
intent(in) :: REF_qv(
ka,
ia,
ja)
1013 integer,
intent(in) :: iq
1015 real(RP),
intent(in) :: ND_COEF
1016 integer,
intent(in) :: ND_ORDER
1017 real(RP),
intent(in) :: ND_SFC_FACT
1018 logical,
intent(in) :: ND_USE_RS
1020 real(RP) :: qv_diff(
ka,
ia,
ja)
1022 real(RP) :: work(
ka,
ia,
ja,3,2)
1026 integer :: nd_order4
1027 real(RP) :: nd_coef_cdz(
ka)
1028 real(RP) :: nd_coef_cdx(
ia)
1029 real(RP) :: nd_coef_cdy(
ja)
1038 nd_order4 = nd_order * 4
1039 diff4 = nd_coef / ( 2**(nd_order4) * dt )
1041 nd_coef_cdz(k) = diff4 * cdz(k)**nd_order4
1044 nd_coef_cdx(i) = diff4 * cdx(i)**nd_order4
1047 nd_coef_cdy(j) = diff4 * cdy(j)**nd_order4
1050 if ( is_qv .AND. (.NOT. nd_use_rs) )
then 1058 qv_diff(k,i,j) = ( ( qtrc(k,i,j) ) * 3.0_rp &
1059 + ( qtrc(k,i+1,j)+qtrc(k,i-1,j)+qtrc(k,i,j+1)+qtrc(k,i,j-1) ) * 2.0_rp &
1060 + ( qtrc(k,i+2,j)+qtrc(k,i-2,j)+qtrc(k,i,j+2)+qtrc(k,i,j-2) ) &
1061 + ( qtrc(k+1,i,j)+qtrc(k-1,i,j) ) * 2.0_rp &
1070 qv_diff(
ks,i,j) = ( ( qtrc(
ks,i,j) ) * 3.0_rp &
1071 + ( qtrc(
ks,i+1,j)+qtrc(
ks,i-1,j)+qtrc(
ks,i,j+1)+qtrc(
ks,i,j-1) ) * 2.0_rp &
1072 + ( qtrc(
ks,i+2,j)+qtrc(
ks,i-2,j)+qtrc(
ks,i,j+2)+qtrc(
ks,i,j-2) ) &
1073 + ( qtrc(
ks+1,i,j) ) * 2.0_rp &
1075 qv_diff(
ke,i,j) = ( ( qtrc(
ke,i,j) ) * 3.0_rp &
1076 + ( qtrc(
ke,i+1,j)+qtrc(
ke,i-1,j)+qtrc(
ke,i,j+1)+qtrc(
ke,i,j-1) ) * 2.0_rp &
1077 + ( qtrc(
ke,i+2,j)+qtrc(
ke,i-2,j)+qtrc(
ke,i,j+2)+qtrc(
ke,i,j-2) ) &
1078 + ( qtrc(
ke-1,i,j) ) * 2.0_rp &
1087 call comm_vars8(qv_diff, 1)
1088 call comm_wait (qv_diff, 1)
1096 if ( nd_use_rs )
then 1104 qv_diff(k,i,j) = qtrc(k,i,j) - ref_qv(k,i,j)
1113 call calc_numdiff( work, iwork, &
1120 call calc_numdiff( work, iwork, &
1135 num_diff_q(k,i,j,
zdir) = work(k,i,j,
zdir,iwork) * nd_coef_cdz(k) &
1136 * 0.5_rp * ( dens(k+1,i,j)+dens(k,i,j) )
1142 num_diff_q(1:
ks-2,i,j,
zdir) = 0.0_rp
1143 num_diff_q(
ks-1,i,j,
zdir) = work(
ks-1,i,j,
zdir,iwork) * nd_coef_cdz(
ks-1) &
1145 num_diff_q(
ke ,i,j,
zdir) = work(
ke ,i,j,
zdir,iwork) * nd_coef_cdz(
ke ) &
1147 num_diff_q(
ke+1:
ka,i,j,
zdir) = 0.0_rp
1154 num_diff_q(k,i,j,
xdir) = work(k,i,j,
xdir,iwork) * nd_coef_cdx(i) &
1155 * 0.5_rp * ( dens(k,i+1,j)+dens(k,i,j) )
1161 num_diff_q(1:
ks-1,i,j,
xdir) = 0.0_rp
1162 num_diff_q(
ks ,i,j,
xdir) = num_diff_q(
ks ,i,j,
xdir) * nd_sfc_fact
1163 num_diff_q(
ks+1,i,j,
xdir) = num_diff_q(
ks+1,i,j,
xdir) * (1.0_rp + nd_sfc_fact) * 0.5_rp
1164 num_diff_q(
ke+1:
ka,i,j,
xdir) = 0.0_rp
1171 num_diff_q(k,i,j,
ydir) = work(k,i,j,
ydir,iwork) * nd_coef_cdy(j) &
1172 * 0.5_rp * ( dens(k,i,j+1)+dens(k,i,j) )
1178 num_diff_q(1:
ks-1,i,j,
ydir) = 0.0_rp
1179 num_diff_q(
ks ,i,j,
ydir) = num_diff_q(
ks ,i,j,
ydir) * nd_sfc_fact
1180 num_diff_q(
ks+1,i,j,
ydir) = num_diff_q(
ks+1,i,j,
ydir) * (1.0_rp + nd_sfc_fact) * 0.5_rp
1181 num_diff_q(
ke+1:
ka,i,j,
ydir) = 0.0_rp
1189 call comm_vars8( num_diff_q(:,:,:,
zdir), i_comm_qtrc_z )
1190 call comm_vars8( num_diff_q(:,:,:,
xdir), i_comm_qtrc_x )
1191 call comm_vars8( num_diff_q(:,:,:,
ydir), i_comm_qtrc_y )
1193 call comm_wait ( num_diff_q(:,:,:,
zdir), i_comm_qtrc_z )
1194 call comm_wait ( num_diff_q(:,:,:,
xdir), i_comm_qtrc_x )
1195 call comm_wait ( num_diff_q(:,:,:,
ydir), i_comm_qtrc_y )
1212 real(RP),
intent(out) :: phi_t(
ka,
ia,
ja)
1213 real(RP),
intent(in ) :: phi (
ka,
ia,
ja)
1214 real(RP),
intent(in ) :: rdz(:)
1215 real(RP),
intent(in ) :: rdx(:)
1216 real(RP),
intent(in ) :: rdy(:)
1217 integer ,
intent(in ) :: KO
1218 integer ,
intent(in ) :: IO
1219 integer ,
intent(in ) :: JO
1221 real(RP) :: flux(
ka,
ia,
ja,3)
1229 call comm_vars8( flux(:,:,:,
xdir), 1 )
1230 call comm_vars8( flux(:,:,:,
ydir), 2 )
1231 call comm_wait ( flux(:,:,:,
xdir), 1 )
1232 call comm_wait ( flux(:,:,:,
ydir), 2 )
1237 phi_t(k,i,j) = ( flux(k+ko,i,j,
zdir) - flux(k-1+ko,i,j,
zdir) ) * rdz(k) &
1238 + ( flux(k,i+io,j,
xdir) - flux(k,i-1+io,j,
xdir) ) * rdx(i) &
1239 + ( flux(k,i,j+jo,
ydir) - flux(k,i,j-1+jo,
ydir) ) * rdy(j)
1249 DENS, MOMZ, MOMX, MOMY, RHOT, PROG, &
1250 DENS0, MOMZ0, MOMX0, MOMY0, RHOT0, PROG0, &
1251 BND_W, BND_E, BND_S, BND_N )
1253 real(RP),
intent(inout) :: DENS (
ka,
ia,
ja)
1254 real(RP),
intent(inout) :: MOMZ (
ka,
ia,
ja)
1255 real(RP),
intent(inout) :: MOMX (
ka,
ia,
ja)
1256 real(RP),
intent(inout) :: MOMY (
ka,
ia,
ja)
1257 real(RP),
intent(inout) :: RHOT (
ka,
ia,
ja)
1258 real(RP),
intent(inout) :: PROG (
ka,
ia,
ja,
va)
1259 real(RP),
intent(in) :: DENS0(
ka,
ia,
ja)
1260 real(RP),
intent(in) :: MOMZ0(
ka,
ia,
ja)
1261 real(RP),
intent(in) :: MOMX0(
ka,
ia,
ja)
1262 real(RP),
intent(in) :: MOMY0(
ka,
ia,
ja)
1263 real(RP),
intent(in) :: RHOT0(
ka,
ia,
ja)
1264 real(RP),
intent(in) :: PROG0(
ka,
ia,
ja,
va)
1265 logical,
intent(in) :: BND_W
1266 logical,
intent(in) :: BND_E
1267 logical,
intent(in) :: BND_S
1268 logical,
intent(in) :: BND_N
1270 integer :: k, i, j, iv
1280 dens(k,i,j) = dens0(k,i,j)
1281 momz(k,i,j) = momz0(k,i,j)
1282 momx(k,i,j) = momx0(k,i,j)
1283 momy(k,i,j) = momy0(k,i,j)
1284 rhot(k,i,j) = rhot0(k,i,j)
1286 prog(k,i,j,iv) = prog0(k,i,j,iv)
1300 dens(k,i,j) = dens0(k,i,j)
1301 momz(k,i,j) = momz0(k,i,j)
1302 momx(k,i,j) = momx0(k,i,j)
1303 momy(k,i,j) = momy0(k,i,j)
1304 rhot(k,i,j) = rhot0(k,i,j)
1306 prog(k,i,j,iv) = prog0(k,i,j,iv)
1315 momx(k,
ie,j) = momx0(k,
ie,j)
1327 dens(k,i,j) = dens0(k,i,j)
1328 momz(k,i,j) = momz0(k,i,j)
1329 momx(k,i,j) = momx0(k,i,j)
1330 momy(k,i,j) = momy0(k,i,j)
1331 rhot(k,i,j) = rhot0(k,i,j)
1333 prog(k,i,j,iv) = prog0(k,i,j,iv)
1347 dens(k,i,j) = dens0(k,i,j)
1348 momz(k,i,j) = momz0(k,i,j)
1349 momx(k,i,j) = momx0(k,i,j)
1350 momy(k,i,j) = momy0(k,i,j)
1351 rhot(k,i,j) = rhot0(k,i,j)
1353 prog(k,i,j,iv) = prog0(k,i,j,iv)
1362 momy(k,i,
je) = momy0(k,i,
je)
1373 BND_W, BND_E, BND_S, BND_N )
1375 real(RP),
intent(inout) :: QTRC (
ka,
ia,
ja)
1376 real(RP),
intent(in) :: QTRC0(
ka,
ia,
ja)
1377 logical,
intent(in) :: BND_W
1378 logical,
intent(in) :: BND_E
1379 logical,
intent(in) :: BND_S
1380 logical,
intent(in) :: BND_N
1391 qtrc(k,i,j) = qtrc0(k,i,j)
1403 qtrc(k,i,j) = qtrc0(k,i,j)
1415 qtrc(k,i,j) = qtrc0(k,i,j)
1427 qtrc(k,i,j) = qtrc0(k,i,j)
1440 GSQRT, J13G, J23G, J33G, MAPF, &
1441 RCDZ, RCDX, RCDY, RFDZ, FDZ )
1443 real(RP),
intent(out) :: DDIV(
ka,
ia,
ja)
1444 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
1445 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
1446 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
1447 real(RP),
intent(in) :: GSQRT(
ka,
ia,
ja,7)
1448 real(RP),
intent(in) :: J13G(
ka,
ia,
ja,7)
1449 real(RP),
intent(in) :: J23G(
ka,
ia,
ja,7)
1450 real(RP),
intent(in) :: J33G
1451 real(RP),
intent(in) :: MAPF(
ia,
ja,2,7)
1452 real(RP),
intent(in) :: RCDZ(
ka)
1453 real(RP),
intent(in) :: RCDX(
ia)
1454 real(RP),
intent(in) :: RCDY(
ja)
1455 real(RP),
intent(in) :: RFDZ(
ka-1)
1456 real(RP),
intent(in) :: FDZ(
ka-1)
1468 ddiv(k,i,j) = j33g * ( momz(k,i,j) - momz(k-1,i ,j ) ) * rcdz(k) &
1469 + ( ( momx(k+1,i,j) + momx(k+1,i-1,j ) ) * j13g(k+1,i,j,
i_xyw) &
1470 - ( momx(k-1,i,j) + momx(k-1,i-1,j ) ) * j13g(k-1,i,j,
i_xyw) &
1471 + ( momy(k+1,i,j) + momy(k+1,i ,j-1) ) * j23g(k+1,i,j,
i_xyw) &
1472 - ( momy(k-1,i,j) + momy(k-1,i ,j-1) ) * j23g(k-1,i,j,
i_xyw) ) / ( fdz(k)+fdz(k-1) ) &
1473 + mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) &
1474 * ( ( momx(k,i ,j ) * gsqrt(k,i ,j ,
i_uyz) / mapf(i ,j ,2,
i_uy) &
1475 - momx(k,i-1,j ) * gsqrt(k,i-1,j ,
i_uyz) / mapf(i-1,j ,2,
i_uy) ) * rcdx(i) &
1476 + ( momy(k,i ,j ) * gsqrt(k,i ,j ,
i_xvz) / mapf(i ,j ,1,
i_xv) &
1477 - momy(k,i, j-1) * gsqrt(k,i ,j-1,
i_xvz) / mapf(i ,j-1,1,
i_xv) ) * rcdy(j) )
1482 k = iundef; i = iundef; j = iundef
1487 ddiv(
ks,i,j) = j33g * ( momz(
ks,i,j) ) * rcdz(
ks) &
1488 + ( ( momx(
ks+1,i,j) + momx(
ks+1,i-1,j ) ) * j13g(
ks+1,i,j,
i_xyw) &
1489 - ( momx(
ks-1,i,j) + momx(
ks ,i-1,j ) ) * j13g(
ks ,i,j,
i_xyw) &
1490 + ( momy(
ks+1,i,j) + momy(
ks+1,i ,j-1) ) * j23g(
ks+1,i,j,
i_xyw) &
1491 - ( momy(
ks ,i,j) + momy(
ks ,i ,j-1) ) * j23g(
ks ,i,j,
i_xyw) ) * rfdz(
ks) &
1492 + mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) &
1493 * ( ( momx(
ks,i ,j ) * gsqrt(
ks,i ,j ,
i_uyz) / mapf(i ,j ,2,
i_uy) &
1494 - momx(
ks,i-1,j ) * gsqrt(
ks,i-1,j ,
i_uyz) / mapf(i-1,j ,2,
i_uy) ) * rcdx(i) &
1495 + ( momy(
ks,i ,j ) * gsqrt(
ks,i ,j ,
i_xvz) / mapf(i ,j ,1,
i_xv) &
1496 - momy(
ks,i, j-1) * gsqrt(
ks,i ,j-1,
i_xvz) / mapf(i ,j-1,1,
i_xv) ) * rcdy(j) )
1497 ddiv(
ke,i,j) = j33g * ( - momz(
ke-1,i ,j ) ) * rcdz(
ke) &
1498 + ( ( momx(
ke ,i,j) + momx(
ke ,i-1,j ) ) * j13g(
ke ,i,j,
i_xyw) &
1499 - ( momx(
ke-1,i,j) + momx(
ke-1,i-1,j ) ) * j13g(
ke-1,i,j,
i_xyw) &
1500 + ( momy(
ke ,i,j) + momy(
ke ,i ,j-1) ) * j23g(
ke ,i,j,
i_xyw) &
1501 - ( momy(
ke-1,i,j) + momy(
ke-1,i ,j-1) ) * j23g(
ke-1,i,j,
i_xyw) ) * rfdz(
ke) &
1502 + mapf(i,j,1,
i_xy) * mapf(i,j,2,
i_xy) &
1503 * ( ( momx(
ke,i ,j ) * gsqrt(
ke,i ,j ,
i_uyz) / mapf(i ,j ,2,
i_uy) &
1504 - momx(
ke,i-1,j ) * gsqrt(
ke,i-1,j ,
i_uyz) / mapf(i-1,j ,2,
i_uy) ) * rcdx(i) &
1505 + ( momy(
ke,i ,j ) * gsqrt(
ke,i ,j ,
i_xvz) / mapf(i ,j ,1,
i_xv) &
1506 - momy(
ke,i, j-1) * gsqrt(
ke,i ,j-1,
i_xvz) / mapf(i ,j-1,1,
i_xv) ) * rcdy(j) )
1510 k = iundef; i = iundef; j = iundef
1518 subroutine calc_numdiff(&
1527 real(RP),
intent(out) :: work(
ka,
ia,
ja,3,2)
1528 integer,
intent(out) :: iwork
1529 real(RP),
intent(in) :: data(
ka,
ia,
ja)
1530 integer,
intent(in) :: nd_order
1531 integer,
intent(in) :: KO
1532 integer,
intent(in) :: IO
1533 integer,
intent(in) :: JO
1534 integer,
intent(in) :: KEE
1536 integer :: i_in, i_out, i_tmp
1559 call comm_vars8( work(:,:,:,
zdir,i_in), 16 )
1560 call comm_vars8( work(:,:,:,
xdir,i_in), 17 )
1561 call comm_vars8( work(:,:,:,
ydir,i_in), 18 )
1563 call comm_wait ( work(:,:,:,
zdir,i_in), 16 )
1564 call comm_wait ( work(:,:,:,
xdir,i_in), 17 )
1565 call comm_wait ( work(:,:,:,
ydir,i_in), 18 )
1571 call calc_diff4( work(:,:,:,:,i_out), &
1572 work(:,:,:,:,i_in), &
1589 end subroutine calc_numdiff
1597 real(RP),
intent(out) :: diff(
ka,
ia,
ja,3)
1598 real(RP),
intent(in ) :: phi(
ka,
ia,
ja)
1599 integer ,
intent(in ) :: KO
1600 integer ,
intent(in ) :: IO
1601 integer ,
intent(in ) :: JO
1616 call check( __line__, phi(k+2,i,j) )
1617 call check( __line__, phi(k+1,i,j) )
1618 call check( __line__, phi(k ,i,j) )
1619 call check( __line__, phi(k-1,i,j) )
1621 diff(k,i,j,
zdir) = ( + cnz3(1,k+1,1) * phi(k+2,i,j) &
1622 - cnz3(2,k+1,1) * phi(k+1,i,j) &
1623 + cnz3(3,k+1,1) * phi(k ,i,j) &
1624 - cnz3(1,k ,1) * phi(k-1,i,j) )
1633 call check( __line__, phi(
ks+2,i,j) )
1634 call check( __line__, phi(
ks+1,i,j) )
1635 call check( __line__, phi(
ks,i,j) )
1636 call check( __line__, phi(
ke,i,j) )
1637 call check( __line__, phi(
ke-1,i,j) )
1638 call check( __line__, phi(
ke-2,i,j) )
1640 diff(
ks,i,j,
zdir) = ( + cnz3(1,
ks+1,1) * phi(
ks+2,i,j) &
1641 - cnz3(2,
ks+1,1) * phi(
ks+1,i,j) &
1642 + cnz3(3,
ks+1,1) * phi(
ks ,i,j) &
1643 - cnz3(1,
ks ,1) * phi(
ks+1,i,j) )
1646 diff(
ke-1,i,j,
zdir) = ( + cnz3(1,
ke ,1) * phi(
ke-1,i,j) &
1647 - cnz3(2,
ke ,1) * phi(
ke ,i,j) &
1648 + cnz3(3,
ke ,1) * phi(
ke-1,i,j) &
1649 - cnz3(1,
ke-1,1) * phi(
ke-2,i,j) )
1652 diff(
ke+2,i,j,
zdir) = 0.0_rp
1664 call check( __line__, phi(k+1,i,j) )
1665 call check( __line__, phi(k ,i,j) )
1666 call check( __line__, phi(k-1,i,j) )
1667 call check( __line__, phi(k-2,i,j) )
1669 diff(k,i,j,
zdir) = ( + cnz3(1,k ,2) * phi(k+1,i,j) &
1670 - cnz3(2,k ,2) * phi(k ,i,j) &
1671 + cnz3(3,k ,2) * phi(k-1,i,j) &
1672 - cnz3(1,k-1,2) * phi(k-2,i,j) )
1681 call check( __line__, phi(
ks+2,i,j) )
1682 call check( __line__, phi(
ks+1,i,j) )
1683 call check( __line__, phi(
ks,i,j) )
1684 call check( __line__, phi(
ks+1,i,j) )
1685 call check( __line__, phi(
ks ,i,j) )
1686 call check( __line__, phi(
ke-1,i,j) )
1687 call check( __line__, phi(
ke-2,i,j) )
1688 call check( __line__, phi(
ke-3,i,j) )
1690 diff(
ks+1,i,j,
zdir) = ( + cnz3(1,
ks+1,2) * phi(
ks+2,i,j) &
1691 - cnz3(2,
ks+1,2) * phi(
ks+1,i,j) &
1692 + cnz3(3,
ks+1,2) * phi(
ks ,i,j) &
1693 - cnz3(1,
ks ,2) * phi(
ks+1,i,j) )
1697 diff(
ke-1,i,j,
zdir) = ( - cnz3(2,
ke-1,2) * phi(
ke-1,i,j) &
1698 + cnz3(3,
ke-1,2) * phi(
ke-2,i,j) &
1699 - cnz3(1,
ke-2,2) * phi(
ke-3,i,j) )
1700 diff(
ke ,i,j,
zdir) = ( + cnz3(1,
ke ,2) * phi(
ke-1,i,j) &
1701 + cnz3(3,
ke ,2) * phi(
ke-1,i,j) &
1702 - cnz3(1,
ke-1,2) * phi(
ke-2,i,j) )
1717 call check( __line__, phi(k,i+2,j) )
1718 call check( __line__, phi(k,i+1,j) )
1719 call check( __line__, phi(k,i ,j) )
1720 call check( __line__, phi(k,i-1,j) )
1722 diff(k,i,j,
xdir) = ( + cnx3(1,i+1,1) * phi(k,i+2,j) &
1723 - cnx3(2,i+1,1) * phi(k,i+1,j) &
1724 + cnx3(3,i+1,1) * phi(k,i ,j) &
1725 - cnx3(1,i ,1) * phi(k,i-1,j) )
1736 call check( __line__, phi(k,i+1,j) )
1737 call check( __line__, phi(k,i ,j) )
1738 call check( __line__, phi(k,i-1,j) )
1739 call check( __line__, phi(k,i-2,j) )
1741 diff(k,i,j,
xdir) = ( + cnx3(1,i ,2) * phi(k,i+1,j) &
1742 - cnx3(2,i ,2) * phi(k,i ,j) &
1743 + cnx3(3,i ,2) * phi(k,i-1,j) &
1744 - cnx3(1,i-1,2) * phi(k,i-2,j) )
1753 diff( 1:
ks-1,i,j,
xdir) = 0.0_rp
1765 call check( __line__, phi(k,i,j+2) )
1766 call check( __line__, phi(k,i,j+1) )
1767 call check( __line__, phi(k,i,j ) )
1768 call check( __line__, phi(k,i,j-1) )
1770 diff(k,i,j,
ydir) = ( + cny3(1,j+1,1) * phi(k,i,j+2) &
1771 - cny3(2,j+1,1) * phi(k,i,j+1) &
1772 + cny3(3,j+1,1) * phi(k,i,j ) &
1773 - cny3(1,j ,1) * phi(k,i,j-1) )
1784 call check( __line__, phi(k,i,j+1) )
1785 call check( __line__, phi(k,i,j ) )
1786 call check( __line__, phi(k,i,j-1) )
1787 call check( __line__, phi(k,i,j-2) )
1789 diff(k,i,j,
ydir) = ( + cny3(1,j ,2) * phi(k,i,j+1) &
1790 - cny3(2,j ,2) * phi(k,i,j ) &
1791 + cny3(3,j ,2) * phi(k,i,j-1) &
1792 - cny3(1,j-1,2) * phi(k,i,j-2) )
1801 diff( 1:
ks-1,i,j,
ydir) = 0.0_rp
1810 subroutine calc_diff4( &
1819 real(RP),
intent(out) :: num_diff_pt1(
ka,
ia,
ja,3)
1820 real(RP),
intent(in) :: num_diff_pt0(
ka,
ia,
ja,3)
1821 real(RP),
intent(in) :: CNZ4(5,
ka)
1822 real(RP),
intent(in) :: CNX4(5,
ia)
1823 real(RP),
intent(in) :: CNY4(5,
ja)
1824 integer,
intent(in) :: k1
1834 call check( __line__, cnz4(1,k) )
1835 call check( __line__, cnz4(2,k) )
1836 call check( __line__, cnz4(3,k) )
1837 call check( __line__, cnz4(4,k) )
1838 call check( __line__, cnz4(5,k) )
1839 call check( __line__, num_diff_pt0(k+2,i,j,
zdir) )
1840 call check( __line__, num_diff_pt0(k+1,i,j,
zdir) )
1841 call check( __line__, num_diff_pt0(k ,i,j,
zdir) )
1842 call check( __line__, num_diff_pt0(k-1,i,j,
zdir) )
1843 call check( __line__, num_diff_pt0(k-2,i,j,
zdir) )
1845 num_diff_pt1(k,i,j,
zdir) = &
1846 ( cnz4(1,k) * num_diff_pt0(k+2,i,j,
zdir) &
1847 - cnz4(2,k) * num_diff_pt0(k+1,i,j,
zdir) &
1848 + cnz4(3,k) * num_diff_pt0(k ,i,j,
zdir) &
1849 - cnz4(4,k) * num_diff_pt0(k-1,i,j,
zdir) &
1850 + cnz4(5,k) * num_diff_pt0(k-2,i,j,
zdir) )
1858 num_diff_pt1(
ks-1,i,j,
zdir) = - num_diff_pt1(
ks ,i,j,
zdir)
1859 num_diff_pt1(
ks-2,i,j,
zdir) = - num_diff_pt1(
ks+1,i,j,
zdir)
1860 num_diff_pt1(
ke ,i,j,
zdir) = - num_diff_pt1(
ke-1,i,j,
zdir)
1861 num_diff_pt1(
ke+1,i,j,
zdir) = - num_diff_pt1(
ke-2,i,j,
zdir)
1870 call check( __line__, cnx4(1,i) )
1871 call check( __line__, cnx4(2,i) )
1872 call check( __line__, cnx4(3,i) )
1873 call check( __line__, cnx4(4,i) )
1874 call check( __line__, cnx4(5,i) )
1875 call check( __line__, num_diff_pt0(k,i-2,j,
xdir) )
1876 call check( __line__, num_diff_pt0(k,i+1,j,
xdir) )
1877 call check( __line__, num_diff_pt0(k,i ,j,
xdir) )
1878 call check( __line__, num_diff_pt0(k,i-1,j,
xdir) )
1879 call check( __line__, num_diff_pt0(k,i-2,j,
xdir) )
1881 num_diff_pt1(k,i,j,
xdir) = &
1882 ( cnx4(1,i) * num_diff_pt0(k,i+2,j,
xdir) &
1883 - cnx4(2,i) * num_diff_pt0(k,i+1,j,
xdir) &
1884 + cnx4(3,i) * num_diff_pt0(k,i ,j,
xdir) &
1885 - cnx4(4,i) * num_diff_pt0(k,i-1,j,
xdir) &
1886 + cnx4(5,i) * num_diff_pt0(k,i-2,j,
xdir) )
1896 call check( __line__, cny4(1,j) )
1897 call check( __line__, cny4(2,j) )
1898 call check( __line__, cny4(3,j) )
1899 call check( __line__, cny4(4,j) )
1900 call check( __line__, cny4(5,j) )
1901 call check( __line__, num_diff_pt0(k,i,j-2,
ydir) )
1902 call check( __line__, num_diff_pt0(k,i,j+1,
ydir) )
1903 call check( __line__, num_diff_pt0(k,i,j ,
ydir) )
1904 call check( __line__, num_diff_pt0(k,i,j-1,
ydir) )
1905 call check( __line__, num_diff_pt0(k,i,j-2,
ydir) )
1907 num_diff_pt1(k,i,j,
ydir) = &
1908 ( cny4(1,j) * num_diff_pt0(k,i,j+2,
ydir) &
1909 - cny4(2,j) * num_diff_pt0(k,i,j+1,
ydir) &
1910 + cny4(3,j) * num_diff_pt0(k,i,j ,
ydir) &
1911 - cny4(4,j) * num_diff_pt0(k,i,j-1,
ydir) &
1912 + cny4(5,j) * num_diff_pt0(k,i,j-2,
ydir) )
1918 end subroutine calc_diff4
1924 phi_in, DENS0, DENS, &
1939 real(RP),
intent(out) :: qflx_anti(
ka,
ia,
ja,3)
1941 real(RP),
intent(in) :: phi_in(
ka,
ia,
ja)
1942 real(RP),
intent(in) :: DENS0(
ka,
ia,
ja)
1943 real(RP),
intent(in) :: DENS (
ka,
ia,
ja)
1945 real(RP),
intent(in) :: qflx_hi(
ka,
ia,
ja,3)
1946 real(RP),
intent(in) :: qflx_lo(
ka,
ia,
ja,3)
1947 real(RP),
intent(in) :: mflx_hi(
ka,
ia,
ja,3)
1949 real(RP),
intent(in) :: RDZ(:)
1950 real(RP),
intent(in) :: RDX(:)
1951 real(RP),
intent(in) :: RDY(:)
1953 real(RP),
intent(in) :: GSQRT(
ka,
ia,
ja)
1954 real(RP),
intent(in) :: MAPF(
ia,
ja,2)
1956 real(RP),
intent(in) :: dt
1958 logical,
intent(in) :: flag_vect
1961 real(RP) :: phi_lo(
ka,
ia,
ja)
1962 real(RP) :: pjpls(
ka,
ia,
ja)
1963 real(RP) :: pjmns(
ka,
ia,
ja)
1964 real(RP) :: qjpls(
ka,
ia,
ja)
1965 real(RP) :: qjmns(
ka,
ia,
ja)
1966 real(RP) :: rjpls(
ka,
ia,
ja)
1967 real(RP) :: rjmns(
ka,
ia,
ja)
1969 real(RP) :: qmin, qmax
1970 real(RP) :: zerosw, dirsw
1972 real(RP) :: fact(0:1,-1:1,-1:1)
1973 real(RP) :: rw, ru, rv
1974 real(RP) :: qa_in, qb_in
1975 real(RP) :: qa_lo, qb_lo
1977 integer :: k, i, j, ijs
1978 integer :: IIS, IIE, JJS, JJE
1982 qflx_anti(:,:,:,:) = undef
1984 pjpls(:,:,:) = undef
1985 pjmns(:,:,:) = undef
1986 qjpls(:,:,:) = undef
1987 qjmns(:,:,:) = undef
1988 rjpls(:,:,:) = undef
1989 rjmns(:,:,:) = undef
2002 call check( __line__, qflx_hi(k,i,j,
zdir) )
2003 call check( __line__, qflx_lo(k,i,j,
zdir) )
2005 qflx_anti(k,i,j,
zdir) = qflx_hi(k,i,j,
zdir) - qflx_lo(k,i,j,
zdir)
2010 k = iundef; i = iundef; j = iundef
2015 qflx_anti(
ks-1,i,j,
zdir) = 0.0_rp
2016 qflx_anti(
ke ,i,j,
zdir) = 0.0_rp
2020 k = iundef; i = iundef; j = iundef
2027 call check( __line__, qflx_hi(k,i,j,
xdir) )
2028 call check( __line__, qflx_lo(k,i,j,
xdir) )
2030 qflx_anti(k,i,j,
xdir) = qflx_hi(k,i,j,
xdir) - qflx_lo(k,i,j,
xdir)
2035 k = iundef; i = iundef; j = iundef
2042 call check( __line__, qflx_hi(k,i,j,
ydir) )
2043 call check( __line__, qflx_lo(k,i,j,
ydir) )
2045 qflx_anti(k,i,j,
ydir) = qflx_hi(k,i,j,
ydir) - qflx_lo(k,i,j,
ydir)
2050 k = iundef; i = iundef; j = iundef
2059 call check( __line__, phi_in(k,i,j) )
2060 call check( __line__, qflx_lo(k ,i ,j ,
zdir) )
2061 call check( __line__, qflx_lo(k-1,i ,j ,
zdir) )
2062 call check( __line__, qflx_lo(k ,i ,j ,
xdir) )
2063 call check( __line__, qflx_lo(k ,i-1,j ,
xdir) )
2064 call check( __line__, qflx_lo(k ,i ,j ,
ydir) )
2065 call check( __line__, qflx_lo(k ,i ,j-1,
ydir) )
2067 phi_lo(k,i,j) = ( phi_in(k,i,j) * dens0(k,i,j) &
2068 + dt * ( - ( ( qflx_lo(k,i,j,
zdir)-qflx_lo(k-1,i ,j ,
zdir) ) * rdz(k) &
2069 + ( qflx_lo(k,i,j,
xdir)-qflx_lo(k ,i-1,j ,
xdir) ) * rdx(i) &
2070 + ( qflx_lo(k,i,j,
ydir)-qflx_lo(k ,i ,j-1,
ydir) ) * rdy(j) &
2071 ) * mapf(i,j,1) * mapf(i,j,2) / gsqrt(k,i,j) ) &
2077 k = iundef; i = iundef; j = iundef
2086 call check( __line__, qflx_anti(k ,i ,j ,
zdir) )
2087 call check( __line__, qflx_anti(k-1,i ,j ,
zdir) )
2088 call check( __line__, qflx_anti(k ,i ,j ,
xdir) )
2089 call check( __line__, qflx_anti(k ,i-1,j ,
xdir) )
2090 call check( __line__, qflx_anti(k ,i ,j ,
ydir) )
2091 call check( __line__, qflx_anti(k ,i ,j-1,
ydir) )
2093 pjpls(k,i,j) = dt * ( ( max(0.0_rp,qflx_anti(k-1,i ,j ,
zdir)) - min(0.0_rp,qflx_anti(k,i,j,
zdir)) ) * rdz(k) &
2094 + ( max(0.0_rp,qflx_anti(k ,i-1,j ,
xdir)) - min(0.0_rp,qflx_anti(k,i,j,
xdir)) ) * rdx(i) &
2095 + ( max(0.0_rp,qflx_anti(k ,i ,j-1,
ydir)) - min(0.0_rp,qflx_anti(k,i,j,
ydir)) ) * rdy(j) &
2096 ) * mapf(i,j,1) * mapf(i,j,2) / gsqrt(k,i,j)
2101 k = iundef; i = iundef; j = iundef
2110 call check( __line__, qflx_anti(k ,i ,j ,
zdir) )
2111 call check( __line__, qflx_anti(k-1,i ,j ,
zdir) )
2112 call check( __line__, qflx_anti(k ,i ,j ,
xdir) )
2113 call check( __line__, qflx_anti(k ,i-1,j ,
xdir) )
2114 call check( __line__, qflx_anti(k ,i ,j ,
ydir) )
2115 call check( __line__, qflx_anti(k ,i ,j-1,
ydir) )
2117 pjmns(k,i,j) = dt * ( ( max(0.0_rp,qflx_anti(k,i,j,
zdir)) - min(0.0_rp,qflx_anti(k-1,i ,j ,
zdir)) ) * rdz(k) &
2118 + ( max(0.0_rp,qflx_anti(k,i,j,
xdir)) - min(0.0_rp,qflx_anti(k ,i-1,j ,
xdir)) ) * rdx(i) &
2119 + ( max(0.0_rp,qflx_anti(k,i,j,
ydir)) - min(0.0_rp,qflx_anti(k ,i ,j-1,
ydir)) ) * rdy(j) &
2120 ) * mapf(i,j,1) * mapf(i,j,2) / gsqrt(k,i,j)
2125 k = iundef; i = iundef; j = iundef
2136 rw = (mflx_hi(k,i,j,
zdir)+mflx_hi(k-1,i ,j ,
zdir)) * rdz(k)
2137 ru = (mflx_hi(k,i,j,
xdir)+mflx_hi(k ,i-1,j ,
xdir)) * rdx(i)
2138 rv = (mflx_hi(k,i,j,
ydir)+mflx_hi(k ,i ,j-1,
ydir)) * rdy(j)
2140 call get_fact_fct( fact, &
2143 qa_in = fact(1, 1, 1) * phi_in(k+1,i+1,j+1) &
2144 + fact(0, 1, 1) * phi_in(k ,i+1,j+1) &
2145 + fact(1, 0, 1) * phi_in(k+1,i ,j+1) &
2146 + fact(0, 0, 1) * phi_in(k ,i ,j+1) &
2147 + fact(1,-1, 1) * phi_in(k+1,i-1,j+1) &
2148 + fact(1, 1, 0) * phi_in(k+1,i+1,j ) &
2149 + fact(0, 1, 0) * phi_in(k ,i+1,j ) &
2150 + fact(1, 0, 0) * phi_in(k+1,i ,j ) &
2151 + fact(1,-1, 0) * phi_in(k+1,i-1,j ) &
2152 + fact(1, 1,-1) * phi_in(k+1,i+1,j-1) &
2153 + fact(0, 1,-1) * phi_in(k ,i+1,j-1) &
2154 + fact(1, 0,-1) * phi_in(k+1,i ,j-1) &
2155 + fact(1,-1,-1) * phi_in(k+1,i-1,j-1) &
2156 + fact(0, 0, 0) * phi_in(k ,i ,j )
2157 qb_in = fact(1, 1, 1) * phi_in(k-1,i-1,j-1) &
2158 + fact(0, 1, 1) * phi_in(k ,i-1,j-1) &
2159 + fact(1, 0, 1) * phi_in(k-1,i ,j-1) &
2160 + fact(0, 0, 1) * phi_in(k ,i ,j-1) &
2161 + fact(1,-1, 1) * phi_in(k-1,i+1,j-1) &
2162 + fact(1, 1, 0) * phi_in(k-1,i-1,j ) &
2163 + fact(0, 1, 0) * phi_in(k ,i-1,j ) &
2164 + fact(1, 0, 0) * phi_in(k-1,i ,j ) &
2165 + fact(1,-1, 0) * phi_in(k-1,i+1,j ) &
2166 + fact(1, 1,-1) * phi_in(k-1,i-1,j+1) &
2167 + fact(0, 1,-1) * phi_in(k ,i-1,j-1) &
2168 + fact(1, 0,-1) * phi_in(k-1,i ,j-1) &
2169 + fact(1,-1,-1) * phi_in(k-1,i+1,j+1) &
2170 + fact(0, 0, 0) * phi_in(k ,i ,j )
2171 qa_lo = fact(1, 1, 1) * phi_lo(k+1,i+1,j+1) &
2172 + fact(0, 1, 1) * phi_lo(k ,i+1,j+1) &
2173 + fact(1, 0, 1) * phi_lo(k+1,i ,j+1) &
2174 + fact(0, 0, 1) * phi_lo(k ,i ,j+1) &
2175 + fact(1,-1, 1) * phi_lo(k+1,i-1,j+1) &
2176 + fact(1, 1, 0) * phi_lo(k+1,i+1,j ) &
2177 + fact(0, 1, 0) * phi_lo(k ,i+1,j ) &
2178 + fact(1, 0, 0) * phi_lo(k+1,i ,j ) &
2179 + fact(1,-1, 0) * phi_lo(k+1,i-1,j ) &
2180 + fact(1, 1,-1) * phi_lo(k+1,i+1,j-1) &
2181 + fact(0, 1,-1) * phi_lo(k ,i+1,j-1) &
2182 + fact(1, 0,-1) * phi_lo(k+1,i ,j-1) &
2183 + fact(1,-1,-1) * phi_lo(k+1,i-1,j-1) &
2184 + fact(0, 0, 0) * phi_lo(k ,i ,j )
2185 qb_lo = fact(1, 1, 1) * phi_lo(k-1,i-1,j-1) &
2186 + fact(0, 1, 1) * phi_lo(k ,i-1,j-1) &
2187 + fact(1, 0, 1) * phi_lo(k-1,i ,j-1) &
2188 + fact(0, 0, 1) * phi_lo(k ,i ,j-1) &
2189 + fact(1,-1, 1) * phi_lo(k-1,i+1,j-1) &
2190 + fact(1, 1, 0) * phi_lo(k-1,i-1,j ) &
2191 + fact(0, 1, 0) * phi_lo(k ,i-1,j ) &
2192 + fact(1, 0, 0) * phi_lo(k-1,i ,j ) &
2193 + fact(1,-1, 0) * phi_lo(k-1,i+1,j ) &
2194 + fact(1, 1,-1) * phi_lo(k-1,i-1,j+1) &
2195 + fact(0, 1,-1) * phi_lo(k ,i-1,j-1) &
2196 + fact(1, 0,-1) * phi_lo(k-1,i ,j-1) &
2197 + fact(1,-1,-1) * phi_lo(k-1,i+1,j+1) &
2198 + fact(0, 0, 0) * phi_lo(k ,i ,j )
2201 phi_in(k,i,j), qa_in, qb_in, &
2202 phi_lo(k,i,j), qa_lo, qb_lo )
2204 phi_in(k,i,j), qa_in, qb_in, &
2205 phi_lo(k,i,j), qa_lo, qb_lo )
2206 qjpls(k,i,j) = ( qmax - phi_lo(k,i,j) ) * dens(k,i,j)
2207 qjmns(k,i,j) = ( phi_lo(k,i,j) - qmin ) * dens(k,i,j)
2216 rw = (mflx_hi(
ks,i,j,
zdir) ) * rdz(
ks)
2217 ru = (mflx_hi(
ks,i,j,
xdir)+mflx_hi(
ks ,i-1,j ,
xdir)) * rdx(i)
2218 rv = (mflx_hi(
ks,i,j,
ydir)+mflx_hi(
ks ,i ,j-1,
ydir)) * rdy(j)
2220 call get_fact_fct( fact, &
2223 qa_in = fact(1, 1, 1) * phi_in(
ks+1,i+1,j+1) &
2224 + fact(0, 1, 1) * phi_in(
ks ,i+1,j+1) &
2225 + fact(1, 0, 1) * phi_in(
ks+1,i ,j+1) &
2226 + fact(0, 0, 1) * phi_in(
ks ,i ,j+1) &
2227 + fact(1,-1, 1) * phi_in(
ks+1,i-1,j+1) &
2228 + fact(1, 1, 0) * phi_in(
ks+1,i+1,j ) &
2229 + fact(0, 1, 0) * phi_in(
ks ,i+1,j ) &
2230 + fact(1, 0, 0) * phi_in(
ks+1,i ,j ) &
2231 + fact(1,-1, 0) * phi_in(
ks+1,i-1,j ) &
2232 + fact(1, 1,-1) * phi_in(
ks+1,i+1,j-1) &
2233 + fact(0, 1,-1) * phi_in(
ks ,i+1,j-1) &
2234 + fact(1, 0,-1) * phi_in(
ks+1,i ,j-1) &
2235 + fact(1,-1,-1) * phi_in(
ks+1,i-1,j-1) &
2236 + fact(0, 0, 0) * phi_in(
ks ,i ,j )
2237 qb_in = fact(1, 1, 1) * phi_in(
ks ,i-1,j-1) &
2238 + fact(0, 1, 1) * phi_in(
ks ,i-1,j-1) &
2239 + fact(1, 0, 1) * phi_in(
ks ,i ,j-1) &
2240 + fact(0, 0, 1) * phi_in(
ks ,i ,j-1) &
2241 + fact(1,-1, 1) * phi_in(
ks ,i+1,j-1) &
2242 + fact(1, 1, 0) * phi_in(
ks ,i-1,j ) &
2243 + fact(0, 1, 0) * phi_in(
ks ,i-1,j ) &
2244 + fact(1, 0, 0) * phi_in(
ks ,i ,j ) &
2245 + fact(1,-1, 0) * phi_in(
ks ,i+1,j ) &
2246 + fact(1, 1,-1) * phi_in(
ks ,i-1,j+1) &
2247 + fact(0, 1,-1) * phi_in(
ks ,i-1,j-1) &
2248 + fact(1, 0,-1) * phi_in(
ks ,i ,j-1) &
2249 + fact(1,-1,-1) * phi_in(
ks ,i+1,j+1) &
2250 + fact(0, 0, 0) * phi_in(
ks ,i ,j )
2251 qa_lo = fact(1, 1, 1) * phi_lo(
ks+1,i+1,j+1) &
2252 + fact(0, 1, 1) * phi_lo(
ks ,i+1,j+1) &
2253 + fact(1, 0, 1) * phi_lo(
ks+1,i ,j+1) &
2254 + fact(0, 0, 1) * phi_lo(
ks ,i ,j+1) &
2255 + fact(1,-1, 1) * phi_lo(
ks+1,i-1,j+1) &
2256 + fact(1, 1, 0) * phi_lo(
ks+1,i+1,j ) &
2257 + fact(0, 1, 0) * phi_lo(
ks ,i+1,j ) &
2258 + fact(1, 0, 0) * phi_lo(
ks+1,i ,j ) &
2259 + fact(1,-1, 0) * phi_lo(
ks+1,i-1,j ) &
2260 + fact(1, 1,-1) * phi_lo(
ks+1,i+1,j-1) &
2261 + fact(0, 1,-1) * phi_lo(
ks ,i+1,j-1) &
2262 + fact(1, 0,-1) * phi_lo(
ks+1,i ,j-1) &
2263 + fact(1,-1,-1) * phi_lo(
ks+1,i-1,j-1) &
2264 + fact(0, 0, 0) * phi_lo(
ks ,i ,j )
2265 qb_lo = fact(1, 1, 1) * phi_lo(
ks ,i-1,j-1) &
2266 + fact(0, 1, 1) * phi_lo(
ks ,i-1,j-1) &
2267 + fact(1, 0, 1) * phi_lo(
ks ,i ,j-1) &
2268 + fact(0, 0, 1) * phi_lo(
ks ,i ,j-1) &
2269 + fact(1,-1, 1) * phi_lo(
ks ,i+1,j-1) &
2270 + fact(1, 1, 0) * phi_lo(
ks ,i-1,j ) &
2271 + fact(0, 1, 0) * phi_lo(
ks ,i-1,j ) &
2272 + fact(1, 0, 0) * phi_lo(
ks ,i ,j ) &
2273 + fact(1,-1, 0) * phi_lo(
ks ,i+1,j ) &
2274 + fact(1, 1,-1) * phi_lo(
ks ,i-1,j+1) &
2275 + fact(0, 1,-1) * phi_lo(
ks ,i-1,j-1) &
2276 + fact(1, 0,-1) * phi_lo(
ks ,i ,j-1) &
2277 + fact(1,-1,-1) * phi_lo(
ks ,i+1,j+1) &
2278 + fact(0, 0, 0) * phi_lo(
ks ,i ,j )
2281 phi_in(
ks,i,j), qa_in, qb_in, &
2282 phi_lo(
ks,i,j), qa_lo, qb_lo )
2284 phi_in(
ks,i,j), qa_in, qb_in, &
2285 phi_lo(
ks,i,j), qa_lo, qb_lo )
2286 qjpls(
ks,i,j) = ( qmax - phi_lo(
ks,i,j) ) * dens(
ks,i,j)
2287 qjmns(
ks,i,j) = ( phi_lo(
ks,i,j) - qmin ) * dens(
ks,i,j)
2295 rw = ( mflx_hi(
ke-1,i ,j ,
zdir)) * rdz(
ke)
2296 ru = (mflx_hi(
ke,i,j,
xdir)+mflx_hi(
ke ,i-1,j ,
xdir)) * rdx(i)
2297 rv = (mflx_hi(
ke,i,j,
ydir)+mflx_hi(
ke ,i ,j-1,
ydir)) * rdy(j)
2299 call get_fact_fct( fact, &
2302 qa_in = fact(1, 1, 1) * phi_in(
ke ,i+1,j+1) &
2303 + fact(0, 1, 1) * phi_in(
ke ,i+1,j+1) &
2304 + fact(1, 0, 1) * phi_in(
ke ,i ,j+1) &
2305 + fact(0, 0, 1) * phi_in(
ke ,i ,j+1) &
2306 + fact(1,-1, 1) * phi_in(
ke ,i-1,j+1) &
2307 + fact(1, 1, 0) * phi_in(
ke ,i+1,j ) &
2308 + fact(0, 1, 0) * phi_in(
ke ,i+1,j ) &
2309 + fact(1, 0, 0) * phi_in(
ke ,i ,j ) &
2310 + fact(1,-1, 0) * phi_in(
ke ,i-1,j ) &
2311 + fact(1, 1,-1) * phi_in(
ke ,i+1,j-1) &
2312 + fact(0, 1,-1) * phi_in(
ke ,i+1,j-1) &
2313 + fact(1, 0,-1) * phi_in(
ke ,i ,j-1) &
2314 + fact(1,-1,-1) * phi_in(
ke ,i-1,j-1) &
2315 + fact(0, 0, 0) * phi_in(
ke ,i ,j )
2316 qb_in = fact(1, 1, 1) * phi_in(
ke-1,i-1,j-1) &
2317 + fact(0, 1, 1) * phi_in(
ke ,i-1,j-1) &
2318 + fact(1, 0, 1) * phi_in(
ke-1,i ,j-1) &
2319 + fact(0, 0, 1) * phi_in(
ke ,i ,j-1) &
2320 + fact(1,-1, 1) * phi_in(
ke-1,i+1,j-1) &
2321 + fact(1, 1, 0) * phi_in(
ke-1,i-1,j ) &
2322 + fact(0, 1, 0) * phi_in(
ke ,i-1,j ) &
2323 + fact(1, 0, 0) * phi_in(
ke-1,i ,j ) &
2324 + fact(1,-1, 0) * phi_in(
ke-1,i+1,j ) &
2325 + fact(1, 1,-1) * phi_in(
ke-1,i-1,j+1) &
2326 + fact(0, 1,-1) * phi_in(
ke ,i-1,j-1) &
2327 + fact(1, 0,-1) * phi_in(
ke-1,i ,j-1) &
2328 + fact(1,-1,-1) * phi_in(
ke-1,i+1,j+1) &
2329 + fact(0, 0, 0) * phi_in(
ke ,i ,j )
2330 qa_lo = fact(1, 1, 1) * phi_lo(
ke ,i+1,j+1) &
2331 + fact(0, 1, 1) * phi_lo(
ke ,i+1,j+1) &
2332 + fact(1, 0, 1) * phi_lo(
ke ,i ,j+1) &
2333 + fact(0, 0, 1) * phi_lo(
ke ,i ,j+1) &
2334 + fact(1,-1, 1) * phi_lo(
ke ,i-1,j+1) &
2335 + fact(1, 1, 0) * phi_lo(
ke ,i+1,j ) &
2336 + fact(0, 1, 0) * phi_lo(
ke ,i+1,j ) &
2337 + fact(1, 0, 0) * phi_lo(
ke ,i ,j ) &
2338 + fact(1,-1, 0) * phi_lo(
ke ,i-1,j ) &
2339 + fact(1, 1,-1) * phi_lo(
ke ,i+1,j-1) &
2340 + fact(0, 1,-1) * phi_lo(
ke ,i+1,j-1) &
2341 + fact(1, 0,-1) * phi_lo(
ke ,i ,j-1) &
2342 + fact(1,-1,-1) * phi_lo(
ke ,i-1,j-1) &
2343 + fact(0, 0, 0) * phi_lo(
ke ,i ,j )
2344 qb_lo = fact(1, 1, 1) * phi_lo(
ke-1,i-1,j-1) &
2345 + fact(0, 1, 1) * phi_lo(
ke ,i-1,j-1) &
2346 + fact(1, 0, 1) * phi_lo(
ke-1,i ,j-1) &
2347 + fact(0, 0, 1) * phi_lo(
ke ,i ,j-1) &
2348 + fact(1,-1, 1) * phi_lo(
ke-1,i+1,j-1) &
2349 + fact(1, 1, 0) * phi_lo(
ke-1,i-1,j ) &
2350 + fact(0, 1, 0) * phi_lo(
ke ,i-1,j ) &
2351 + fact(1, 0, 0) * phi_lo(
ke-1,i ,j ) &
2352 + fact(1,-1, 0) * phi_lo(
ke-1,i+1,j ) &
2353 + fact(1, 1,-1) * phi_lo(
ke-1,i-1,j+1) &
2354 + fact(0, 1,-1) * phi_lo(
ke ,i-1,j-1) &
2355 + fact(1, 0,-1) * phi_lo(
ke-1,i ,j-1) &
2356 + fact(1,-1,-1) * phi_lo(
ke-1,i+1,j+1) &
2357 + fact(0, 0, 0) * phi_lo(
ke ,i ,j )
2360 phi_in(
ke,i,j), qa_in, qb_in, &
2361 phi_lo(
ke,i,j), qa_lo, qb_lo )
2363 phi_in(
ke,i,j), qa_in, qb_in, &
2364 phi_lo(
ke,i,j), qa_lo, qb_lo )
2365 qjpls(
ke,i,j) = ( qmax - phi_lo(
ke,i,j) ) * dens(
ke,i,j)
2366 qjmns(
ke,i,j) = ( phi_lo(
ke,i,j) - qmin ) * dens(
ke,i,j)
2377 call check( __line__, phi_in(k ,i ,j ) )
2378 call check( __line__, phi_in(k-1,i ,j ) )
2379 call check( __line__, phi_in(k+1,i ,j ) )
2380 call check( __line__, phi_in(k ,i-1,j ) )
2381 call check( __line__, phi_in(k ,i+1,j ) )
2382 call check( __line__, phi_in(k ,i ,j+1) )
2383 call check( __line__, phi_in(k ,i ,j-1) )
2384 call check( __line__, phi_lo(k ,i ,j ) )
2385 call check( __line__, phi_lo(k-1,i ,j ) )
2386 call check( __line__, phi_lo(k+1,i ,j ) )
2387 call check( __line__, phi_lo(k ,i-1,j ) )
2388 call check( __line__, phi_lo(k ,i+1,j ) )
2389 call check( __line__, phi_lo(k ,i ,j+1) )
2390 call check( __line__, phi_lo(k ,i ,j-1) )
2392 qmax = max( phi_in(k ,i ,j ), &
2393 phi_in(k+1,i ,j ), &
2394 phi_in(k-1,i ,j ), &
2395 phi_in(k ,i+1,j ), &
2396 phi_in(k ,i-1,j ), &
2397 phi_in(k ,i ,j+1), &
2398 phi_in(k ,i ,j-1), &
2400 phi_lo(k+1,i ,j ), &
2401 phi_lo(k-1,i ,j ), &
2402 phi_lo(k ,i+1,j ), &
2403 phi_lo(k ,i-1,j ), &
2404 phi_lo(k ,i ,j+1), &
2406 qmin = min( phi_in(k ,i ,j ), &
2407 phi_in(k+1,i ,j ), &
2408 phi_in(k-1,i ,j ), &
2409 phi_in(k ,i-1,j ), &
2410 phi_in(k ,i+1,j ), &
2411 phi_in(k ,i ,j+1), &
2412 phi_in(k ,i ,j-1), &
2414 phi_lo(k+1,i ,j ), &
2415 phi_lo(k-1,i ,j ), &
2416 phi_lo(k ,i-1,j ), &
2417 phi_lo(k ,i+1,j ), &
2418 phi_lo(k ,i ,j+1), &
2420 qjpls(k,i,j) = ( qmax - phi_lo(k,i,j) ) * dens(k,i,j)
2421 qjmns(k,i,j) = ( phi_lo(k,i,j) - qmin ) * dens(k,i,j)
2426 k = iundef; i = iundef; j = iundef
2432 call check( __line__, phi_in(
ks ,i ,j ) )
2433 call check( __line__, phi_in(
ks+1,i ,j ) )
2434 call check( __line__, phi_in(
ks ,i-1,j ) )
2435 call check( __line__, phi_in(
ks ,i+1,j ) )
2436 call check( __line__, phi_in(
ks ,i ,j+1) )
2437 call check( __line__, phi_in(
ks ,i ,j-1) )
2438 call check( __line__, phi_lo(
ks ,i ,j ) )
2439 call check( __line__, phi_lo(
ks+1,i ,j ) )
2440 call check( __line__, phi_lo(
ks ,i-1,j ) )
2441 call check( __line__, phi_lo(
ks ,i+1,j ) )
2442 call check( __line__, phi_lo(
ks ,i ,j+1) )
2443 call check( __line__, phi_lo(
ks ,i ,j-1) )
2444 call check( __line__, phi_in(
ke ,i ,j ) )
2445 call check( __line__, phi_in(
ke-1,i ,j ) )
2446 call check( __line__, phi_in(
ke ,i-1,j ) )
2447 call check( __line__, phi_in(
ke ,i+1,j ) )
2448 call check( __line__, phi_in(
ke ,i ,j+1) )
2449 call check( __line__, phi_in(
ke ,i ,j-1) )
2450 call check( __line__, phi_lo(
ke ,i ,j ) )
2451 call check( __line__, phi_lo(
ke-1,i ,j ) )
2452 call check( __line__, phi_lo(
ke ,i-1,j ) )
2453 call check( __line__, phi_lo(
ke ,i+1,j ) )
2454 call check( __line__, phi_lo(
ke ,i ,j+1) )
2455 call check( __line__, phi_lo(
ke ,i ,j-1) )
2457 qmax = max( phi_in(
ks ,i ,j ), &
2458 phi_in(
ks+1,i ,j ), &
2459 phi_in(
ks ,i+1,j ), &
2460 phi_in(
ks ,i-1,j ), &
2461 phi_in(
ks ,i ,j+1), &
2462 phi_in(
ks ,i ,j-1), &
2463 phi_lo(
ks ,i ,j ), &
2464 phi_lo(
ks+1,i ,j ), &
2465 phi_lo(
ks ,i+1,j ), &
2466 phi_lo(
ks ,i-1,j ), &
2467 phi_lo(
ks ,i ,j+1), &
2468 phi_lo(
ks ,i ,j-1) )
2469 qmin = min( phi_in(
ks ,i ,j ), &
2470 phi_in(
ks+1,i ,j ), &
2471 phi_in(
ks ,i+1,j ), &
2472 phi_in(
ks ,i-1,j ), &
2473 phi_in(
ks ,i ,j+1), &
2474 phi_in(
ks ,i ,j-1), &
2475 phi_lo(
ks ,i ,j ), &
2476 phi_lo(
ks+1,i ,j ), &
2477 phi_lo(
ks ,i+1,j ), &
2478 phi_lo(
ks ,i-1,j ), &
2479 phi_lo(
ks ,i ,j+1), &
2480 phi_lo(
ks ,i ,j-1) )
2481 qjmns(
ks,i,j) = ( phi_lo(
ks,i,j) - qmin ) * dens(
ks,i,j)
2482 qjpls(
ks,i,j) = ( qmax - phi_lo(
ks,i,j) ) * dens(
ks,i,j)
2484 qmax = max( phi_in(
ke ,i ,j ), &
2485 phi_in(
ke-1,i ,j ), &
2486 phi_in(
ke ,i+1,j ), &
2487 phi_in(
ke ,i-1,j ), &
2488 phi_in(
ke ,i ,j+1), &
2489 phi_in(
ke ,i ,j-1), &
2490 phi_lo(
ke ,i ,j ), &
2491 phi_lo(
ke-1,i ,j ), &
2492 phi_lo(
ke ,i+1,j ), &
2493 phi_lo(
ke ,i-1,j ), &
2494 phi_lo(
ke ,i ,j+1), &
2495 phi_lo(
ke ,i ,j-1) )
2496 qmin = min( phi_in(
ke ,i ,j ), &
2497 phi_in(
ke-1,i ,j ), &
2498 phi_in(
ke ,i-1,j ), &
2499 phi_in(
ke ,i+1,j ), &
2500 phi_in(
ke ,i ,j+1), &
2501 phi_in(
ke ,i ,j-1), &
2502 phi_lo(
ke ,i ,j ), &
2503 phi_lo(
ke-1,i ,j ), &
2504 phi_lo(
ke ,i-1,j ), &
2505 phi_lo(
ke ,i+1,j ), &
2506 phi_lo(
ke ,i ,j+1), &
2507 phi_lo(
ke ,i ,j-1) )
2508 qjpls(
ke,i,j) = ( qmax - phi_lo(
ke,i,j) ) * dens(
ke,i,j)
2509 qjmns(
ke,i,j) = ( phi_lo(
ke,i,j) - qmin ) * dens(
ke,i,j)
2513 k = iundef; i = iundef; j = iundef
2523 call check( __line__, pjpls(k,i,j) )
2524 call check( __line__, qjpls(k,i,j) )
2527 zerosw = 0.5_rp - sign( 0.5_rp, pjpls(k,i,j)-epsilon )
2528 rjpls(k,i,j) = min( 1.0_rp, qjpls(k,i,j) * ( 1.0_rp-zerosw ) / ( pjpls(k,i,j)-zerosw ) )
2533 k = iundef; i = iundef; j = iundef
2542 call check( __line__, pjmns(k,i,j) )
2543 call check( __line__, qjmns(k,i,j) )
2546 zerosw = 0.5_rp - sign( 0.5_rp, pjmns(k,i,j)-epsilon )
2547 rjmns(k,i,j) = min( 1.0_rp, qjmns(k,i,j) * ( 1.0_rp-zerosw ) / ( pjmns(k,i,j)-zerosw ) )
2552 k = iundef; i = iundef; j = iundef
2558 call comm_vars8( rjpls(:,:,:), 1 )
2559 call comm_vars8( rjmns(:,:,:), 2 )
2560 call comm_wait ( rjpls(:,:,:), 1 )
2561 call comm_wait ( rjmns(:,:,:), 2 )
2574 call check( __line__, qflx_anti(k,i,j,
zdir) )
2575 call check( __line__, rjpls(k ,i,j) )
2576 call check( __line__, rjpls(k+1,i,j) )
2577 call check( __line__, rjmns(k ,i,j) )
2578 call check( __line__, rjmns(k+1,i,j) )
2581 dirsw = 0.5_rp + sign( 0.5_rp, qflx_anti(k,i,j,
zdir) )
2582 qflx_anti(k,i,j,
zdir) = qflx_anti(k,i,j,
zdir) &
2584 - min( rjpls(k+1,i,j),rjmns(k ,i,j) ) * ( dirsw ) &
2585 - min( rjpls(k ,i,j),rjmns(k+1,i,j) ) * ( 1.0_rp - dirsw ) )
2590 k = iundef; i = iundef; j = iundef
2597 call check( __line__, rjpls(
ke ,i,j) )
2598 call check( __line__, rjmns(
ke ,i,j) )
2600 qflx_anti(
ks-1,i,j,
zdir) = 0.0_rp
2601 qflx_anti(
ke ,i,j,
zdir) = 0.0_rp
2605 k = iundef; i = iundef; j = iundef
2608 if ( iis ==
is )
then 2619 call check( __line__, qflx_anti(k,i,j,
xdir) )
2620 call check( __line__, rjpls(k,i ,j) )
2621 call check( __line__, rjpls(k,i+1,j) )
2622 call check( __line__, rjmns(k,i ,j) )
2623 call check( __line__, rjmns(k,i+1,j) )
2626 dirsw = 0.5_rp + sign( 0.5_rp, qflx_anti(k,i,j,
xdir) )
2627 qflx_anti(k,i,j,
xdir) = qflx_anti(k,i,j,
xdir) &
2629 - min( rjpls(k,i+1,j),rjmns(k,i ,j) ) * ( dirsw ) &
2630 - min( rjpls(k,i ,j),rjmns(k,i+1,j) ) * ( 1.0_rp - dirsw ) )
2635 k = iundef; i = iundef; j = iundef
2638 if ( jjs ==
js )
then 2648 call check( __line__, qflx_anti(k,i,j,
ydir) )
2649 call check( __line__, rjpls(k,i,j+1) )
2650 call check( __line__, rjpls(k,i,j ) )
2651 call check( __line__, rjmns(k,i,j ) )
2652 call check( __line__, rjmns(k,i,j+1) )
2655 dirsw = 0.5_rp + sign( 0.5_rp, qflx_anti(k,i,j,
ydir) )
2656 qflx_anti(k,i,j,
ydir) = qflx_anti(k,i,j,
ydir) &
2658 - min( rjpls(k,i,j+1),rjmns(k,i,j ) ) * ( dirsw ) &
2659 - min( rjpls(k,i,j ),rjmns(k,i,j+1) ) * ( 1.0_rp - dirsw ) )
2664 k = iundef; i = iundef; j = iundef
2676 subroutine get_fact_fct( &
2682 real(RP),
intent(out) :: fact(0:1,-1:1,-1:1)
2683 real(RP),
intent(in) :: rw, ru, rv
2685 real(RP) :: sign_uv, sign_uw, sign_vw
2686 real(RP) :: ugev, ugew, vgew
2687 real(RP) :: umax, vmax, wmax
2688 real(RP) :: vu, wu, uv, wv, uw, vw
2689 real(RP) :: uzero, vzero, wzero
2692 ugev = sign(0.5_rp, abs(ru)-abs(rv)) + 0.5_rp
2693 ugew = sign(0.5_rp, abs(ru)-abs(rw)) + 0.5_rp
2694 vgew = sign(0.5_rp, abs(rv)-abs(rw)) + 0.5_rp
2696 uzero = sign(0.5_rp,abs(ru)-epsilon) - 0.5_rp
2697 vzero = sign(0.5_rp,abs(rv)-epsilon) - 0.5_rp
2698 wzero = sign(0.5_rp,abs(rw)-epsilon) - 0.5_rp
2700 sign_uv = sign(0.5_rp, ru*rv) + 0.5_rp
2701 sign_uw = sign(0.5_rp, ru*rw) + 0.5_rp
2702 sign_vw = sign(0.5_rp, rv*rw) + 0.5_rp
2704 wu = abs( rw / ( ru+uzero ) * ( 1.0_rp+uzero ) )
2705 vu = abs( rv / ( ru+uzero ) * ( 1.0_rp+uzero ) )
2706 uv = abs( ru / ( rv+vzero ) * ( 1.0_rp+vzero ) )
2707 wv = abs( rw / ( rv+vzero ) * ( 1.0_rp+vzero ) )
2708 uw = abs( ru / ( rw+wzero ) * ( 1.0_rp+wzero ) )
2709 vw = abs( rv / ( rw+wzero ) * ( 1.0_rp+wzero ) )
2711 umax = ugev * ugew * ( 1.0_rp+uzero )
2712 vmax = (1.0_rp-ugev) * vgew
2713 wmax = 1.0_rp - ugev * ugew - vmax
2715 fact(0, 0, 0) = - ugev * ugew * uzero
2717 fact(1, 0, 0) = wmax * (1.0_rp-uw) * (1.0_rp-vw)
2718 fact(0, 1, 0) = umax * (1.0_rp-vu) * (1.0_rp-wu)
2719 fact(0, 0, 1) = vmax * (1.0_rp-uv) * (1.0_rp-wv)
2721 fact(1, 1, 1) = sign_uv * sign_uw * ( umax * vu*wu + vmax * uv*wv + wmax * uw*vw )
2722 fact(1,-1, 1) = (1.0_rp-sign_uv) * (1.0_rp-sign_uw) * ( umax * vu*wu + vmax * uv*wv + wmax * uw*vw )
2723 fact(1, 1,-1) = (1.0_rp-sign_uv) * sign_uw * ( umax * vu*wu + vmax * uv*wv + wmax * uw*vw )
2724 fact(1,-1,-1) = sign_uv * (1.0_rp-sign_uw) * ( umax * vu*wu + vmax * uv*wv + wmax * uw*vw )
2726 fact(1, 1, 0) = sign_uw * (1.0_rp-vmax) * ( ugew * wu * (1.0_rp-vu) + (1.0_rp-ugew) * uw * (1.0_rp-vw) )
2727 fact(1,-1, 0) = (1.0_rp-sign_uw) * (1.0_rp-vmax) * ( ugew * wu * (1.0_rp-vu) + (1.0_rp-ugew) * uw * (1.0_rp-vw) )
2728 fact(1, 0, 1) = sign_vw * (1.0_rp-umax) * ( vgew * wv * (1.0_rp-uv) + (1.0_rp-vgew) * vw * (1.0_rp-uw) )
2729 fact(1, 0,-1) = (1.0_rp-sign_vw) * (1.0_rp-umax) * ( vgew * wv * (1.0_rp-uv) + (1.0_rp-vgew) * vw * (1.0_rp-uw) )
2730 fact(0, 1, 1) = sign_uv * (1.0_rp-wmax) * ( ugev * vu * (1.0_rp-wu) + (1.0_rp-ugev) * uv * (1.0_rp-wv) )
2731 fact(0, 1,-1) = (1.0_rp-sign_uv) * (1.0_rp-wmax) * ( ugev * vu * (1.0_rp-wu) + (1.0_rp-ugev) * uv * (1.0_rp-wv) )
2734 end subroutine get_fact_fct
integer, parameter, public i_rhot
integer, parameter, public khalo
of halo cells: z
integer, public ihalo
of halo cells: x
subroutine, public atmos_dyn_numfilter_coef(num_diff, DENS, MOMZ, MOMX, MOMY, RHOT, CDZ, CDX, CDY, FDZ, FDX, FDY, DT, REF_dens, REF_pott, ND_COEF, ND_ORDER, ND_SFC_FACT, ND_USE_RS)
Calc coefficient of numerical filter.
integer, public jhalo
of halo cells: y
integer, public ia
of whole cells: x, local, with HALO
integer, parameter, public i_momx
integer, parameter, public i_momz
integer, public iblock
block size for cache blocking: x
integer, public ja
of whole cells: y, local, with HALO
subroutine, public atmos_dyn_filter_tend(phi_t, phi, rdz, rdx, rdy, KO, IO, JO)
subroutine, public check(current_line, v)
Undefined value checker.
integer, parameter, public i_dens
integer, parameter, public i_momy
subroutine, public atmos_dyn_wdamp_setup(wdamp_coef, wdamp_tau, wdamp_height, FZ)
Setup.
real(rp), public const_undef
integer, public is
start point of inner domain: x, local
integer, public ie
end point of inner domain: x, local
integer, parameter, public ydir
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
subroutine calc_diff3(diff, phi, KO, IO, JO)
integer, public je
end point of inner domain: y, local
subroutine, public atmos_dyn_filter_setup(num_diff, num_diff_q, CDZ, CDX, CDY, FDZ, FDX, FDY)
Setup.
subroutine, public atmos_dyn_numfilter_coef_q(num_diff_q, DENS, QTRC, is_qv, CDZ, CDX, CDY, dt, REF_qv, iq, ND_COEF, ND_ORDER, ND_SFC_FACT, ND_USE_RS)
Calc coefficient of numerical filter.
integer, parameter, public const_undef2
undefined value (INT2)
module Atmosphere / Dynamics common
integer, public ks
start point of inner domain: z, local
integer, public jblock
block size for cache blocking: y
subroutine, public comm_vars8_init(varname, var, vid)
Register variables.
subroutine, public prc_abort
Abort Process.
integer, public js
start point of inner domain: y, local
integer, parameter, public xdir
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
subroutine, public atmos_dyn_copy_boundary(DENS, MOMZ, MOMX, MOMY, RHOT, PROG, DENS0, MOMZ0, MOMX0, MOMY0, RHOT0, PROG0, BND_W, BND_E, BND_S, BND_N)
real(rp), public const_eps
small number
integer, public ka
of whole cells: z, local, with HALO
subroutine, public atmos_dyn_fct(qflx_anti, phi_in, DENS0, DENS, qflx_hi, qflx_lo, mflx_hi, rdz, rdx, rdy, GSQRT, MAPF, dt, flag_vect)
Flux Correction Transport Limiter.
subroutine, public atmos_dyn_divergence(DDIV, MOMZ, MOMX, MOMY, GSQRT, J13G, J23G, J33G, MAPF, RCDZ, RCDX, RCDY, RFDZ, FDZ)
real(rp), public const_pi
pi
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
integer, parameter, public zdir
subroutine, public atmos_dyn_copy_boundary_tracer(QTRC, QTRC0, BND_W, BND_E, BND_S, BND_N)