1 subroutine set_lvlsxml(param,ifld,irec,kpv,pv,kth,th)
49 use ctlblk_mod
, only: lsm, spl, nsoil, isf_surface_physics, nfd, htfd, &
51 use soil, only: sldpth,sllevel
52 use rqstfld_mod
,only : mxlvl,lvls,lvlsxml
55 type(param_t),
intent(inout) :: param
56 integer,
intent(in) :: ifld
57 integer,
intent(inout) :: irec
58 integer,
intent(in) :: kpv
59 real,
intent(in) :: pv(1:kpv)
60 integer,
intent(in) :: kth
61 real,
intent(in) :: th(1:kth)
63 real,
parameter :: small=1.e-5
64 real,
parameter :: small1=1.e-3
65 real,
parameter :: small2=1
66 integer,
parameter :: lsig1=22,lsig2=5
67 integer i,j,l,nlevel,scalef,lvlcape,lvlcin
68 logical readthk,logrec
69 REAL :: sigo2(lsig2+1),asigo2(lsig2),dsigo2(lsig2)
70 REAL :: sigo1(lsig1+1),asigo1(lsig1),dsigo1(lsig1)
74 nlevel=
size(param%level)
84 if(trim(param%fixed_sfc1_type)==
'isobaric_sfc')
then
85 if(index(param%shortname,
"ON_ICAO_STD_SFC")<=0)
then
89 if(abs(param%level(j)-spl(i))<small1)
then
108 if(trim(param%fixed_sfc1_type)==
'hybrid_lvl')
then
110 iloop1:
do i=1, mxlvl
111 if(nint(param%level(j))==i)
then
122 if(trim(param%fixed_sfc1_type)==
'depth_bel_land_sfc'.and. &
123 trim(param%fixed_sfc2_type)==
'depth_bel_land_sfc' )
then
127 iloop2:
do i=1, nsoil
128 if(isf_surface_physics ==3)
then
129 if(nint(param%level(j))==nint(sllevel(i)*100.))
then
136 if(nint(param%level2(j))==nint(sum(sldpth(1:i))*100.) )
then
149 if(trim(param%fixed_sfc1_type)==
'pot_vort_sfc')
then
151 scalef=param%scale_fact_fixed_sfc1(j)-6
152 if(param%scale_fact_fixed_sfc1(j)<6) scalef=0
154 if(pv(i)/=0.and.abs(param%level(j)*10.**(-1*scalef)-pv(i))<=1.e-5)
then
170 if(trim(param%fixed_sfc1_type)==
'isentropic_lvl')
then
174 if(th(i)/=0.and.abs(param%level(j)-th(i))<=1.e-5)
then
189 if(trim(param%fixed_sfc1_type)==
'spec_alt_above_mean_sea_lvl')
then
190 if(index(param%shortname,
"GTG_ON_SPEC_ALT_ABOVE_MEAN_SEA_LVL")<=0)
then
193 if(nint(param%level(j))==nint(htfd(i)) )
then
194 if(htfd(i)>300.)
then
218 if(trim(param%fixed_sfc1_type)==
'spec_pres_above_grnd')
then
220 if(trim(param%shortname)==
"MIXED_LAYER_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
221 trim(param%shortname)==
"MIXED_LAYER_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
225 param%level(1)=nint(petabnd(3)+15.)*100
226 param%level2(1)=nint(petabnd(1)-15.)*100
227 else if (trim(param%shortname)==
"UNSTABLE_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
228 trim(param%shortname)==
"UNSTABLE_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
234 else if (trim(param%shortname)==
"BEST_CAPE_ON_SPEC_PRES_ABOVE_GRND" .or. &
235 trim(param%shortname)==
"BEST_CIN_ON_SPEC_PRES_ABOVE_GRND")
then
240 param%level(1)=nint(petabnd(nbnd)+15.)*100
241 param%level2(1)=nint(petabnd(1)-15.)*100
245 if(nint(param%level(j)/100.)==nint(petabnd(i)+15.))
then
253 if(nint(param%level(j)/100.) == 255)
then
259 if(.not.logrec.and.nlevel==1)
then
268 if(trim(param%fixed_sfc1_type)==
'spec_hgt_lvl_above_grnd')
then
269 if(index(param%shortname,
"SPEC_HGT_LVL_ABOVE_GRND_FDHGT")>0)
then
272 if(nint(param%level(j))==nint(htfd(i)) )
then
290 if(trim(param%shortname)==
'TMP_ON_SIGMA_LVL_HPC')
then
296 sigo2(l)=sigo2(l-1)+dsigo2(lsig2-l+2)
300 asigo2(l)=0.5*(sigo2(l)+sigo2(l+1))
312 if(abs(param%level(j)-asigo2(i)*10000)<small1)
then
324 if(index(trim(param%shortname),
'SIGMA_LVLS')>0)
then
330 sigo1(l)=sigo1(l-1)+dsigo1(lsig1-l+2)
334 asigo1(l)=0.5*(sigo1(l)+sigo1(l+1))
388 if(abs(param%level(j)-asigo1(i)*10000)<small1)
then