58 use constants_mod
, only: grav, rdgas, rvgas
61 use field_manager_mod
, only: model_atmos
62 use tracer_manager_mod
, only: get_tracer_index
63 use mpp_domains_mod
, only: domain2d
82 subroutine p_var(km, ifirst, ilast, jfirst, jlast, ptop, ptop_min, &
83 delp, delz, pt, ps, pe, peln, pk, pkz, cappa, q, ng, nq, area, &
84 dry_mass, adjust_dry_mass, mountain, moist_phys, &
85 hydrostatic, nwat, domain, adiabatic, 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, adiabatic
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:ilast,jfirst:jlast, 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)))
179 if ( adiabatic )
then 182 zvir = rvgas/rdgas - 1.
184 sphum = get_tracer_index(model_atmos,
'sphum')
186 if ( .not.hydrostatic )
then 189 if (
present(make_nh) )
then 196 delz(i,j,k) = rdg*pt(i,j,k)*(1.+zvir*q(i,j,k,sphum))*(peln(i,k+1,j)-peln(i,k,j))
200 if(is_master())
write(*,*)
'delz computed from hydrostatic state' 204 if ( moist_phys )
then 214 pkz(i,j,k) = exp( cappa*(
virqd(q(i,j,k,:))/
vicpqd(q(i,j,k,:))) * &
215 log(rdg*delp(i,j,k)*pt(i,j,k)* &
216 virq(q(i,j,k,:)) /delz(i,j,k)) )
218 pkz(i,j,k) = exp( cappa*log(rdg*delp(i,j,k)*pt(i,j,k)* &
219 (1.+zvir*q(i,j,k,sphum))/delz(i,j,k)) )
234 pkz(i,j,k) = exp( cappa * (
virqd(q(i,j,k,:))/
vicpqd(q(i,j,k,:))) * &
235 log(rdg*delp(i,j,k)*pt(i,j,k)/delz(i,j,k)) )
237 pkz(i,j,k) = exp( cappa*log(rdg*delp(i,j,k)*pt(i,j,k)/delz(i,j,k)) )
250 subroutine drymadj(km, ifirst, ilast, jfirst, jlast, ng, &
251 cappa, ptop, ps, delp, q, nq, area, nwat, &
252 dry_mass, adjust_dry_mass, moist_phys, dpd, domain)
256 integer ifirst, ilast
257 integer jfirst, jlast
259 real,
intent(in):: dry_mass
260 real,
intent(in):: ptop
261 real,
intent(in):: cappa
262 logical,
intent(in):: adjust_dry_mass
263 logical,
intent(in):: moist_phys
264 real(kind=R_GRID),
intent(IN) :: area(ifirst-ng:ilast+ng, jfirst-ng:jlast+ng)
265 type(domain2d),
intent(IN) :: domain
268 real,
intent(in):: q(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng,km,nq)
269 real,
intent(in)::delp(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng,km)
270 real,
intent(inout):: ps(ifirst-ng:ilast+ng,jfirst-ng:jlast+ng)
271 real,
intent(out):: dpd
273 real psd(ifirst:ilast,jfirst:jlast)
287 ps(i,j) = ps(i,j) + delp(i,j,k)
294 psd(i,j) = psd(i,j) + delp(i,j,k)*(1. - sum(q(i,j,k,1:nwat)))
306 psdry =
g_sum(domain, psd, ifirst, ilast, jfirst, jlast, ng, area, 1, .true.)
307 psmo =
g_sum(domain, ps(ifirst:ilast,jfirst:jlast), ifirst, ilast, jfirst, jlast, &
310 psdry =
g_sum(domain, psd, ifirst, ilast, jfirst, jlast, ng, area, 1)
311 psmo =
g_sum(domain, ps(ifirst:ilast,jfirst:jlast), ifirst, ilast, jfirst, jlast, &
316 write(*,*)
'Total surface pressure (mb) = ', 0.01*psmo
317 if ( moist_phys )
then 318 write(*,*)
'mean dry surface pressure = ', 0.01*psdry
319 write(*,*)
'Total Water (kg/m**2) =',
real(psmo-psdry,4)/GRAV
323 if( adjust_dry_mass )
Then 324 dpd =
real(dry_mass - psdry,4)
325 if(is_master())
write(*,*)
'dry mass to be added (pascals) =', dpd
332 subroutine hydro_eq(km, is, ie, js, je, ps, hs, drym, delp, ak, bk, &
333 pt, delz, area, ng, mountain, hydrostatic, hybrid_z, domain)
335 integer,
intent(in):: is, ie, js, je, km, ng
336 real,
intent(in):: ak(km+1), bk(km+1)
337 real,
intent(in):: hs(is-ng:ie+ng,js-ng:je+ng)
338 real,
intent(in):: drym
339 logical,
intent(in):: mountain
340 logical,
intent(in):: hydrostatic
341 logical,
intent(in):: hybrid_z
342 real(kind=R_GRID),
intent(IN) :: area(is-ng:ie+ng,js-ng:je+ng)
343 type(domain2d),
intent(IN) :: domain
345 real,
intent(out):: ps(is-ng:ie+ng,js-ng:je+ng)
346 real,
intent(out):: pt(is-ng:ie+ng,js-ng:je+ng,km)
347 real,
intent(out):: delp(is-ng:ie+ng,js-ng:je+ng,km)
348 real,
intent(inout):: delz(is:,js:,1:)
352 real mslp, z1, t1, p1, t0, a0, psm
363 if ( is_master() )
write(*,*)
'Initializing ATM hydrostatically' 365 if ( is_master() )
write(*,*)
'Initializing Earth' 380 ztop = z1 + (rdgas*t1)*log(p1/ptop)
381 if(is_master())
write(*,*)
'ZTOP is computed as', ztop/grav*1.e-3
387 ps(i,j) = mslp*( c0/(hs(i,j)+c0))**(1./(a0*rdgas))
390 psm =
g_sum(domain, ps(is:ie,js:je), is, ie, js, je, ng, area, 1, .true.)
392 if(is_master())
write(*,*)
'Computed mean ps=', psm
393 if(is_master())
write(*,*)
'Correction delta-ps=', dps
407 ps(i,j) = ps(i,j) + dps
420 gz(i,k) = gz(i,k+1) - delz(i,j,k)*grav
425 delz(i,j,1) = (gz(i,2) - ztop) / grav
430 if ( gz(i,k) >= z1 )
then 432 ph(i,k) = ptop*exp( (gz(i,1)-gz(i,k))/(rdgas*t1) )
435 ph(i,k) = ps(i,j)*((hs(i,j)+c0)/(gz(i,k)+c0))**(1./(a0*rdgas))
445 ph(i,k) = ak(k) + bk(k)*ps(i,j)
451 if ( ph(i,k) <= p1 )
then 453 gz(i,k) = ztop + (rdgas*t1)*log(ptop/ph(i,k))
456 gz(i,k) = (hs(i,j)+c0)/(ph(i,k)/ps(i,j))**(a0*rdgas) - c0
460 if ( .not. hydrostatic )
then 463 delz(i,j,k) = ( gz(i,k+1) - gz(i,k) ) / grav
472 pt(i,j,k) = (gz(i,k)-gz(i,k+1))/(rdgas*(log(ph(i,k+1)/ph(i,k))))
473 pt(i,j,k) = max(t1, pt(i,j,k))
474 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.
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, adiabatic, make_nh)
the subroutine 'p_var' computes auxiliary pressure variables for a hydrostatic state.
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...