25 integer,
parameter :: nl = 101
27 real,
parameter ::
pstd(nl) = (/0.0050, 0.0161, 0.0384, 0.0769, 0.1370, &
28 0.2244, 0.3454, 0.5064, 0.7140, 0.9753, 1.2972,&
29 1.6872, 2.1526, 2.7009, 3.3398, 4.0770, 4.9204,&
30 5.8776, 6.9567, 8.1655, 9.5119, 11.0038, 12.6492,&
31 14.4559, 16.4318, 18.5847, 20.9224, 23.4526, 26.1829,&
32 29.1210, 32.2744, 35.6505, 39.2566, 43.1001, 47.1882,&
33 51.5278, 56.1260, 60.9895, 66.1253, 71.5398, 77.2396,&
34 83.2310, 89.5204, 96.1138, 103.0172, 110.2366, 117.7775,&
35 125.6456, 133.8462, 142.3848, 151.2664, 160.4959, 170.0784,&
36 180.0183, 190.3203, 200.9887, 212.0277, 223.4415, 235.2338,&
37 247.4085, 259.9691, 272.9191, 286.2617, 300.0000, 314.1369,&
38 328.6753, 343.6176, 358.9665, 374.7241, 390.8926, 407.4738,&
39 424.4698, 441.8819, 459.7118, 477.9607, 496.6298, 515.7200,&
40 535.2322, 555.1669, 575.5248, 596.3062, 617.5112, 639.1398,&
41 661.1920, 683.6673, 706.5654, 729.8857, 753.6275, 777.7897,&
42 802.3714, 827.3713, 852.7880, 878.6201, 904.8659, 931.5236,&
43 958.5911, 986.0666, 1013.9476, 1042.2319, 1070.9170, 1100.0000/)
46 real,
parameter ::
tstd(nl) = (/190.19, 203.65, 215.30, 226.87, 237.83, &
47 247.50, 256.03, 263.48, 267.09, 270.37, 266.42, 261.56, 256.40, &
48 251.69, 247.32, 243.27, 239.56, 236.07, 232.76, 230.67, 228.71, &
49 227.35, 226.29, 225.28, 224.41, 223.61, 222.85, 222.12, 221.42, &
50 220.73, 220.07, 219.44, 218.82, 218.23, 217.65, 217.18, 216.91, &
51 216.70, 216.70, 216.70, 216.70, 216.70, 216.70, 216.70, 216.70, &
52 216.70, 216.70, 216.70, 216.70, 216.70, 216.70, 216.70, 216.71, &
53 216.71, 216.72, 216.81, 217.80, 218.77, 219.72, 220.66, 222.51, &
54 224.57, 226.59, 228.58, 230.61, 232.61, 234.57, 236.53, 238.48, &
55 240.40, 242.31, 244.21, 246.09, 247.94, 249.78, 251.62, 253.45, &
56 255.26, 257.04, 258.80, 260.55, 262.28, 264.02, 265.73, 267.42, &
57 269.09, 270.77, 272.43, 274.06, 275.70, 277.32, 278.92, 280.51, &
58 282.08, 283.64, 285.20, 286.74, 288.25, 289.75, 291.22, 292.68/)
60 real,
parameter ::
wstd(nl) = (/ 0.001, 0.001, 0.002, 0.003, 0.003, &
61 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, &
62 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, &
63 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, &
64 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, &
65 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, 0.003, &
66 0.003, 0.003, 0.004, 0.004, 0.005, 0.005, 0.007, 0.009, &
67 0.011, 0.012, 0.014, 0.020, 0.025, 0.030, 0.035, 0.047, &
68 0.061, 0.075, 0.089, 0.126, 0.162, 0.197, 0.235, 0.273, &
69 0.310, 0.356, 0.410, 0.471, 0.535, 0.601, 0.684, 0.784, &
70 0.886, 0.987, 1.094, 1.225, 1.353, 1.519, 1.686, 1.852, &
71 2.036, 2.267, 2.496, 2.721, 2.947, 3.170, 3.391, 3.621, &
72 3.848, 4.084, 4.333, 4.579, 4.822, 5.061, 5.296, 5.528/)
74 real,
parameter ::
ostd(nl) = (/0.47330,0.27695,0.28678,0.51816,0.83229, &
75 1.18466,1.69647,2.16633,3.00338,3.76287,4.75054,5.61330,6.33914, &
76 7.03675,7.50525,7.75612,7.81607,7.69626,7.56605,7.28440,7.01002, &
77 6.72722,6.44629,6.17714,5.92914,5.69481,5.47387,5.26813,5.01252, &
78 4.68941,4.35141,4.01425,3.68771,3.37116,3.06407,2.77294,2.50321, &
79 2.24098,1.98592,1.74840,1.54451,1.34582,1.17824,1.02513,0.89358, &
80 0.78844,0.69683,0.62654,0.55781,0.50380,0.45515,0.42037,0.38632, &
81 0.35297,0.32029,0.28832,0.25756,0.22739,0.19780,0.16877,0.14901, &
82 0.13190,0.11511,0.09861,0.08818,0.07793,0.06786,0.06146,0.05768, &
83 0.05396,0.05071,0.04803,0.04548,0.04301,0.04081,0.03983,0.03883, &
84 0.03783,0.03685,0.03588,0.03491,0.03395,0.03368,0.03349,0.03331, &
85 0.03313,0.03292,0.03271,0.03251,0.03190,0.03126,0.03062,0.02990, &
86 0.02918,0.02850,0.02785,0.02721,0.02658,0.02596,0.02579,0.02579/)
89 integer,
parameter ::
fnm = 101-1
92 integer,
parameter ::
fnm = 66-1
99 integer,
parameter ::
fnr = 10
109 integer,
parameter ::
fnr = 8
119 integer,
parameter ::
fnr = 22
128 integer,
parameter ::
fnr = 13
173 real function secant (z)
175 real,
intent(in) :: z
177 secant = 1./cos(0.01745329*z)
182 subroutine calpir(t_avg_ref, amt_wet_ref, amt_ozo_ref, &
183 t_avg, amt_wet, amt_ozo, &
184 p_avg, sec_theta, n_layers, &
185 n_dry_pred, n_wet_pred, n_ozo_pred, &
187 pred_dry, pred_wet, pred_ozo, &
287 integer*4 :: n_layers, &
288 n_dry_pred, n_wet_pred, n_ozo_pred, n_con_pred
290 real*4 :: t_avg_ref(*), amt_wet_ref(*), amt_ozo_ref(*),&
291 t_avg(*), amt_wet(*), amt_ozo(*), &
292 p_avg(*), sec_theta(*)
298 real*4 :: pred_dry(n_dry_pred, *), &
299 pred_wet(n_wet_pred, *),&
300 pred_ozo(n_ozo_pred, *),&
301 pred_con(n_con_pred, *)
309 integer,
parameter :: max_layers = 65
311 integer,
parameter :: max_layers = 100
313 integer,
parameter :: max_dry_pred = 8, &
325 real*4 :: p_dp(max_layers),&
329 real*4 :: delta_t(max_layers), &
330 t_ratio(max_layers), &
331 pw_t_ratio(max_layers)
334 real*4 :: wet_ratio(max_layers),&
335 pw_wet(max_layers), &
336 pw_wet_ref(max_layers), &
337 pw_wet_ratio(max_layers)
340 real*4 :: ozo_ratio(max_layers), &
341 pw_ozo_ratio(max_layers), &
342 pow_t_ratio(max_layers)
353 if( do_init == 1 )
then
354 if( n_layers > max_layers )
then
355 write(*,
'(/10x,''*** calpir : n_layers > max_layers'')')
367 if( n_dry_pred /= max_dry_pred )
then
368 write(*,
'(/10x,''*** calpir : invalid n_dry_pred'')')
376 if( n_wet_pred /= max_wet_pred )
then
377 write(*,
'(/10x,''*** calpir : invalid n_wet_pred'')')
385 if( n_ozo_pred /= max_ozo_pred )
then
386 write(*,
'(/10x,''*** calpir : invalid n_ozo_pred'')')
394 if( n_con_pred /= max_con_pred )
then
395 write(*,
'(/10x,''*** calpir : invalid n_con_pred'')')
407 p_dp(1) = p_avg(1) * ( p_avg(2) - p_avg(1) )
414 delta_t(1) = t_avg(1) - t_avg_ref(1)
415 t_ratio(1) = t_avg(1) / t_avg_ref(1)
424 wet_ratio(1) = amt_wet(1) / amt_wet_ref(1)
425 pw_wet(1) = p_dp(1) * amt_wet(1)
426 pw_wet_ref(1) = p_dp(1) * amt_wet_ref(1)
427 pw_wet_ratio(1) = wet_ratio(1)
431 ozo_ratio(1) = amt_ozo(1) / amt_ozo_ref(1)
432 pw_ozo_ratio(1) = 0.0
445 p_dp(l) = p_avg(l) * ( p_avg(l) - p_avg(l-1) )
446 p_norm(l) = p_norm(l-1) + p_dp(l)
452 delta_t(l) = t_avg(l) - t_avg_ref(l)
453 t_ratio(l) = t_avg(l) / t_avg_ref(l)
454 pw_t_ratio(l) = pw_t_ratio(l-1) + ( p_dp(l) * t_ratio(l-1) )
462 wet_ratio(l) = amt_wet(l) / amt_wet_ref(l)
463 pw_wet(l) = pw_wet(l-1) + ( p_dp(l) * amt_wet(l) )
464 pw_wet_ref(l) = pw_wet_ref(l-1) + ( p_dp(l) * amt_wet_ref(l) )
468 ozo_ratio(l) = amt_ozo(l) / amt_ozo_ref(l)
469 pw_ozo_ratio(l) = pw_ozo_ratio(l-1) + &
470 ( p_dp(l) * ozo_ratio(l-1) )
471 pow_t_ratio(l) = pow_t_ratio(l-1) + &
472 ( p_dp(l) * ozo_ratio(l-1) * delta_t(l-1) )
482 pw_t_ratio(l) = pw_t_ratio(l) / p_norm(l)
483 pw_wet_ratio(l) = pw_wet(l) / pw_wet_ref(l)
484 pw_ozo_ratio(l) = pw_ozo_ratio(l) / p_norm(l)
485 pow_t_ratio(l) = pow_t_ratio(l) / p_norm(l)
502 pred_dry(1,l) = sec_theta(l)
503 pred_dry(2,l) = sec_theta(l) * sec_theta(l)
504 pred_dry(3,l) = sec_theta(l) * t_ratio(l)
505 pred_dry(4,l) = pred_dry(3,l) * t_ratio(l)
506 pred_dry(5,l) = t_ratio(l)
507 pred_dry(6,l) = t_ratio(l) * t_ratio(l)
508 pred_dry(7,l) = sec_theta(l) * pw_t_ratio(l)
509 pred_dry(8,l) = pred_dry(7,l) / t_ratio(l)
515 pred_wet(1,l) = sec_theta(l) * wet_ratio(l)
516 pred_wet(2,l) = sqrt( pred_wet(1,l) )
517 pred_wet(3,l) = pred_wet(1,l) * delta_t(l)
518 pred_wet(4,l) = pred_wet(1,l) * pred_wet(1,l)
519 pred_wet(5,l) =
abs( delta_t(l) ) * delta_t(l) * pred_wet(1,l)
520 pred_wet(6,l) = pred_wet(1,l) * pred_wet(4,l)
521 pred_wet(7,l) = sec_theta(l) * pw_wet_ratio(l)
522 pred_wet(8,l) = pred_wet(2,l) * delta_t(l)
523 pred_wet(9,l) = sqrt( pred_wet(2,l) )
524 pred_wet(10,l) = pred_wet(7,l) * pred_wet(7,l)
525 pred_wet(11,l) = sqrt( pred_wet(7,l) )
526 pred_wet(12,l) = pred_wet(1,l)
530 pred_wet(13,l) = pred_wet(1,l) / pred_wet(10,l)
536 pred_ozo(1,l) = sec_theta(l) * ozo_ratio(l)
537 pred_ozo(2,l) = sqrt( pred_ozo(1,l) )
538 pred_ozo(3,l) = pred_ozo(1,l) * delta_t(l)
539 pred_ozo(4,l) = pred_ozo(1,l) * pred_ozo(1,l)
540 pred_ozo(5,l) = pred_ozo(2,l) * delta_t(l)
541 pred_ozo(6,l) = sec_theta(l) * pw_ozo_ratio(l)
542 pred_ozo(7,l) = sqrt( pred_ozo(6,l) ) * pred_ozo(1,l)
543 pred_ozo(8,l) = pred_ozo(1,l) * pred_wet(1,l)
544 pred_ozo(9,l) = sec_theta(l) * pow_t_ratio(l) * pred_ozo(1,l)
550 pred_con(1,l) = sec_theta(l) * wet_ratio(l) / ( t_ratio(l) * t_ratio(l) )
551 pred_con(2,l) = pred_con(1,l) * pred_con(1,l) / sec_theta(l)
552 pred_con(3,l) = sec_theta(l) * wet_ratio(l) / t_ratio(l)
553 pred_con(4,l) = pred_con(3,l) * wet_ratio(l)
560 subroutine conpir( p, t, w, o, n_levels, i_dir, &
561 p_avg, t_avg, w_amt, o_amt)
653 real*4 :: p(*), t(*), w(*), o(*), &
654 p_avg(*), t_avg(*), w_amt(*), o_amt(*)
658 integer*4 :: n_levels, i_dir
667 integer*4,
parameter :: max_levels = 66
669 integer*4,
parameter :: max_levels = 101
671 real,
parameter :: r_equator = 6.378388e+06,&
672 r_polar = 6.356911e+06, &
673 r_avg = 0.5*(r_equator+r_polar)
675 real,
parameter :: g_sfc = 9.80665
677 real*4,
parameter :: rho_ref = 1.2027e-12
679 real,
parameter :: mw_dryair = 28.97, &
683 real,
parameter :: R_gas = 8.3143, &
688 integer*4 l, l_start, l_end, l_indx
690 real*4 rho1, rho2, p1, p2, w1, w2, o1, o2, z1, z2, &
691 c_avg, g_avg, z_avg, w_avg, o_avg, &
696 real*4 :: z(max_levels), &
698 mw_air(max_levels), &
699 rho_air(max_levels), &
711 call gphite( p, t, w, 0.0, n_levels, i_dir, z)
747 do l = l_start, l_end, -1*i_dir
753 w_ppmv(l) = 1.0e+03 * w(l) * mw_dryair / mw_h2o
759 mw_air(l) = ( ( 1.0 - (w_ppmv(l)/1.0e+6) ) * mw_dryair ) + &
760 ( ( w_ppmv(l)/1.0e+06 ) * mw_h2o )
766 c(l) = 0.001 * mw_air(l) / r_air
767 rho_air(l) = c(l) * p(l) / t(l)
775 g_sfc*( 1.0 - ( (r_avg*r_avg)/(r_hgt*r_hgt) ) )
787 do l = l_start, l_end+i_dir, -1*i_dir
812 rho2 = rho_air(l-i_dir)
818 c_avg = ( (rho1*c(l)) + (rho2*c(l-i_dir)) ) / ( rho1 + rho2 )
824 t_avg(l_indx) = ( (rho1*t(l)) + (rho2*t(l-i_dir)) ) / ( rho1 + rho2 )
838 a = log(p2/p1) / (z2-z1)
841 p_avg(l_indx) = dp / log(p2/p1)
851 dz = -1.0 * dp * t_avg(l_indx) / ( g_avg*c_avg*p_avg(l_indx) )
854 z_avg = z(l) + ( 0.5*dz )
857 r_hgt = r_avg + z_avg
858 g_avg = g_sfc - g_sfc*( 1.0 - ( (r_avg*r_avg)/(r_hgt*r_hgt) ) )
861 dz = -1.0 * dp * t_avg(l_indx) / ( g_avg*c_avg*p_avg(l_indx) )
870 w_avg = ( (rho1*w1) + (rho2*w2) ) / ( rho1+rho2 )
872 w_amt(l_indx) = rho_ref * w_avg * dz * p_avg(l_indx) / t_avg(l_indx)
881 o_avg = ( (rho1*o1) + (rho2*o2) ) / ( rho1+rho2 )
883 o_amt(l_indx) = rho_ref * o_avg * dz * p_avg(l_indx) / t_avg(l_indx)
891 subroutine gphite( p, t, w, z_sfc, n_levels, i_dir, z)
949 real*4 :: p(*), t(*), w(*), z(*)
953 integer*4 :: n_levels, i_dir
963 real*4,
parameter :: rog = 29.2898, &
968 integer*4 :: i_start, i_end, l
970 real*4 :: v_lower, v_upper, algp_lower, algp_upper, hgt
988 v_lower = t(n_levels) * ( 1.0 + ( 0.00061 * w(n_levels) ) )
990 algp_lower = alog( p(n_levels) )
1001 v_lower = t(1) * ( 1.0 + ( 0.00061 * w(1) ) )
1003 algp_lower = alog( p(1) )
1031 do l = i_start, i_end, -1*i_dir
1038 if( p(l) >= 300.0 ) v_upper = v_upper * ( 1.0 + ( 0.00061 * w(l) ) )
1044 algp_upper = alog( p(l) )
1050 hgt = hgt + (
fac*(v_upper+v_lower)*(algp_lower-algp_upper) )
1057 algp_lower = algp_upper
1071 subroutine taudoc(nc,nx,ny,cc,xx,tau)
1074 integer,
intent(in) :: nc, ny, nx
1075 real,
intent(in) :: cc(:,:), xx(:,:)
1076 real,
intent(inout) :: tau(*)
1081 real,
parameter :: trap = -999.99
1083 integer :: last, j, i
1084 real :: taulyr, taulev, yy
1094 if (taulev == 0.)
then
1100 taulev=taulev*taulyr
1110 taulev=taulev*taulyr
1117 yy=yy+cc(i,j)*xx(i,j)
1121 if(yy > 0.) taulyr=exp(-yy)
1123 taulev=taulev*taulyr
1131 subroutine taudry(nc,nx,ny,cc,xx,tau)
1134 integer,
intent(in) :: nc, ny, nx
1135 real,
intent(in) :: cc(:,:), xx(:,:)
1136 real,
intent(inout) :: tau(:)
1141 real,
parameter :: trap = -999.99
1144 real :: taulyr, taulev, yy
1152 if (taulev == 0.)
then
1168 yy=yy+cc(i,j)*xx(i,j)
1172 if(yy > 0.) taulyr=exp(-yy)
1174 taulev=taulev*taulyr
1184 subroutine tauwtr(ncs,ncl,nxs,nxl,nxw,ny,ccs,ccl,xx,tau)
1188 integer,
intent(in) :: ncs, ncl, nxs, nxl, nxw, ny
1189 real,
intent(in) :: ccs(:,:), ccl(:,:), xx(:,:)
1190 real,
intent(inout) :: tau(:)
1194 real :: odsum, taulyr, taulev, yy
1206 yy=yy+ccs(i,j)*xx(i,j)
1211 yy=yy+ccl(i,j)*xx(i+11,j)
1216 if(yy > 0.) taulyr=exp(-yy)
1217 taulev=taulev*taulyr