46 use constants_mod
, only: kappa, grav, cp_air, rdgas
48 use mpp_mod
, only: fatal, mpp_error
61 subroutine set_eta(km, ks, ptop, ak, bk, npz_type)
63 integer,
intent(in):: km
64 integer,
intent(out):: ks
65 real:: a60(61),b60(61)
68 data a60/300.0000, 430.00000, 558.00000, &
69 700.00000, 863.05803, 1051.07995, &
70 1265.75194, 1510.71101, 1790.05098, &
71 2108.36604, 2470.78817, 2883.03811, &
72 3351.46002, 3883.05187, 4485.49315, &
73 5167.14603, 5937.04991, 6804.87379, &
74 7780.84698, 8875.64338, 10100.20534, &
75 11264.35673, 12190.64366, 12905.42546, &
76 13430.87867, 13785.88765, 13986.77987, &
77 14047.96335, 13982.46770, 13802.40331, &
78 13519.33841, 13144.59486, 12689.45608, &
79 12165.28766, 11583.57006, 10955.84778, &
80 10293.60402, 9608.08306, 8910.07678, &
81 8209.70131, 7516.18560, 6837.69250, &
82 6181.19473, 5552.39653, 4955.72632, &
83 4394.37629, 3870.38682, 3384.76586, &
84 2937.63489, 2528.37666, 2155.78385, &
85 1818.20722, 1513.68173, 1240.03585, &
86 994.99144, 776.23591, 581.48797, &
87 408.53400, 255.26520, 119.70243, 0. /
89 data b60/0.00000, 0.00000, 0.00000, &
90 0.00000, 0.00000, 0.00000, &
91 0.00000, 0.00000, 0.00000, &
92 0.00000, 0.00000, 0.00000, &
93 0.00000, 0.00000, 0.00000, &
94 0.00000, 0.00000, 0.00000, &
95 0.00000, 0.00000, 0.00000, &
96 0.00201, 0.00792, 0.01755, &
97 0.03079, 0.04751, 0.06761, &
98 0.09097, 0.11746, 0.14690, &
99 0.17911, 0.21382, 0.25076, &
100 0.28960, 0.32994, 0.37140, &
101 0.41353, 0.45589, 0.49806, &
102 0.53961, 0.58015, 0.61935, &
103 0.65692, 0.69261, 0.72625, &
104 0.75773, 0.78698, 0.81398, &
105 0.83876, 0.86138, 0.88192, &
106 0.90050, 0.91722, 0.93223, &
107 0.94565, 0.95762, 0.96827, &
108 0.97771, 0.98608, 0.99347, 1./
109 real,
intent(out):: ak(km+1)
110 real,
intent(out):: bk(km+1)
111 real,
intent(out):: ptop
112 character(24),
intent(IN) :: npz_type
113 real pint, stretch_fac
115 real :: s_rate = -1.0
255 #ifdef MOUNTAIN_WAVES 258 if (s_rate > 0.)
then 259 call var_les(km, ak, bk, ptop, ks, pint, s_rate)
262 call var_hi2(km, ak, bk, ptop, ks, pint, stretch_fac)
263 elseif (km==5 .or. km==10 )
then 268 bk(k) =
real(k-1) /
real (km) 269 ak(k) = ptop*(1.-bk(k))
273 call var_hi(km, ak, bk, ptop, ks, pint, stretch_fac)
287 subroutine set_eta(km, ks, ptop, ak, bk, npz_type)
290 #include <tools/fv_eta.h> 292 integer,
intent(in):: km
293 integer,
intent(out):: ks
294 real,
intent(out):: ak(km+1)
295 real,
intent(out):: bk(km+1)
296 real,
intent(out):: ptop
297 character(24),
intent(IN) :: npz_type
303 real press(km+1), pt1(km)
305 integer :: var_fn = 0
307 real :: pint = 100.e2
308 real :: stretch_fac = 1.03
309 integer :: auto_routine = 0
316 if (trim(npz_type) ==
'superC' .or. trim(npz_type) ==
'superK')
then 364 bk(k) =
real(k-1) /
real (km) 365 ak(k) = ptop*(1.-bk(k))
391 if (trim(npz_type) ==
'lowtop')
then 404 if (trim(npz_type) ==
'old32')
then 410 elseif (trim(npz_type) ==
'lowtop')
then 449 if (trim(npz_type) ==
'lowtop')
then 477 if (trim(npz_type) ==
'lowtop')
then 481 elseif (trim(npz_type) ==
'meso')
then 486 elseif (trim(npz_type) ==
'meso2')
then 500 if (trim(npz_type) ==
'rce')
then 535 if (trim(npz_type) ==
'gfs')
then 541 else if (trim(npz_type) ==
'BCwave')
then 547 else if (trim(npz_type) ==
'meso')
then 563 if (trim(npz_type) ==
'meso')
then 569 elseif (trim(npz_type) ==
'hitop')
then 586 if (trim(npz_type) ==
'gfs')
then 620 if (trim(npz_type) ==
'gcrm')
then 682 if (trim(npz_type) ==
'hitop')
then 701 if(trim(npz_type) ==
'hitop')
then 704 elseif(trim(npz_type) ==
'midtop')
then 707 elseif(trim(npz_type) ==
'lowtop')
then 712 if (trim(npz_type) ==
'gfs')
then 714 elseif(trim(npz_type) ==
'les')
then 716 elseif(trim(npz_type) ==
'mountain_wave')
then 718 elseif (km > 79)
then 728 select case (auto_routine)
731 call var_hi(km, ak, bk, ptop, ks, pint, stretch_fac)
733 call var_hi2(km, ak, bk, ptop, ks, pint, stretch_fac)
735 call var_les(km, ak, bk, ptop, ks, pint, stretch_fac)
739 call var_dz(km, ak, bk, ptop, ks, pint, stretch_fac)
741 call var_gfs(km, ak, bk, ptop, ks, pint, stretch_fac)
747 if (is_master())
then 748 write(*,
'(A4, A13, A13, A11)')
'klev',
'ak',
'bk',
'p_ref' 750 write(*,
'(I4, F13.5, F13.5, F11.2)') k, ak(k), bk(k), 1000.e2*bk(k) + ak(k)
763 real,
intent(in) :: ak(:)
764 real,
intent(in) :: bk(:)
765 real,
intent(out) :: ptop
766 integer,
intent(out) :: ks
773 do k = 1,
size(bk(:))
774 if (bk(k).lt.eps) ks = k
778 if (is_master())
write(6,*)
' ptop & ks ', ptop, ks
783 subroutine var_les(km, ak, bk, ptop, ks, pint, s_rate)
785 integer,
intent(in):: km
786 real,
intent(in):: ptop
787 real,
intent(in):: s_rate
788 real,
intent(out):: ak(km+1), bk(km+1)
789 real,
intent(inout):: pint
790 integer,
intent(out):: ks
792 real,
parameter:: p00 = 1.e5
793 real,
dimension(km+1):: ze, pe1, peln, eta
794 real,
dimension(km):: dz, s_fac, dlnp, pm, dp, dk
795 real ztop, t0, dz0, sum1, tmp1
796 real ep, es, alpha, beta, gama
797 real,
parameter:: akap = 2./7.
806 peln(1) = log(pe1(1))
808 peln(km+1) = log(pe1(km+1))
811 ztop = rdgas/grav*t0*(peln(km+1) - peln(1))
813 s_inc = (1.-s0) /
real(k_inc)
816 do k=km-1, km-k_inc, -1
817 s_fac(k) = s_fac(k+1) + s_inc
820 s_fac(km-k_inc-1) = 0.5*(s_fac(km-k_inc) + s_rate)
822 do k=km-k_inc-2, 5, -1
823 s_fac(k) = s_rate * s_fac(k+1)
826 s_fac(4) = 0.5*(1.1+s_rate)*s_fac(5)
827 s_fac(3) = 1.1 *s_fac(4)
828 s_fac(2) = 1.1 *s_fac(3)
829 s_fac(1) = 1.1 *s_fac(2)
833 sum1 = sum1 + s_fac(k)
839 dz(k) = s_fac(k) * dz0
844 ze(k) = ze(k+1) + dz(k)
849 dz(k) = dz(k) * (ztop/ze(1))
853 ze(k) = ze(k+1) + dz(k)
857 if ( is_master() )
then 858 write(*,*)
'var_les: computed model top (m)=', ztop,
' bottom/top dz=', dz(km), dz(1)
864 call sm1_edge(1, 1, 1, 1, km, 1, 1, ze, 2)
868 dz(k) = ze(k) - ze(k+1)
869 dlnp(k) = grav*dz(k) / (rdgas*t0)
873 peln(k) = peln(k-1) + dlnp(k-1)
874 pe1(k) = exp(peln(k))
882 if ( pint < pe1(k))
then 887 if ( is_master() )
then 888 write(*,*)
'For (input) PINT=', 0.01*pint,
' KS=', ks,
'pint(computed)=', 0.01*pe1(ks+1)
893 eta(k) = pe1(k) / pe1(km+1)
899 alpha = (ep**2-2.*ep*es) / (es-ep)**2
900 beta = 2.*ep*es**2 / (es-ep)**2
901 gama = -(ep*es)**2 / (es-ep)**2
910 ak(k) = alpha*eta(k) + beta + gama/eta(k)
916 bk(k) = (pe1(k) - ak(k))/pe1(km+1)
920 if ( is_master() )
then 928 tmp1 = max(tmp1, (ak(k)-ak(k+1))/max(1.e-5, (bk(k+1)-bk(k))) )
930 write(*,*)
'Hybrid Sigma-P: minimum allowable surface pressure (hpa)=', tmp1/100.
931 write(*,800) (pm(k), k=km,1,-1)
935 dp(k) = (pe1(k+1) - pe1(k))/100.
936 dk(k) = pe1(k+1)**akap - pe1(k)**akap
939 800
format(1x,5(1x,f9.4))
945 subroutine var_gfs(km, ak, bk, ptop, ks, pint, s_rate)
946 integer,
intent(in):: km
947 real,
intent(in):: ptop
948 real,
intent(in):: s_rate
949 real,
intent(out):: ak(km+1), bk(km+1)
950 real,
intent(inout):: pint
951 integer,
intent(out):: ks
953 real,
parameter:: p00 = 1.e5
954 real,
dimension(km+1):: ze, pe1, peln, eta
955 real,
dimension(km):: dz, s_fac, dlnp
956 real ztop, t0, dz0, sum1, tmp1
957 real ep, es, alpha, beta, gama
966 peln(1) = log(pe1(1))
968 peln(km+1) = log(pe1(km+1))
971 ztop = rdgas/grav*t0*(peln(km+1) - peln(1))
973 s_inc = (1.-s0) /
real(k_inc)
976 do k=km-1, km-k_inc, -1
977 s_fac(k) = s_fac(k+1) + s_inc
980 do k=km-k_inc-1, 9, -1
981 s_fac(k) = s_rate * s_fac(k+1)
983 s_fac(8) = 0.5*(1.1+s_rate)*s_fac(9)
984 s_fac(7) = 1.10*s_fac(8)
985 s_fac(6) = 1.15*s_fac(7)
986 s_fac(5) = 1.20*s_fac(6)
987 s_fac(4) = 1.26*s_fac(5)
988 s_fac(3) = 1.33*s_fac(4)
989 s_fac(2) = 1.41*s_fac(3)
990 s_fac(1) = 1.60*s_fac(2)
994 sum1 = sum1 + s_fac(k)
1000 dz(k) = s_fac(k) * dz0
1005 ze(k) = ze(k+1) + dz(k)
1010 dz(k) = dz(k) * (ztop/ze(1))
1014 ze(k) = ze(k+1) + dz(k)
1018 if ( is_master() )
then 1019 write(*,*)
'var_gfs: computed model top (m)=', ztop*0.001,
' bottom/top dz=', dz(km), dz(1)
1029 dz(k) = ze(k) - ze(k+1)
1030 dlnp(k) = grav*dz(k) / (rdgas*t0)
1033 peln(k) = peln(k-1) + dlnp(k-1)
1034 pe1(k) = exp(peln(k))
1041 if ( pint < pe1(k))
then 1046 if ( is_master() )
then 1047 write(*,*)
'For (input) PINT=', 0.01*pint,
' KS=', ks,
'pint(computed)=', 0.01*pe1(ks+1)
1048 write(*,*)
'ptop =', ptop
1059 bk(k) = (pe1(k) - pint) / (pe1(km+1)-pint)
1060 ak(k) = pe1(k) - bk(k) * pe1(km+1)
1067 eta(k) = pe1(k) / pe1(km+1)
1073 alpha = (ep**2-2.*ep*es) / (es-ep)**2
1074 beta = 2.*ep*es**2 / (es-ep)**2
1075 gama = -(ep*es)**2 / (es-ep)**2
1084 ak(k) = alpha*eta(k) + beta + gama/eta(k)
1090 bk(k) = (pe1(k) - ak(k))/pe1(km+1)
1095 if ( is_master() )
then 1096 write(*,*)
'KS=', ks,
'PINT (mb)=', pint/100.
1098 write(*,*) k, 0.5*(pe1(k)+pe1(k+1))/100., dz(k)
1102 tmp1 = max(tmp1, (ak(k)-ak(k+1))/max(1.e-5, (bk(k+1)-bk(k))) )
1104 write(*,*)
'Hybrid Sigma-P: minimum allowable surface pressure (hpa)=', tmp1/100.
1109 subroutine var_hi(km, ak, bk, ptop, ks, pint, s_rate)
1110 integer,
intent(in):: km
1111 real,
intent(in):: ptop
1112 real,
intent(in):: s_rate
1113 real,
intent(out):: ak(km+1), bk(km+1)
1114 real,
intent(inout):: pint
1115 integer,
intent(out):: ks
1117 real,
parameter:: p00 = 1.e5
1118 real,
dimension(km+1):: ze, pe1, peln, eta
1119 real,
dimension(km):: dz, s_fac, dlnp
1120 real ztop, t0, dz0, sum1, tmp1
1121 real ep, es, alpha, beta, gama
1123 integer:: k_inc = 15
1130 peln(1) = log(pe1(1))
1132 peln(km+1) = log(pe1(km+1))
1135 ztop = rdgas/grav*t0*(peln(km+1) - peln(1))
1137 s_inc = (1.-s0) /
real(k_inc)
1140 do k=km-1, km-k_inc, -1
1141 s_fac(k) = s_fac(k+1) + s_inc
1144 s_fac(km-k_inc-1) = 0.5*(s_fac(km-k_inc) + s_rate)
1147 do k=km-k_inc-2, 4, -1
1148 s_fac(k) = s_rate * s_fac(k+1)
1150 s_fac(3) = 0.5*(1.15+s_rate)*s_fac(4)
1151 s_fac(2) = 1.15 *s_fac(3)
1152 s_fac(1) = 1.3 *s_fac(2)
1154 do k=km-k_inc-2, 9, -1
1155 s_fac(k) = s_rate * s_fac(k+1)
1158 s_fac(8) = 0.5*(1.1+s_rate)*s_fac(9)
1159 s_fac(7) = 1.1 *s_fac(8)
1160 s_fac(6) = 1.15*s_fac(7)
1161 s_fac(5) = 1.2 *s_fac(6)
1162 s_fac(4) = 1.3 *s_fac(5)
1163 s_fac(3) = 1.4 *s_fac(4)
1164 s_fac(2) = 1.45 *s_fac(3)
1165 s_fac(1) = 1.5 *s_fac(2)
1170 sum1 = sum1 + s_fac(k)
1176 dz(k) = s_fac(k) * dz0
1181 ze(k) = ze(k+1) + dz(k)
1186 dz(k) = dz(k) * (ztop/ze(1))
1190 ze(k) = ze(k+1) + dz(k)
1194 if ( is_master() )
then 1195 write(*,*)
'var_hi: computed model top (m)=', ztop*0.001,
' bottom/top dz=', dz(km), dz(1)
1201 call sm1_edge(1, 1, 1, 1, km, 1, 1, ze, 1)
1205 dz(k) = ze(k) - ze(k+1)
1206 dlnp(k) = grav*dz(k) / (rdgas*t0)
1209 peln(k) = peln(k-1) + dlnp(k-1)
1210 pe1(k) = exp(peln(k))
1217 if ( pint < pe1(k))
then 1222 if ( is_master() )
then 1223 write(*,*)
'For (input) PINT=', 0.01*pint,
' KS=', ks,
'pint(computed)=', 0.01*pe1(ks+1)
1224 write(*,*)
'ptop =', ptop
1235 bk(k) = (pe1(k) - pint) / (pe1(km+1)-pint)
1236 ak(k) = pe1(k) - bk(k) * pe1(km+1)
1243 eta(k) = pe1(k) / pe1(km+1)
1249 alpha = (ep**2-2.*ep*es) / (es-ep)**2
1250 beta = 2.*ep*es**2 / (es-ep)**2
1251 gama = -(ep*es)**2 / (es-ep)**2
1260 ak(k) = alpha*eta(k) + beta + gama/eta(k)
1266 bk(k) = (pe1(k) - ak(k))/pe1(km+1)
1271 if ( is_master() )
then 1272 write(*,*)
'KS=', ks,
'PINT (mb)=', pint/100.
1274 write(*,*) k, 0.5*(pe1(k)+pe1(k+1))/100., dz(k)
1278 tmp1 = max(tmp1, (ak(k)-ak(k+1))/max(1.e-5, (bk(k+1)-bk(k))) )
1280 write(*,*)
'Hybrid Sigma-P: minimum allowable surface pressure (hpa)=', tmp1/100.
1285 subroutine var_hi2(km, ak, bk, ptop, ks, pint, s_rate)
1286 integer,
intent(in):: km
1287 real,
intent(in):: ptop
1288 real,
intent(in):: s_rate
1289 real,
intent(out):: ak(km+1), bk(km+1)
1290 real,
intent(inout):: pint
1291 integer,
intent(out):: ks
1293 real,
parameter:: p00 = 1.e5
1294 real,
dimension(km+1):: ze, pe1, peln, eta
1295 real,
dimension(km):: dz, s_fac, dlnp
1296 real ztop, t0, dz0, sum1, tmp1
1297 real ep, es, alpha, beta, gama
1301 peln(1) = log(pe1(1))
1303 peln(km+1) = log(pe1(km+1))
1306 ztop = rdgas/grav*t0*(peln(km+1) - peln(1))
1318 s_fac(km-10) = 0.5*(s_fac(km-9) + s_rate)
1321 s_fac(k) = s_rate * s_fac(k+1)
1324 s_fac(7) = 0.5*(1.1+s_rate)*s_fac(9)
1325 s_fac(6) = 1.05*s_fac(7)
1326 s_fac(5) = 1.1*s_fac(6)
1327 s_fac(4) = 1.15*s_fac(5)
1328 s_fac(3) = 1.2*s_fac(4)
1329 s_fac(2) = 1.3*s_fac(3)
1330 s_fac(1) = 1.4*s_fac(2)
1334 sum1 = sum1 + s_fac(k)
1340 dz(k) = s_fac(k) * dz0
1345 ze(k) = ze(k+1) + dz(k)
1350 dz(k) = dz(k) * (ztop/ze(1))
1354 ze(k) = ze(k+1) + dz(k)
1358 if ( is_master() )
write(*,*)
'var_hi2: computed model top (m)=', ztop*0.001,
' bottom/top dz=', dz(km), dz(1)
1359 call sm1_edge(1, 1, 1, 1, km, 1, 1, ze, 1)
1363 dz(k) = ze(k) - ze(k+1)
1364 dlnp(k) = grav*dz(k) / (rdgas*t0)
1367 peln(k) = peln(k-1) + dlnp(k-1)
1368 pe1(k) = exp(peln(k))
1375 if ( pint < pe1(k))
then 1380 if ( is_master() )
then 1381 write(*,*)
'For (input) PINT=', 0.01*pint,
' KS=', ks,
'pint(computed)=', 0.01*pe1(ks+1)
1392 bk(k) = (pe1(k) - pint) / (pe1(km+1)-pint)
1393 ak(k) = pe1(k) - bk(k) * pe1(km+1)
1400 eta(k) = pe1(k) / pe1(km+1)
1406 alpha = (ep**2-2.*ep*es) / (es-ep)**2
1407 beta = 2.*ep*es**2 / (es-ep)**2
1408 gama = -(ep*es)**2 / (es-ep)**2
1417 ak(k) = alpha*eta(k) + beta + gama/eta(k)
1423 bk(k) = (pe1(k) - ak(k))/pe1(km+1)
1428 if ( is_master() )
then 1429 write(*,*)
'KS=', ks,
'PINT (mb)=', pint/100.
1431 write(*,*) k, 0.5*(pe1(k)+pe1(k+1))/100., dz(k)
1435 tmp1 = max(tmp1, (ak(k)-ak(k+1))/max(1.e-5, (bk(k+1)-bk(k))) )
1437 write(*,*)
'Hybrid Sigma-P: minimum allowable surface pressure (hpa)=', tmp1/100.
1444 subroutine var_dz(km, ak, bk, ptop, ks, pint, s_rate)
1445 integer,
intent(in):: km
1446 real,
intent(in):: ptop
1447 real,
intent(in):: s_rate
1448 real,
intent(out):: ak(km+1), bk(km+1)
1449 real,
intent(inout):: pint
1450 integer,
intent(out):: ks
1452 real,
parameter:: p00 = 1.e5
1453 real,
dimension(km+1):: ze, pe1, peln, eta
1454 real,
dimension(km):: dz, s_fac, dlnp
1455 real ztop, t0, dz0, sum1, tmp1
1456 real ep, es, alpha, beta, gama
1460 peln(1) = log(pe1(1))
1462 peln(km+1) = log(pe1(km+1))
1465 ztop = rdgas/grav*t0*(peln(km+1) - peln(1))
1477 s_fac(km-10) = 0.5*(s_fac(km-9) + s_rate)
1480 s_fac(k) = min(10.0, s_rate * s_fac(k+1) )
1483 s_fac(8) = 0.5*(1.1+s_rate)*s_fac(9)
1484 s_fac(7) = 1.1 *s_fac(8)
1485 s_fac(6) = 1.15*s_fac(7)
1486 s_fac(5) = 1.2 *s_fac(6)
1487 s_fac(4) = 1.3 *s_fac(5)
1488 s_fac(3) = 1.4 *s_fac(4)
1489 s_fac(2) = 1.5 *s_fac(3)
1490 s_fac(1) = 1.6 *s_fac(2)
1494 sum1 = sum1 + s_fac(k)
1500 dz(k) = s_fac(k) * dz0
1505 ze(k) = ze(k+1) + dz(k)
1510 dz(k) = dz(k) * (ztop/ze(1))
1514 ze(k) = ze(k+1) + dz(k)
1518 if ( is_master() )
write(*,*)
'var_dz: computed model top (m)=', ztop*0.001,
' bottom/top dz=', dz(km), dz(1)
1519 call sm1_edge(1, 1, 1, 1, km, 1, 1, ze, 1)
1523 dz(k) = ze(k) - ze(k+1)
1524 dlnp(k) = grav*dz(k) / (rdgas*t0)
1527 peln(k) = peln(k-1) + dlnp(k-1)
1528 pe1(k) = exp(peln(k))
1535 if ( pint < pe1(k))
then 1540 if ( is_master() )
then 1541 write(*,*)
'For (input) PINT=', 0.01*pint,
' KS=', ks,
'pint(computed)=', 0.01*pe1(ks+1)
1542 write(*,*)
'ptop =', ptop
1553 bk(k) = (pe1(k) - pint) / (pe1(km+1)-pint)
1554 ak(k) = pe1(k) - bk(k) * pe1(km+1)
1561 eta(k) = pe1(k) / pe1(km+1)
1567 alpha = (ep**2-2.*ep*es) / (es-ep)**2
1568 beta = 2.*ep*es**2 / (es-ep)**2
1569 gama = -(ep*es)**2 / (es-ep)**2
1578 ak(k) = alpha*eta(k) + beta + gama/eta(k)
1584 bk(k) = (pe1(k) - ak(k))/pe1(km+1)
1589 if ( is_master() )
then 1590 write(*,*)
'KS=', ks,
'PINT (mb)=', pint/100.
1592 write(*,*) k, 0.5*(pe1(k)+pe1(k+1))/100., dz(k)
1596 tmp1 = max(tmp1, (ak(k)-ak(k+1))/max(1.e-5, (bk(k+1)-bk(k))) )
1598 write(*,*)
'Hybrid Sigma-P: minimum allowable surface pressure (hpa)=', tmp1/100.
1605 subroutine var55_dz(km, ak, bk, ptop, ks, pint, s_rate)
1606 integer,
intent(in):: km
1607 real,
intent(in):: ptop
1608 real,
intent(in):: s_rate
1609 real,
intent(out):: ak(km+1), bk(km+1)
1610 real,
intent(inout):: pint
1611 integer,
intent(out):: ks
1613 real,
parameter:: p00 = 1.e5
1614 real,
dimension(km+1):: ze, pe1, peln, eta
1615 real,
dimension(km):: dz, s_fac, dlnp
1616 real ztop, t0, dz0, sum1, tmp1
1617 real ep, es, alpha, beta, gama
1621 peln(1) = log(pe1(1))
1623 peln(km+1) = log(pe1(km+1))
1626 ztop = rdgas/grav*t0*(peln(km+1) - peln(1))
1644 s_fac(k) = min(10.0, s_rate * s_fac(k+1) )
1647 s_fac(8) = 0.5*(1.1+s_rate)*s_fac(9)
1648 s_fac(7) = 1.1 *s_fac(8)
1649 s_fac(6) = 1.15*s_fac(7)
1650 s_fac(5) = 1.2 *s_fac(6)
1651 s_fac(4) = 1.3 *s_fac(5)
1652 s_fac(3) = 1.4 *s_fac(4)
1653 s_fac(2) = 1.5 *s_fac(3)
1654 s_fac(1) = 1.6 *s_fac(2)
1658 sum1 = sum1 + s_fac(k)
1664 dz(k) = s_fac(k) * dz0
1669 ze(k) = ze(k+1) + dz(k)
1674 dz(k) = dz(k) * (ztop/ze(1))
1678 ze(k) = ze(k+1) + dz(k)
1682 if ( is_master() )
write(*,*)
'var55_dz: computed model top (m)=', ztop*0.001,
' bottom/top dz=', dz(km), dz(1)
1683 call sm1_edge(1, 1, 1, 1, km, 1, 1, ze, 2)
1687 dz(k) = ze(k) - ze(k+1)
1688 dlnp(k) = grav*dz(k) / (rdgas*t0)
1691 peln(k) = peln(k-1) + dlnp(k-1)
1692 pe1(k) = exp(peln(k))
1699 if ( pint < pe1(k))
then 1704 if ( is_master() )
then 1705 write(*,*)
'For (input) PINT=', 0.01*pint,
' KS=', ks,
'pint(computed)=', 0.01*pe1(ks+1)
1716 bk(k) = (pe1(k) - pint) / (pe1(km+1)-pint)
1717 ak(k) = pe1(k) - bk(k) * pe1(km+1)
1724 eta(k) = pe1(k) / pe1(km+1)
1730 alpha = (ep**2-2.*ep*es) / (es-ep)**2
1731 beta = 2.*ep*es**2 / (es-ep)**2
1732 gama = -(ep*es)**2 / (es-ep)**2
1741 ak(k) = alpha*eta(k) + beta + gama/eta(k)
1747 bk(k) = (pe1(k) - ak(k))/pe1(km+1)
1752 if ( is_master() )
then 1753 write(*,*)
'KS=', ks,
'PINT (mb)=', pint/100.
1755 write(*,*) k, 0.5*(pe1(k)+pe1(k+1))/100., dz(k)
1759 tmp1 = max(tmp1, (ak(k)-ak(k+1))/max(1.e-5, (bk(k+1)-bk(k))) )
1761 write(*,*)
'Hybrid Sigma-P: minimum allowable surface pressure (hpa)=', tmp1/100.
1768 integer,
intent(in):: km
1769 real,
intent(in):: s_rate
1770 real,
intent(in):: ztop
1771 real,
intent(out):: dz(km)
1773 real,
parameter:: p00 = 1.e5
1774 real,
dimension(km+1):: ze, pe1, peln, eta
1775 real,
dimension(km):: s_fac, dlnp
1776 real t0, dz0, sum1, tmp1
1777 real ep, es, alpha, beta, gama
1792 s_fac(k) = min(4.0, s_rate * s_fac(k+1) )
1795 s_fac(8) = 1.05*s_fac(9)
1796 s_fac(7) = 1.1 *s_fac(8)
1797 s_fac(6) = 1.15*s_fac(7)
1798 s_fac(5) = 1.2 *s_fac(6)
1799 s_fac(4) = 1.3 *s_fac(5)
1800 s_fac(3) = 1.4 *s_fac(4)
1801 s_fac(2) = 1.5 *s_fac(3)
1802 s_fac(1) = 1.6 *s_fac(2)
1806 sum1 = sum1 + s_fac(k)
1812 dz(k) = s_fac(k) * dz0
1817 ze(k) = ze(k+1) + dz(k)
1822 call sm1_edge(1, 1, 1, 1, km, 1, 1, ze, 2)
1825 dz(k) = ze(k) - ze(k+1)
1833 integer,
intent(in) :: npz
1834 real,
intent(in) :: p_s
1835 real,
intent(in) :: ak(npz+1)
1836 real,
intent(in) :: bk(npz+1)
1837 real,
intent(in),
optional :: pscale
1838 real,
intent(out) :: pf(npz)
1839 real,
intent(out) :: ph(npz+1)
1844 ph(k) = ak(k) + bk(k)*p_s
1847 if (
present(pscale) )
then 1849 ph(k) = pscale*ph(k)
1853 if( ak(1) > 1.e-8 )
then 1854 pf(1) = (ph(2) - ph(1)) / log(ph(2)/ph(1))
1856 pf(1) = (ph(2) - ph(1)) * kappa/(kappa+1.)
1860 pf(k) = (ph(k+1) - ph(k)) / log(ph(k+1)/ph(k))
1869 integer,
intent(in):: km
1870 real,
intent(in):: ztop
1871 real,
intent(out):: dz(km)
1873 real ze(km+1), dzt(km)
1878 dz(1) = ztop /
real(km) 1890 ze(k) = ze(k+1) + dz(k)
1893 if ( is_master() )
then 1894 write(*,*)
'Hybrid_z: dz, zm' 1896 dzt(k) = 0.5*(ze(k)+ze(k+1)) / 1000.
1897 write(*,*) k, dz(k), dzt(k)
1905 integer,
intent(in):: km
1906 real,
intent(in):: ztop
1907 real,
intent(out):: dz(km)
1909 real,
parameter:: s_rate = 1.0
1927 s_fac(k) = s_rate * s_fac(k+1)
1930 s_fac(8) = 1.05*s_fac(9)
1931 s_fac(7) = 1.1 *s_fac(8)
1932 s_fac(6) = 1.15*s_fac(7)
1933 s_fac(5) = 1.2 *s_fac(6)
1934 s_fac(4) = 1.3 *s_fac(5)
1935 s_fac(3) = 1.4 *s_fac(4)
1936 s_fac(2) = 1.5 *s_fac(3)
1937 s_fac(1) = 1.6 *s_fac(2)
1941 sum1 = sum1 + s_fac(k)
1947 dz(k) = s_fac(k) * dz0
1953 ze(k) = ze(k+1) + dz(k)
1958 dz(k) = dz(k) * (ztop/ze(1))
1962 ze(k) = ze(k+1) + dz(k)
1965 call sm1_edge(1, 1, 1, 1, km, 1, 1, ze, 2)
1968 dz(k) = ze(k) - ze(k+1)
1975 integer,
intent(in):: km
1976 real,
intent(out):: dz(km)
1977 real,
intent(out):: ztop
1983 integer k, k0, k1, k2, n
2004 ze(3) = ze(2) + dz(2)
2006 dz1 = 2.*(z1-ze(3) - k1*dz0) / (k1*(k1-1))
2009 dz(k) = dz0 + (k-k0)*dz1
2010 ze(k+1) = ze(k) + dz(k)
2014 dz2 = 2.*(z2-ze(k0+k1+1)-k2*dz0) / (k2*(k2-1))
2016 do k=k0+k1+1,k0+k1+k2
2017 dz(k) = dz0 + (k-k0-k1)*dz2
2018 ze(k+1) = ze(k) + dz(k)
2021 dz(km) = 2.*dz(km-1)
2022 ztop = ze(km) + dz(km)
2023 ze(km+1) = ze(km) + dz(km)
2025 call zflip (dz, 1, km)
2029 ze(k) = ze(k+1) + dz(k)
2044 integer,
intent(in):: km
2045 real,
intent(out):: dz(km)
2046 real,
intent(out):: ztop
2050 real:: stretch_f = 1.16
2061 ze(k) = ze(k+1) + dz(k)
2065 dz(k) = stretch_f * dz(k+1)
2066 ze(k) = ze(k+1) + dz(k)
2070 ze(1) = ze(2) + dz(1)
2073 if ( is_master() )
then 2074 write(*,*)
'Hybrid_z: dz, ze' 2076 write(*,*) k, 0.001*dz(k), 0.001*ze(k)
2079 write(*,*)
'ztop (km) =', ztop * 0.001
2084 subroutine set_hybrid_z(is, ie, js, je, ng, km, ztop, dz, rgrav, hs, ze, dz3)
2086 integer,
intent(in):: is, ie, js, je, ng, km
2087 real,
intent(in):: rgrav, ztop
2088 real,
intent(in):: dz(km)
2089 real,
intent(in):: hs(is-ng:ie+ng,js-ng:je+ng)
2090 real,
intent(inout):: ze(is:ie,js:je,km+1)
2091 real,
optional,
intent(out):: dz3(is-ng:ie+ng,js-ng:je+ng,km)
2093 logical:: filter_xy = .false.
2094 real,
allocatable:: delz(:,:,:)
2097 real:: z1(is:ie,js:je)
2100 integer ks(is:ie,js:je)
2101 integer i, j, k, ks_min, kint
2105 z(k) = z(k+1) + dz(k)
2111 ze(i,j,km+1) = hs(i,j) * rgrav
2124 #ifndef USE_VAR_ZINT 2129 if ( z(k)<=zint )
then 2135 if ( is_master() )
write(*,*)
'Z_coord interface set at k=',kint,
' ZE=', z(kint)
2139 z_rat = (ze(i,j,kint)-ze(i,j,km+1)) / (z(kint)-z(km+1))
2141 ze(i,j,k) = ze(i,j,k+1) + dz(k)*z_rat
2146 call sm1_edge(is, ie, js, je, km, i, j, ze, ntimes)
2154 z1(i,j) = dim(ze(i,j,km+1), 2500.) + 7500.
2162 if ( z(k)>=z1(i,j) )
then 2164 ks_min = min(ks_min, k)
2175 z_rat = (ze(i,j,kint)-ze(i,j,km+1)) / (z(kint)-z(km+1))
2177 ze(i,j,k) = ze(i,j,k+1) + dz(k)*z_rat
2182 call sm1_edge(is, ie, js, je, km, i, j, ze, ntimes)
2188 if ( filter_xy )
then 2189 allocate (delz(isd:ied, jsd:jed, km) )
2194 delz(i,j,k) = ze(i,j,k+1) - ze(i,j,k)
2198 call del2_cubed(delz, 0.2*da_min, npx, npy, km, ntimes)
2202 ze(i,j,k) = ze(i,j,k+1) - delz(i,j,k)
2209 if (
present(dz3) )
then 2213 dz3(i,j,k) = ze(i,j,k+1) - ze(i,j,k)
2222 subroutine sm1_edge(is, ie, js, je, km, i, j, ze, ntimes)
2223 integer,
intent(in):: is, ie, js, je, km
2224 integer,
intent(in):: ntimes, i, j
2225 real,
intent(inout):: ze(is:ie,js:je,km+1)
2227 real,
parameter:: df = 0.25
2230 integer k, n, k1, k2
2234 dz(k) = ze(i,j,k+1) - ze(i,j,k)
2243 flux(k) = df*(dz(k) - dz(k-1))
2247 dz(k) = dz(k) - flux(k) + flux(k+1)
2252 ze(i,j,k) = ze(i,j,k+1) - dz(k)
2259 subroutine gw_1d(km, p0, ak, bk, ptop, ztop, pt1)
2260 integer,
intent(in):: km
2261 real,
intent(in):: p0, ztop
2262 real,
intent(inout):: ptop
2263 real,
intent(inout):: ak(km+1), bk(km+1)
2264 real,
intent(out):: pt1(km)
2266 logical:: isothermal
2267 real,
dimension(km+1):: ze, pe1, pk1
2268 real,
dimension(km):: dz1
2273 isothermal = .false.
2276 if ( isothermal )
then 2277 n2 = grav**2/(cp_air*t0)
2282 s0 = grav*grav / (cp_air*n2)
2286 dz1(k) = ztop /
real(km)
2287 ze(k) = ze(k+1) + dz1(k)
2292 pe1(k) = p0*( (1.-s0/t0) + s0/t0*exp(-n2*ze(k)/grav) )**(1./kappa)
2302 bk(k) = (pe1(k) - pe1(1)) / (pe1(km+1)-pe1(1))
2303 ak(k) = pe1(1)*(1.-bk(k))
2309 pk1(k) = pe1(k) ** kappa
2314 pt1(k) = grav*dz1(k) / ( cp_air*(pk1(k+1)-pk1(k)) )
2317 end subroutine gw_1d 2319 subroutine mount_waves(km, ak, bk, ptop, ks, pint)
2320 integer,
intent(in):: km
2321 real,
intent(out):: ak(km+1), bk(km+1)
2322 real,
intent(out):: ptop, pint
2323 integer,
intent(out):: ks
2325 real,
parameter:: p00 = 1.e5
2326 real,
dimension(km+1):: ze, pe1, peln, eta
2327 real,
dimension(km):: dz, dlnp
2328 real ztop, t0, dz0, sum1, tmp1
2329 real ep, es, alpha, beta, gama, s_fac
2335 if ( km <= 60 )
then 2354 ze(k) = ze(k+1) + dz0
2360 ze(k) = ze(k+1) + dz0
2362 ze(2) = ze(3) + sqrt(2.)*dz0
2363 ze(1) = ze(2) + 2.0*dz0
2369 dz(k) = ze(k) - ze(k+1)
2370 dlnp(k) = grav*dz(k) / (rdgas*t0)
2374 peln(km+1) = log(p00)
2376 peln(k) = peln(k+1) - dlnp(k)
2377 pe1(k) = exp(peln(k))
2387 if ( pint < pe1(k))
then 2393 if ( is_master() )
then 2394 write(*,*)
'For (input) PINT=', 0.01*pint,
' KS=', ks,
'pint(computed)=', 0.01*pe1(ks+1)
2395 write(*,*)
'Modified ptop =', ptop,
' ztop=', ze(1)/1000.
2397 write(*,*) k,
'ze =', ze(k)/1000.
2409 bk(k) = (pe1(k) - pint) / (pe1(km+1)-pint)
2410 ak(k) = pe1(k) - bk(k) * pe1(km+1)
2417 eta(k) = pe1(k) / pe1(km+1)
2422 alpha = (ep**2-2.*ep*es) / (es-ep)**2
2423 beta = 2.*ep*es**2 / (es-ep)**2
2424 gama = -(ep*es)**2 / (es-ep)**2
2433 ak(k) = alpha*eta(k) + beta + gama/eta(k)
2439 bk(k) = (pe1(k) - ak(k))/pe1(km+1)
2444 if ( is_master() )
then 2447 tmp1 = max(tmp1, (ak(k)-ak(k+1))/max(1.e-5, (bk(k+1)-bk(k))) )
2449 write(*,*)
'Hybrid Sigma-P: minimum allowable surface pressure (hpa)=', tmp1/100.
2455 subroutine zflip(q, im, km)
2456 integer,
intent(in):: im, km
2457 real,
intent(inout):: q(im,km)
2465 q(i,k) = q(i,km+1-k)
2470 end subroutine zflip subroutine, public sm1_edge(is, ie, js, je, km, i, j, ze, ntimes)
The module 'fv_mp_mod' is a single program multiple data (SPMD) parallel decompostion/communication m...
subroutine, public hybrid_z_dz(km, dz, ztop, s_rate)
subroutine var_hi2(km, ak, bk, ptop, ks, pint, s_rate)
subroutine var_les(km, ak, bk, ptop, ks, pint, s_rate)
subroutine, public get_eta_level(npz, p_s, pf, ph, ak, bk, pscale)
The subroutine 'get_eta_level' returns the interface and layer-mean pressures for reference...
subroutine, public set_hybrid_z(is, ie, js, je, ng, km, ztop, dz, rgrav, hs, ze, dz3)
subroutine, public gw_1d(km, p0, ak, bk, ptop, ztop, pt1)
subroutine var55_dz(km, ak, bk, ptop, ks, pint, s_rate)
subroutine, public compute_dz(km, ztop, dz)
subroutine, public compute_dz_l32(km, ztop, dz)
subroutine zflip(q, im, km)
subroutine, public set_external_eta(ak, bk, ptop, ks)
The subroutine 'set_external_eta' sets 'ptop' (model top) and 'ks' (first level of pure pressure coor...
subroutine, public set_eta(km, ks, ptop, ak, bk, npz_type)
The module 'fv_eta' contains routine to set up the reference (Eulerian) pressure coordinate.
subroutine, public compute_dz_var(km, ztop, dz)
subroutine var_gfs(km, ak, bk, ptop, ks, pint, s_rate)
subroutine var_dz(km, ak, bk, ptop, ks, pint, s_rate)
subroutine mount_waves(km, ak, bk, ptop, ks, pint)
subroutine var_hi(km, ak, bk, ptop, ks, pint, s_rate)
subroutine, public compute_dz_l101(km, ztop, dz)