37 initgd_lem(1) = vals(1)
40 initgd_lem(nn) = vals(nn-1)
41 zngd_lem(nn) = zvals(nn-1)
46 IF( zngd_lem(nn).LE.zgrid(k) .AND. zgrid(k).LT.zngd_lem(nn+1))
then
47 field(k) = initgd_lem(nn) + ( initgd_lem(nn+1) - initgd_lem(nn))*(zgrid(k)- zngd_lem(nn))/ &
48 (zngd_lem(nn+1) - zngd_lem(nn))
54 if (zgrid(
size(field)) == zngd_lem(nnodes+1))
Then
55 field(
size(field)) = initgd_lem(nnodes+1)
70 character(*),
intent(in),
optional :: extrapolate
75 integer,
parameter :: MAXCHARS=20
76 character(MAXCHARS) :: ext_type
82 if (zvals(nnodes-1) < zvals(nnodes))
exit
87 if (
present(extrapolate))ext_type=trim(extrapolate)
91 select case (trim(ext_type))
93 f = vals(nn) + (vals(nn+1) - vals(nn))/(zvals(nn+1) - zvals(nn)) &
101 if (
present(extrapolate))ext_type=trim(extrapolate)
103 if (z >= zvals(nnodes))
then
105 select case (trim(ext_type))
107 f = vals(nn) + (vals(nn-1) - vals(nn))/(zvals(nn-1) - zvals(nn)) &
116 if (zvals(nn) <= z .and. z < zvals(nn+1))
then
117 f = vals(nn) + (vals(nn+1) - vals(nn))/(zvals(nn+1) - zvals(nn)) &
141 integer :: nn, k_monc, k_force
142 integer :: nz_force, nt_force, nz_monc, nt_monc
145 nz_force =
size(zvals)
146 nt_force =
size(time_vals)
148 nt_monc =
size(time_vals)
150 if ( zvals(1) .GT. zvals(nz_force) )
then
152 " - please modify your forcing file to using height coordinates or modify the" // &
153 " interpolation routine in model_core to work with pressure coords - STOP")
156 do k_force=1,nz_force-1
157 if( z(k_monc) >= zvals(k_force) .AND. z(k_monc) < zvals(k_force+1) )
then
158 scale_tmp = ( z(k_monc) - zvals(k_force) ) / &
159 ( zvals(k_force+1) - zvals(k_force) )
161 field(k_monc,nn) = vals(k_force,nn) + &
162 ( vals(k_force+1,nn) - vals(k_force,nn) ) &
172 if ( z(k_monc) >= zvals(nt_force) )
then
173 scale_tmp = ( z(k_monc) - zvals(nz_force) ) &
174 / ( zvals(nz_force) - zvals(nz_force-1) )
176 field(k_monc,nn) = vals(nz_force,nn) + &
177 ( vals(nz_force,nn) - vals(nz_force-1,nn) ) &
180 elseif ( z(k_monc) < zvals(1) )
THEN
181 scale_tmp = ( z(k_monc) - zvals(1) ) &
182 / ( zvals(1) - zvals(2) )
184 field(k_monc,nn) = vals(1,nn) + &
185 ( vals(1,nn) - vals(2,nn) ) &
202 character(*),
intent(in),
optional :: extrapolate
207 integer,
parameter :: MAXCHARS=20
208 character(MAXCHARS) :: ext_type
213 if (nnodes == 1)
exit
214 if (zvals(nnodes-1) < zvals(nnodes))
exit
219 if (
present(extrapolate))ext_type=trim(extrapolate)
224 if (z < zvals(1))
then
233 if (z >= zvals(nnodes))
then
242 if (zvals(nn) <= z .and. z < zvals(nn+1))
then
243 select case (trim(ext_type))
245 f(:) = vals(:,nn) + (vals(:,nn+1) - vals(:,nn))/(zvals(nn+1) - zvals(nn)) &