53 use constants_mod,
only: rdgas, cp_air, grav
70 real,
parameter::
r3 = 1./3.
74 subroutine update_dz_c(is, ie, js, je, km, ng, dt, dp0, zs, area, ut, vt, gz, ws, &
75 npx, npy, sw_corner, se_corner, ne_corner, nw_corner, bd, grid_type)
78 integer,
intent(in):: is, ie, js, je, ng, km, npx, npy, grid_type
79 logical,
intent(IN):: sw_corner, se_corner, ne_corner, nw_corner
81 real,
intent(in):: dp0(km)
82 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: ut, vt
83 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng):: area
84 real,
intent(inout):: gz(is-ng:ie+ng,js-ng:je+ng,km+1)
85 real,
intent(in ):: zs(is-ng:ie+ng, js-ng:je+ng)
86 real,
intent( out):: ws(is-ng:ie+ng, js-ng:je+ng)
88 real:: gz2(is-ng:ie+ng,js-ng:je+ng)
89 real,
dimension(is-1:ie+2,js-1:je+1):: xfx, fx
90 real,
dimension(is-1:ie+1,js-1:je+2):: yfx, fy
91 real,
parameter:: r14 = 1./14.
93 integer:: is1, ie1, js1, je1
95 real:: rdt, top_ratio, bot_ratio, int_ratio
100 top_ratio = dp0(1 ) / (dp0( 1)+dp0(2 ))
101 bot_ratio = dp0(km) / (dp0(km-1)+dp0(km))
122 xfx(i,j) = ut(i,j,1) + (ut(i,j,1)-ut(i,j,2))*top_ratio
127 yfx(i,j) = vt(i,j,1) + (vt(i,j,1)-vt(i,j,2))*top_ratio
130 elseif ( k==km+1 )
then 134 xfx(i,j) = ut(i,j,km) + (ut(i,j,km)-ut(i,j,km-1))*bot_ratio
141 yfx(i,j) = vt(i,j,km) + (vt(i,j,km)-vt(i,j,km-1))*bot_ratio
147 int_ratio = 1./(dp0(k-1)+dp0(k))
150 xfx(i,j) = (dp0(k)*ut(i,j,k-1)+dp0(k-1)*ut(i,j,k))*int_ratio
155 yfx(i,j) = (dp0(k)*vt(i,j,k-1)+dp0(k-1)*vt(i,j,k))*int_ratio
166 if (grid_type < 3)
call fill_4corners(gz2, 1, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
169 if( xfx(i,j) > 0. )
then 174 fx(i,j) = xfx(i,j)*fx(i,j)
178 if (grid_type < 3)
call fill_4corners(gz2, 2, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
181 if( yfx(i,j) > 0. )
then 186 fy(i,j) = yfx(i,j)*fy(i,j)
192 gz(i,j,k) = (gz2(i,j)*area(i,j) + fx(i,j)- fx(i+1,j)+ fy(i,j)- fy(i,j+1)) &
193 / ( area(i,j) + xfx(i,j)-xfx(i+1,j)+yfx(i,j)-yfx(i,j+1))
202 ws(i,j) = ( zs(i,j) - gz(i,j,km+1) ) * rdt
206 gz(i,j,k) = max( gz(i,j,k), gz(i,j,k+1) +
dz_min )
214 subroutine update_dz_d(ndif, damp, hord, is, ie, js, je, km, ng, npx, npy, area, rarea, &
215 dp0, zs, zh, crx, cry, xfx, yfx, delz, ws, rdt, gridstruct, bd, lim_fac, regional)
218 integer,
intent(in):: is, ie, js, je, ng, km, npx, npy
219 integer,
intent(in):: hord
220 real,
intent(in) :: rdt
221 real,
intent(in) :: dp0(km)
222 real,
intent(in) :: area(is-ng:ie+ng,js-ng:je+ng)
223 real,
intent(in) :: rarea(is-ng:ie+ng,js-ng:je+ng)
224 real,
intent(inout):: damp(km+1)
225 integer,
intent(inout):: ndif(km+1)
226 real,
intent(in ) :: zs(is-ng:ie+ng,js-ng:je+ng)
227 real,
intent(inout) :: zh(is-ng:ie+ng,js-ng:je+ng,km+1)
228 real,
intent( out) ::delz(is-ng:ie+ng,js-ng:je+ng,km)
229 real,
intent(inout),
dimension(is:ie+1,js-ng:je+ng,km):: crx, xfx
230 real,
intent(inout),
dimension(is-ng:ie+ng,js:je+1,km):: cry, yfx
231 real,
intent(out) :: ws(is:ie,js:je)
233 real,
intent(in) :: lim_fac
234 logical,
intent(in) :: regional
237 real,
dimension(is: ie+1, js-ng:je+ng,km+1):: crx_adv, xfx_adv
238 real,
dimension(is-ng:ie+ng,js: je+1,km+1 ):: cry_adv, yfx_adv
239 real,
dimension(is:ie+1,js:je ):: fx
240 real,
dimension(is:ie ,js:je+1):: fy
241 real,
dimension(is-ng:ie+ng+1,js-ng:je+ng ):: fx2
242 real,
dimension(is-ng:ie+ng ,js-ng:je+ng+1):: fy2
243 real,
dimension(is-ng:ie+ng ,js-ng:je+ng ):: wk2, z2
244 real:: ra_x(is:ie,js-ng:je+ng)
245 real:: ra_y(is-ng:ie+ng,js:je)
247 integer i, j, k, isd, ied, jsd, jed
248 logical:: uniform_grid
250 uniform_grid = .false.
252 damp(km+1) = damp(km)
253 ndif(km+1) = ndif(km)
255 isd = is - ng; ied = ie + ng
256 jsd = js - ng; jed = je + ng
261 call edge_profile(crx, xfx, crx_adv, xfx_adv, is, ie+1, jsd, jed, j, km, &
262 dp0, uniform_grid, 0)
263 if ( j<=je+1 .and. j>=js ) &
264 call edge_profile(cry, yfx, cry_adv, yfx_adv, isd, ied, js, je+1, j, km, &
265 dp0, uniform_grid, 0)
276 ra_x(i,j) = area(i,j) + xfx_adv(i,j,k) - xfx_adv(i+1,j,k)
281 ra_y(i,j) = area(i,j) + yfx_adv(i,j,k) - yfx_adv(i,j+1,k)
285 if ( damp(k)>1.e-5 )
then 291 call fv_tp_2d(z2, crx_adv(is,jsd,k), cry_adv(isd,js,k), npx, npy, hord, &
292 fx, fy, xfx_adv(is,jsd,k), yfx_adv(isd,js,k), gridstruct, bd, ra_x, ra_y, lim_fac, regional)
293 call del6_vt_flux(ndif(k), npx, npy, damp(k), z2, wk2, fx2, fy2, gridstruct, bd)
296 zh(i,j,k) = (z2(i,j)*area(i,j)+fx(i,j)-fx(i+1,j)+fy(i,j)-fy(i,j+1)) &
297 / (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)
301 call fv_tp_2d(zh(isd,jsd,k), crx_adv(is,jsd,k), cry_adv(isd,js,k), npx, npy, hord, &
302 fx, fy, xfx_adv(is,jsd,k), yfx_adv(isd,js,k), gridstruct, bd, ra_x, ra_y, lim_fac, regional)
305 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)) &
306 / (ra_x(i,j) + ra_y(i,j) - area(i,j))
318 ws(i,j) = ( zs(i,j) - zh(i,j,km+1) ) * rdt
323 zh(i,j,k) = max( zh(i,j,k), zh(i,j,k+1) +
dz_min )
336 ptop, hs, w3, pt, q_con, &
337 delp, gz, pef, ws, p_fac, a_imp, scale_m)
339 integer,
intent(in):: is, ie, js, je, ng, km
340 integer,
intent(in):: ms
341 real,
intent(in):: dt, akap, cp, ptop, p_fac, a_imp, scale_m
342 real,
intent(in):: ws(is-ng:ie+ng,js-ng:je+ng)
343 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, delp
344 real,
intent(in),
dimension(is-ng:,js-ng:,1:):: q_con, cappa
346 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: kapad
348 real,
intent(in):: hs(is-ng:ie+ng,js-ng:je+ng)
349 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: w3
351 real,
intent(inout),
dimension(is-ng:ie+ng,js-ng:je+ng,km+1):: gz
352 real,
intent( out),
dimension(is-ng:ie+ng,js-ng:je+ng,km+1):: pef
354 real,
dimension(is-1:ie+1,km ):: dm, dz2, w2, pm2, gm2, cp2
355 real,
dimension(is-1:ie+1,km+1):: pem, pe2, peg
357 real,
dimension(is-1:ie+1,km ):: kapad2
381 dm(i,k) = delp(i,j,k)
395 pem(i,k) = pem(i,k-1) + dm(i,k-1)
398 peg(i,k) = peg(i,k-1) + dm(i,k-1)*(1.-q_con(i,j,k-1))
405 dz2(i,k) = gz(i,j,k+1) - gz(i,j,k)
407 pm2(i,k) = (peg(i,k+1)-peg(i,k))/log(peg(i,k+1)/peg(i,k))
410 cp2(i,k) = cappa(i,j,k)
411 gm2(i,k) = 1. / (1.-cp2(i,k))
415 pm2(i,k) = dm(i,k)/log(pem(i,k+1)/pem(i,k))
418 kapad2(i,k) = kapad(i,j,k)
420 dm(i,k) = dm(i,k) * rgrav
426 if ( a_imp < -0.01 )
then 432 pem, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), p_fac, scale_m)
433 elseif ( a_imp <= 0.5 )
then 434 call rim_2d(ms, dt, is1, ie1, km, rdgas, gama, gm2, &
439 dm, pm2, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), .true.)
441 call sim1_solver(dt, is1, ie1, km, rdgas, gama, gm2, cp2, akap, &
446 dm, pm2, pem, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), p_fac)
452 pef(i,j,k) = pe2(i,k) + pem(i,k)
458 gz(i,j,km+1) = hs(i,j)
463 gz(i,j,k) = gz(i,j,k+1) - dz2(i,k)*grav
475 isd, ied, jsd, jed, akap, cappa, cp, &
479 ptop, zs, q_con, w, delz, pt, &
480 delp, zh, pe, ppe, pk3, pk, peln, &
481 ws, scale_m, p_fac, a_imp, &
482 use_logp, last_call, fp_out)
489 integer,
intent(in):: ms, is, ie, js, je, km, ng
490 integer,
intent(in):: isd, ied, jsd, jed
491 real,
intent(in):: dt
492 real,
intent(in):: akap, cp, ptop, p_fac, a_imp, scale_m
493 real,
intent(in):: zs(isd:ied,jsd:jed)
494 logical,
intent(in):: last_call, use_logp, fp_out
495 real,
intent(in):: ws(is:ie,js:je)
496 real,
intent(in),
dimension(isd:,jsd:,1:):: q_con, cappa
497 real,
intent(in),
dimension(isd:ied,jsd:jed,km):: delp, pt
499 real,
intent(in),
dimension(isd:ied,jsd:jed,km):: kapad
501 real,
intent(inout),
dimension(isd:ied,jsd:jed,km+1):: zh
502 real,
intent(inout),
dimension(isd:ied,jsd:jed,km):: w
503 real,
intent(inout):: pe(is-1:ie+1,km+1,js-1:je+1)
504 real,
intent(out):: peln(is:ie,km+1,js:je)
505 real,
intent(out),
dimension(isd:ied,jsd:jed,km+1):: ppe
506 real,
intent(out):: delz(is-ng:ie+ng,js-ng:je+ng,km)
507 real,
intent(out):: pk(is:ie,js:je,km+1)
508 real,
intent(out):: pk3(isd:ied,jsd:jed,km+1)
510 real,
dimension(is:ie,km):: dm, dz2, pm2, w2, gm2, cp2
511 real,
dimension(is:ie,km+1)::pem, pe2, peln2, peg, pelng
513 real,
dimension(is:ie,km):: kapad2
515 real gama, rgrav, ptk, peln1
521 ptk = exp(akap*peln1)
536 dm(i,k) = delp(i,j,k)
538 cp2(i,k) = cappa(i,j,k)
541 kapad2(i,k) = kapad(i,j,k)
557 pem(i,k) = pem(i,k-1) + dm(i,k-1)
558 peln2(i,k) = log(pem(i,k))
562 peg(i,k) = peg(i,k-1) + dm(i,k-1)*(1.-q_con(i,j,k-1))
563 pelng(i,k) = log(peg(i,k))
565 pk3(i,j,k) = exp(akap*peln2(i,k))
572 pm2(i,k) = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
575 gm2(i,k) = 1. / (1.-cp2(i,k))
579 pm2(i,k) = dm(i,k)/(peln2(i,k+1)-peln2(i,k))
581 dm(i,k) = dm(i,k) * rgrav
582 dz2(i,k) = zh(i,j,k+1) - zh(i,j,k)
588 if ( a_imp < -0.999 )
then 594 pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), p_fac, scale_m )
595 elseif ( a_imp < -0.5 )
then 596 call sim3_solver(dt, is, ie, km, rdgas, gama, akap, &
601 pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), abs(a_imp), p_fac, scale_m)
602 elseif ( a_imp <= 0.5 )
then 603 call rim_2d(ms, dt, is, ie, km, rdgas, gama, gm2, &
608 dm, pm2, w2, dz2, pt(is:ie,j,1:km), ws(is,j), .false.)
609 elseif ( a_imp > 0.999 )
then 610 call sim1_solver(dt, is, ie, km, rdgas, gama, gm2, cp2, akap, &
615 pm2, pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), p_fac)
617 call sim_solver(dt, is, ie, km, rdgas, gama, gm2, cp2, akap, &
622 pm2, pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), &
623 a_imp, p_fac, scale_m)
630 delz(i,j,k) = dz2(i,k)
634 if ( last_call )
then 637 peln(i,k,j) = peln2(i,k)
638 pk(i,j,k) = pk3(i,j,k)
647 ppe(i,j,k) = pe2(i,k) + pem(i,k)
653 ppe(i,j,k) = pe2(i,k)
661 pk3(i,j,k) = peln2(i,k)
667 zh(i,j,km+1) = zs(i,j)
671 zh(i,j,k) = zh(i,j,k+1) - dz2(i,k)
679 subroutine imp_diff_w(j, is, ie, js, je, ng, km, cd, delz, ws, w, w3)
680 integer,
intent(in) :: j, is, ie, js, je, km, ng
681 real,
intent(in) :: cd
682 real,
intent(in) :: delz(is-ng:ie+ng, km)
683 real,
intent(in) :: w(is:ie, km)
684 real,
intent(in) :: ws(is:ie)
685 real,
intent(out) :: w3(is-ng:ie+ng,js-ng:je+ng,km)
687 real,
dimension(is:ie,km):: c, gam, dz, wt
694 dz(i,k) = 0.5*(delz(i,k-1)+delz(i,k))
699 c(i,k) = -cd/(dz(i,k+1)*delz(i,k))
706 wt(i,1) = w(i,1) / bet(i)
712 gam(i,k) = c(i,k-1)/bet(i)
713 a = cd/(dz(i,k)*delz(i,k))
714 bet(i) = (1.+a-c(i,k)) + a*gam(i,k)
715 wt(i,k) = (w(i,k) + a*wt(i,k-1)) / bet(i)
721 gam(i,km) = c(i,km-1) / bet(i)
722 a = cd/(dz(i,km)*delz(i,km))
723 wt(i,km) = (w(i,km) + 2.*ws(i)*cd/delz(i,km)**2 &
724 + a*wt(i,km-1))/(1. + a + (cd+cd)/delz(i,km)**2 + a*gam(i,km))
729 wt(i,k) = wt(i,k) - gam(i,k+1)*wt(i,k+1)
742 subroutine rim_2d(ms, bdt, is, ie, km, rgas, gama, gm2, &
746 pe2, dm2, pm2, w2, dz2, pt2, ws, c_core )
748 integer,
intent(in):: ms, is, ie, km
749 real,
intent(in):: bdt, gama, rgas
750 real,
intent(in),
dimension(is:ie,km):: dm2, pm2, gm2
751 logical,
intent(in):: c_core
752 real,
intent(in ) :: pt2(is:ie,km)
753 real,
intent(in ) :: ws(is:ie)
755 real,
intent(inout):: dz2(is:ie,km)
756 real,
intent(inout):: w2(is:ie,km)
757 real,
intent(out ):: pe2(is:ie,km+1)
759 real,
intent(inout),
dimension(is:ie,km):: kapad2
763 real,
dimension(km+1):: m_bot, m_top, r_bot, r_top, pe1, pbar, wbar
764 real,
dimension(km):: r_hi, r_lo, dz, wm, dm, dts
765 real,
dimension(km):: pf1, wc, cm , pp, pt1
766 real:: dt, rdt, grg, z_frac, ptmp1, rden, pf, time_left
771 integer:: i, k, n, ke, kt1, ktop
790 wm(k) = w2(i,k)*dm(k)
798 if ( ms > 1 .and. ms < 8 )
then 801 rden = -rgas*dm(k)/dz(k)
803 pf1(k) = exp( gm2(i,k)*log(rden*pt1(k)) )
805 dts(k) = -dz(k)/sqrt(grg*pf1(k)/rden)
808 gamax = 1./(1.-kapad2(i,k))
809 pf1(k) = exp( gamax*log(rden*pt1(k)) )
811 pf1(k) = exp( gama*log(rden*pt1(k)) )
813 dts(k) = -dz(k)/sqrt(grg*pf1(k)/rden)
815 if ( bdt > dts(k) )
then 821 222
if ( ks0==1 )
goto 244
824 cm(k) = dm(k) / dts(k)
825 wc(k) = wm(k) / dts(k)
826 pp(k) = pf1(k) - pm2(i,k)
829 wbar(1) = (wc(1)+pp(1)) / cm(1)
831 wbar(k) = (wc(k-1)+wc(k) + pp(k)-pp(k-1)) / (cm(k-1)+cm(k))
832 pbar(k) = bdt*(cm(k-1)*wbar(k) - wc(k-1) + pp(k-1))
836 if ( ks0 == km )
then 837 pbar(km+1) = bdt*(cm(km)*wbar(km+1) - wc(km) + pp(km))
840 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
844 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
845 w2(i,k) = (wm(k)+pbar(k+1)-pbar(k))/dm(k)
850 pe2(i,k) = pbar(k)*rdt
856 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
860 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
861 w2(i,k) = (wm(k)+pbar(k+1)-pbar(k))/dm(k)
864 pbar(ks0) = pbar(ks0) /
real(ms)
872 rden = -rgas*dm(k)/dz(k)
874 pf = exp( gm2(i,k)*log(rden*pt1(k)) )
876 dts(k) = -dz(k) / sqrt( grg*pf/rden )
879 gamax = 1./(1.-kapad2(i,k))
880 pf = exp( gamax*log(rden*pt1(k)) )
882 pf = exp( gama*log(rden*pt1(k)) )
884 dts(k) = -dz(k) / sqrt( grg*pf/rden )
886 ptmp1 = dts(k)*(pf - pm2(i,k))
887 r_lo(k) = wm(k) + ptmp1
888 r_hi(k) = wm(k) - ptmp1
893 if( dt > dts(k) )
then 901 if ( ktop >= ks1 )
then 904 r_bot(k ) = z_frac*r_lo(k)
905 r_top(k+1) = z_frac*r_hi(k)
906 m_bot(k ) = z_frac* dm(k)
907 m_top(k+1) = m_bot(k)
909 if ( ktop == km )
goto 666
918 do 444 ke=km+1, ktop+2, -1
921 if ( time_left > dts(k) )
then 922 time_left = time_left - dts(k)
923 m_top(ke) = m_top(ke) + dm(k)
924 r_top(ke) = r_top(ke) + r_hi(k)
926 z_frac = time_left/dts(k)
927 m_top(ke) = m_top(ke) + z_frac*dm(k)
928 r_top(ke) = r_top(ke) + z_frac*r_hi(k)
939 do 4000 ke=ktop+1, km
942 if ( time_left > dts(k) )
then 943 time_left = time_left - dts(k)
944 m_bot(ke) = m_bot(ke) + dm(k)
945 r_bot(ke) = r_bot(ke) + r_lo(k)
947 z_frac = time_left/dts(k)
948 m_bot(ke) = m_bot(ke) + z_frac* dm(k)
949 r_bot(ke) = r_bot(ke) + z_frac*r_lo(k)
955 if ( time_left > dts(k) )
then 956 time_left = time_left - dts(k)
957 m_bot(ke) = m_bot(ke) + dm(k)
958 r_bot(ke) = r_bot(ke) - r_hi(k)
960 z_frac = time_left/dts(k)
961 m_bot(ke) = m_bot(ke) + z_frac* dm(k)
962 r_bot(ke) = r_bot(ke) - z_frac*r_hi(k) + (m_bot(ke)-m_surf)*ws2(i)
968 666
if ( ks1==1 ) wbar(1) = r_bot(1) / m_bot(1)
970 wbar(k) = (r_bot(k)+r_top(k)) / (m_top(k)+m_bot(k))
974 pbar(k) = m_top(k)*wbar(k) - r_top(k)
975 pe1(k) = pe1(k) + pbar(k)
981 dz2(i,k) = dz(k) + dt*(wbar(k+1)-wbar(k))
985 dz2(i,k) = dz(k) + dt*(wbar(k+1)-wbar(k))
986 w2(i,k) = ( wm(k) + pbar(k+1) - pbar(k) ) / dm(k)
991 dz(k) = dz(k) + dt*(wbar(k+1)-wbar(k))
992 wm(k) = wm(k) + pbar(k+1) - pbar(k)
999 pe2(i,k) = pe1(k)*rdt
1006 subroutine sim3_solver(dt, is, ie, km, rgas, gama, kappa, &
1011 pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
1012 integer,
intent(in):: is, ie, km
1013 real,
intent(in):: dt, rgas, gama, kappa, alpha, p_fac, scale_m
1014 real,
intent(in ),
dimension(is:ie,km):: dm, pt2
1015 real,
intent(in ):: ws(is:ie)
1016 real,
intent(in ),
dimension(is:ie,km+1):: pem
1017 real,
intent(out):: pe2(is:ie,km+1)
1018 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1020 real,
intent(inout),
dimension(is:ie,km):: kapad2
1023 real,
dimension(is:ie,km ):: aa, bb, dd, w1, wk, g_rat, gam
1024 real,
dimension(is:ie,km+1):: pp
1025 real,
dimension(is:ie):: p1, wk1, bet
1026 real beta, t2, t1g, rdt, ra, capa1, r2g, r6g
1028 real gamax, capa1x, t1gx
1035 t1g = gama * 2.*(alpha*dt)**2
1047 gamax = 1. / (1.-kapad2(i,k))
1048 aa(i,k) = exp(gamax*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1050 aa(i,k) = exp(gama*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1057 g_rat(i,k) = dm(i,k)/dm(i,k+1)
1058 bb(i,k) = 2.*(1.+g_rat(i,k))
1059 dd(i,k) = 3.*(aa(i,k) + g_rat(i,k)*aa(i,k+1))
1068 pe2(i,2) = (dd(i,1)-pem(i,1)) / bet(i)
1071 dd(i,km) = 3.*aa(i,km) + r2g*dm(i,km)
1076 gam(i,k) = g_rat(i,k-1) / bet(i)
1077 bet(i) = bb(i,k) - gam(i,k)
1078 pe2(i,k+1) = (dd(i,k) - pe2(i,k) ) / bet(i)
1084 pe2(i,k) = pe2(i,k) - gam(i,k)*pe2(i,k+1)
1092 pp(i,k) = pe2(i,k) - pem(i,k)
1099 gamax = 1./(1.-kapad2(i,k))
1100 t1gx = gamax*2.*(alpha*dt)**2
1101 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1103 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1105 wk(i,k) = t2*aa(i,k)*(w1(i,k-1)-w1(i,k))
1106 aa(i,k) = aa(i,k) - scale_m*dm(i,1)
1110 bet(i) = dm(i,1) - aa(i,2)
1111 w2(i,1) = (dm(i,1)*w1(i,1)+dt*pp(i,2) + wk(i,2)) / bet(i)
1115 gam(i,k) = aa(i,k) / bet(i)
1116 bet(i) = dm(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1117 w2(i,k) = (dm(i,k)*w1(i,k)+dt*(pp(i,k+1)-pp(i,k)) + wk(i,k+1)-wk(i,k) &
1118 - aa(i,k)*w2(i,k-1)) / bet(i)
1123 gamax = 1./(1.-kapad2(i,km))
1124 t1gx = gamax*2.*(alpha*dt)**2
1125 wk1(i) = t1gx/dz2(i,km)*pe2(i,km+1)
1127 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1129 gam(i,km) = aa(i,km) / bet(i)
1130 bet(i) = dm(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1131 w2(i,km) = (dm(i,km)*w1(i,km)+dt*(pp(i,km+1)-pp(i,km))-wk(i,km) + &
1132 wk1(i)*(t2*w1(i,km)-ra*ws(i)) - aa(i,km)*w2(i,km-1)) / bet(i)
1136 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1146 pe2(i,k+1) = pe2(i,k) + ( dm(i,k)*(w2(i,k)-w1(i,k))*rdt &
1147 - beta*(pp(i,k+1)-pp(i,k)) )*ra
1157 pe2(i,k) = max(p_fac*pem(i,k), pe2(i,k)+pem(i,k))
1163 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 - r6g*dm(i,km)
1165 capa1x = kapad2(i,km) - 1.
1166 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1x*log(p1(i)) )
1168 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1*log(p1(i)) )
1174 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)
1176 capa1x = kapad2(i,k) - 1.
1177 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1x*log(p1(i)) )
1179 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1*log(p1(i)) )
1186 pe2(i,k) = pe2(i,k) - pem(i,k)
1187 pe2(i,k) = pe2(i,k) + beta*(pp(i,k) - pe2(i,k))
1193 subroutine sim3p0_solver(dt, is, ie, km, rgas, gama, kappa, &
1198 pem, w2, dz2, pt2, ws, p_fac, scale_m)
1200 integer,
intent(in):: is, ie, km
1201 real,
intent(in):: dt, rgas, gama, kappa, p_fac, scale_m
1202 real,
intent(in ),
dimension(is:ie,km):: dm, pt2
1203 real,
intent(in ):: ws(is:ie)
1204 real,
intent(in ):: pem(is:ie,km+1)
1205 real,
intent(out):: pe2(is:ie,km+1)
1206 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1208 real,
intent(inout),
dimension(is:ie,km):: kapad2
1211 real,
dimension(is:ie,km ):: aa, bb, dd, w1, g_rat, gam
1212 real,
dimension(is:ie,km+1):: pp
1213 real,
dimension(is:ie):: p1, wk1, bet
1214 real t1g, rdt, capa1, r2g, r6g
1216 real gamax, capa1x, t1gx
1231 gamax = 1. / ( 1. - kapad2(i,k) )
1232 aa(i,k) = exp(gamax*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1234 aa(i,k) = exp(gama*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1241 g_rat(i,k) = dm(i,k)/dm(i,k+1)
1242 bb(i,k) = 2.*(1.+g_rat(i,k))
1243 dd(i,k) = 3.*(aa(i,k) + g_rat(i,k)*aa(i,k+1))
1252 pe2(i,2) = (dd(i,1)-pem(i,1)) / bet(i)
1255 dd(i,km) = 3.*aa(i,km) + r2g*dm(i,km)
1260 gam(i,k) = g_rat(i,k-1) / bet(i)
1261 bet(i) = bb(i,k) - gam(i,k)
1262 pe2(i,k+1) = (dd(i,k) - pe2(i,k) ) / bet(i)
1268 pe2(i,k) = pe2(i,k) - gam(i,k)*pe2(i,k+1)
1276 pp(i,k) = pe2(i,k) - pem(i,k)
1283 gamax = 1. / (1.-kapad2(i,k))
1284 t1gx = 2.*gamax*dt**2
1285 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k))*pe2(i,k) - scale_m*dm(i,1)
1287 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k) - scale_m*dm(i,1)
1292 bet(i) = dm(i,1) - aa(i,2)
1293 w2(i,1) = (dm(i,1)*w1(i,1)+dt*pp(i,2)) / bet(i)
1297 gam(i,k) = aa(i,k) / bet(i)
1298 bet(i) = dm(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1299 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)
1304 gamax = 1. / (1.-kapad2(i,km))
1305 t1gx = 2.*gamax*dt**2
1306 wk1(i) = t1gx/dz2(i,km)*pe2(i,km+1)
1308 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1310 gam(i,km) = aa(i,km) / bet(i)
1311 bet(i) = dm(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1312 w2(i,km) = (dm(i,km)*w1(i,km)+dt*(pp(i,km+1)-pp(i,km))-wk1(i)*ws(i) - &
1313 aa(i,km)*w2(i,km-1)) / bet(i)
1317 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1327 pe2(i,k+1) = pe2(i,k) + dm(i,k)*(w2(i,k)-w1(i,k))*rdt
1337 pe2(i,k) = max(p_fac*pem(i,k), pe2(i,k)+pem(i,k))
1343 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 - r6g*dm(i,km)
1345 capa1x = kapad2(i,km) - 1.
1346 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1x*log(p1(i)) )
1348 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1*log(p1(i)) )
1354 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)
1356 capa1x = kapad2(i,k) - 1.
1357 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1x*log(p1(i)) )
1359 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1*log(p1(i)) )
1366 pe2(i,k) = pe2(i,k) - pem(i,k)
1373 subroutine sim1_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, &
1378 pm2, pem, w2, dz2, pt2, ws, p_fac)
1379 integer,
intent(in):: is, ie, km
1380 real,
intent(in):: dt, rgas, gama, kappa, p_fac
1381 real,
intent(in),
dimension(is:ie,km):: dm2, pt2, pm2, gm2, cp2
1382 real,
intent(in ):: ws(is:ie)
1383 real,
intent(in ),
dimension(is:ie,km+1):: pem
1384 real,
intent(out):: pe(is:ie,km+1)
1385 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1387 real,
intent(inout),
dimension(is:ie,km):: kapad2
1390 real,
dimension(is:ie,km ):: aa, bb, dd, w1, g_rat, gam
1391 real,
dimension(is:ie,km+1):: pp
1392 real,
dimension(is:ie):: p1, bet
1393 real t1g, rdt, capa1
1395 real gamax, capa1x, t1gx
1402 t1g = gama * 2.*dt*dt
1410 pe(i,k) = exp(gm2(i,k)*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1413 gamax = 1. / ( 1. - kapad2(i,k) )
1414 pe(i,k) = exp(gamax*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1416 pe(i,k) = exp(gama*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1425 g_rat(i,k) = dm2(i,k)/dm2(i,k+1)
1426 bb(i,k) = 2.*(1.+g_rat(i,k))
1427 dd(i,k) = 3.*(pe(i,k) + g_rat(i,k)*pe(i,k+1))
1434 pp(i,2) = dd(i,1) / bet(i)
1436 dd(i,km) = 3.*pe(i,km)
1441 gam(i,k) = g_rat(i,k-1) / bet(i)
1442 bet(i) = bb(i,k) - gam(i,k)
1443 pp(i,k+1) = (dd(i,k) - pp(i,k) ) / bet(i)
1449 pp(i,k) = pp(i,k) - gam(i,k)*pp(i,k+1)
1457 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))
1460 gamax = 1./(1.-kapad2(i,k))
1461 t1gx = gamax * 2.*dt*dt
1462 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k)) * (pem(i,k)+pp(i,k))
1464 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k)) * (pem(i,k)+pp(i,k))
1470 bet(i) = dm2(i,1) - aa(i,2)
1471 w2(i,1) = (dm2(i,1)*w1(i,1) + dt*pp(i,2)) / bet(i)
1475 gam(i,k) = aa(i,k) / bet(i)
1476 bet(i) = dm2(i,k) - (aa(i,k) + aa(i,k+1) + aa(i,k)*gam(i,k))
1477 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)
1482 p1(i) = t1g*gm2(i,km)/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1485 gamax = 1./(1.-kapad2(i,km))
1486 t1gx = gamax * 2.*dt*dt
1487 p1(i) = t1gx/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1489 p1(i) = t1g/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1492 gam(i,km) = aa(i,km) / bet(i)
1493 bet(i) = dm2(i,km) - (aa(i,km)+p1(i) + aa(i,km)*gam(i,km))
1494 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)
1498 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1507 pe(i,k+1) = pe(i,k) + dm2(i,k)*(w2(i,k)-w1(i,k))*rdt
1512 p1(i) = ( pe(i,km) + 2.*pe(i,km+1) )*
r3 1514 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))))
1517 capa1x = kapad2(i,km)-1.
1518 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1x*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1520 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1527 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)
1529 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))))
1533 capa1x = kapad2(i,k)-1.
1534 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1x*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1536 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1544 subroutine sim_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, &
1549 pm2, pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
1550 integer,
intent(in):: is, ie, km
1551 real,
intent(in):: dt, rgas, gama, kappa, p_fac, alpha, scale_m
1552 real,
intent(in),
dimension(is:ie,km):: dm2, pt2, pm2, gm2, cp2
1553 real,
intent(in ):: ws(is:ie)
1554 real,
intent(in ),
dimension(is:ie,km+1):: pem
1555 real,
intent(out):: pe2(is:ie,km+1)
1556 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1558 real,
intent(inout),
dimension(is:ie,km):: kapad2
1561 real,
dimension(is:ie,km ):: aa, bb, dd, w1, wk, g_rat, gam
1562 real,
dimension(is:ie,km+1):: pp
1563 real,
dimension(is:ie):: p1, wk1, bet
1564 real beta, t2, t1g, rdt, ra, capa1
1566 real gamax, capa1x, t1gx
1574 t1g = 2.*(alpha*dt)**2
1576 t1g = 2.*gama*(alpha*dt)**2
1586 pe2(i,k) = exp(gm2(i,k)*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1589 gamax = 1./(1.-kapad2(i,k))
1590 pe2(i,k) = exp(gamax*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1592 pe2(i,k) = exp(gama*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1600 g_rat(i,k) = dm2(i,k)/dm2(i,k+1)
1601 bb(i,k) = 2.*(1.+g_rat(i,k))
1602 dd(i,k) = 3.*(pe2(i,k) + g_rat(i,k)*pe2(i,k+1))
1609 pp(i,2) = dd(i,1) / bet(i)
1611 dd(i,km) = 3.*pe2(i,km)
1616 gam(i,k) = g_rat(i,k-1) / bet(i)
1617 bet(i) = bb(i,k) - gam(i,k)
1618 pp(i,k+1) = (dd(i,k) - pp(i,k) ) / bet(i)
1624 pp(i,k) = pp(i,k) - gam(i,k)*pp(i,k+1)
1631 pe2(i,k) = pem(i,k) + pp(i,k)
1638 aa(i,k) = t1g*0.5*(gm2(i,k-1)+gm2(i,k))/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1641 gamax = 1./(1.-kapad2(i,k))
1642 t1gx = 2.*gamax*(alpha*dt)**2
1643 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1645 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1648 wk(i,k) = t2*aa(i,k)*(w1(i,k-1)-w1(i,k))
1649 aa(i,k) = aa(i,k) - scale_m*dm2(i,1)
1654 bet(i) = dm2(i,1) - aa(i,2)
1655 w2(i,1) = (dm2(i,1)*w1(i,1) + dt*pp(i,2) + wk(i,2)) / bet(i)
1660 gam(i,k) = aa(i,k) / bet(i)
1661 bet(i) = dm2(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1662 w2(i,k) = (dm2(i,k)*w1(i,k) + dt*(pp(i,k+1)-pp(i,k)) + wk(i,k+1)-wk(i,k) &
1663 - aa(i,k)*w2(i,k-1)) / bet(i)
1669 wk1(i) = t1g*gm2(i,km)/dz2(i,km)*pe2(i,km+1)
1672 gamax = 1./(1.-kapad2(i,km))
1673 t1gx = 2.*gamax*(alpha*dt)**2
1674 wk1(i) = t1gx/dz2(i,km)*pe2(i,km+1)
1676 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1679 gam(i,km) = aa(i,km) / bet(i)
1680 bet(i) = dm2(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1681 w2(i,km) = (dm2(i,km)*w1(i,km) + dt*(pp(i,km+1)-pp(i,km)) - wk(i,km) + &
1682 wk1(i)*(t2*w1(i,km)-ra*ws(i)) - aa(i,km)*w2(i,km-1)) / bet(i)
1686 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1695 pe2(i,k+1) = pe2(i,k) + ( dm2(i,k)*(w2(i,k)-w1(i,k))*rdt &
1696 - beta*(pp(i,k+1)-pp(i,k)) ) * ra
1701 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 1703 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))))
1706 capa1x = kapad2(i,km)-1.
1707 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1x*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1709 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1716 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)
1719 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))))
1722 capa1x = kapad2(i,k)-1.
1723 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1x*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1725 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1733 pe2(i,k) = pe2(i,k) + beta*(pp(i,k)-pe2(i,k))
1742 integer,
intent(in):: i1, i2, km
1743 integer,
intent(in):: id
1744 real,
intent(in ),
dimension(i1:i2,km):: q1
1745 real,
intent(out),
dimension(i1:i2,km+1):: qe
1747 real,
parameter:: r2o3 = 2./3.
1748 real,
parameter:: r4o3 = 4./3.
1759 qe(i,1) = r4o3*q1(i,1) + r2o3*q1(i,2)
1769 gak(k) = 1. / (4. - gak(k-1))
1771 qe(i,k) = (3.*(q1(i,k-1) + q1(i,k)) - qe(i,k-1)) * gak(k)
1775 bet = 1. / (1.5 - 3.5*gak(km))
1777 qe(i,km+1) = (4.*q1(i,km) + q1(i,km-1) - 3.5*qe(i,km)) * bet
1782 qe(i,k) = qe(i,k) - gak(k)*qe(i,k+1)
1790 subroutine edge_profile(q1, q2, q1e, q2e, i1, i2, j1, j2, j, km, dp0, uniform_grid, limiter)
1792 integer,
intent(in):: i1, i2, j1, j2
1793 integer,
intent(in):: j, km
1794 integer,
intent(in):: limiter
1795 logical,
intent(in):: uniform_grid
1796 real,
intent(in):: dp0(km)
1797 real,
intent(in),
dimension(i1:i2,j1:j2,km):: q1, q2
1798 real,
intent(out),
dimension(i1:i2,j1:j2,km+1):: q1e, q2e
1800 real,
dimension(i1:i2,km+1):: qe1, qe2, gam
1802 real bet, r2o3, r4o3
1803 real g0, gk, xt1, xt2, a_bot
1806 if ( uniform_grid )
then 1813 qe1(i,1) = r4o3*q1(i,j,1) + r2o3*q1(i,j,2)
1814 qe2(i,1) = r4o3*q2(i,j,1) + r2o3*q2(i,j,2)
1819 gak(k) = 1. / (4. - gak(k-1))
1821 qe1(i,k) = (3.*(q1(i,j,k-1) + q1(i,j,k)) - qe1(i,k-1)) * gak(k)
1822 qe2(i,k) = (3.*(q2(i,j,k-1) + q2(i,j,k)) - qe2(i,k-1)) * gak(k)
1826 bet = 1. / (1.5 - 3.5*gak(km))
1828 qe1(i,km+1) = (4.*q1(i,j,km) + q1(i,j,km-1) - 3.5*qe1(i,km)) * bet
1829 qe2(i,km+1) = (4.*q2(i,j,km) + q2(i,j,km-1) - 3.5*qe2(i,km)) * bet
1834 qe1(i,k) = qe1(i,k) - gak(k)*qe1(i,k+1)
1835 qe2(i,k) = qe2(i,k) - gak(k)*qe2(i,k+1)
1840 g0 = dp0(2) / dp0(1)
1841 xt1 = 2.*g0*(g0+1. )
1844 qe1(i,1) = ( xt1*q1(i,j,1) + q1(i,j,2) ) / bet
1845 qe2(i,1) = ( xt1*q2(i,j,1) + q2(i,j,2) ) / bet
1846 gam(i,1) = ( 1. + g0*(g0+1.5) ) / bet
1850 gk = dp0(k-1) / dp0(k)
1852 bet = 2. + 2.*gk - gam(i,k-1)
1853 qe1(i,k) = ( 3.*(q1(i,j,k-1)+gk*q1(i,j,k)) - qe1(i,k-1) ) / bet
1854 qe2(i,k) = ( 3.*(q2(i,j,k-1)+gk*q2(i,j,k)) - qe2(i,k-1) ) / bet
1859 a_bot = 1. + gk*(gk+1.5)
1862 xt2 = gk*(gk+0.5) - a_bot*gam(i,km)
1863 qe1(i,km+1) = ( xt1*q1(i,j,km) + q1(i,j,km-1) - a_bot*qe1(i,km) ) / xt2
1864 qe2(i,km+1) = ( xt1*q2(i,j,km) + q2(i,j,km-1) - a_bot*qe2(i,km) ) / xt2
1869 qe1(i,k) = qe1(i,k) - gam(i,k)*qe1(i,k+1)
1870 qe2(i,k) = qe2(i,k) - gam(i,k)*qe2(i,k+1)
1878 if ( limiter/=0 )
then 1881 if ( q1(i,j,1)*qe1(i,1) < 0. ) qe1(i,1) = 0.
1882 if ( q2(i,j,1)*qe2(i,1) < 0. ) qe2(i,1) = 0.
1884 if ( q1(i,j,km)*qe1(i,km+1) < 0. ) qe1(i,km+1) = 0.
1885 if ( q2(i,j,km)*qe2(i,km+1) < 0. ) qe2(i,km+1) = 0.
1891 q1e(i,j,k) = qe1(i,k)
1892 q2e(i,j,k) = qe2(i,k)
1898 subroutine nest_halo_nh(ptop, grav, kappa, cp, delp, delz, pt, phis, &
1909 npx, npy, npz, nested, pkc_pertn, computepk3, fullhalo, bd, regional)
1913 integer,
intent(IN) :: npx, npy, npz
1914 logical,
intent(IN) :: pkc_pertn, computepk3, fullhalo, nested, regional
1915 real,
intent(IN) :: ptop, kappa, cp, grav
1917 real,
intent(IN) :: phis(bd%isd:bd%ied,bd%jsd:bd%jed)
1918 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: pt, delp, delz
1920 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz,*):: q
1923 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: q_con
1925 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: cappa
1928 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz+1):: gz, pkc, pk3
1932 real :: ptk, rgrav, rkap, peln1, rdg
1934 real,
dimension(bd%isd:bd%ied, npz+1, bd%jsd:bd%jed ) :: pe, peln
1936 real,
dimension(bd%isd:bd%ied, npz+1 ) :: peg, pelng
1938 real,
dimension(bd%isd:bd%ied, npz) :: gam, bb, dd, pkz
1939 real,
dimension(bd%isd:bd%ied, npz-1) :: g_rat
1940 real,
dimension(bd%isd:bd%ied) :: bet
1946 integer :: ifirst, ilast, jfirst, jlast
1948 integer :: is, ie, js, je
1949 integer :: isd, ied, jsd, jed
1960 if (.not. (nested .or. regional))
return 1970 gama = 1./(1.-kappa)
1974 rdg = - rdgas * rgrav
1984 gz(i,j,npz+1) = phis(i,j)
1988 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*grav
2003 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
2004 peln(i,k,j) = log(pe(i,k,j))
2006 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
2007 pelng(i,k) = log(peg(i,k))
2017 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
2021 pkz(i,k) = exp(gamax*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2023 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2028 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
2030 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2033 pkz(i,k) = pkz(i,k) - pm
2040 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
2041 bb(i,k) = 2.*(1. + g_rat(i,k))
2042 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
2049 pkc(i,j,2) = dd(i,1)/bet(i)
2051 dd(i,npz) = 3.*pkz(i,npz)
2055 gam(i,k) = g_rat(i,k-1)/bet(i)
2056 bet(i) = bb(i,k) - gam(i,k)
2057 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
2062 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
2064 if (abs(pkc(i,j,k)) > 1.e5)
then 2065 print*, mpp_pe(), i,j,k,
'PKC: ', pkc(i,j,k)
2075 if (.not. pkc_pertn)
then 2078 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
2084 if (computepk3)
then 2090 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
2099 if (ie == npx-1)
then 2105 gz(i,j,npz+1) = phis(i,j)
2109 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*grav
2124 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
2125 peln(i,k,j) = log(pe(i,k,j))
2127 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
2128 pelng(i,k) = log(peg(i,k))
2138 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
2142 pkz(i,k) = exp(gamax*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2144 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2149 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
2151 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2154 pkz(i,k) = pkz(i,k) - pm
2161 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
2162 bb(i,k) = 2.*(1. + g_rat(i,k))
2163 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
2170 pkc(i,j,2) = dd(i,1)/bet(i)
2172 dd(i,npz) = 3.*pkz(i,npz)
2176 gam(i,k) = g_rat(i,k-1)/bet(i)
2177 bet(i) = bb(i,k) - gam(i,k)
2178 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
2183 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
2192 if (.not. pkc_pertn)
then 2195 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
2201 if (computepk3)
then 2207 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
2222 gz(i,j,npz+1) = phis(i,j)
2226 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*grav
2241 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
2242 peln(i,k,j) = log(pe(i,k,j))
2244 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
2245 pelng(i,k) = log(peg(i,k))
2255 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
2259 pkz(i,k) = exp(gamax*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2261 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2266 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
2268 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2271 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2273 pkz(i,k) = pkz(i,k) - pm
2280 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
2281 bb(i,k) = 2.*(1. + g_rat(i,k))
2282 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
2289 pkc(i,j,2) = dd(i,1)/bet(i)
2291 dd(i,npz) = 3.*pkz(i,npz)
2295 gam(i,k) = g_rat(i,k-1)/bet(i)
2296 bet(i) = bb(i,k) - gam(i,k)
2297 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
2302 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
2304 if (abs(pkc(i,j,k)) > 1.e5)
then 2305 print*, mpp_pe(), i,j,k,
'PKC: ', pkc(i,j,k)
2315 if (.not. pkc_pertn)
then 2318 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
2324 if (computepk3)
then 2330 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
2339 if (je == npy-1)
then 2345 gz(i,j,npz+1) = phis(i,j)
2349 gz(i,j,k) = gz(i,j,k+1) - delz(i,j,k)*grav
2364 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
2365 peln(i,k,j) = log(pe(i,k,j))
2367 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
2368 pelng(i,k) = log(peg(i,k))
2378 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
2382 pkz(i,k) = exp(gamax*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2384 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz(i,j,k)*rdgas*pt(i,j,k)))
2389 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
2391 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2394 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2396 pkz(i,k) = pkz(i,k) - pm
2404 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
2405 bb(i,k) = 2.*(1. + g_rat(i,k))
2406 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
2413 pkc(i,j,2) = dd(i,1)/bet(i)
2415 dd(i,npz) = 3.*pkz(i,npz)
2419 gam(i,k) = g_rat(i,k-1)/bet(i)
2420 bet(i) = bb(i,k) - gam(i,k)
2421 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
2426 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
2435 if (.not. pkc_pertn)
then 2438 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
2444 if (computepk3)
then 2450 pk3(i,j,k) = exp(kappa*log(pe(i,k,j)))
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)
pure real function, public vicpqd(q)
subroutine, public sim3_solver(dt, is, ie, km, rgas, gama, kappa, pe2, dm, pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
The type 'fv_grid_type' is made up of grid-dependent information from fv_grid_tools and fv_grid_utils...
The module 'sw_core' advances the forward step of the Lagrangian dynamics as described by ...
The module 'multi_gases' peforms multi constitutents computations.
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)
GFDL - This routine will not give absoulte reproducibility when compiled with -fast-transcendentals. GFDL - It is now inside of nh_core.F90 and being compiled without -fast-transcendentals.
subroutine edge_profile(q1, q2, q1e, q2e, i1, i2, j1, j2, j, km, dp0, uniform_grid, limiter)
subroutine, public del6_vt_flux(nord, npx, npy, damp, q, d2, fx2, fy2, gridstruct, bd)
The subroutine 'del6_vt_flux' applies 2nd, 4th, or 6th-order damping to fluxes ("vorticity damping") ...
The module 'nh_utils' peforms non-hydrostatic computations.
The module 'tp_core' is a collection of routines to support FV transport.
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)
subroutine, public fill_4corners(q, dir, bd, npx, npy, sw_corner, se_corner, ne_corner, nw_corner)
The subroutine 'fill_4corners' fills the 4 corners of the scalar fields only as needed by c_core...
subroutine imp_diff_w(j, is, ie, js, je, ng, km, cd, delz, ws, w, w3)
The module 'fv_arrays' contains the 'fv_atmos_type' and associated datatypes.
subroutine, public sim1_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, pe, dm2, pm2, pem, w2, dz2, pt2, ws, p_fac)
subroutine, public sim3p0_solver(dt, is, ie, km, rgas, gama, kappa, pe2, dm, pem, w2, dz2, pt2, ws, 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, regional)
subroutine, public fv_tp_2d(q, crx, cry, npx, npy, hord, fx, fy, xfx, yfx, gridstruct, bd, ra_x, ra_y, lim_fac, regional, mfx, mfy, mass, nord, damp_c)
The subroutine 'fv_tp_2d' contains the FV advection scheme .
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 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, lim_fac, regional)
pure real function, public vicvqd(q)
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)