Does a simple 1d piecewise linear interpolation.
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))