39 real,
parameter::
r3 = 1./3.
43 subroutine update_dz_c(is, ie, js, je, km, ng, dt, dp0, zs, area, ut, vt, gz, ws, &
44 npx, npy, sw_corner, se_corner, ne_corner, nw_corner, bd, grid_type)
47 integer,
intent(in):: is, ie, js, je, ng, km, npx, npy,
grid_type 48 logical,
intent(IN):: sw_corner, se_corner, ne_corner, nw_corner
50 real,
intent(in):: dp0(km)
51 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: ut, vt
52 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng):: area
53 real,
intent(inout):: gz(is-ng:ie+ng,js-ng:je+ng,km+1)
54 real,
intent(in ):: zs(is-ng:ie+ng, js-ng:je+ng)
55 real,
intent( out):: ws(is-ng:ie+ng, js-ng:je+ng)
57 real:: gz2(is-ng:ie+ng,js-ng:je+ng)
58 real,
dimension(is-1:ie+2,js-1:je+1):: xfx, fx
59 real,
dimension(is-1:ie+1,js-1:je+2):: yfx, fy
60 real,
parameter:: r14 = 1./14.
62 integer:: is1, ie1, js1, je1
64 real:: rdt, top_ratio, bot_ratio, int_ratio
69 top_ratio = dp0(1 ) / (dp0( 1)+dp0(2 ))
70 bot_ratio = dp0(km) / (dp0(km-1)+dp0(km))
91 xfx(i,j) = ut(i,j,1) + (ut(i,j,1)-ut(i,j,2))*top_ratio
96 yfx(i,j) = vt(i,j,1) + (vt(i,j,1)-vt(i,j,2))*top_ratio
99 elseif ( k==km+1 )
then 103 xfx(i,j) = ut(i,j,km) + (ut(i,j,km)-ut(i,j,km-1))*bot_ratio
110 yfx(i,j) = vt(i,j,km) + (vt(i,j,km)-vt(i,j,km-1))*bot_ratio
116 int_ratio = 1./(dp0(k-1)+dp0(k))
119 xfx(i,j) = (dp0(k)*ut(i,j,k-1)+dp0(k-1)*ut(i,j,k))*int_ratio
124 yfx(i,j) = (dp0(k)*vt(i,j,k-1)+dp0(k-1)*vt(i,j,k))*int_ratio
138 if( xfx(i,j) > 0. )
then 143 fx(i,j) = xfx(i,j)*fx(i,j)
150 if( yfx(i,j) > 0. )
then 155 fy(i,j) = yfx(i,j)*fy(i,j)
161 gz(i,j,k) = (gz2(i,j)*area(i,j) + ( fx(i,j)- fx(i+1,j))+( fy(i,j)- fy(i,j+1))) &
162 / ( area(i,j) + (xfx(i,j)-xfx(i+1,j))+(yfx(i,j)-yfx(i,j+1)))
171 ws(i,j) = ( zs(i,j) - gz(i,j,km+1) ) * rdt
175 gz(i,j,k) =
max( gz(i,j,k), gz(i,j,k+1) +
dz_min )
183 subroutine update_dz_d(ndif, damp, hord, is, ie, js, je, km, ng, npx, npy, area, rarea, &
184 dp0, zs, zh, crx, cry, xfx, yfx, delz, ws, rdt, gridstruct, bd)
187 integer,
intent(in):: is, ie, js, je, ng, km, npx, npy
188 integer,
intent(in):: hord
189 real,
intent(in) :: rdt
190 real,
intent(in) :: dp0(km)
191 real,
intent(in) :: area(is-ng:ie+ng,js-ng:je+ng)
192 real,
intent(in) :: rarea(is-ng:ie+ng,js-ng:je+ng)
193 real,
intent(inout):: damp(km+1)
194 integer,
intent(inout):: ndif(km+1)
195 real,
intent(in ) :: zs(is-ng:ie+ng,js-ng:je+ng)
196 real,
intent(inout) :: zh(is-ng:ie+ng,js-ng:je+ng,km+1)
197 real,
intent( out) ::delz(is-ng:ie+ng,js-ng:je+ng,km)
198 real,
intent(inout),
dimension(is:ie+1,js-ng:je+ng,km):: crx, xfx
199 real,
intent(inout),
dimension(is-ng:ie+ng,js:je+1,km):: cry, yfx
200 real,
intent(out) :: ws(is:ie,js:je)
204 real,
dimension(is: ie+1, js-ng:je+ng,km+1):: crx_adv, xfx_adv
205 real,
dimension(is-ng:ie+ng,js: je+1,km+1 ):: cry_adv, yfx_adv
206 real,
dimension(is:ie+1,js:je ):: fx
207 real,
dimension(is:ie ,js:je+1):: fy
208 real,
dimension(is-ng:ie+ng+1,js-ng:je+ng ):: fx2
209 real,
dimension(is-ng:ie+ng ,js-ng:je+ng+1):: fy2
210 real,
dimension(is-ng:ie+ng ,js-ng:je+ng ):: wk2, z2
211 real:: ra_x(is:ie,js-ng:je+ng)
212 real:: ra_y(is-ng:ie+ng,js:je)
214 integer i, j, k, isd, ied, jsd, jed
215 logical:: uniform_grid
217 uniform_grid = .false.
219 damp(km+1) = damp(km)
220 ndif(km+1) = ndif(km)
222 isd = is - ng; ied = ie + ng
223 jsd = js - ng; jed = je + ng
228 call edge_profile(crx, xfx, crx_adv, xfx_adv, is, ie+1, jsd, jed, j, km, &
229 dp0, uniform_grid, 0)
230 if ( j<=je+1 .and. j>=js ) &
231 call edge_profile(cry, yfx, cry_adv, yfx_adv, isd, ied, js, je+1, j, km, &
232 dp0, uniform_grid, 0)
243 ra_x(i,j) = area(i,j) + (xfx_adv(i,j,k) - xfx_adv(i+1,j,k))
248 ra_y(i,j) = area(i,j) + (yfx_adv(i,j,k) - yfx_adv(i,j+1,k))
252 if ( damp(k)>1.e-5 )
then 258 call fv_tp_2d(z2, crx_adv(is,jsd,k), cry_adv(isd,js,k), npx, npy, hord, &
259 fx, fy, xfx_adv(is,jsd,k), yfx_adv(isd,js,k), gridstruct, bd, ra_x, ra_y)
260 call del6_vt_flux(ndif(k), npx, npy, damp(k), z2, wk2, fx2, fy2, gridstruct, bd)
263 zh(i,j,k) = (z2(i,j)*area(i,j)+(fx(i,j)-fx(i+1,j))+(fy(i,j)-fy(i,j+1))) &
264 / ((ra_x(i,j)+ra_y(i,j))-area(i,j)) + ((fx2(i,j)-fx2(i+1,j))+(fy2(i,j)-fy2(i,j+1)))*rarea(i,j)
268 call fv_tp_2d(zh(isd,jsd,k), crx_adv(is,jsd,k), cry_adv(isd,js,k), npx, npy, hord, &
269 fx, fy, xfx_adv(is,jsd,k), yfx_adv(isd,js,k), gridstruct, bd, ra_x, ra_y)
272 zh(i,j,k) = (zh(i,j,k)*area(i,j)+(fx(i,j)-fx(i+1,j))+(fy(i,j)-fy(i,j+1))) &
273 / ((ra_x(i,j) + ra_y(i,j)) - area(i,j))
285 ws(i,j) = ( zs(i,j) - zh(i,j,km+1) ) * rdt
290 zh(i,j,k) =
max( zh(i,j,k), zh(i,j,k+1) +
dz_min )
298 akap, cappa, cp, ptop, hs, w3, pt, q_con, &
299 delp, gz, pef, ws, p_fac, a_imp, scale_m)
301 integer,
intent(in):: is, ie, js, je, ng, km
302 integer,
intent(in):: ms
303 real,
intent(in):: dt, akap, cp, ptop, p_fac, a_imp, scale_m
304 real,
intent(in):: ws(is-ng:ie+ng,js-ng:je+ng)
305 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, delp
306 real,
intent(in),
dimension(is-ng:,js-ng:,1:):: q_con, cappa
307 real,
intent(in):: hs(is-ng:ie+ng,js-ng:je+ng)
308 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: w3
310 real,
intent(inout),
dimension(is-ng:ie+ng,js-ng:je+ng,km+1):: gz
311 real,
intent( out),
dimension(is-ng:ie+ng,js-ng:je+ng,km+1):: pef
313 real,
dimension(is-1:ie+1,km ):: dm, dz2, w2, pm2, gm2, cp2
314 real,
dimension(is-1:ie+1,km+1):: pem, pe2, peg
332 dm(i,k) = delp(i,j,k)
346 pem(i,k) = pem(i,k-1) + dm(i,k-1)
349 peg(i,k) = peg(i,k-1) + dm(i,k-1)*(1.-q_con(i,j,k-1))
356 dz2(i,k) = gz(i,j,k+1) - gz(i,j,k)
358 pm2(i,k) = (peg(i,k+1)-peg(i,k))/log(peg(i,k+1)/peg(i,k))
361 cp2(i,k) = cappa(i,j,k)
362 gm2(i,k) = 1. / (1.-cp2(i,k))
366 pm2(i,k) = dm(i,k)/log(pem(i,k+1)/pem(i,k))
368 dm(i,k) = dm(i,k) * rgrav
374 if ( a_imp < -0.01 )
then 376 pem, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), p_fac, scale_m)
377 elseif ( a_imp <= 0.5 )
then 378 call rim_2d(ms, dt, is1, ie1, km,
rdgas, gama, gm2, pe2, &
379 dm, pm2, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), .true.)
381 call sim1_solver(dt, is1, ie1, km,
rdgas, gama, gm2, cp2, akap, pe2, &
382 dm, pm2, pem, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), p_fac)
387 pef(i,j,k) = pe2(i,k) + pem(i,k)
393 gz(i,j,km+1) = hs(i,j)
398 gz(i,j,k) = gz(i,j,k+1) - dz2(i,k)*
grav 410 isd, ied, jsd, jed, akap, cappa, cp, &
411 ptop, zs, q_con, w, delz, pt, &
412 delp, zh, pe, ppe, pk3, pk, peln, &
413 ws, scale_m, p_fac, a_imp, &
414 use_logp, last_call, fp_out)
421 integer,
intent(in):: ms, is, ie, js, je, km, ng
422 integer,
intent(in):: isd, ied, jsd, jed
423 real,
intent(in):: dt
424 real,
intent(in):: akap, cp, ptop, p_fac, a_imp, scale_m
425 real,
intent(in):: zs(isd:ied,jsd:jed)
426 logical,
intent(in):: last_call, use_logp, fp_out
427 real,
intent(in):: ws(is:ie,js:je)
428 real,
intent(in),
dimension(isd:,jsd:,1:):: q_con, cappa
429 real,
intent(in),
dimension(isd:ied,jsd:jed,km):: delp, pt
430 real,
intent(inout),
dimension(isd:ied,jsd:jed,km+1):: zh
431 real,
intent(inout),
dimension(isd:ied,jsd:jed,km):: w
432 real,
intent(inout):: pe(is-1:ie+1,km+1,js-1:je+1)
433 real,
intent(out):: peln(is:ie,km+1,js:je)
434 real,
intent(out),
dimension(isd:ied,jsd:jed,km+1):: ppe
435 real,
intent(out):: delz(is-ng:ie+ng,js-ng:je+ng,km)
436 real,
intent(out):: pk(is:ie,js:je,km+1)
437 real,
intent(out):: pk3(isd:ied,jsd:jed,km+1)
439 real,
dimension(is:ie,km):: dm, dz2, pm2, w2, gm2, cp2
440 real,
dimension(is:ie,km+1)::pem, pe2, peln2, peg, pelng
441 real gama, rgrav, ptk, peln1
447 ptk = exp(akap*peln1)
457 dm(i,k) = delp(i,j,k)
459 cp2(i,k) = cappa(i,j,k)
475 pem(i,k) = pem(i,k-1) + dm(i,k-1)
476 peln2(i,k) = log(pem(i,k))
480 peg(i,k) = peg(i,k-1) + dm(i,k-1)*(1.-q_con(i,j,k-1))
481 pelng(i,k) = log(peg(i,k))
483 pk3(i,j,k) = exp(akap*peln2(i,k))
490 pm2(i,k) = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
493 gm2(i,k) = 1. / (1.-cp2(i,k))
497 pm2(i,k) = dm(i,k)/(peln2(i,k+1)-peln2(i,k))
499 dm(i,k) = dm(i,k) * rgrav
500 dz2(i,k) = zh(i,j,k+1) - zh(i,j,k)
505 if ( a_imp < -0.999 )
then 507 pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), p_fac, scale_m )
508 elseif ( a_imp < -0.5 )
then 510 pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), abs(a_imp), p_fac, scale_m)
511 elseif ( a_imp <= 0.5 )
then 512 call rim_2d(ms, dt, is, ie, km,
rdgas, gama, gm2, pe2, &
513 dm, pm2, w2, dz2, pt(is:ie,j,1:km), ws(is,j), .false.)
514 elseif ( a_imp > 0.999 )
then 515 call sim1_solver(dt, is, ie, km,
rdgas, gama, gm2, cp2, akap, pe2, dm, &
516 pm2, pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), p_fac)
518 call sim_solver(dt, is, ie, km,
rdgas, gama, gm2, cp2, akap, pe2, dm, &
519 pm2, pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), &
520 a_imp, p_fac, scale_m)
526 delz(i,j,k) = dz2(i,k)
530 if ( last_call )
then 533 peln(i,k,j) = peln2(i,k)
534 pk(i,j,k) = pk3(i,j,k)
543 ppe(i,j,k) = pe2(i,k) + pem(i,k)
549 ppe(i,j,k) = pe2(i,k)
557 pk3(i,j,k) = peln2(i,k)
563 zh(i,j,km+1) = zs(i,j)
567 zh(i,j,k) = zh(i,j,k+1) - dz2(i,k)
576 subroutine imp_diff_w(j, is, ie, js, je, ng, km, cd, delz, ws, w, w3)
577 integer,
intent(in) :: j, is, ie, js, je, km, ng
578 real,
intent(in) :: cd
579 real,
intent(in) :: delz(is-ng:ie+ng, km)
580 real,
intent(in) :: w(is:ie, km)
581 real,
intent(in) :: ws(is:ie)
582 real,
intent(out) :: w3(is-ng:ie+ng,js-ng:je+ng,km)
584 real,
dimension(is:ie,km):: c, gam, dz, wt
591 dz(i,k) = 0.5*(delz(i,k-1)+delz(i,k))
596 c(i,k) = -cd/(dz(i,k+1)*delz(i,k))
603 wt(i,1) = w(i,1) / bet(i)
609 gam(i,k) = c(i,k-1)/bet(i)
610 a = cd/(dz(i,k)*delz(i,k))
611 bet(i) = (1.+a-c(i,k)) + a*gam(i,k)
612 wt(i,k) = (w(i,k) + a*wt(i,k-1)) / bet(i)
618 gam(i,km) = c(i,km-1) / bet(i)
619 a = cd/(dz(i,km)*delz(i,km))
620 wt(i,km) = (w(i,km) + 2.*ws(i)*cd/delz(i,km)**2 &
621 + a*wt(i,km-1))/(1. + a + (cd+cd)/delz(i,km)**2 + a*gam(i,km))
626 wt(i,k) = wt(i,k) - gam(i,k+1)*wt(i,k+1)
639 subroutine rim_2d(ms, bdt, is, ie, km, rgas, gama, gm2, pe2, &
640 dm2, pm2, w2, dz2, pt2, ws, c_core )
642 integer,
intent(in):: ms, is, ie, km
643 real,
intent(in):: bdt, gama, rgas
644 real,
intent(in),
dimension(is:ie,km):: dm2, pm2, gm2
645 logical,
intent(in):: c_core
646 real,
intent(in ) :: pt2(is:ie,km)
647 real,
intent(in ) :: ws(is:ie)
649 real,
intent(inout):: dz2(is:ie,km)
650 real,
intent(inout):: w2(is:ie,km)
651 real,
intent(out ):: pe2(is:ie,km+1)
654 real,
dimension(km+1):: m_bot, m_top, r_bot, r_top, pe1, pbar, wbar
655 real,
dimension(km):: r_hi, r_lo, dz, wm, dm, dts
656 real,
dimension(km):: pf1, wc, cm , pp, pt1
657 real:: dt, rdt, grg, z_frac, ptmp1, rden, pf, time_left
659 integer:: i, k, n, ke, kt1, ktop
678 wm(k) = w2(i,k)*dm(k)
686 if ( ms > 1 .and. ms < 8 )
then 689 rden = -rgas*dm(k)/dz(k)
691 pf1(k) = exp( gm2(i,k)*log(rden*pt1(k)) )
693 dts(k) = -dz(k)/sqrt(grg*pf1(k)/rden)
695 pf1(k) = exp( gama*log(rden*pt1(k)) )
696 dts(k) = -dz(k)/sqrt(grg*pf1(k)/rden)
698 if ( bdt > dts(k) )
then 704 222
if ( ks0==1 )
goto 244
707 cm(k) = dm(k) / dts(k)
708 wc(k) = wm(k) / dts(k)
709 pp(k) = pf1(k) - pm2(i,k)
712 wbar(1) = (wc(1)+pp(1)) / cm(1)
714 wbar(k) = (wc(k-1)+wc(k) + pp(k)-pp(k-1)) / (cm(k-1)+cm(k))
715 pbar(k) = bdt*(cm(k-1)*wbar(k) - wc(k-1) + pp(k-1))
719 if ( ks0 == km )
then 720 pbar(km+1) = bdt*(cm(km)*wbar(km+1) - wc(km) + pp(km))
723 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
727 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
728 w2(i,k) = (wm(k)+pbar(k+1)-pbar(k))/dm(k)
733 pe2(i,k) = pbar(k)*rdt
739 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
743 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
744 w2(i,k) = (wm(k)+pbar(k+1)-pbar(k))/dm(k)
747 pbar(ks0) = pbar(ks0) /
real(ms)
755 rden = -rgas*dm(k)/dz(k)
757 pf = exp( gm2(i,k)*log(rden*pt1(k)) )
759 dts(k) = -dz(k) / sqrt( grg*pf/rden )
761 pf = exp( gama*log(rden*pt1(k)) )
762 dts(k) = -dz(k) / sqrt( grg*pf/rden )
764 ptmp1 = dts(k)*(pf - pm2(i,k))
765 r_lo(k) = wm(k) + ptmp1
766 r_hi(k) = wm(k) - ptmp1
771 if( dt > dts(k) )
then 779 if ( ktop >= ks1 )
then 782 r_bot(k ) = z_frac*r_lo(k)
783 r_top(k+1) = z_frac*r_hi(k)
784 m_bot(k ) = z_frac* dm(k)
785 m_top(k+1) = m_bot(k)
787 if ( ktop == km )
goto 666
796 do 444 ke=km+1, ktop+2, -1
799 if ( time_left > dts(k) )
then 800 time_left = time_left - dts(k)
801 m_top(ke) = m_top(ke) + dm(k)
802 r_top(ke) = r_top(ke) + r_hi(k)
804 z_frac = time_left/dts(k)
805 m_top(ke) = m_top(ke) + z_frac*dm(k)
806 r_top(ke) = r_top(ke) + z_frac*r_hi(k)
817 do 4000 ke=ktop+1, km
820 if ( time_left > dts(k) )
then 821 time_left = time_left - dts(k)
822 m_bot(ke) = m_bot(ke) + dm(k)
823 r_bot(ke) = r_bot(ke) + r_lo(k)
825 z_frac = time_left/dts(k)
826 m_bot(ke) = m_bot(ke) + z_frac* dm(k)
827 r_bot(ke) = r_bot(ke) + z_frac*r_lo(k)
833 if ( time_left > dts(k) )
then 834 time_left = time_left - dts(k)
835 m_bot(ke) = m_bot(ke) + dm(k)
836 r_bot(ke) = r_bot(ke) - r_hi(k)
838 z_frac = time_left/dts(k)
839 m_bot(ke) = m_bot(ke) + z_frac* dm(k)
840 r_bot(ke) = r_bot(ke) - z_frac*r_hi(k) + (m_bot(ke)-m_surf)*ws2(i)
846 666
if ( ks1==1 ) wbar(1) = r_bot(1) / m_bot(1)
848 wbar(k) = (r_bot(k)+r_top(k)) / (m_top(k)+m_bot(k))
852 pbar(k) = m_top(k)*wbar(k) - r_top(k)
853 pe1(k) = pe1(k) + pbar(k)
859 dz2(i,k) = dz(k) + dt*(wbar(k+1)-wbar(k))
863 dz2(i,k) = dz(k) + dt*(wbar(k+1)-wbar(k))
864 w2(i,k) = ( wm(k) + pbar(k+1) - pbar(k) ) / dm(k)
869 dz(k) = dz(k) + dt*(wbar(k+1)-wbar(k))
870 wm(k) = wm(k) + pbar(k+1) - pbar(k)
877 pe2(i,k) = pe1(k)*rdt
884 subroutine sim3_solver(dt, is, ie, km, rgas, gama, kappa, pe2, dm, &
885 pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
886 integer,
intent(in):: is, ie, km
887 real,
intent(in):: dt, rgas, gama, kappa, alpha, p_fac, scale_m
888 real,
intent(in ),
dimension(is:ie,km):: dm, pt2
889 real,
intent(in ):: ws(is:ie)
890 real,
intent(in ),
dimension(is:ie,km+1):: pem
891 real,
intent(out):: pe2(is:ie,km+1)
892 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
894 real,
dimension(is:ie,km ):: aa, bb, dd, w1, wk, g_rat, gam
895 real,
dimension(is:ie,km+1):: pp
896 real,
dimension(is:ie):: p1, wk1, bet
897 real beta, t2, t1g, rdt, ra, capa1, r2g, r6g
903 t1g = gama * 2.*(alpha*dt)**2
914 aa(i,k) = exp(gama*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
920 g_rat(i,k) = dm(i,k)/dm(i,k+1)
921 bb(i,k) = 2.*(1.+g_rat(i,k))
922 dd(i,k) = 3.*(aa(i,k) + g_rat(i,k)*aa(i,k+1))
931 pe2(i,2) = (dd(i,1)-pem(i,1)) / bet(i)
934 dd(i,km) = 3.*aa(i,km) + r2g*dm(i,km)
939 gam(i,k) = g_rat(i,k-1) / bet(i)
940 bet(i) = bb(i,k) - gam(i,k)
941 pe2(i,k+1) = (dd(i,k) - pe2(i,k) ) / bet(i)
947 pe2(i,k) = pe2(i,k) - gam(i,k)*pe2(i,k+1)
955 pp(i,k) = pe2(i,k) - pem(i,k)
961 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
962 wk(i,k) = t2*aa(i,k)*(w1(i,k-1)-w1(i,k))
963 aa(i,k) = aa(i,k) - scale_m*dm(i,1)
967 bet(i) = dm(i,1) - aa(i,2)
968 w2(i,1) = (dm(i,1)*w1(i,1)+dt*pp(i,2) + wk(i,2)) / bet(i)
972 gam(i,k) = aa(i,k) / bet(i)
973 bet(i) = dm(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
974 w2(i,k) = (dm(i,k)*w1(i,k)+dt*(pp(i,k+1)-pp(i,k)) + wk(i,k+1)-wk(i,k) &
975 - aa(i,k)*w2(i,k-1)) / bet(i)
979 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
980 gam(i,km) = aa(i,km) / bet(i)
981 bet(i) = dm(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
982 w2(i,km) = (dm(i,km)*w1(i,km)+dt*(pp(i,km+1)-pp(i,km))-wk(i,km) + &
983 wk1(i)*(t2*w1(i,km)-ra*ws(i)) - aa(i,km)*w2(i,km-1)) / bet(i)
987 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
997 pe2(i,k+1) = pe2(i,k) + ( dm(i,k)*(w2(i,k)-w1(i,k))*rdt &
998 - beta*(pp(i,k+1)-pp(i,k)) )*ra
1008 pe2(i,k) =
max(p_fac*pem(i,k), pe2(i,k)+pem(i,k))
1014 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 - r6g*dm(i,km)
1015 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1*log(p1(i)) )
1020 p1(i) = (pe2(i,k)+bb(i,k)*pe2(i,k+1)+g_rat(i,k)*pe2(i,k+2))*
r3 - g_rat(i,k)*p1(i)
1021 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1*log(p1(i)) )
1027 pe2(i,k) = pe2(i,k) - pem(i,k)
1028 pe2(i,k) = pe2(i,k) + beta*(pp(i,k) - pe2(i,k))
1034 subroutine sim3p0_solver(dt, is, ie, km, rgas, gama, kappa, pe2, dm, &
1035 pem, w2, dz2, pt2, ws, p_fac, scale_m)
1037 integer,
intent(in):: is, ie, km
1038 real,
intent(in):: dt, rgas, gama, kappa, p_fac, scale_m
1039 real,
intent(in ),
dimension(is:ie,km):: dm, pt2
1040 real,
intent(in ):: ws(is:ie)
1041 real,
intent(in ):: pem(is:ie,km+1)
1042 real,
intent(out):: pe2(is:ie,km+1)
1043 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1045 real,
dimension(is:ie,km ):: aa, bb, dd, w1, g_rat, gam
1046 real,
dimension(is:ie,km+1):: pp
1047 real,
dimension(is:ie):: p1, wk1, bet
1048 real t1g, rdt, capa1, r2g, r6g
1061 aa(i,k) = exp(gama*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1067 g_rat(i,k) = dm(i,k)/dm(i,k+1)
1068 bb(i,k) = 2.*(1.+g_rat(i,k))
1069 dd(i,k) = 3.*(aa(i,k) + g_rat(i,k)*aa(i,k+1))
1078 pe2(i,2) = (dd(i,1)-pem(i,1)) / bet(i)
1081 dd(i,km) = 3.*aa(i,km) + r2g*dm(i,km)
1086 gam(i,k) = g_rat(i,k-1) / bet(i)
1087 bet(i) = bb(i,k) - gam(i,k)
1088 pe2(i,k+1) = (dd(i,k) - pe2(i,k) ) / bet(i)
1094 pe2(i,k) = pe2(i,k) - gam(i,k)*pe2(i,k+1)
1102 pp(i,k) = pe2(i,k) - pem(i,k)
1108 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k) - scale_m*dm(i,1)
1112 bet(i) = dm(i,1) - aa(i,2)
1113 w2(i,1) = (dm(i,1)*w1(i,1)+dt*pp(i,2)) / bet(i)
1117 gam(i,k) = aa(i,k) / bet(i)
1118 bet(i) = dm(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1119 w2(i,k) = (dm(i,k)*w1(i,k)+dt*(pp(i,k+1)-pp(i,k))-aa(i,k)*w2(i,k-1))/bet(i)
1123 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1124 gam(i,km) = aa(i,km) / bet(i)
1125 bet(i) = dm(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1126 w2(i,km) = (dm(i,km)*w1(i,km)+dt*(pp(i,km+1)-pp(i,km))-wk1(i)*ws(i) - &
1127 aa(i,km)*w2(i,km-1)) / bet(i)
1131 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1141 pe2(i,k+1) = pe2(i,k) + dm(i,k)*(w2(i,k)-w1(i,k))*rdt
1151 pe2(i,k) =
max(p_fac*pem(i,k), pe2(i,k)+pem(i,k))
1157 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 - r6g*dm(i,km)
1158 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1*log(p1(i)) )
1163 p1(i) = (pe2(i,k)+bb(i,k)*pe2(i,k+1)+g_rat(i,k)*pe2(i,k+2))*
r3-g_rat(i,k)*p1(i)
1164 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1*log(p1(i)) )
1170 pe2(i,k) = pe2(i,k) - pem(i,k)
1177 subroutine sim1_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, pe, dm2, &
1178 pm2, pem, w2, dz2, pt2, ws, p_fac)
1179 integer,
intent(in):: is, ie, km
1180 real,
intent(in):: dt, rgas, gama, kappa, p_fac
1181 real,
intent(in),
dimension(is:ie,km):: dm2, pt2, pm2, gm2, cp2
1182 real,
intent(in ):: ws(is:ie)
1183 real,
intent(in ),
dimension(is:ie,km+1):: pem
1184 real,
intent(out):: pe(is:ie,km+1)
1185 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1187 real,
dimension(is:ie,km ):: aa, bb, dd, w1, g_rat, gam
1188 real,
dimension(is:ie,km+1):: pp
1189 real,
dimension(is:ie):: p1, bet
1190 real t1g, rdt, capa1
1196 t1g = gama * 2.*dt*dt
1205 pe(i,k) = exp(gm2(i,k)*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1207 pe(i,k) = exp(gama*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1214 g_rat(i,k) = dm2(i,k)/dm2(i,k+1)
1215 bb(i,k) = 2.*(1.+g_rat(i,k))
1216 dd(i,k) = 3.*(pe(i,k) + g_rat(i,k)*pe(i,k+1))
1223 pp(i,2) = dd(i,1) / bet(i)
1225 dd(i,km) = 3.*pe(i,km)
1230 gam(i,k) = g_rat(i,k-1) / bet(i)
1231 bet(i) = bb(i,k) - gam(i,k)
1232 pp(i,k+1) = (dd(i,k) - pp(i,k) ) / bet(i)
1238 pp(i,k) = pp(i,k) - gam(i,k)*pp(i,k+1)
1246 aa(i,k) = t1g*0.5*(gm2(i,k-1)+gm2(i,k))/(dz2(i,k-1)+dz2(i,k)) * (pem(i,k)+pp(i,k))
1248 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k)) * (pem(i,k)+pp(i,k))
1253 bet(i) = dm2(i,1) - aa(i,2)
1254 w2(i,1) = (dm2(i,1)*w1(i,1) + dt*pp(i,2)) / bet(i)
1258 gam(i,k) = aa(i,k) / bet(i)
1259 bet(i) = dm2(i,k) - (aa(i,k) + aa(i,k+1) + aa(i,k)*gam(i,k))
1260 w2(i,k) = (dm2(i,k)*w1(i,k)+dt*(pp(i,k+1)-pp(i,k))-aa(i,k)*w2(i,k-1)) / bet(i)
1265 p1(i) = t1g*gm2(i,km)/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1267 p1(i) = t1g/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1269 gam(i,km) = aa(i,km) / bet(i)
1270 bet(i) = dm2(i,km) - (aa(i,km)+p1(i) + aa(i,km)*gam(i,km))
1271 w2(i,km) = (dm2(i,km)*w1(i,km)+dt*(pp(i,km+1)-pp(i,km))-p1(i)*ws(i)-aa(i,km)*w2(i,km-1))/bet(i)
1275 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1284 pe(i,k+1) = pe(i,k) + dm2(i,k)*(w2(i,k)-w1(i,k))*rdt
1289 p1(i) = ( pe(i,km) + 2.*pe(i,km+1) )*
r3 1291 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp((cp2(i,km)-1.)*log(
max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1293 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1*log(
max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1299 p1(i) = (pe(i,k) + bb(i,k)*pe(i,k+1) + g_rat(i,k)*pe(i,k+2))*
r3 - g_rat(i,k)*p1(i)
1301 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp((cp2(i,k)-1.)*log(
max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1303 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1*log(
max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1310 subroutine sim_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, pe2, dm2, &
1311 pm2, pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
1312 integer,
intent(in):: is, ie, km
1313 real,
intent(in):: dt, rgas, gama, kappa, p_fac, alpha, scale_m
1314 real,
intent(in),
dimension(is:ie,km):: dm2, pt2, pm2, gm2, cp2
1315 real,
intent(in ):: ws(is:ie)
1316 real,
intent(in ),
dimension(is:ie,km+1):: pem
1317 real,
intent(out):: pe2(is:ie,km+1)
1318 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1320 real,
dimension(is:ie,km ):: aa, bb, dd, w1, wk, g_rat, gam
1321 real,
dimension(is:ie,km+1):: pp
1322 real,
dimension(is:ie):: p1, wk1, bet
1323 real beta, t2, t1g, rdt, ra, capa1
1330 t1g = 2.*(alpha*dt)**2
1332 t1g = 2.*gama*(alpha*dt)**2
1342 pe2(i,k) = exp(gm2(i,k)*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1344 pe2(i,k) = exp(gama*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1351 g_rat(i,k) = dm2(i,k)/dm2(i,k+1)
1352 bb(i,k) = 2.*(1.+g_rat(i,k))
1353 dd(i,k) = 3.*(pe2(i,k) + g_rat(i,k)*pe2(i,k+1))
1360 pp(i,2) = dd(i,1) / bet(i)
1362 dd(i,km) = 3.*pe2(i,km)
1367 gam(i,k) = g_rat(i,k-1) / bet(i)
1368 bet(i) = bb(i,k) - gam(i,k)
1369 pp(i,k+1) = (dd(i,k) - pp(i,k) ) / bet(i)
1375 pp(i,k) = pp(i,k) - gam(i,k)*pp(i,k+1)
1382 pe2(i,k) = pem(i,k) + pp(i,k)
1389 aa(i,k) = t1g*0.5*(gm2(i,k-1)+gm2(i,k))/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1391 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1393 wk(i,k) = t2*aa(i,k)*(w1(i,k-1)-w1(i,k))
1394 aa(i,k) = aa(i,k) - scale_m*dm2(i,1)
1399 bet(i) = dm2(i,1) - aa(i,2)
1400 w2(i,1) = (dm2(i,1)*w1(i,1) + dt*pp(i,2) + wk(i,2)) / bet(i)
1405 gam(i,k) = aa(i,k) / bet(i)
1406 bet(i) = dm2(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1407 w2(i,k) = (dm2(i,k)*w1(i,k) + dt*(pp(i,k+1)-pp(i,k)) + wk(i,k+1)-wk(i,k) &
1408 - aa(i,k)*w2(i,k-1)) / bet(i)
1414 wk1(i) = t1g*gm2(i,km)/dz2(i,km)*pe2(i,km+1)
1416 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1418 gam(i,km) = aa(i,km) / bet(i)
1419 bet(i) = dm2(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1420 w2(i,km) = (dm2(i,km)*w1(i,km) + dt*(pp(i,km+1)-pp(i,km)) - wk(i,km) + &
1421 wk1(i)*(t2*w1(i,km)-ra*ws(i)) - aa(i,km)*w2(i,km-1)) / bet(i)
1425 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1434 pe2(i,k+1) = pe2(i,k) + ( dm2(i,k)*(w2(i,k)-w1(i,k))*rdt &
1435 - beta*(pp(i,k+1)-pp(i,k)) ) * ra
1440 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 1442 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp((cp2(i,km)-1.)*log(
max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1444 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1*log(
max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1450 p1(i) = (pe2(i,k)+bb(i,k)*pe2(i,k+1)+g_rat(i,k)*pe2(i,k+2))*
r3 - g_rat(i,k)*p1(i)
1453 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp((cp2(i,k)-1.)*log(
max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1455 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1*log(
max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1462 pe2(i,k) = pe2(i,k) + beta*(pp(i,k)-pe2(i,k))
1471 integer,
intent(in):: i1, i2, km
1472 integer,
intent(in):: id
1473 real,
intent(in ),
dimension(i1:i2,km):: q1
1474 real,
intent(out),
dimension(i1:i2,km+1):: qe
1476 real,
parameter:: r2o3 = 2./3.
1477 real,
parameter:: r4o3 = 4./3.
1488 qe(i,1) = r4o3*q1(i,1) + r2o3*q1(i,2)
1498 gak(k) = 1. / (4. - gak(k-1))
1500 qe(i,k) = (3.*(q1(i,k-1) + q1(i,k)) - qe(i,k-1)) * gak(k)
1504 bet = 1. / (1.5 - 3.5*gak(km))
1506 qe(i,km+1) = (4.*q1(i,km) + q1(i,km-1) - 3.5*qe(i,km)) * bet
1511 qe(i,k) = qe(i,k) - gak(k)*qe(i,k+1)
1519 subroutine edge_profile(q1, q2, q1e, q2e, i1, i2, j1, j2, j, km, dp0, uniform_grid, limiter)
1521 integer,
intent(in):: i1, i2, j1, j2
1522 integer,
intent(in):: j, km
1523 integer,
intent(in):: limiter
1524 logical,
intent(in):: uniform_grid
1525 real,
intent(in):: dp0(km)
1526 real,
intent(in),
dimension(i1:i2,j1:j2,km):: q1, q2
1527 real,
intent(out),
dimension(i1:i2,j1:j2,km+1):: q1e, q2e
1529 real,
dimension(i1:i2,km+1):: qe1, qe2, gam
1531 real bet, r2o3, r4o3
1532 real g0, gk, xt1, xt2, a_bot
1535 if ( uniform_grid )
then 1542 qe1(i,1) = r4o3*q1(i,j,1) + r2o3*q1(i,j,2)
1543 qe2(i,1) = r4o3*q2(i,j,1) + r2o3*q2(i,j,2)
1548 gak(k) = 1. / (4. - gak(k-1))
1550 qe1(i,k) = (3.*(q1(i,j,k-1) + q1(i,j,k)) - qe1(i,k-1)) * gak(k)
1551 qe2(i,k) = (3.*(q2(i,j,k-1) + q2(i,j,k)) - qe2(i,k-1)) * gak(k)
1555 bet = 1. / (1.5 - 3.5*gak(km))
1557 qe1(i,km+1) = (4.*q1(i,j,km) + q1(i,j,km-1) - 3.5*qe1(i,km)) * bet
1558 qe2(i,km+1) = (4.*q2(i,j,km) + q2(i,j,km-1) - 3.5*qe2(i,km)) * bet
1563 qe1(i,k) = qe1(i,k) - gak(k)*qe1(i,k+1)
1564 qe2(i,k) = qe2(i,k) - gak(k)*qe2(i,k+1)
1569 g0 = dp0(2) / dp0(1)
1570 xt1 = 2.*g0*(g0+1. )
1573 qe1(i,1) = ( xt1*q1(i,j,1) + q1(i,j,2) ) / bet
1574 qe2(i,1) = ( xt1*q2(i,j,1) + q2(i,j,2) ) / bet
1575 gam(i,1) = ( 1. + g0*(g0+1.5) ) / bet
1579 gk = dp0(k-1) / dp0(k)
1581 bet = 2. + 2.*gk - gam(i,k-1)
1582 qe1(i,k) = ( 3.*(q1(i,j,k-1)+gk*q1(i,j,k)) - qe1(i,k-1) ) / bet
1583 qe2(i,k) = ( 3.*(q2(i,j,k-1)+gk*q2(i,j,k)) - qe2(i,k-1) ) / bet
1588 a_bot = 1. + gk*(gk+1.5)
1591 xt2 = gk*(gk+0.5) - a_bot*gam(i,km)
1592 qe1(i,km+1) = ( xt1*q1(i,j,km) + q1(i,j,km-1) - a_bot*qe1(i,km) ) / xt2
1593 qe2(i,km+1) = ( xt1*q2(i,j,km) + q2(i,j,km-1) - a_bot*qe2(i,km) ) / xt2
1598 qe1(i,k) = qe1(i,k) - gam(i,k)*qe1(i,k+1)
1599 qe2(i,k) = qe2(i,k) - gam(i,k)*qe2(i,k+1)
1607 if ( limiter/=0 )
then 1610 if ( q1(i,j,1)*qe1(i,1) < 0. ) qe1(i,1) = 0.
1611 if ( q2(i,j,1)*qe2(i,1) < 0. ) qe2(i,1) = 0.
1613 if ( q1(i,j,km)*qe1(i,km+1) < 0. ) qe1(i,km+1) = 0.
1614 if ( q2(i,j,km)*qe2(i,km+1) < 0. ) qe2(i,km+1) = 0.
1620 q1e(i,j,k) = qe1(i,k)
1621 q2e(i,j,k) = qe2(i,k)
1627 subroutine nest_halo_nh(ptop, grav, kappa, cp, delp, delz, pt, phis, &
1635 npx, npy, npz, nested, pkc_pertn, computepk3, fullhalo, bd)
1639 integer,
intent(IN) :: npx, npy, npz
1640 logical,
intent(IN) :: pkc_pertn, computepk3, fullhalo, nested
1641 real,
intent(IN) :: ptop, kappa, cp,
grav 1643 real,
intent(IN) :: phis(bd%isd:bd%ied,bd%jsd:bd%jed)
1644 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: pt, delp, delz
1646 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: q_con
1648 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: cappa
1651 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz+1):: gz, pkc, pk3
1655 real :: ptk, rgrav, rkap, peln1, rdg
1657 real,
dimension(bd%isd:bd%ied, npz+1, bd%jsd:bd%jed ) :: pe, peln
1659 real,
dimension(bd%isd:bd%ied, npz+1 ) :: peg, pelng
1661 real,
dimension(bd%isd:bd%ied, npz) :: gam, bb, dd, pkz
1662 real,
dimension(bd%isd:bd%ied, npz-1) :: g_rat
1663 real,
dimension(bd%isd:bd%ied) :: bet
1666 integer :: ifirst, ilast, jfirst, jlast
1668 integer :: is, ie, js, je
1669 integer :: isd, ied, jsd, jed
1680 if (.not. nested)
return 1690 gama = 1./(1.-kappa)
1694 rdg = -
rdgas * rgrav
1704 gz(i,j,npz+1) = phis(i,j)
1708 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*
grav 1723 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
1724 peln(i,k,j) = log(pe(i,k,j))
1726 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
1727 pelng(i,k) = log(peg(i,k))
1737 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
1739 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*
rdgas*pt(i,j,k)))
1743 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
1745 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
1748 pkz(i,k) = pkz(i,k) - pm
1755 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
1756 bb(i,k) = 2.*(1. + g_rat(i,k))
1757 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
1764 pkc(i,j,2) = dd(i,1)/bet(i)
1766 dd(i,npz) = 3.*pkz(i,npz)
1770 gam(i,k) = g_rat(i,k-1)/bet(i)
1771 bet(i) = bb(i,k) - gam(i,k)
1772 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
1777 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
1779 if (abs(pkc(i,j,k)) > 1.e5)
then 1780 print*, mpp_pe(), i,j,k,
'PKC: ', pkc(i,j,k)
1790 if (.not. pkc_pertn)
then 1793 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
1799 if (computepk3)
then 1805 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
1814 if (ie == npx-1)
then 1820 gz(i,j,npz+1) = phis(i,j)
1824 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*
grav 1839 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
1840 peln(i,k,j) = log(pe(i,k,j))
1842 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
1843 pelng(i,k) = log(peg(i,k))
1853 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
1855 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*
rdgas*pt(i,j,k)))
1859 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
1861 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
1864 pkz(i,k) = pkz(i,k) - pm
1871 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
1872 bb(i,k) = 2.*(1. + g_rat(i,k))
1873 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
1880 pkc(i,j,2) = dd(i,1)/bet(i)
1882 dd(i,npz) = 3.*pkz(i,npz)
1886 gam(i,k) = g_rat(i,k-1)/bet(i)
1887 bet(i) = bb(i,k) - gam(i,k)
1888 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
1893 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
1902 if (.not. pkc_pertn)
then 1905 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
1911 if (computepk3)
then 1917 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
1932 gz(i,j,npz+1) = phis(i,j)
1936 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*
grav 1951 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
1952 peln(i,k,j) = log(pe(i,k,j))
1954 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
1955 pelng(i,k) = log(peg(i,k))
1965 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
1967 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*
rdgas*pt(i,j,k)))
1971 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
1973 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
1976 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
1978 pkz(i,k) = pkz(i,k) - pm
1985 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
1986 bb(i,k) = 2.*(1. + g_rat(i,k))
1987 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
1994 pkc(i,j,2) = dd(i,1)/bet(i)
1996 dd(i,npz) = 3.*pkz(i,npz)
2000 gam(i,k) = g_rat(i,k-1)/bet(i)
2001 bet(i) = bb(i,k) - gam(i,k)
2002 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
2007 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
2009 if (abs(pkc(i,j,k)) > 1.e5)
then 2010 print*, mpp_pe(), i,j,k,
'PKC: ', pkc(i,j,k)
2020 if (.not. pkc_pertn)
then 2023 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
2029 if (computepk3)
then 2035 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
2044 if (je == npy-1)
then 2050 gz(i,j,npz+1) = phis(i,j)
2054 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*
grav 2069 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
2070 peln(i,k,j) = log(pe(i,k,j))
2072 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
2073 pelng(i,k) = log(peg(i,k))
2083 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
2085 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*
rdgas*pt(i,j,k)))
2089 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
2091 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2094 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2096 pkz(i,k) = pkz(i,k) - pm
2104 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
2105 bb(i,k) = 2.*(1. + g_rat(i,k))
2106 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
2113 pkc(i,j,2) = dd(i,1)/bet(i)
2115 dd(i,npz) = 3.*pkz(i,npz)
2119 gam(i,k) = g_rat(i,k-1)/bet(i)
2120 bet(i) = bb(i,k) - gam(i,k)
2121 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
2126 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
2135 if (.not. pkc_pertn)
then 2138 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
2144 if (computepk3)
then 2150 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
subroutine riem_solver3test(ms, dt, is, ie, js, je, km, ng, isd, ied, jsd, jed, akap, cappa, cp, ptop, zs, q_con, w, delz, pt, delp, zh, pe, ppe, pk3, pk, peln, ws, scale_m, p_fac, a_imp, use_logp, last_call, fp_out)
subroutine, public sim_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, pe2, dm2, pm2, pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
subroutine, public nest_halo_nh(ptop, grav, kappa, cp, delp, delz, pt, phis, pkc, gz, pk3, npx, npy, npz, nested, pkc_pertn, computepk3, fullhalo, bd)
subroutine edge_profile(q1, q2, q1e, q2e, i1, i2, j1, j2, j, km, dp0, uniform_grid, limiter)
subroutine, public sim1_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, pe, dm2, pm2, pem, w2, dz2, pt2, ws, p_fac)
real, parameter, public rdgas
Gas constant for dry air [J/kg/deg].
subroutine, public del6_vt_flux(nord, npx, npy, damp, q, d2, fx2, fy2, gridstruct, bd)
subroutine, public rim_2d(ms, bdt, is, ie, km, rgas, gama, gm2, pe2, dm2, pm2, w2, dz2, pt2, ws, c_core)
subroutine edge_scalar(q1, qe, i1, i2, km, id)
subroutine, public riem_solver_c(ms, dt, is, ie, js, je, km, ng, akap, cappa, cp, ptop, hs, w3, pt, q_con, delp, gz, pef, ws, p_fac, a_imp, scale_m)
subroutine, public update_dz_c(is, ie, js, je, km, ng, dt, dp0, zs, area, ut, vt, gz, ws, npx, npy, sw_corner, se_corner, ne_corner, nw_corner, bd, grid_type)
real, parameter, public cp_air
Specific heat capacity of dry air at constant pressure [J/kg/deg].
subroutine, public sim3p0_solver(dt, is, ie, km, rgas, gama, kappa, pe2, dm, pem, w2, dz2, pt2, ws, p_fac, scale_m)
subroutine, public fill_4corners(q, dir, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
subroutine imp_diff_w(j, is, ie, js, je, ng, km, cd, delz, ws, w, w3)
subroutine, public sim3_solver(dt, is, ie, km, rgas, gama, kappa, pe2, dm, pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
real, parameter, public grav
Acceleration due to gravity [m/s^2].
subroutine, public update_dz_d(ndif, damp, hord, is, ie, js, je, km, ng, npx, npy, area, rarea, dp0, zs, zh, crx, cry, xfx, yfx, delz, ws, rdt, gridstruct, bd)
subroutine, public fv_tp_2d(q, crx, cry, npx, npy, hord, fx, fy, xfx, yfx, gridstruct, bd, ra_x, ra_y, mfx, mfy, mass, nord, damp_c)
Derived type containing the data.