16 real(kind=DEFAULT_PRECISION),
intent(in) :: zvals(:), vals(:)
17 real(kind=DEFAULT_PRECISION),
intent(inout) :: zgrid(:)
18 real(kind=DEFAULT_PRECISION),
intent(inout) :: field(:)
20 real(kind=DEFAULT_PRECISION) :: initgd_lem(size(zvals)+1)
21 real(kind=DEFAULT_PRECISION) :: zngd_lem(size(zvals)+1)
22 real(kind=DEFAULT_PRECISION) :: field_lem(size(field))
24 real(kind=DEFAULT_PRECISION) :: verylow, veryhigh
44 initgd_lem(1) = vals(1)
47 initgd_lem(nn) = vals(nn-1)
48 zngd_lem(nn) = zvals(nn-1)
53 IF( zngd_lem(nn).LE.zgrid(k) .AND. zgrid(k).LT.zngd_lem(nn+1))
then 54 field(k) = initgd_lem(nn) + ( initgd_lem(nn+1) - initgd_lem(nn))*(zgrid(k)- zngd_lem(nn))/ &
55 (zngd_lem(nn+1) - zngd_lem(nn))
73 real(kind=DEFAULT_PRECISION),
intent(in) :: zvals(:), vals(:)
74 real(kind=DEFAULT_PRECISION),
intent(in) :: z
75 real(kind=DEFAULT_PRECISION),
intent(out) :: f
76 character(*),
intent(in),
optional :: extrapolate
81 integer,
parameter :: MAXCHARS=20
82 character(MAXCHARS) :: ext_type
88 if (zvals(nnodes-1) < zvals(nnodes))
exit 93 if (
present(extrapolate))ext_type=trim(extrapolate)
97 select case (trim(ext_type))
99 f = vals(nn) + (vals(nn+1) - vals(nn))/(zvals(nn+1) - zvals(nn)) &
107 if (
present(extrapolate))ext_type=trim(extrapolate)
109 if (z >= zvals(nnodes))
then 111 select case (trim(ext_type))
113 f = vals(nn) + (vals(nn-1) - vals(nn))/(zvals(nn-1) - zvals(nn)) &
122 if (zvals(nn) <= z .and. z < zvals(nn+1))
then 123 f = vals(nn) + (vals(nn+1) - vals(nn))/(zvals(nn+1) - zvals(nn)) &
subroutine interpolate_point_linear_1d(zvals, vals, z, f, extrapolate)
Does a simple 1d linear interpolation to a point.
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Contains common definitions for the data and datatypes used by MONC.
subroutine piecewise_linear_1d(zvals, vals, zgrid, field)
Does a simple 1d piecewise linear interpolation.