Hi,

When generating a new grid based on a high resolution bathymetry we came
across some severe efficiency problems with the algorithm employed for
regridding values on a sphere. In particular, the sequential search
algorithm used for getting a point within the maximum radius of influence
requires that the distance in radians between two points on the sphere be
calculated O(map_src_size*map_dest_size) times. This becomes
extremely expensive.

The algorithm can be accelerated significantly if a preliminary search is
made of the latitudes of the source grid in order to find a better
starting point for the main algorithm. Note that it is a necessary
condition that the difference in latitudes be less than or equal to the
distance between two points. Further, if the source grid is a regular
lon/lat we need only compare every map_src_xsize points in our attempt to
satisfy the new condition.

Implementation of this preliminary search is simple. At line 431 of
spherical_regrid.F90 in mom4_beta2/shared/spherical_regrid  insert

!
   d=max_src_dist+1.0
   do while ( d > max_src_dist .and. step <= map_src_size)
     d=abs(phi_dest(j)-phi_src(step))
     if(d>max_src_dist) then
       step=step+ 1             ! replace 1 by map_src_xsize if source
                                ! grid is regular
     endif
   enddo
!

Rather than hardwiring the increment in 'step' I suggest that an optional
logical namelist variable 'src_grid_is_regular' be added and the step
stride be chosen based on its value.

The number of full distance calculations is reduced to
O(map_src_xsize*map_dest_size).

As an indication of the speed up available we estimated that when using a
global 5 minute resolution source grid mapping to a destination grid of
about 700x1000 it would take over 60 days to run on 1 cpu on a PC whereas
the new algorithm runs in less than an hour.

Cheers,
Russ Fiedler
CSIRO Marine Research



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
FMS-mom4 mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fms-mom4

Reply via email to