26 module horiz_interp_type_mod
30 use mpp_mod,
only : comm_tag_1, comm_tag_2
31 use platform_mod,
only: r4_kind, r8_kind
38 integer,
parameter :: CONSERVE = 1
39 integer,
parameter :: BILINEAR = 2
40 integer,
parameter :: SPHERICAL = 3
41 integer,
parameter :: BICUBIC = 4
43 public :: conserve, bilinear, spherical, bicubic
49 interface assignment(=)
55 module procedure stats_r4
56 module procedure stats_r8
62 real(kind=r8_kind),
dimension(:,:),
allocatable :: faci
63 real(kind=r8_kind),
dimension(:,:),
allocatable :: facj
64 real(kind=r8_kind),
dimension(:,:),
allocatable :: area_src
65 real(kind=r8_kind),
dimension(:,:),
allocatable :: area_dst
66 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: wti
68 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: wtj
70 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: src_dist
72 real(kind=r8_kind),
dimension(:,:),
allocatable :: rat_x
75 real(kind=r8_kind),
dimension(:,:),
allocatable :: rat_y
78 real(kind=r8_kind),
dimension(:),
allocatable :: lon_in
79 real(kind=r8_kind),
dimension(:),
allocatable :: lat_in
80 real(kind=r8_kind),
dimension(:),
allocatable :: area_frac_dst
81 real(kind=r8_kind),
dimension(:,:),
allocatable :: mask_in
82 real(kind=r8_kind) :: max_src_dist
83 logical :: is_allocated = .false.
89 real(kind=r4_kind),
dimension(:,:),
allocatable :: faci
90 real(kind=r4_kind),
dimension(:,:),
allocatable :: facj
91 real(kind=r4_kind),
dimension(:,:),
allocatable :: area_src
92 real(kind=r4_kind),
dimension(:,:),
allocatable :: area_dst
93 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: wti
95 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: wtj
97 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: src_dist
99 real(kind=r4_kind),
dimension(:,:),
allocatable :: rat_x
102 real(kind=r4_kind),
dimension(:,:),
allocatable :: rat_y
105 real(kind=r4_kind),
dimension(:),
allocatable :: lon_in
106 real(kind=r4_kind),
dimension(:),
allocatable :: lat_in
107 real(kind=r4_kind),
dimension(:),
allocatable :: area_frac_dst
108 real(kind=r4_kind),
dimension(:,:),
allocatable :: mask_in
109 real(kind=r4_kind) :: max_src_dist
110 logical :: is_allocated = .false.
117 integer,
dimension(:,:),
allocatable :: ilon
118 integer,
dimension(:,:),
allocatable :: jlat
120 integer,
dimension(:,:,:),
allocatable :: i_lon
122 integer,
dimension(:,:,:),
allocatable :: j_lat
124 logical,
dimension(:,:),
allocatable :: found_neighbors
126 integer,
dimension(:,:),
allocatable :: num_found
131 integer :: interp_method
136 logical :: i_am_initialized=.false.
142 integer,
dimension(:),
allocatable :: i_src
143 integer,
dimension(:),
allocatable :: j_src
144 integer,
dimension(:),
allocatable :: i_dst
145 integer,
dimension(:),
allocatable :: j_dst
162 if(.not.horiz_interp_in%I_am_initialized)
then
163 call mpp_error(fatal,
'horiz_interp_type_eq: horiz_interp_type variable on right hand side is unassigned')
166 if(
allocated(horiz_interp_in%ilon )) &
167 horiz_interp_out%ilon = horiz_interp_in%ilon
169 if(
allocated(horiz_interp_in%jlat )) &
170 horiz_interp_out%jlat = horiz_interp_in%jlat
172 if(
allocated(horiz_interp_in%i_lon )) &
173 horiz_interp_out%i_lon = horiz_interp_in%i_lon
175 if(
allocated(horiz_interp_in%j_lat )) &
176 horiz_interp_out%j_lat = horiz_interp_in%j_lat
178 if(
allocated(horiz_interp_in%found_neighbors )) &
179 horiz_interp_out%found_neighbors = horiz_interp_in%found_neighbors
181 if(
allocated(horiz_interp_in%num_found )) &
182 horiz_interp_out%num_found = horiz_interp_in%num_found
184 if(
allocated(horiz_interp_in%i_src )) &
185 horiz_interp_out%i_src = horiz_interp_in%i_src
187 if(
allocated(horiz_interp_in%j_src )) &
188 horiz_interp_out%j_src = horiz_interp_in%j_src
190 if(
allocated(horiz_interp_in%i_dst )) &
191 horiz_interp_out%i_dst = horiz_interp_in%i_dst
193 if(
allocated(horiz_interp_in%j_dst )) &
194 horiz_interp_out%j_dst = horiz_interp_in%j_dst
196 horiz_interp_out%nlon_src = horiz_interp_in%nlon_src
197 horiz_interp_out%nlat_src = horiz_interp_in%nlat_src
198 horiz_interp_out%nlon_dst = horiz_interp_in%nlon_dst
199 horiz_interp_out%nlat_dst = horiz_interp_in%nlat_dst
200 horiz_interp_out%interp_method = horiz_interp_in%interp_method
201 horiz_interp_out%I_am_initialized = .true.
203 if(horiz_interp_in%horizInterpReals8_type%is_allocated)
then
205 if(
allocated(horiz_interp_in%horizInterpReals8_type%faci)) &
206 horiz_interp_out%horizInterpReals8_type%faci = horiz_interp_in%horizInterpReals8_type%faci
208 if(
allocated( horiz_interp_in%horizInterpReals8_type%facj)) &
209 horiz_interp_out%horizInterpReals8_type%facj = horiz_interp_in%horizInterpReals8_type%facj
211 if(
allocated( horiz_interp_in%horizInterpReals8_type%area_src)) &
212 horiz_interp_out%horizInterpReals8_type%area_src = horiz_interp_in%horizInterpReals8_type%area_src
214 if(
allocated( horiz_interp_in%horizInterpReals8_type%area_dst)) &
215 horiz_interp_out%horizInterpReals8_type%area_dst = horiz_interp_in%horizInterpReals8_type%area_dst
217 if(
allocated( horiz_interp_in%horizInterpReals8_type%wti)) &
218 horiz_interp_out%horizInterpReals8_type%wti = horiz_interp_in%horizInterpReals8_type%wti
220 if(
allocated( horiz_interp_in%horizInterpReals8_type%wtj)) &
221 horiz_interp_out%horizInterpReals8_type%wtj = horiz_interp_in%horizInterpReals8_type%wtj
223 if(
allocated( horiz_interp_in%horizInterpReals8_type%src_dist)) &
224 horiz_interp_out%horizInterpReals8_type%src_dist = horiz_interp_in%horizInterpReals8_type%src_dist
226 if(
allocated( horiz_interp_in%horizInterpReals8_type%rat_x)) &
227 horiz_interp_out%horizInterpReals8_type%rat_x = horiz_interp_in%horizInterpReals8_type%rat_x
229 if(
allocated( horiz_interp_in%horizInterpReals8_type%rat_y)) &
230 horiz_interp_out%horizInterpReals8_type%rat_y = horiz_interp_in%horizInterpReals8_type%rat_y
232 if(
allocated( horiz_interp_in%horizInterpReals8_type%lon_in)) &
233 horiz_interp_out%horizInterpReals8_type%lon_in = horiz_interp_in%horizInterpReals8_type%lon_in
235 if(
allocated( horiz_interp_in%horizInterpReals8_type%lat_in)) &
236 horiz_interp_out%horizInterpReals8_type%lat_in = horiz_interp_in%horizInterpReals8_type%lat_in
238 if(
allocated( horiz_interp_in%horizInterpReals8_type%area_frac_dst)) &
239 horiz_interp_out%horizInterpReals8_type%area_frac_dst = horiz_interp_in%horizInterpReals8_type%area_frac_dst
241 horiz_interp_out%horizInterpReals8_type%max_src_dist = horiz_interp_in%horizInterpReals8_type%max_src_dist
243 horiz_interp_out%horizInterpReals8_type%is_allocated = .true.
245 if(
allocated(horiz_interp_in%horizInterpReals8_type%mask_in)) &
246 horiz_interp_out%horizInterpReals8_type%mask_in = horiz_interp_in%horizInterpReals8_type%mask_in
248 else if (horiz_interp_in%horizInterpReals4_type%is_allocated)
then
249 if(
allocated(horiz_interp_in%horizInterpReals4_type%faci)) &
250 horiz_interp_out%horizInterpReals4_type%faci = horiz_interp_in%horizInterpReals4_type%faci
252 if(
allocated( horiz_interp_in%horizInterpReals4_type%facj)) &
253 horiz_interp_out%horizInterpReals4_type%facj = horiz_interp_in%horizInterpReals4_type%facj
255 if(
allocated( horiz_interp_in%horizInterpReals4_type%area_src)) &
256 horiz_interp_out%horizInterpReals4_type%area_src = horiz_interp_in%horizInterpReals4_type%area_src
258 if(
allocated( horiz_interp_in%horizInterpReals4_type%area_dst)) &
259 horiz_interp_out%horizInterpReals4_type%area_dst = horiz_interp_in%horizInterpReals4_type%area_dst
261 if(
allocated( horiz_interp_in%horizInterpReals4_type%wti)) &
262 horiz_interp_out%horizInterpReals4_type%wti = horiz_interp_in%horizInterpReals4_type%wti
264 if(
allocated( horiz_interp_in%horizInterpReals4_type%wtj)) &
265 horiz_interp_out%horizInterpReals4_type%wtj = horiz_interp_in%horizInterpReals4_type%wtj
267 if(
allocated( horiz_interp_in%horizInterpReals4_type%src_dist)) &
268 horiz_interp_out%horizInterpReals4_type%src_dist = horiz_interp_in%horizInterpReals4_type%src_dist
270 if(
allocated( horiz_interp_in%horizInterpReals4_type%rat_x)) &
271 horiz_interp_out%horizInterpReals4_type%rat_x = horiz_interp_in%horizInterpReals4_type%rat_x
273 if(
allocated( horiz_interp_in%horizInterpReals4_type%rat_y)) &
274 horiz_interp_out%horizInterpReals4_type%rat_y = horiz_interp_in%horizInterpReals4_type%rat_y
276 if(
allocated( horiz_interp_in%horizInterpReals4_type%lon_in)) &
277 horiz_interp_out%horizInterpReals4_type%lon_in = horiz_interp_in%horizInterpReals4_type%lon_in
279 if(
allocated( horiz_interp_in%horizInterpReals4_type%lat_in)) &
280 horiz_interp_out%horizInterpReals4_type%lat_in = horiz_interp_in%horizInterpReals4_type%lat_in
282 if(
allocated( horiz_interp_in%horizInterpReals4_type%area_frac_dst)) &
283 horiz_interp_out%horizInterpReals4_type%area_frac_dst = horiz_interp_in%horizInterpReals4_type%area_frac_dst
285 horiz_interp_out%horizInterpReals4_type%max_src_dist = horiz_interp_in%horizInterpReals4_type%max_src_dist
287 horiz_interp_out%horizInterpReals4_type%is_allocated = .true.
289 if(
allocated(horiz_interp_in%horizInterpReals4_type%mask_in)) &
290 horiz_interp_out%horizInterpReals4_type%mask_in = horiz_interp_in%horizInterpReals4_type%mask_in
293 call mpp_error(fatal,
"horiz_interp_type_eq: cannot assign unallocated real values from horiz_interp_in")
296 if(horiz_interp_in%interp_method == conserve)
then
297 horiz_interp_out%version = horiz_interp_in%version
298 if(horiz_interp_in%version==2) horiz_interp_out%nxgrid = horiz_interp_in%nxgrid
304 #include "horiz_interp_type_r4.fh"
305 #include "horiz_interp_type_r8.fh"
307 end module horiz_interp_type_mod
subroutine horiz_interp_type_eq(horiz_interp_out, horiz_interp_in)
horiz_interp_type_eq creates a copy of the horiz_interp_type object
Holds data pointers and metadata for horizontal interpolations, passed between the horiz_interp modul...
subroutine mpp_sync_self(pelist, check, request, msg_size, msg_type)
This is to check if current PE's outstanding puts are complete but we can't use shmem_fence because w...
integer function mpp_npes()
Returns processor count for current pelist.
integer function mpp_pe()
Returns processor ID.
Receive data from another PE.
Send data to a receiving PE.
holds real(4) pointers for use in horiz_interp_type
real(8) pointers for use in horiz_interp_type