1 !=================================================================================================================
3 use ccpp_kind_types,only: kind_phys
5 use bl_gwdo,only: bl_gwdo_run
16 !=================================================================================================================
17 subroutine gwdo(u3d,v3d,t3d,qv3d,p3d,p3di,pi3d,z, &
19 dtaux3d,dtauy3d,dusfcg,dvsfcg, &
20 var2d,oc12d,oa2d1,oa2d2,oa2d3,oa2d4,ol2d1,ol2d2,ol2d3,ol2d4, &
21 sina,cosa,znu,znw,p_top, &
23 dt,dx,kpbl2d,itimestep, &
24 ids,ide, jds,jde, kds,kde, &
25 ims,ime, jms,jme, kms,kme, &
26 its,ite, jts,jte, kts,kte, &
29 !=================================================================================================================
31 !-- u3d 3d u-velocity interpolated to theta points (m/s)
32 !-- v3d 3d v-velocity interpolated to theta points (m/s)
33 !-- t3d temperature (k)
34 !-- qv3d 3d water vapor mixing ratio (kg/kg)
35 !-- p3d 3d pressure (pa)
36 !-- p3di 3d pressure (pa) at interface level
37 !-- pi3d 3d exner function (dimensionless)
38 !-- rublten u tendency due to pbl parameterization (m/s/s)
39 !-- rvblten v tendency due to pbl parameterization (m/s/s)
40 !-- sina sine rotation angle
41 !-- cosa cosine rotation angle
42 !-- znu eta values (sigma values)
43 !-- cp heat capacity at constant pressure for dry air (j/kg/k)
44 !-- g acceleration due to gravity (m/s^2)
45 !-- rd gas constant for dry air (j/kg/k)
46 !-- z height above sea level (m)
47 !-- rv gas constant for water vapor (j/kg/k)
49 !-- dx model grid interval (m)
50 !-- ep1 constant for virtual temperature (r_v/r_d - 1) (dimensionless)
51 !-- ids start index for i in domain
52 !-- ide end index for i in domain
53 !-- jds start index for j in domain
54 !-- jde end index for j in domain
55 !-- kds start index for k in domain
56 !-- kde end index for k in domain
57 !-- ims start index for i in memory
58 !-- ime end index for i in memory
59 !-- jms start index for j in memory
60 !-- jme end index for j in memory
61 !-- kms start index for k in memory
62 !-- kme end index for k in memory
63 !-- its start index for i in tile
64 !-- ite end index for i in tile
65 !-- jts start index for j in tile
66 !-- jte end index for j in tile
67 !-- kts start index for k in tile
68 !-- kte end index for k in tile
70 !=================================================================================================================
73 integer,intent(in):: ids,ide,jds,jde,kds,kde, &
74 ims,ime,jms,jme,kms,kme, &
75 its,ite,jts,jte,kts,kte
76 integer,intent(in):: itimestep
78 integer,intent(in),dimension(ims:ime,jms:jme):: kpbl2d
80 real(kind=kind_phys),intent(in):: dt,cp,g,rd,rv,ep1,pi
81 real(kind=kind_phys),intent(in),optional:: p_top
83 real(kind=kind_phys),intent(in),dimension(kms:kme),optional:: &
87 real(kind=kind_phys),intent(in),dimension(ims:ime,jms:jme):: &
91 oa2d1,oa2d2,oa2d3,oa2d4, &
92 ol2d1,ol2d2,ol2d3,ol2d4, &
95 real(kind=kind_phys),intent(in),dimension(ims:ime,kms:kme,jms:jme):: &
104 real(kind=kind_phys),intent(in),dimension(ims:ime,kms:kme,jms:jme):: &
107 !--- output arguments:
108 character(len=*),intent(out):: errmsg
110 integer,intent(out):: errflg
112 real(kind=kind_phys),intent(out),dimension(ims:ime,jms:jme):: &
116 real(kind=kind_phys),intent(out),dimension(ims:ime,kms:kme,jms:jme ):: &
120 !--- inout arguments:
121 real(kind=kind_phys),intent(inout),dimension(ims:ime,kms:kme,jms:jme):: &
125 !--- local variables and arrays:
128 real(kind=kind_phys),dimension(its:ite):: &
129 var2d_hv,oc12d_hv,dx_hv,sina_hv,cosa_hv
130 real(kind=kind_phys),dimension(its:ite):: &
131 oa2d1_hv,oa2d2_hv,oa2d3_hv,oa2d4_hv,ol2d1_hv,ol2d2_hv,ol2d3_hv,ol2d4_hv
132 real(kind=kind_phys),dimension(its:ite):: &
135 real(kind=kind_phys),dimension(its:ite,kts:kte):: &
136 u3d_hv,v3d_hv,t3d_hv,qv3d_hv,pi3d_hv,p3d_hv,z_hv
138 real(kind=kind_phys),dimension(its:ite,kts:kte):: &
139 rublten_hv,rvblten_hv,dtaux3d_hv,dtauy3d_hv
141 real(kind=kind_phys),dimension(its:ite,kms:kme):: &
144 !-----------------------------------------------------------------------------------------------------------------
146 ! Outer j-loop. Allows consistency between WRF and MPAS in the driver.
150 ! All variables for gwdo2d are tile-sized and have only a single
151 ! horizontal dimension. The _hv suffix refers to "horizontal vertical",
152 ! a reminder that there is a single horizontal index. Yes, we know that
153 ! variables that have only a horizontal index are not *really* _hv.
155 ! All of the following 3d and 2d variables are declared intent(in) in the
156 ! gwdo2d subroutine, so there is no need to put the updated values back
157 ! from the temporary arrays back into the original arrays.
159 ! Variables that are INTENT(IN) or INTENT(INOUT)
161 ! 3d, interface levels:
164 p3di_hv(i,k) = p3di(i,k,j)
171 rublten_hv(i,k) = rublten(i,k,j)
172 rvblten_hv(i,k) = rvblten(i,k,j)
173 u3d_hv(i,k) = u3d(i,k,j)
174 v3d_hv(i,k) = v3d(i,k,j)
175 t3d_hv(i,k) = t3d(i,k,j)
176 qv3d_hv(i,k) = qv3d(i,k,j)
177 p3d_hv(i,k) = p3d(i,k,j)
178 pi3d_hv(i,k) = pi3d(i,k,j)
186 var2d_hv(i) = var2d(i,j)
187 oc12d_hv(i) = oc12d(i,j)
188 sina_hv(i) = sina(i,j)
189 cosa_hv(i) = cosa(i,j)
190 oa2d1_hv(i) = oa2d1(i,j)
191 oa2d2_hv(i) = oa2d2(i,j)
192 oa2d3_hv(i) = oa2d3(i,j)
193 oa2d4_hv(i) = oa2d4(i,j)
194 ol2d1_hv(i) = ol2d1(i,j)
195 ol2d2_hv(i) = ol2d2(i,j)
196 ol2d3_hv(i) = ol2d3(i,j)
197 ol2d4_hv(i) = ol2d4(i,j)
200 call bl_gwdo_run(sina=sina_hv,cosa=cosa_hv &
201 ,rublten=rublten_hv,rvblten=rvblten_hv &
202 ,dtaux3d=dtaux3d_hv,dtauy3d=dtauy3d_hv &
203 ,dusfcg=dusfcg_hv,dvsfcg=dvsfcg_hv &
204 ,uproj=u3d_hv,vproj=v3d_hv &
205 ,t1=t3d_hv,q1=qv3d_hv &
207 ,prsl=p3d_hv,prslk=pi3d_hv &
209 ,var=var2d_hv,oc1=oc12d_hv &
210 ,oa2d1=oa2d1_hv, oa2d2=oa2d2_hv &
211 ,oa2d3=oa2d3_hv, oa2d4=oa2d4_hv &
212 ,ol2d1=ol2d1_hv, ol2d2=ol2d2_hv &
213 ,ol2d3=ol2d3_hv, ol2d4=ol2d4_hv &
214 ,g_=g,cp_=cp,rd_=rd,rv_=rv,fv_=ep1,pi_=pi &
215 ,dxmeter=dx_hv,deltim=dt &
216 ,its=its,ite=ite,kte=kte,kme=kte+1 &
217 ,errmsg=errmsg,errflg=errflg)
219 ! Variables that are INTENT(OUT) or INTENT(INOUT):
224 rublten(i,k,j) = rublten_hv(i,k)
225 rvblten(i,k,j) = rvblten_hv(i,k)
226 dtaux3d(i,k,j) = dtaux3d_hv(i,k)
227 dtauy3d(i,k,j) = dtauy3d_hv(i,k)
233 dusfcg(i,j) = dusfcg_hv(i)
234 dvsfcg(i,j) = dvsfcg_hv(i)
241 !=================================================================================================================
242 end module module_bl_gwdo
243 !=================================================================================================================