59 use constants_mod,
only: grav, rdgas, rvgas
62 use field_manager_mod,
only: model_atmos
63 use tracer_manager_mod,
only: get_tracer_index
64 use mpp_domains_mod,
only: domain2d
83 subroutine p_var(km, ifirst, ilast, jfirst, jlast, ptop, ptop_min, &
84 delp, delz, pt, ps, pe, peln, pk, pkz, cappa, q, ng, nq, area, &
85 dry_mass, adjust_dry_mass, mountain, moist_phys, &
86 hydrostatic, nwat, domain, make_nh)
89 integer,
intent(in):: km
90 integer,
intent(in):: ifirst, ilast
91 integer,
intent(in):: jfirst, jlast
92 integer,
intent(in):: nq, nwat
93 integer,
intent(in):: ng
94 logical,
intent(in):: adjust_dry_mass, mountain, moist_phys, hydrostatic
95 real,
intent(in):: dry_mass, cappa, ptop, ptop_min
96 real,
intent(in ):: pt(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng, km)
97 real,
intent(inout):: delz(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng, km)
98 real,
intent(inout):: delp(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng, km)
99 real,
intent(inout):: q(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng, km, nq)
100 real(kind=R_GRID),
intent(IN) :: area(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng)
101 logical,
optional:: make_nh
103 real,
intent(out) :: ps(ifirst-ng:ilast+ng, jfirst-ng:jlast+ng)
104 real,
intent(out) :: pk(ifirst:ilast, jfirst:jlast, km+1)
105 real,
intent(out) :: pe(ifirst-1:ilast+1,km+1,jfirst-1:jlast+1)
106 real,
intent(out) :: peln(ifirst:ilast, km+1, jfirst:jlast)
107 real,
intent(out) :: pkz(ifirst:ilast, jfirst:jlast, km)
108 type(domain2d),
intent(IN) :: domain
111 integer sphum, liq_wat, ice_wat
112 integer rainwat, snowwat, graupel
113 real ratio(ifirst:ilast)
114 real pek, lnp, ak1, rdg, dpd, zvir
118 if ( adjust_dry_mass ) &
119 call drymadj(km, ifirst, ilast, jfirst, jlast, ng, cappa, ptop, ps, &
120 delp, q, nq, area, nwat, dry_mass, adjust_dry_mass, moist_phys, dpd, domain)
134 if ( adjust_dry_mass )
then 136 ratio(i) = 1. + dpd/(ps(i,j)-ptop)
140 delp(i,j,k) = delp(i,j,k) * ratio(i)
147 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
148 peln(i,k,j) = log(pe(i,k,j))
149 pk(i,j,k) = exp( cappa*peln(i,k,j) )
154 ps(i,j) = pe(i,km+1,j)
157 if( ptop < ptop_min )
then 159 ak1 = (cappa + 1.) / cappa
161 peln(i,1,j) = peln(i,2,j) - ak1
170 if ( hydrostatic )
then 173 pkz(i,j,k) = (pk(i,j,k+1)-pk(i,j,k))/(cappa*(peln(i,k+1,j)-peln(i,k,j)))
180 if ( .not.hydrostatic )
then 183 if (
present(make_nh) )
then 190 delz(i,j,k) = rdg*pt(i,j,k)*(peln(i,k+1,j)-peln(i,k,j))
194 if(is_master())
write(*,*)
'delz computed from hydrostatic state' 198 if ( moist_phys )
then 202 zvir = rvgas/rdgas - 1.
203 sphum = get_tracer_index(model_atmos,
'sphum')
210 pkz(i,j,k) = exp( cappa*(
virqd(q(i,j,k,:))/
vicpqd(q(i,j,k,:))) * &
211 log(rdg*delp(i,j,k)*pt(i,j,k)* &
212 virq(q(i,j,k,:)) /delz(i,j,k)) )
214 pkz(i,j,k) = exp( cappa*log(rdg*delp(i,j,k)*pt(i,j,k)* &
215 (1.+zvir*q(i,j,k,sphum))/delz(i,j,k)) )
230 pkz(i,j,k) = exp( cappa * (
virqd(q(i,j,k,:))/
vicpqd(q(i,j,k,:))) * &
231 log(rdg*delp(i,j,k)*pt(i,j,k)/delz(i,j,k)) )
233 pkz(i,j,k) = exp( cappa*log(rdg*delp(i,j,k)*pt(i,j,k)/delz(i,j,k)) )
246 subroutine drymadj(km, ifirst, ilast, jfirst, jlast, ng, &
247 cappa, ptop, ps, delp, q, nq, area, nwat, &
248 dry_mass, adjust_dry_mass, moist_phys, dpd, domain)
252 integer ifirst, ilast
253 integer jfirst, jlast
255 real,
intent(in):: dry_mass
256 real,
intent(in):: ptop
257 real,
intent(in):: cappa
258 logical,
intent(in):: adjust_dry_mass
259 logical,
intent(in):: moist_phys
260 real(kind=R_GRID),
intent(IN) :: area(ifirst-ng:ilast+ng, jfirst-ng:jlast+ng)
261 type(domain2d),
intent(IN) :: domain
264 real,
intent(in):: q(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng,km,nq)
265 real,
intent(in)::delp(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng,km)
266 real,
intent(inout):: ps(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng)
267 real,
intent(out):: dpd
269 real psd(ifirst:ilast,jfirst:jlast)
283 ps(i,j) = ps(i,j) + delp(i,j,k)
290 psd(i,j) = psd(i,j) + delp(i,j,k)*(1. - sum(q(i,j,k,1:nwat)))
302 psdry =
g_sum(domain, psd, ifirst, ilast, jfirst, jlast, ng, area, 1, .true.)
303 psmo =
g_sum(domain, ps(ifirst:ilast,jfirst:jlast), ifirst, ilast, jfirst, jlast, &
306 psdry =
g_sum(domain, psd, ifirst, ilast, jfirst, jlast, ng, area, 1)
307 psmo =
g_sum(domain, ps(ifirst:ilast,jfirst:jlast), ifirst, ilast, jfirst, jlast, &
312 write(*,*)
'Total surface pressure (mb) = ', 0.01*psmo
313 if ( moist_phys )
then 314 write(*,*)
'mean dry surface pressure = ', 0.01*psdry
315 write(*,*)
'Total Water (kg/m**2) =',
real(psmo-psdry,4)/GRAV
319 if( adjust_dry_mass )
Then 320 dpd =
real(dry_mass - psdry,4)
321 if(is_master())
write(*,*)
'dry mass to be added (pascals) =', dpd
328 subroutine hydro_eq(km, is, ie, js, je, ps, hs, drym, delp, ak, bk, &
329 pt, delz, area, ng, mountain, hydrostatic, hybrid_z, domain)
331 integer,
intent(in):: is, ie, js, je, km, ng
332 real,
intent(in):: ak(km+1), bk(km+1)
333 real,
intent(in):: hs(is-ng:ie+ng,js-ng:je+ng)
334 real,
intent(in):: drym
335 logical,
intent(in):: mountain
336 logical,
intent(in):: hydrostatic
337 logical,
intent(in):: hybrid_z
338 real(kind=R_GRID),
intent(IN) :: area(is-ng:ie+ng,js-ng:je+ng)
339 type(domain2d),
intent(IN) :: domain
341 real,
intent(out):: ps(is-ng:ie+ng,js-ng:je+ng)
342 real,
intent(out):: pt(is-ng:ie+ng,js-ng:je+ng,km)
343 real,
intent(out):: delp(is-ng:ie+ng,js-ng:je+ng,km)
344 real,
intent(inout):: delz(is-ng:ie+ng,js-ng:je+ng,km)
348 real mslp, z1, t1, p1, t0, a0, psm
359 if ( is_master() )
write(*,*)
'Initializing ATM hydrostatically' 361 if ( is_master() )
write(*,*)
'Initializing Earth' 376 ztop = z1 + (rdgas*t1)*log(p1/ptop)
377 if(is_master())
write(*,*)
'ZTOP is computed as', ztop/grav*1.e-3
383 ps(i,j) = mslp*( c0/(hs(i,j)+c0))**(1./(a0*rdgas))
386 psm =
g_sum(domain, ps(is:ie,js:je), is, ie, js, je, ng, area, 1, .true.)
388 if(is_master())
write(*,*)
'Computed mean ps=', psm
389 if(is_master())
write(*,*)
'Correction delta-ps=', dps
403 ps(i,j) = ps(i,j) + dps
416 gz(i,k) = gz(i,k+1) - delz(i,j,k)*grav
421 delz(i,j,1) = (gz(i,2) - ztop) / grav
426 if ( gz(i,k) >= z1 )
then 428 ph(i,k) = ptop*exp( (gz(i,1)-gz(i,k))/(rdgas*t1) )
431 ph(i,k) = ps(i,j)*((hs(i,j)+c0)/(gz(i,k)+c0))**(1./(a0*rdgas))
441 ph(i,k) = ak(k) + bk(k)*ps(i,j)
447 if ( ph(i,k) <= p1 )
then 449 gz(i,k) = ztop + (rdgas*t1)*log(ptop/ph(i,k))
452 gz(i,k) = (hs(i,j)+c0)/(ph(i,k)/ps(i,j))**(a0*rdgas) - c0
456 if ( .not. hydrostatic )
then 459 delz(i,j,k) = ( gz(i,k+1) - gz(i,k) ) / grav
468 pt(i,j,k) = (gz(i,k)-gz(i,k+1))/(rdgas*(log(ph(i,k+1)/ph(i,k))))
469 pt(i,j,k) = max(t1, pt(i,j,k))
470 delp(i,j,k) = ph(i,k+1) - ph(i,k)
pure real function, public vicpqd(q)
The module 'fv_mp_mod' is a single program multiple data (SPMD) parallel decompostion/communication m...
The module 'multi_gases' peforms multi constitutents computations.
real function, public g_sum(domain, p, ifirst, ilast, jfirst, jlast, ngc, area, mode, reproduce)
The function 'g_sum' is the fast version of 'globalsum'.
integer, parameter, public r_grid
pure real function, public virqd(q)
subroutine, public hydro_eq(km, is, ie, js, je, ps, hs, drym, delp, ak, bk, pt, delz, area, ng, mountain, hydrostatic, hybrid_z, domain)
The subroutine 'hydro_eq' computes a hydrostatically balanced and isothermal basic state from input h...
pure real function, public virq(q)
The module 'fv_arrays' contains the 'fv_atmos_type' and associated datatypes.
subroutine drymadj(km, ifirst, ilast, jfirst, jlast, ng, cappa, ptop, ps, delp, q, nq, area, nwat, dry_mass, adjust_dry_mass, moist_phys, dpd, domain)
The module 'fv_grid_utils' contains routines for setting up and computing grid-related quantities...
subroutine, public p_var(km, ifirst, ilast, jfirst, jlast, ptop, ptop_min, delp, delz, pt, ps, pe, peln, pk, pkz, cappa, q, ng, nq, area, dry_mass, adjust_dry_mass, mountain, moist_phys, hydrostatic, nwat, domain, make_nh)
the subroutine 'p_var' computes auxiliary pressure variables for a hydrostatic state.