2 !$OMP
PRIVATE ( ii
,k
,ic
,ip
,i
,j
,t_
,q_
,p_
,delz_
,qci_
,qrs_
,den_
,rain_
,rainncv_
,sr_
,snow_
,snowncv_
) &
3 !$OMP
SCHEDULE(dynamic
)
4 DO ip
= 1,((1+(ite
-its
+1)/CHUNK
)*CHUNK
)*(jte
-jts
+1),CHUNK
5 ! tid
= omp_get_thread_num() + 1 ! not currently used but available
and useful
for debugging
6 j
= jts
+(ip
-1)/((1+(ite
-its
+1)/CHUNK
)*CHUNK
)
7 IF ( j
.ge
. jts
.and. j
.le
. jte
) THEN
8 ii
= its
+mod((ip
-1),((1+(ite
-its
+1)/CHUNK
)*CHUNK
))
10 DO ic
=1,min(CHUNK
,ite
-ii
+1)
12 t_(ic
,k
)=th(i
,k
,j
)*pii(i
,k
,j
)
15 delz_(ic
,k
)=delz(i
,k
,j
)
16 qci_(ic
,k
,1) = qc(i
,k
,j
)
17 qci_(ic
,k
,2) = qi(i
,k
,j
)
18 qrs_(ic
,k
,1) = qr(i
,k
,j
)
19 qrs_(ic
,k
,2) = qs(i
,k
,j
)
20 den_(ic
,k
) = den(i
,k
,j
)
23 DO ic
=1,min(CHUNK
,ite
-ii
+1)
26 rainncv_(ic
) = rainncv(i
,j
)
29 snowncv_(ic
) = snowncv(i
,j
)
31 IF ( min(CHUNK
,ite
-ii
+1) .gt
. 0 ) THEN
32 CALL
wsm52D(T
=t_
, Q
=q_
, QCI
=qci_
, QRS
=qrs_
&
35 ,DELT
=delt
,G
=g
, CPD
=cpd
, CPV
=cpv
, RD
=rd
&
37 ,EP1
=ep1
, EP2
=ep2
, QMIN
=qmin
&
38 ,XLS
=XLS
, XLV0
=XLV0
, XLF0
=XLF0
&
39 ,DEN0
=den0
, DENR
=denr
&
40 ,CLIQ
=cliq
,CICE
=cice
,PSAT
=psat
&
42 ,RAIN
=rain_
,RAINNCV
=rainncv_
&
44 ,SNOW
=snow_
,SNOWNCV
=snowncv_
&
45 ,NX0
=CHUNK
, NK0
=kte
-kts
+1 &
46 ,IRESTRICT
=min(CHUNK
,ite
-ii
+1) &
47 ,DOIT
=.TRUE
., KTS
=kts
,KTE
=kte
)
50 DO ic
=1,min(CHUNK
,ite
-ii
+1)
52 th(i
,k
,j
)=t_(ic
,k
)/pii(i
,k
,j
)
54 qc(i
,k
,j
) = qci_(ic
,k
,1)
55 qi(i
,k
,j
) = qci_(ic
,k
,2)
56 qr(i
,k
,j
) = qrs_(ic
,k
,1)
57 qs(i
,k
,j
) = qrs_(ic
,k
,2)
60 DO ic
=1,min(CHUNK
,ite
-ii
+1)
63 rainncv(i
,j
) = rainncv_(ic
)
66 snowncv(i
,j
) = snowncv_(ic
)