rgrd2u Subroutine

private subroutine rgrd2u(nx, ny, p, mx, my, q, intpol, w, lw, iw, liw, ier)

subroutine rgrd2u interpolates the nx by ny array p onto the mx by my array q. linear or cubic interpolation is used in each direction (see argument intpol). it is assumed that p and q are values on uniform nx by ny and mx by my grids superimposed on the same rectangle (INCLUDING BOUNDARIES). if p and q are values on nonuniform orthogonal grids and/or if the grid on which q is defined lies within the p grid then subroutine rgrd2 should be used.

method

linear or cubic interpolation (see intpol) is used in each direction for which the q grid is not a subgrid of the p grid. [the mx (my) uniform grid is a subgrid of the nx (ny) uniform grid if and only if mx-1 (my-1) divides nx-1 (ny-1)]. values are set directly without (the need for) interpolation in subgrid directions.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nx

the integer first dimension of p. nx > 1 if intpol(1) = 1 or nx > 3 if intpol(1) = 3 is required (see ier = 2).

integer, intent(in) :: ny

the integer second dimension of p. ny > 1 if intpol(2) = 1 or ny > 3 if intpol(2) = 3 is required (see ier = 2).

real(kind=wp), intent(in) :: p(nx,ny)

a real(wp) nx by ny array of given values

integer, intent(in) :: mx

the integer first dimension of q. mx > 1 is required (see ier = 1)

integer, intent(in) :: my

the integer second dimension of q. my > 1 is required (see ier = 1)

real(kind=wp), intent(out) :: q(mx,my)

a real(wp) mx by my array of values which are interpolated from p.

integer, intent(in) :: intpol(2)

an integer vector of dimension 2 which sets linear or cubic interpolation in each of the x,y directions as follows:

  • intpol(1) = 1 sets linear interpolation in the x direction
  • intpol(1) = 3 sets cubic interpolation in the x direction.
  • intpol(2) = 1 sets linear interpolation in the y direction
  • intpol(2) = 3 sets cubic interpolation in the y direction.

values other than 1 or 3 in intpol are not allowed (ier = 3).

real(kind=wp), intent(inout) :: w(lw)

a real(wp) work space of length at least lw which must be provided in the routine calling rgrd2u

integer, intent(in) :: lw

the integer length of the work space w.

  • let lwx = 1 if mx-1 divides nx-1; otherwise let lwx = mx if intpol(1) = 1 or let lwx = 4*mx if intpol(1) = 3
  • let lwy = 0 if my-1 divides ny-1; otherwise let lwy = 2mx+my if intpol(2) = 1 or let lwy = 4(mx+my) if intpol(2) = 3

then lw must be greater than or equal to lwx+lwy

integer, intent(inout) :: iw(liw)

an integer work space of length at least liw which must be provided in the routine calling rgrd2u

integer, intent(in) :: liw

the integer length of the integer work space iw. liw must be greater than or equal to mx+my.

integer, intent(out) :: ier

an integer error flag set as follows:

  • ier = 0 if no errors in input arguments are detected
  • ier = 1 if min(mx,my) < 2
  • ier = 2 if nx < 2 when intpol(1)=1 or nx < 4 when intpol(1)=3 (or) ny < 2 when intpol(2)=1 or ny < 4 when intpol(2)=3.
  • ier = 3 if intpol(1) or intpol(2) is not equal to 1 or 3
  • ier = 4 if lw or liw is to small (insufficient work space)

Calls

proc~~rgrd2u~~CallsGraph proc~rgrd2u regridpack_module::rgrd2u proc~cubnmxu regridpack_module::cubnmxu proc~rgrd2u->proc~cubnmxu proc~cubt2u regridpack_module::cubt2u proc~rgrd2u->proc~cubt2u proc~linmxu regridpack_module::linmxu proc~rgrd2u->proc~linmxu proc~lint2u regridpack_module::lint2u proc~rgrd2u->proc~lint2u proc~cubt1u regridpack_module::cubt1u proc~cubt2u->proc~cubt1u proc~lint1u regridpack_module::lint1u proc~cubt2u->proc~lint1u proc~lint2u->proc~cubt1u proc~lint2u->proc~lint1u

Called by

proc~~rgrd2u~~CalledByGraph proc~rgrd2u regridpack_module::rgrd2u interface~regrid regridpack_module::regrid interface~regrid->proc~rgrd2u