22 integer,
intent(in ) :: nlev
23 real(kind_real),
intent(in ) :: obl
24 real(kind_real),
intent(in ) :: vec(nlev)
25 integer,
intent(out) :: wi
26 real(kind_real),
intent(out) :: wf
30 if (vec(1) < vec(nlev))
then 32 if (obl < vec(1))
then 34 elseif (obl > vec(nlev))
then 38 if (obl >= vec(k) .and. obl <= vec(k+1))
then 46 if (obl > vec(1))
then 48 elseif (obl < vec(nlev))
then 52 if (obl >= vec(k+1) .and. obl <= vec(k))
then 60 wf = (vec(wi+1) - obl)/(vec(wi+1) - vec(wi))
69 integer,
intent(in ) :: nlev
70 real(kind_real),
intent(in ) :: fvec(nlev)
71 integer,
intent(in ) :: wi
72 real(kind_real),
intent(in ) :: wf
73 real(kind_real),
intent(out) :: f
75 f = fvec(wi)*wf + fvec(wi+1)*(1.0-wf)
84 integer,
intent(in) :: nlev
85 real(kind_real),
intent(in) :: fvec_tl(nlev)
86 integer,
intent(in) :: wi
87 real(kind_real),
intent(in) :: wf
88 real(kind_real),
intent(out) :: f_tl
90 f_tl = fvec_tl(wi)*wf + fvec_tl(wi+1)*(1.0_kind_real-wf)
99 integer,
intent(in) :: nlev
100 real(kind_real),
intent(inout) :: fvec_ad(nlev)
101 integer,
intent(in) :: wi
102 real(kind_real),
intent(in) :: wf
103 real(kind_real),
intent(in) :: f_ad
105 fvec_ad(wi ) = fvec_ad(wi ) + f_ad*wf
106 fvec_ad(wi+1) = fvec_ad(wi+1) + f_ad*(1.0_kind_real-wf)
subroutine vert_interp_apply(nlev, fvec, f, wi, wf)
subroutine vert_interp_apply_ad(nlev, fvec_ad, f_ad, wi, wf)
subroutine vert_interp_apply_tl(nlev, fvec_tl, f_tl, wi, wf)
Fortran module to perform linear interpolation.
integer, parameter, public kind_real
subroutine vert_interp_weights(nlev, obl, vec, wi, wf)