Merge pull request #22 from wirc-sjsu/develop-w21
[WRF-Fire-merge.git] / phys / mic-wsm5-3-5-callsite.h
blob468a83396cdf42183be775baf9f799e7e6a655b1
1 !$OMP PARALLEL DO &
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))
9 DO k=kts,kte
10 DO ic=1,min(CHUNK,ite-ii+1)
11 i = ii+ic -1
12 t_(ic,k)=th(i,k,j)*pii(i,k,j)
13 q_(ic,k)=q(i,k,j)
14 p_(ic,k)=p(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)
21 ENDDO
22 ENDDO
23 DO ic=1,min(CHUNK,ite-ii+1)
24 i = ii+ic -1
25 rain_(ic) = rain(i,j)
26 rainncv_(ic) = rainncv(i,j)
27 sr_(ic) = sr(i,j)
28 snow_(ic) = snow(i,j)
29 snowncv_(ic) = snowncv(i,j)
30 ENDDO
31 IF ( min(CHUNK,ite-ii+1) .gt. 0 ) THEN
32 CALL wsm52D(T=t_, Q=q_, QCI=qci_, QRS=qrs_ &
33 ,DEN=den_ &
34 ,P=p_, DELZ=delz_ &
35 ,DELT=delt,G=g, CPD=cpd, CPV=cpv, RD=rd &
36 ,RV=rv, T0C=t0c &
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 &
41 ,LON=ii,LAT=j &
42 ,RAIN=rain_ ,RAINNCV=rainncv_ &
43 ,SR=sr_ &
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 )
48 ENDIF
49 DO K=kts,kte
50 DO ic=1,min(CHUNK,ite-ii+1)
51 i = ii+ic -1
52 th(i,k,j)=t_(ic,k)/pii(i,k,j)
53 q(i,k,j) = q_(ic,k)
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)
58 ENDDO
59 ENDDO
60 DO ic=1,min(CHUNK,ite-ii+1)
61 i = ii+ic -1
62 rain(i,j) = rain_(ic)
63 rainncv(i,j) = rainncv_(ic)
64 sr(i,j) = sr_(ic)
65 snow(i,j) = snow_(ic)
66 snowncv(i,j) = snowncv_(ic)
67 ENDDO
68 ENDIF
69 ENDDO
70 !$OMP END PARALLEL DO