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))
203 gz(i,j,k) = min( gz(i,j,k), gz(i,j,k-1) -
dz_min )
207 ws(i,j) = ( zs(i,j) - gz(i,j,km+1) ) * rdt
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, ws, rdt, gridstruct, bd, lim_fac)
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(inout),
dimension(is:ie+1,js-ng:je+ng,km):: crx, xfx
229 real,
intent(inout),
dimension(is-ng:ie+ng,js:je+1,km):: cry, yfx
230 real,
intent(out) :: ws(is:ie,js:je)
232 real,
intent(in) :: lim_fac
235 real,
dimension(is: ie+1, js-ng:je+ng,km+1):: crx_adv, xfx_adv
236 real,
dimension(is-ng:ie+ng,js: je+1,km+1 ):: cry_adv, yfx_adv
237 real,
dimension(is:ie+1,js:je ):: fx
238 real,
dimension(is:ie ,js:je+1):: fy
239 real,
dimension(is-ng:ie+ng+1,js-ng:je+ng ):: fx2
240 real,
dimension(is-ng:ie+ng ,js-ng:je+ng+1):: fy2
241 real,
dimension(is-ng:ie+ng ,js-ng:je+ng ):: wk2, z2
242 real:: ra_x(is:ie,js-ng:je+ng)
243 real:: ra_y(is-ng:ie+ng,js:je)
245 integer i, j, k, isd, ied, jsd, jed
246 logical:: uniform_grid
248 uniform_grid = .false.
250 damp(km+1) = damp(km)
251 ndif(km+1) = ndif(km)
253 isd = is - ng; ied = ie + ng
254 jsd = js - ng; jed = je + ng
259 call edge_profile(crx, xfx, crx_adv, xfx_adv, is, ie+1, jsd, jed, j, km, &
260 dp0, uniform_grid, 0)
261 if ( j<=je+1 .and. j>=js ) &
262 call edge_profile(cry, yfx, cry_adv, yfx_adv, isd, ied, js, je+1, j, km, &
263 dp0, uniform_grid, 0)
274 ra_x(i,j) = area(i,j) + xfx_adv(i,j,k) - xfx_adv(i+1,j,k)
279 ra_y(i,j) = area(i,j) + yfx_adv(i,j,k) - yfx_adv(i,j+1,k)
283 if ( damp(k)>1.e-5 )
then 289 call fv_tp_2d(z2, crx_adv(is,jsd,k), cry_adv(isd,js,k), npx, npy, hord, &
290 fx, fy, xfx_adv(is,jsd,k), yfx_adv(isd,js,k), gridstruct, bd, ra_x, ra_y, lim_fac)
291 call del6_vt_flux(ndif(k), npx, npy, damp(k), z2, wk2, fx2, fy2, gridstruct, bd)
294 zh(i,j,k) = (z2(i,j)*area(i,j)+fx(i,j)-fx(i+1,j)+fy(i,j)-fy(i,j+1)) &
295 / (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)
299 call fv_tp_2d(zh(isd,jsd,k), crx_adv(is,jsd,k), cry_adv(isd,js,k), npx, npy, hord, &
300 fx, fy, xfx_adv(is,jsd,k), yfx_adv(isd,js,k), gridstruct, bd, ra_x, ra_y, lim_fac)
303 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)) &
304 / (ra_x(i,j) + ra_y(i,j) - area(i,j))
318 zh(i,j,k) = min( zh(i,j,k), zh(i,j,k-1) -
dz_min )
322 ws(i,j) = ( zs(i,j) - zh(i,j,km+1) ) * rdt
334 ptop, hs, w3, pt, q_con, &
335 delp, gz, pef, ws, p_fac, a_imp, scale_m)
337 integer,
intent(in):: is, ie, js, je, ng, km
338 integer,
intent(in):: ms
339 real,
intent(in):: dt, akap, cp, ptop, p_fac, a_imp, scale_m
340 real,
intent(in):: ws(is-ng:ie+ng,js-ng:je+ng)
341 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: pt, delp
342 real,
intent(in),
dimension(is-ng:,js-ng:,1:):: q_con, cappa
344 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: kapad
346 real,
intent(in):: hs(is-ng:ie+ng,js-ng:je+ng)
347 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng,km):: w3
349 real,
intent(inout),
dimension(is-ng:ie+ng,js-ng:je+ng,km+1):: gz
350 real,
intent( out),
dimension(is-ng:ie+ng,js-ng:je+ng,km+1):: pef
352 real,
dimension(is-1:ie+1,km ):: dm, dz2, w2, pm2, gm2, cp2
353 real,
dimension(is-1:ie+1,km+1):: pem, pe2, peg
355 real,
dimension(is-1:ie+1,km ):: kapad2
379 dm(i,k) = delp(i,j,k)
393 pem(i,k) = pem(i,k-1) + dm(i,k-1)
396 peg(i,k) = peg(i,k-1) + dm(i,k-1)*(1.-q_con(i,j,k-1))
403 dz2(i,k) = gz(i,j,k+1) - gz(i,j,k)
405 pm2(i,k) = (peg(i,k+1)-peg(i,k))/log(peg(i,k+1)/peg(i,k))
408 cp2(i,k) = cappa(i,j,k)
409 gm2(i,k) = 1. / (1.-cp2(i,k))
413 pm2(i,k) = dm(i,k)/log(pem(i,k+1)/pem(i,k))
416 kapad2(i,k) = kapad(i,j,k)
418 dm(i,k) = dm(i,k) * rgrav
424 if ( a_imp < -0.01 )
then 430 pem, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), p_fac, scale_m)
431 elseif ( a_imp <= 0.5 )
then 432 call rim_2d(ms, dt, is1, ie1, km, rdgas, gama, gm2, &
437 dm, pm2, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), .true.)
439 call sim1_solver(dt, is1, ie1, km, rdgas, gama, gm2, cp2, akap, &
444 dm, pm2, pem, w2, dz2, pt(is1:ie1,j,1:km), ws(is1,j), p_fac)
450 pef(i,j,k) = pe2(i,k) + pem(i,k)
456 gz(i,j,km+1) = hs(i,j)
461 gz(i,j,k) = gz(i,j,k+1) - dz2(i,k)*grav
473 isd, ied, jsd, jed, akap, cappa, cp, &
477 ptop, zs, q_con, w, delz, pt, &
478 delp, zh, pe, ppe, pk3, pk, peln, &
479 ws, scale_m, p_fac, a_imp, &
480 use_logp, last_call, fp_out)
487 integer,
intent(in):: ms, is, ie, js, je, km, ng
488 integer,
intent(in):: isd, ied, jsd, jed
489 real,
intent(in):: dt
490 real,
intent(in):: akap, cp, ptop, p_fac, a_imp, scale_m
491 real,
intent(in):: zs(isd:ied,jsd:jed)
492 logical,
intent(in):: last_call, use_logp, fp_out
493 real,
intent(in):: ws(is:ie,js:je)
494 real,
intent(in),
dimension(isd:,jsd:,1:):: q_con, cappa
495 real,
intent(in),
dimension(isd:ied,jsd:jed,km):: delp, pt
497 real,
intent(in),
dimension(isd:ied,jsd:jed,km):: kapad
499 real,
intent(inout),
dimension(isd:ied,jsd:jed,km+1):: zh
500 real,
intent(inout),
dimension(isd:ied,jsd:jed,km):: w
501 real,
intent(inout):: pe(is-1:ie+1,km+1,js-1:je+1)
502 real,
intent(out):: peln(is:ie,km+1,js:je)
503 real,
intent(out),
dimension(isd:ied,jsd:jed,km+1):: ppe
504 real,
intent(out):: delz(is:ie,js:je,km)
505 real,
intent(out):: pk(is:ie,js:je,km+1)
506 real,
intent(out):: pk3(isd:ied,jsd:jed,km+1)
508 real,
dimension(is:ie,km):: dm, dz2, pm2, w2, gm2, cp2
509 real,
dimension(is:ie,km+1)::pem, pe2, peln2, peg, pelng
511 real,
dimension(is:ie,km):: kapad2
513 real gama, rgrav, ptk, peln1
519 ptk = exp(akap*peln1)
534 dm(i,k) = delp(i,j,k)
536 cp2(i,k) = cappa(i,j,k)
539 kapad2(i,k) = kapad(i,j,k)
555 pem(i,k) = pem(i,k-1) + dm(i,k-1)
556 peln2(i,k) = log(pem(i,k))
560 peg(i,k) = peg(i,k-1) + dm(i,k-1)*(1.-q_con(i,j,k-1))
561 pelng(i,k) = log(peg(i,k))
563 pk3(i,j,k) = exp(akap*peln2(i,k))
570 pm2(i,k) = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
573 gm2(i,k) = 1. / (1.-cp2(i,k))
577 pm2(i,k) = dm(i,k)/(peln2(i,k+1)-peln2(i,k))
579 dm(i,k) = dm(i,k) * rgrav
580 dz2(i,k) = zh(i,j,k+1) - zh(i,j,k)
586 if ( a_imp < -0.999 )
then 592 pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), p_fac, scale_m )
593 elseif ( a_imp < -0.5 )
then 594 call sim3_solver(dt, is, ie, km, rdgas, gama, akap, &
599 pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), abs(a_imp), p_fac, scale_m)
600 elseif ( a_imp <= 0.5 )
then 601 call rim_2d(ms, dt, is, ie, km, rdgas, gama, gm2, &
606 dm, pm2, w2, dz2, pt(is:ie,j,1:km), ws(is,j), .false.)
607 elseif ( a_imp > 0.999 )
then 608 call sim1_solver(dt, is, ie, km, rdgas, gama, gm2, cp2, akap, &
613 pm2, pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), p_fac)
615 call sim_solver(dt, is, ie, km, rdgas, gama, gm2, cp2, akap, &
620 pm2, pem, w2, dz2, pt(is:ie,j,1:km), ws(is,j), &
621 a_imp, p_fac, scale_m)
628 delz(i,j,k) = dz2(i,k)
632 if ( last_call )
then 635 peln(i,k,j) = peln2(i,k)
636 pk(i,j,k) = pk3(i,j,k)
645 ppe(i,j,k) = pe2(i,k) + pem(i,k)
651 ppe(i,j,k) = pe2(i,k)
659 pk3(i,j,k) = peln2(i,k)
665 zh(i,j,km+1) = zs(i,j)
669 zh(i,j,k) = zh(i,j,k+1) - dz2(i,k)
677 subroutine imp_diff_w(j, is, ie, js, je, ng, km, cd, delz, ws, w, w3)
678 integer,
intent(in) :: j, is, ie, js, je, km, ng
679 real,
intent(in) :: cd
680 real,
intent(in) :: delz(is:ie, km)
681 real,
intent(in) :: w(is:ie, km)
682 real,
intent(in) :: ws(is:ie)
683 real,
intent(out) :: w3(is-ng:ie+ng,js-ng:je+ng,km)
685 real,
dimension(is:ie,km):: c, gam, dz, wt
692 dz(i,k) = 0.5*(delz(i,k-1)+delz(i,k))
697 c(i,k) = -cd/(dz(i,k+1)*delz(i,k))
704 wt(i,1) = w(i,1) / bet(i)
710 gam(i,k) = c(i,k-1)/bet(i)
711 a = cd/(dz(i,k)*delz(i,k))
712 bet(i) = (1.+a-c(i,k)) + a*gam(i,k)
713 wt(i,k) = (w(i,k) + a*wt(i,k-1)) / bet(i)
719 gam(i,km) = c(i,km-1) / bet(i)
720 a = cd/(dz(i,km)*delz(i,km))
721 wt(i,km) = (w(i,km) + 2.*ws(i)*cd/delz(i,km)**2 &
722 + a*wt(i,km-1))/(1. + a + (cd+cd)/delz(i,km)**2 + a*gam(i,km))
727 wt(i,k) = wt(i,k) - gam(i,k+1)*wt(i,k+1)
740 subroutine rim_2d(ms, bdt, is, ie, km, rgas, gama, gm2, &
744 pe2, dm2, pm2, w2, dz2, pt2, ws, c_core )
746 integer,
intent(in):: ms, is, ie, km
747 real,
intent(in):: bdt, gama, rgas
748 real,
intent(in),
dimension(is:ie,km):: dm2, pm2, gm2
749 logical,
intent(in):: c_core
750 real,
intent(in ) :: pt2(is:ie,km)
751 real,
intent(in ) :: ws(is:ie)
753 real,
intent(inout):: dz2(is:ie,km)
754 real,
intent(inout):: w2(is:ie,km)
755 real,
intent(out ):: pe2(is:ie,km+1)
757 real,
intent(inout),
dimension(is:ie,km):: kapad2
761 real,
dimension(km+1):: m_bot, m_top, r_bot, r_top, pe1, pbar, wbar
762 real,
dimension(km):: r_hi, r_lo, dz, wm, dm, dts
763 real,
dimension(km):: pf1, wc, cm , pp, pt1
764 real:: dt, rdt, grg, z_frac, ptmp1, rden, pf, time_left
769 integer:: i, k, n, ke, kt1, ktop
788 wm(k) = w2(i,k)*dm(k)
796 if ( ms > 1 .and. ms < 8 )
then 799 rden = -rgas*dm(k)/dz(k)
801 pf1(k) = exp( gm2(i,k)*log(rden*pt1(k)) )
803 dts(k) = -dz(k)/sqrt(grg*pf1(k)/rden)
806 gamax = 1./(1.-kapad2(i,k))
807 pf1(k) = exp( gamax*log(rden*pt1(k)) )
809 pf1(k) = exp( gama*log(rden*pt1(k)) )
811 dts(k) = -dz(k)/sqrt(grg*pf1(k)/rden)
813 if ( bdt > dts(k) )
then 819 222
if ( ks0==1 )
goto 244
822 cm(k) = dm(k) / dts(k)
823 wc(k) = wm(k) / dts(k)
824 pp(k) = pf1(k) - pm2(i,k)
827 wbar(1) = (wc(1)+pp(1)) / cm(1)
829 wbar(k) = (wc(k-1)+wc(k) + pp(k)-pp(k-1)) / (cm(k-1)+cm(k))
830 pbar(k) = bdt*(cm(k-1)*wbar(k) - wc(k-1) + pp(k-1))
834 if ( ks0 == km )
then 835 pbar(km+1) = bdt*(cm(km)*wbar(km+1) - wc(km) + pp(km))
838 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
842 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
843 w2(i,k) = (wm(k)+pbar(k+1)-pbar(k))/dm(k)
848 pe2(i,k) = pbar(k)*rdt
854 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
858 dz2(i,k) = dz(k) + bdt*(wbar(k+1) - wbar(k))
859 w2(i,k) = (wm(k)+pbar(k+1)-pbar(k))/dm(k)
862 pbar(ks0) = pbar(ks0) /
real(ms)
870 rden = -rgas*dm(k)/dz(k)
872 pf = exp( gm2(i,k)*log(rden*pt1(k)) )
874 dts(k) = -dz(k) / sqrt( grg*pf/rden )
877 gamax = 1./(1.-kapad2(i,k))
878 pf = exp( gamax*log(rden*pt1(k)) )
880 pf = exp( gama*log(rden*pt1(k)) )
882 dts(k) = -dz(k) / sqrt( grg*pf/rden )
884 ptmp1 = dts(k)*(pf - pm2(i,k))
885 r_lo(k) = wm(k) + ptmp1
886 r_hi(k) = wm(k) - ptmp1
891 if( dt > dts(k) )
then 899 if ( ktop >= ks1 )
then 902 r_bot(k ) = z_frac*r_lo(k)
903 r_top(k+1) = z_frac*r_hi(k)
904 m_bot(k ) = z_frac* dm(k)
905 m_top(k+1) = m_bot(k)
907 if ( ktop == km )
goto 666
916 do 444 ke=km+1, ktop+2, -1
919 if ( time_left > dts(k) )
then 920 time_left = time_left - dts(k)
921 m_top(ke) = m_top(ke) + dm(k)
922 r_top(ke) = r_top(ke) + r_hi(k)
924 z_frac = time_left/dts(k)
925 m_top(ke) = m_top(ke) + z_frac*dm(k)
926 r_top(ke) = r_top(ke) + z_frac*r_hi(k)
937 do 4000 ke=ktop+1, km
940 if ( time_left > dts(k) )
then 941 time_left = time_left - dts(k)
942 m_bot(ke) = m_bot(ke) + dm(k)
943 r_bot(ke) = r_bot(ke) + r_lo(k)
945 z_frac = time_left/dts(k)
946 m_bot(ke) = m_bot(ke) + z_frac* dm(k)
947 r_bot(ke) = r_bot(ke) + z_frac*r_lo(k)
953 if ( time_left > dts(k) )
then 954 time_left = time_left - dts(k)
955 m_bot(ke) = m_bot(ke) + dm(k)
956 r_bot(ke) = r_bot(ke) - r_hi(k)
958 z_frac = time_left/dts(k)
959 m_bot(ke) = m_bot(ke) + z_frac* dm(k)
960 r_bot(ke) = r_bot(ke) - z_frac*r_hi(k) + (m_bot(ke)-m_surf)*ws2(i)
966 666
if ( ks1==1 ) wbar(1) = r_bot(1) / m_bot(1)
968 wbar(k) = (r_bot(k)+r_top(k)) / (m_top(k)+m_bot(k))
972 pbar(k) = m_top(k)*wbar(k) - r_top(k)
973 pe1(k) = pe1(k) + pbar(k)
979 dz2(i,k) = dz(k) + dt*(wbar(k+1)-wbar(k))
983 dz2(i,k) = dz(k) + dt*(wbar(k+1)-wbar(k))
984 w2(i,k) = ( wm(k) + pbar(k+1) - pbar(k) ) / dm(k)
989 dz(k) = dz(k) + dt*(wbar(k+1)-wbar(k))
990 wm(k) = wm(k) + pbar(k+1) - pbar(k)
997 pe2(i,k) = pe1(k)*rdt
1004 subroutine sim3_solver(dt, is, ie, km, rgas, gama, kappa, &
1009 pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
1010 integer,
intent(in):: is, ie, km
1011 real,
intent(in):: dt, rgas, gama, kappa, alpha, p_fac, scale_m
1012 real,
intent(in ),
dimension(is:ie,km):: dm, pt2
1013 real,
intent(in ):: ws(is:ie)
1014 real,
intent(in ),
dimension(is:ie,km+1):: pem
1015 real,
intent(out):: pe2(is:ie,km+1)
1016 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1018 real,
intent(inout),
dimension(is:ie,km):: kapad2
1021 real,
dimension(is:ie,km ):: aa, bb, dd, w1, wk, g_rat, gam
1022 real,
dimension(is:ie,km+1):: pp
1023 real,
dimension(is:ie):: p1, wk1, bet
1024 real beta, t2, t1g, rdt, ra, capa1, r2g, r6g
1026 real gamax, capa1x, t1gx
1033 t1g = gama * 2.*(alpha*dt)**2
1045 gamax = 1. / (1.-kapad2(i,k))
1046 aa(i,k) = exp(gamax*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1048 aa(i,k) = exp(gama*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1055 g_rat(i,k) = dm(i,k)/dm(i,k+1)
1056 bb(i,k) = 2.*(1.+g_rat(i,k))
1057 dd(i,k) = 3.*(aa(i,k) + g_rat(i,k)*aa(i,k+1))
1066 pe2(i,2) = (dd(i,1)-pem(i,1)) / bet(i)
1069 dd(i,km) = 3.*aa(i,km) + r2g*dm(i,km)
1074 gam(i,k) = g_rat(i,k-1) / bet(i)
1075 bet(i) = bb(i,k) - gam(i,k)
1076 pe2(i,k+1) = (dd(i,k) - pe2(i,k) ) / bet(i)
1082 pe2(i,k) = pe2(i,k) - gam(i,k)*pe2(i,k+1)
1090 pp(i,k) = pe2(i,k) - pem(i,k)
1097 gamax = 1./(1.-kapad2(i,k))
1098 t1gx = gamax*2.*(alpha*dt)**2
1099 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1101 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1103 wk(i,k) = t2*aa(i,k)*(w1(i,k-1)-w1(i,k))
1104 aa(i,k) = aa(i,k) - scale_m*dm(i,1)
1108 bet(i) = dm(i,1) - aa(i,2)
1109 w2(i,1) = (dm(i,1)*w1(i,1)+dt*pp(i,2) + wk(i,2)) / bet(i)
1113 gam(i,k) = aa(i,k) / bet(i)
1114 bet(i) = dm(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1115 w2(i,k) = (dm(i,k)*w1(i,k)+dt*(pp(i,k+1)-pp(i,k)) + wk(i,k+1)-wk(i,k) &
1116 - aa(i,k)*w2(i,k-1)) / bet(i)
1121 gamax = 1./(1.-kapad2(i,km))
1122 t1gx = gamax*2.*(alpha*dt)**2
1123 wk1(i) = t1gx/dz2(i,km)*pe2(i,km+1)
1125 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1127 gam(i,km) = aa(i,km) / bet(i)
1128 bet(i) = dm(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1129 w2(i,km) = (dm(i,km)*w1(i,km)+dt*(pp(i,km+1)-pp(i,km))-wk(i,km) + &
1130 wk1(i)*(t2*w1(i,km)-ra*ws(i)) - aa(i,km)*w2(i,km-1)) / bet(i)
1134 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1144 pe2(i,k+1) = pe2(i,k) + ( dm(i,k)*(w2(i,k)-w1(i,k))*rdt &
1145 - beta*(pp(i,k+1)-pp(i,k)) )*ra
1155 pe2(i,k) = max(p_fac*pem(i,k), pe2(i,k)+pem(i,k))
1161 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 - r6g*dm(i,km)
1163 capa1x = kapad2(i,km) - 1.
1164 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1x*log(p1(i)) )
1166 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1*log(p1(i)) )
1172 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)
1174 capa1x = kapad2(i,k) - 1.
1175 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1x*log(p1(i)) )
1177 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1*log(p1(i)) )
1184 pe2(i,k) = pe2(i,k) - pem(i,k)
1185 pe2(i,k) = pe2(i,k) + beta*(pp(i,k) - pe2(i,k))
1191 subroutine sim3p0_solver(dt, is, ie, km, rgas, gama, kappa, &
1196 pem, w2, dz2, pt2, ws, p_fac, scale_m)
1198 integer,
intent(in):: is, ie, km
1199 real,
intent(in):: dt, rgas, gama, kappa, p_fac, scale_m
1200 real,
intent(in ),
dimension(is:ie,km):: dm, pt2
1201 real,
intent(in ):: ws(is:ie)
1202 real,
intent(in ):: pem(is:ie,km+1)
1203 real,
intent(out):: pe2(is:ie,km+1)
1204 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1206 real,
intent(inout),
dimension(is:ie,km):: kapad2
1209 real,
dimension(is:ie,km ):: aa, bb, dd, w1, g_rat, gam
1210 real,
dimension(is:ie,km+1):: pp
1211 real,
dimension(is:ie):: p1, wk1, bet
1212 real t1g, rdt, capa1, r2g, r6g
1214 real gamax, capa1x, t1gx
1229 gamax = 1. / ( 1. - kapad2(i,k) )
1230 aa(i,k) = exp(gamax*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1232 aa(i,k) = exp(gama*log(-dm(i,k)/dz2(i,k)*rgas*pt2(i,k)))
1239 g_rat(i,k) = dm(i,k)/dm(i,k+1)
1240 bb(i,k) = 2.*(1.+g_rat(i,k))
1241 dd(i,k) = 3.*(aa(i,k) + g_rat(i,k)*aa(i,k+1))
1250 pe2(i,2) = (dd(i,1)-pem(i,1)) / bet(i)
1253 dd(i,km) = 3.*aa(i,km) + r2g*dm(i,km)
1258 gam(i,k) = g_rat(i,k-1) / bet(i)
1259 bet(i) = bb(i,k) - gam(i,k)
1260 pe2(i,k+1) = (dd(i,k) - pe2(i,k) ) / bet(i)
1266 pe2(i,k) = pe2(i,k) - gam(i,k)*pe2(i,k+1)
1274 pp(i,k) = pe2(i,k) - pem(i,k)
1281 gamax = 1. / (1.-kapad2(i,k))
1282 t1gx = 2.*gamax*dt**2
1283 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k))*pe2(i,k) - scale_m*dm(i,1)
1285 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k) - scale_m*dm(i,1)
1290 bet(i) = dm(i,1) - aa(i,2)
1291 w2(i,1) = (dm(i,1)*w1(i,1)+dt*pp(i,2)) / bet(i)
1295 gam(i,k) = aa(i,k) / bet(i)
1296 bet(i) = dm(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1297 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)
1302 gamax = 1. / (1.-kapad2(i,km))
1303 t1gx = 2.*gamax*dt**2
1304 wk1(i) = t1gx/dz2(i,km)*pe2(i,km+1)
1306 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1308 gam(i,km) = aa(i,km) / bet(i)
1309 bet(i) = dm(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1310 w2(i,km) = (dm(i,km)*w1(i,km)+dt*(pp(i,km+1)-pp(i,km))-wk1(i)*ws(i) - &
1311 aa(i,km)*w2(i,km-1)) / bet(i)
1315 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1325 pe2(i,k+1) = pe2(i,k) + dm(i,k)*(w2(i,k)-w1(i,k))*rdt
1335 pe2(i,k) = max(p_fac*pem(i,k), pe2(i,k)+pem(i,k))
1341 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 - r6g*dm(i,km)
1343 capa1x = kapad2(i,km) - 1.
1344 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1x*log(p1(i)) )
1346 dz2(i,km) = -dm(i,km)*rgas*pt2(i,km)*exp( capa1*log(p1(i)) )
1352 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)
1354 capa1x = kapad2(i,k) - 1.
1355 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1x*log(p1(i)) )
1357 dz2(i,k) = -dm(i,k)*rgas*pt2(i,k)*exp( capa1*log(p1(i)) )
1364 pe2(i,k) = pe2(i,k) - pem(i,k)
1371 subroutine sim1_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, &
1376 pm2, pem, w2, dz2, pt2, ws, p_fac)
1377 integer,
intent(in):: is, ie, km
1378 real,
intent(in):: dt, rgas, gama, kappa, p_fac
1379 real,
intent(in),
dimension(is:ie,km):: dm2, pt2, pm2, gm2, cp2
1380 real,
intent(in ):: ws(is:ie)
1381 real,
intent(in ),
dimension(is:ie,km+1):: pem
1382 real,
intent(out):: pe(is:ie,km+1)
1383 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1385 real,
intent(inout),
dimension(is:ie,km):: kapad2
1388 real,
dimension(is:ie,km ):: aa, bb, dd, w1, g_rat, gam
1389 real,
dimension(is:ie,km+1):: pp
1390 real,
dimension(is:ie):: p1, bet
1391 real t1g, rdt, capa1
1393 real gamax, capa1x, t1gx
1400 t1g = gama * 2.*dt*dt
1408 pe(i,k) = exp(gm2(i,k)*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1411 gamax = 1. / ( 1. - kapad2(i,k) )
1412 pe(i,k) = exp(gamax*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1414 pe(i,k) = exp(gama*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1423 g_rat(i,k) = dm2(i,k)/dm2(i,k+1)
1424 bb(i,k) = 2.*(1.+g_rat(i,k))
1425 dd(i,k) = 3.*(pe(i,k) + g_rat(i,k)*pe(i,k+1))
1432 pp(i,2) = dd(i,1) / bet(i)
1434 dd(i,km) = 3.*pe(i,km)
1439 gam(i,k) = g_rat(i,k-1) / bet(i)
1440 bet(i) = bb(i,k) - gam(i,k)
1441 pp(i,k+1) = (dd(i,k) - pp(i,k) ) / bet(i)
1447 pp(i,k) = pp(i,k) - gam(i,k)*pp(i,k+1)
1455 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))
1458 gamax = 1./(1.-kapad2(i,k))
1459 t1gx = gamax * 2.*dt*dt
1460 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k)) * (pem(i,k)+pp(i,k))
1462 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k)) * (pem(i,k)+pp(i,k))
1468 bet(i) = dm2(i,1) - aa(i,2)
1469 w2(i,1) = (dm2(i,1)*w1(i,1) + dt*pp(i,2)) / bet(i)
1473 gam(i,k) = aa(i,k) / bet(i)
1474 bet(i) = dm2(i,k) - (aa(i,k) + aa(i,k+1) + aa(i,k)*gam(i,k))
1475 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)
1480 p1(i) = t1g*gm2(i,km)/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1483 gamax = 1./(1.-kapad2(i,km))
1484 t1gx = gamax * 2.*dt*dt
1485 p1(i) = t1gx/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1487 p1(i) = t1g/dz2(i,km)*(pem(i,km+1)+pp(i,km+1))
1490 gam(i,km) = aa(i,km) / bet(i)
1491 bet(i) = dm2(i,km) - (aa(i,km)+p1(i) + aa(i,km)*gam(i,km))
1492 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)
1496 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1505 pe(i,k+1) = pe(i,k) + dm2(i,k)*(w2(i,k)-w1(i,k))*rdt
1510 p1(i) = ( pe(i,km) + 2.*pe(i,km+1) )*
r3 1512 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))))
1515 capa1x = kapad2(i,km)-1.
1516 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1x*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1518 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1525 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)
1527 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))))
1531 capa1x = kapad2(i,k)-1.
1532 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1x*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1534 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1542 subroutine sim_solver(dt, is, ie, km, rgas, gama, gm2, cp2, kappa, &
1547 pm2, pem, w2, dz2, pt2, ws, alpha, p_fac, scale_m)
1548 integer,
intent(in):: is, ie, km
1549 real,
intent(in):: dt, rgas, gama, kappa, p_fac, alpha, scale_m
1550 real,
intent(in),
dimension(is:ie,km):: dm2, pt2, pm2, gm2, cp2
1551 real,
intent(in ):: ws(is:ie)
1552 real,
intent(in ),
dimension(is:ie,km+1):: pem
1553 real,
intent(out):: pe2(is:ie,km+1)
1554 real,
intent(inout),
dimension(is:ie,km):: dz2, w2
1556 real,
intent(inout),
dimension(is:ie,km):: kapad2
1559 real,
dimension(is:ie,km ):: aa, bb, dd, w1, wk, g_rat, gam
1560 real,
dimension(is:ie,km+1):: pp
1561 real,
dimension(is:ie):: p1, wk1, bet
1562 real beta, t2, t1g, rdt, ra, capa1
1564 real gamax, capa1x, t1gx
1572 t1g = 2.*(alpha*dt)**2
1574 t1g = 2.*gama*(alpha*dt)**2
1584 pe2(i,k) = exp(gm2(i,k)*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1587 gamax = 1./(1.-kapad2(i,k))
1588 pe2(i,k) = exp(gamax*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1590 pe2(i,k) = exp(gama*log(-dm2(i,k)/dz2(i,k)*rgas*pt2(i,k))) - pm2(i,k)
1598 g_rat(i,k) = dm2(i,k)/dm2(i,k+1)
1599 bb(i,k) = 2.*(1.+g_rat(i,k))
1600 dd(i,k) = 3.*(pe2(i,k) + g_rat(i,k)*pe2(i,k+1))
1607 pp(i,2) = dd(i,1) / bet(i)
1609 dd(i,km) = 3.*pe2(i,km)
1614 gam(i,k) = g_rat(i,k-1) / bet(i)
1615 bet(i) = bb(i,k) - gam(i,k)
1616 pp(i,k+1) = (dd(i,k) - pp(i,k) ) / bet(i)
1622 pp(i,k) = pp(i,k) - gam(i,k)*pp(i,k+1)
1629 pe2(i,k) = pem(i,k) + pp(i,k)
1636 aa(i,k) = t1g*0.5*(gm2(i,k-1)+gm2(i,k))/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1639 gamax = 1./(1.-kapad2(i,k))
1640 t1gx = 2.*gamax*(alpha*dt)**2
1641 aa(i,k) = t1gx/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1643 aa(i,k) = t1g/(dz2(i,k-1)+dz2(i,k))*pe2(i,k)
1646 wk(i,k) = t2*aa(i,k)*(w1(i,k-1)-w1(i,k))
1647 aa(i,k) = aa(i,k) - scale_m*dm2(i,1)
1652 bet(i) = dm2(i,1) - aa(i,2)
1653 w2(i,1) = (dm2(i,1)*w1(i,1) + dt*pp(i,2) + wk(i,2)) / bet(i)
1658 gam(i,k) = aa(i,k) / bet(i)
1659 bet(i) = dm2(i,k) - (aa(i,k)+aa(i,k+1) + aa(i,k)*gam(i,k))
1660 w2(i,k) = (dm2(i,k)*w1(i,k) + dt*(pp(i,k+1)-pp(i,k)) + wk(i,k+1)-wk(i,k) &
1661 - aa(i,k)*w2(i,k-1)) / bet(i)
1667 wk1(i) = t1g*gm2(i,km)/dz2(i,km)*pe2(i,km+1)
1670 gamax = 1./(1.-kapad2(i,km))
1671 t1gx = 2.*gamax*(alpha*dt)**2
1672 wk1(i) = t1gx/dz2(i,km)*pe2(i,km+1)
1674 wk1(i) = t1g/dz2(i,km)*pe2(i,km+1)
1677 gam(i,km) = aa(i,km) / bet(i)
1678 bet(i) = dm2(i,km) - (aa(i,km)+wk1(i) + aa(i,km)*gam(i,km))
1679 w2(i,km) = (dm2(i,km)*w1(i,km) + dt*(pp(i,km+1)-pp(i,km)) - wk(i,km) + &
1680 wk1(i)*(t2*w1(i,km)-ra*ws(i)) - aa(i,km)*w2(i,km-1)) / bet(i)
1684 w2(i,k) = w2(i,k) - gam(i,k+1)*w2(i,k+1)
1693 pe2(i,k+1) = pe2(i,k) + ( dm2(i,k)*(w2(i,k)-w1(i,k))*rdt &
1694 - beta*(pp(i,k+1)-pp(i,k)) ) * ra
1699 p1(i) = (pe2(i,km)+ 2.*pe2(i,km+1))*
r3 1701 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))))
1704 capa1x = kapad2(i,km)-1.
1705 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1x*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1707 dz2(i,km) = -dm2(i,km)*rgas*pt2(i,km)*exp(capa1*log(max(p_fac*pm2(i,km),p1(i)+pm2(i,km))))
1714 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)
1717 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))))
1720 capa1x = kapad2(i,k)-1.
1721 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1x*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1723 dz2(i,k) = -dm2(i,k)*rgas*pt2(i,k)*exp(capa1*log(max(p_fac*pm2(i,k),p1(i)+pm2(i,k))))
1731 pe2(i,k) = pe2(i,k) + beta*(pp(i,k)-pe2(i,k))
1740 integer,
intent(in):: i1, i2, km
1741 integer,
intent(in):: id
1742 real,
intent(in ),
dimension(i1:i2,km):: q1
1743 real,
intent(out),
dimension(i1:i2,km+1):: qe
1745 real,
parameter:: r2o3 = 2./3.
1746 real,
parameter:: r4o3 = 4./3.
1757 qe(i,1) = r4o3*q1(i,1) + r2o3*q1(i,2)
1767 gak(k) = 1. / (4. - gak(k-1))
1769 qe(i,k) = (3.*(q1(i,k-1) + q1(i,k)) - qe(i,k-1)) * gak(k)
1773 bet = 1. / (1.5 - 3.5*gak(km))
1775 qe(i,km+1) = (4.*q1(i,km) + q1(i,km-1) - 3.5*qe(i,km)) * bet
1780 qe(i,k) = qe(i,k) - gak(k)*qe(i,k+1)
1788 subroutine edge_profile(q1, q2, q1e, q2e, i1, i2, j1, j2, j, km, dp0, uniform_grid, limiter)
1790 integer,
intent(in):: i1, i2, j1, j2
1791 integer,
intent(in):: j, km
1792 integer,
intent(in):: limiter
1793 logical,
intent(in):: uniform_grid
1794 real,
intent(in):: dp0(km)
1795 real,
intent(in),
dimension(i1:i2,j1:j2,km):: q1, q2
1796 real,
intent(out),
dimension(i1:i2,j1:j2,km+1):: q1e, q2e
1798 real,
dimension(i1:i2,km+1):: qe1, qe2, gam
1800 real bet, r2o3, r4o3
1801 real g0, gk, xt1, xt2, a_bot
1804 if ( uniform_grid )
then 1811 qe1(i,1) = r4o3*q1(i,j,1) + r2o3*q1(i,j,2)
1812 qe2(i,1) = r4o3*q2(i,j,1) + r2o3*q2(i,j,2)
1817 gak(k) = 1. / (4. - gak(k-1))
1819 qe1(i,k) = (3.*(q1(i,j,k-1) + q1(i,j,k)) - qe1(i,k-1)) * gak(k)
1820 qe2(i,k) = (3.*(q2(i,j,k-1) + q2(i,j,k)) - qe2(i,k-1)) * gak(k)
1824 bet = 1. / (1.5 - 3.5*gak(km))
1826 qe1(i,km+1) = (4.*q1(i,j,km) + q1(i,j,km-1) - 3.5*qe1(i,km)) * bet
1827 qe2(i,km+1) = (4.*q2(i,j,km) + q2(i,j,km-1) - 3.5*qe2(i,km)) * bet
1832 qe1(i,k) = qe1(i,k) - gak(k)*qe1(i,k+1)
1833 qe2(i,k) = qe2(i,k) - gak(k)*qe2(i,k+1)
1838 g0 = dp0(2) / dp0(1)
1839 xt1 = 2.*g0*(g0+1. )
1842 qe1(i,1) = ( xt1*q1(i,j,1) + q1(i,j,2) ) / bet
1843 qe2(i,1) = ( xt1*q2(i,j,1) + q2(i,j,2) ) / bet
1844 gam(i,1) = ( 1. + g0*(g0+1.5) ) / bet
1848 gk = dp0(k-1) / dp0(k)
1850 bet = 2. + 2.*gk - gam(i,k-1)
1851 qe1(i,k) = ( 3.*(q1(i,j,k-1)+gk*q1(i,j,k)) - qe1(i,k-1) ) / bet
1852 qe2(i,k) = ( 3.*(q2(i,j,k-1)+gk*q2(i,j,k)) - qe2(i,k-1) ) / bet
1857 a_bot = 1. + gk*(gk+1.5)
1860 xt2 = gk*(gk+0.5) - a_bot*gam(i,km)
1861 qe1(i,km+1) = ( xt1*q1(i,j,km) + q1(i,j,km-1) - a_bot*qe1(i,km) ) / xt2
1862 qe2(i,km+1) = ( xt1*q2(i,j,km) + q2(i,j,km-1) - a_bot*qe2(i,km) ) / xt2
1867 qe1(i,k) = qe1(i,k) - gam(i,k)*qe1(i,k+1)
1868 qe2(i,k) = qe2(i,k) - gam(i,k)*qe2(i,k+1)
1876 if ( limiter/=0 )
then 1879 if ( q1(i,j,1)*qe1(i,1) < 0. ) qe1(i,1) = 0.
1880 if ( q2(i,j,1)*qe2(i,1) < 0. ) qe2(i,1) = 0.
1882 if ( q1(i,j,km)*qe1(i,km+1) < 0. ) qe1(i,km+1) = 0.
1883 if ( q2(i,j,km)*qe2(i,km+1) < 0. ) qe2(i,km+1) = 0.
1889 q1e(i,j,k) = qe1(i,k)
1890 q2e(i,j,k) = qe2(i,k)
1897 subroutine nh_bc(ptop, grav, kappa, cp, delp, delzBC, pt, phis, &
1908 BC_step, BC_split, &
1909 npx, npy, npz, bounded_domain, pkc_pertn, computepk3, fullhalo, bd)
1913 integer,
intent(IN) :: npx, npy, npz
1914 logical,
intent(IN) :: pkc_pertn, computepk3, fullhalo, bounded_domain
1915 real,
intent(IN) :: ptop, kappa, cp, grav, BC_step, BC_split
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
1921 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz,*):: q
1924 real,
intent(IN),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: q_con
1926 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz):: cappa
1929 real,
intent(INOUT),
dimension(bd%isd:bd%ied,bd%jsd:bd%jed,npz+1):: gz, pkc, pk3
1933 real :: ptk, rgrav, rkap, peln1, rdg
1935 integer :: istart, iend
1937 integer :: is, ie, js, je
1938 integer :: isd, ied, jsd, jed
1949 if (.not. bounded_domain)
return 1953 call nh_bc_k(ptop, grav, kappa, cp, delp, delzbc%west_t0, delzbc%west_t1, pt, phis, &
1964 bc_step, bc_split, &
1965 pkc_pertn, computepk3, isd, ied, isd, 0, isd, 0, jsd, jed, jsd, jed, npz)
1969 if (ie == npx-1)
then 1971 call nh_bc_k(ptop, grav, kappa, cp, delp, delzbc%east_t0, delzbc%east_t1, pt, phis, &
1982 bc_step, bc_split, &
1983 pkc_pertn, computepk3, isd, ied, npx, ied, npx, ied, jsd, jed, jsd, jed, npz)
1992 if (ie == npx-1)
then 2000 call nh_bc_k(ptop, grav, kappa, cp, delp, delzbc%south_t0, delzbc%south_t1, pt, phis, &
2011 bc_step, bc_split, &
2012 pkc_pertn, computepk3, isd, ied, isd, ied, istart, iend, jsd, jed, jsd, 0, npz)
2016 if (je == npy-1)
then 2018 call nh_bc_k(ptop, grav, kappa, cp, delp, delzbc%north_t0, delzbc%north_t1, pt, phis, &
2029 bc_step, bc_split, &
2030 pkc_pertn, computepk3, isd, ied, isd, ied, istart, iend, jsd, jed, npy, jed, npz)
2033 end subroutine nh_bc 2035 subroutine nh_bc_k(ptop, grav, kappa, cp, delp, delzBC_t0, delzBC_t1, pt, phis, &
2046 BC_step, BC_split, &
2047 pkc_pertn, computepk3, isd, ied, isd_BC, ied_BC, istart, iend, jsd, jed, jstart, jend, npz)
2049 integer,
intent(IN) :: isd, ied, isd_BC, ied_BC, istart, iend, jsd, jed, jstart, jend, npz
2050 real,
intent(IN),
dimension(isd_BC:ied_BC,jstart:jend,npz) :: delzBC_t0, delzBC_t1
2051 real,
intent(IN) :: BC_step, BC_split
2053 logical,
intent(IN) :: pkc_pertn, computepk3
2054 real,
intent(IN) :: ptop, kappa, cp, grav
2055 real,
intent(IN) :: phis(isd:ied,jsd:jed)
2056 real,
intent(IN),
dimension(isd:ied,jsd:jed,npz):: pt, delp
2058 real,
intent(IN),
dimension(isd:ied,jsd:jed,npz,*):: q
2061 real,
intent(IN),
dimension(isd:ied,jsd:jed,npz):: q_con
2063 real,
intent(INOUT),
dimension(isd:ied,jsd:jed,npz):: cappa
2066 real,
intent(INOUT),
dimension(isd:ied,jsd:jed,npz+1):: gz, pkc, pk3
2070 real :: ptk, rgrav, rkap, peln1, rdg, denom
2072 real,
dimension(istart:iend, npz+1, jstart:jend ) :: pe, peln
2074 real,
dimension(istart:iend, npz+1 ) :: peg, pelng
2076 real,
dimension(istart:iend, npz) :: gam, bb, dd, pkz
2077 real,
dimension(istart:iend, npz-1) :: g_rat
2078 real,
dimension(istart:iend) :: bet
2079 real :: pm, delz_int
2082 real :: pealn, pebln, rpkz
2087 gama = 1./(1.-kappa)
2091 rdg = - rdgas * rgrav
2098 gz(i,j,npz+1) = phis(i,j)
2102 delz_int = (delzbc_t0(i,j,k)*(bc_split-bc_step) + bc_step*delzbc_t1(i,j,k))*denom
2103 gz(i,j,k) = gz(i,j,k+1) - delz_int*grav
2118 pe(i,k,j) = pe(i,k-1,j) + delp(i,j,k-1)
2119 peln(i,k,j) = log(pe(i,k,j))
2121 peg(i,k) = peg(i,k-1) + delp(i,j,k-1)*(1.-q_con(i,j,k-1))
2122 pelng(i,k) = log(peg(i,k))
2130 delz_int = (delzbc_t0(i,j,k)*(bc_split-bc_step) + bc_step*delzbc_t1(i,j,k))*denom
2134 pkz(i,k) = exp(1./(1.-cappa(i,j,k))*log(rdg*delp(i,j,k)/delz_int*pt(i,j,k)))
2138 pkz(i,k) = exp(gamax*log(-delp(i,j,k)*rgrav/delz_int*rdgas*pt(i,j,k)))
2140 pkz(i,k) = exp(gama*log(-delp(i,j,k)*rgrav/delz_int*rdgas*pt(i,j,k)))
2145 pm = (peg(i,k+1)-peg(i,k))/(pelng(i,k+1)-pelng(i,k))
2147 pm = delp(i,j,k)/(peln(i,k+1,j)-peln(i,k,j))
2150 pkz(i,k) = pkz(i,k) - pm
2157 g_rat(i,k) = delp(i,j,k)/delp(i,j,k+1)
2158 bb(i,k) = 2.*(1. + g_rat(i,k))
2159 dd(i,k) = 3.*(pkz(i,k) + g_rat(i,k)*pkz(i,k+1))
2166 pkc(i,j,2) = dd(i,1)/bet(i)
2168 dd(i,npz) = 3.*pkz(i,npz)
2172 gam(i,k) = g_rat(i,k-1)/bet(i)
2173 bet(i) = bb(i,k) - gam(i,k)
2174 pkc(i,j,k+1) = (dd(i,k) - pkc(i,j,k))/bet(i)
2179 pkc(i,j,k) = pkc(i,j,k) - gam(i,k)*pkc(i,j,k+1)
2181 if (abs(pkc(i,j,k)) > 1.e5)
then 2182 print*, mpp_pe(), i,j,k,
'PKC: ', pkc(i,j,k)
2193 if (.not. pkc_pertn)
then 2196 pkc(i,j,k) = pkc(i,j,k) + pe(i,k,j)
2202 if (computepk3)
then 2208 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)
subroutine, public fv_tp_2d(q, crx, cry, npx, npy, hord, fx, fy, xfx, yfx, gridstruct, bd, ra_x, ra_y, lim_fac, mfx, mfy, mass, nord, damp_c)
The subroutine 'fv_tp_2d' contains the FV advection scheme .
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") ...
subroutine, public nh_bc(ptop, grav, kappa, cp, delp, delzBC, pt, phis, pkc, gz, pk3, BC_step, BC_split, npx, npy, npz, bounded_domain, pkc_pertn, computepk3, fullhalo, bd)
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 nh_bc_k(ptop, grav, kappa, cp, delp, delzBC_t0, delzBC_t1, pt, phis, pkc, gz, pk3, BC_step, BC_split, pkc_pertn, computepk3, isd, ied, isd_BC, ied_BC, istart, iend, jsd, jed, jstart, jend, npz)
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 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)
pure real function, public vicvqd(q)
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, ws, rdt, gridstruct, bd, lim_fac)
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)