SCALE-RM
Data Types | Functions/Subroutines | Variables
scale_interpolation_nest Module Reference

module INTERPOLATION (nesting system) More...

Functions/Subroutines

subroutine, public intrpnest_setup (interp_search_divnum, NEST_INTERP_LEVEL, OFFLINE)
 Setup. More...
 
subroutine, public intrpnest_interp_fact_latlon (hfact, igrd, jgrd, mylat, mylon, myIA, myJA, inlat, inlon, inIA, inJA)
 
subroutine, public intrpnest_interp_fact_llz (hfact, vfact, kgrd, igrd, jgrd, ncopy, myhgt, mylat, mylon, myKS, myKE, myIA, myJA, inhgt, inlat, inlon, inKA, inIA, inJA, landgrid)
 
subroutine, public intrpnest_domain_compatibility (lon_org, lat_org, lev_org, lon_loc, lat_loc, lev_loc, skip_x, skip_y, skip_z)
 

Variables

procedure(intrpnest_intfc_interp_2d), pointer, public intrpnest_interp_2d => NULL()
 
procedure(intrpnest_intfc_interp_3d), pointer, public intrpnest_interp_3d => NULL()
 

Detailed Description

module INTERPOLATION (nesting system)

Description
INTERPOLATION module for nesting system
Author
Team SCALE
History
  • 2015-02-10 (R.Yoshida) [new] rearranged sub-routines

Function/Subroutine Documentation

◆ intrpnest_setup()

subroutine, public scale_interpolation_nest::intrpnest_setup ( integer, intent(in)  interp_search_divnum,
integer, intent(in)  NEST_INTERP_LEVEL,
logical, intent(in)  OFFLINE 
)

Setup.

Definition at line 227 of file scale_interpolation_nest.F90.

References intrpnest_interp_2d, intrpnest_interp_3d, scale_stdio::io_fid_log, scale_stdio::io_l, and scale_process::prc_mpistop().

Referenced by scale_grid_nest::nest_setup().

227  use scale_process, only: &
229  implicit none
230 
231  integer, intent(in) :: interp_search_divnum
232  integer, intent(in) :: nest_interp_level
233  logical, intent(in) :: offline
234 
235  character(7) :: select_type
236  !---------------------------------------------------------------------------
237 
238  if( io_l ) write(io_fid_log,*)
239  if( io_l ) write(io_fid_log,*) '+++ Module[NEST]/Categ[GRID INTERP]'
240 
241  divnum = interp_search_divnum
242 
243  select case ( nest_interp_level )
244  case ( 1 )
245  intrpnest_search_horiz => intrpnest_search_horiz_1points
246  intrpnest_interp_2d => intrpnest_interp_2d_1points
247  intrpnest_interp_3d => intrpnest_interp_3d_1points
248  itp_nh = 1
249 
250  case ( 3 )
251  intrpnest_search_horiz => intrpnest_search_horiz_3points
252  intrpnest_interp_2d => intrpnest_interp_2d_3points
253  intrpnest_interp_3d => intrpnest_interp_3d_3points
254  itp_nh = 3
255 
256  case ( 4 )
257  intrpnest_search_horiz => intrpnest_search_horiz_4points
258  intrpnest_interp_2d => intrpnest_interp_2d_4points
259  intrpnest_interp_3d => intrpnest_interp_3d_4points
260  itp_nh = 4
261 
262  case ( 8 )
263  intrpnest_search_horiz => intrpnest_search_horiz_8points
264  intrpnest_interp_2d => intrpnest_interp_2d_8points
265  intrpnest_interp_3d => intrpnest_interp_3d_8points
266  itp_nh = 8
267 
268  case ( 12 )
269  intrpnest_search_horiz => intrpnest_search_horiz_12points
270  intrpnest_interp_2d => intrpnest_interp_2d_12points
271  intrpnest_interp_3d => intrpnest_interp_3d_12points
272  itp_nh = 12
273 
274  case default
275  write(*,*) 'xxx invarid NEST_INTERP_LEVEL (', nest_interp_level, &
276  ') [setup: nest/interp]'
277  call prc_mpistop
278  end select
279 
280  if ( offline ) then
281  select_type = "offline"
282  intrpnest_search_vert => intrpnest_search_vert_offline
283  else
284  select_type = "online"
285  intrpnest_search_vert => intrpnest_search_vert_online
286  endif
287 
288  if( io_l ) write(io_fid_log,*) '+++ horizontal interpolation with ', &
289  nest_interp_level, " points."
290  if( io_l ) write(io_fid_log,*) '+++ vertical interpolation for ', &
291  trim(select_type)
292 
293  return
subroutine, public prc_mpistop
Abort MPI.
module PROCESS
procedure(intrpnest_intfc_interp_3d), pointer, public intrpnest_interp_3d
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intrpnest_interp_fact_latlon()

subroutine, public scale_interpolation_nest::intrpnest_interp_fact_latlon ( real(rp), dimension(:,:,:), intent(out)  hfact,
integer, dimension (:,:,:), intent(out)  igrd,
integer, dimension (:,:,:), intent(out)  jgrd,
real(rp), dimension(:,:), intent(in)  mylat,
real(rp), dimension(:,:), intent(in)  mylon,
integer, intent(in)  myIA,
integer, intent(in)  myJA,
real(rp), dimension(:,:), intent(in)  inlat,
real(rp), dimension(:,:), intent(in)  inlon,
integer, intent(in)  inIA,
integer, intent(in)  inJA 
)

Definition at line 311 of file scale_interpolation_nest.F90.

References scale_process::prc_mpistop().

Referenced by mod_copytopo::copytopo(), mod_realinput::land_interporation(), and mod_realinput::parentatomsetup().

311  use scale_process, only: &
313  implicit none
314 
315  real(RP), intent(out) :: hfact(:,:,:) ! horizontal interp factor
316  integer, intent(out) :: igrd (:,:,:) ! grid points of interp target
317  integer, intent(out) :: jgrd (:,:,:) ! grid points of interp target
318 
319  real(RP), intent(in) :: mylat(:,:) ! latitude data of mine
320  real(RP), intent(in) :: mylon(:,:) ! longitude data of mine
321  integer, intent(in) :: myia ! grid number of mine
322  integer, intent(in) :: myja ! grid number of mine
323 
324  real(RP), intent(in) :: inlat(:,:) ! latitude data of you (input)
325  real(RP), intent(in) :: inlon(:,:) ! longitude data of you (input)
326  integer, intent(in) :: inia ! grid number of you (input)
327  integer, intent(in) :: inja ! grid number of you (input)
328 
329  integer :: i, j
330  integer :: is, ie
331  integer :: js, je
332  !---------------------------------------------------------------------------
333 
334  hfact(:,:,:) = 0.0_rp
335 
336  do j = 1, myja
337  do i = 1, myia
338  ! nearest block search
339  call intrpnest_search_nearest_block( is, ie, js, je, &
340  mylat(i,j), mylon(i,j), &
341  inlat(:,:), inlon(:,:), &
342  inia, inja )
343 
344  ! main search
345  call intrpnest_search_horiz( hfact(i,j,:), &
346  igrd(i,j,:), &
347  jgrd(i,j,:), &
348  mylat(i,j), &
349  mylon(i,j), &
350  inlat, &
351  inlon, &
352  is, ie, &
353  js, je )
354  enddo
355  enddo
356 
357  return
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
integer, public js
start point of inner domain: y, local
module PROCESS
integer, public ie
end point of inner domain: x, local
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intrpnest_interp_fact_llz()

subroutine, public scale_interpolation_nest::intrpnest_interp_fact_llz ( real(rp), dimension(:,:,:), intent(out)  hfact,
real(rp), dimension(:,:,:,:,:), intent(out)  vfact,
integer, dimension (:,:,:,:,:), intent(out)  kgrd,
integer, dimension (:,:,:), intent(out)  igrd,
integer, dimension (:,:,:), intent(out)  jgrd,
integer, dimension(:,:,:), intent(out)  ncopy,
real(rp), dimension(:,:,:), intent(in)  myhgt,
real(rp), dimension(:,:), intent(in)  mylat,
real(rp), dimension(:,:), intent(in)  mylon,
integer, intent(in)  myKS,
integer, intent(in)  myKE,
integer, intent(in)  myIA,
integer, intent(in)  myJA,
real(rp), dimension(:,:,:), intent(in)  inhgt,
real(rp), dimension(:,:), intent(in)  inlat,
real(rp), dimension(:,:), intent(in)  inlon,
integer, intent(in)  inKA,
integer, intent(in)  inIA,
integer, intent(in)  inJA,
logical, intent(in), optional  landgrid 
)

Definition at line 384 of file scale_interpolation_nest.F90.

References scale_const::const_eps, scale_grid_index::ia, scale_grid_index::ie, scale_grid_index::is, scale_grid_index::ja, scale_grid_index::je, scale_grid_index::js, scale_grid_index::ke, scale_grid_index::khalo, scale_grid_index::ks, scale_land_grid_index::lkmax, and scale_process::prc_mpistop().

Referenced by mod_realinput::land_interporation(), scale_grid_nest::nest_setup(), mod_realinput_scale::parentatominputscale(), and mod_realinput::parentatomsetup().

384  use scale_process, only: &
386  implicit none
387 
388  real(RP), intent(out) :: hfact(:,:,:) ! horizontal interp factor
389  real(RP), intent(out) :: vfact(:,:,:,:,:) ! vertical interp factor
390  integer, intent(out) :: kgrd (:,:,:,:,:) ! grid points of interp target
391  integer, intent(out) :: igrd (:,:,:) ! grid points of interp target
392  integer, intent(out) :: jgrd (:,:,:) ! grid points of interp target
393  integer, intent(out) :: ncopy(:,:,:) ! number of daughter's layers below parent lowest layer
394 
395  real(RP), intent(in) :: myhgt(:,:,:) ! height data of mine
396  real(RP), intent(in) :: mylat(:,:) ! latitude data of mine
397  real(RP), intent(in) :: mylon(:,:) ! longitude data of mine
398  integer, intent(in) :: myks ! start grid number of mine
399  integer, intent(in) :: myke ! end grid number of mine
400  integer, intent(in) :: myia ! grid number of mine
401  integer, intent(in) :: myja ! grid number of mine
402 
403  real(RP), intent(in) :: inhgt(:,:,:) ! height data of you (input)
404  real(RP), intent(in) :: inlat(:,:) ! latitude data of you (input)
405  real(RP), intent(in) :: inlon(:,:) ! longitude data of you (input)
406  integer, intent(in) :: inka ! grid number of you (input)
407  integer, intent(in) :: inia ! grid number of you (input)
408  integer, intent(in) :: inja ! grid number of you (input)
409 
410  logical, intent(in), optional :: landgrid
411 
412  integer :: i, j
413  integer :: is, ie
414  integer :: js, je
415  logical :: lndgrd
416  !---------------------------------------------------------------------------
417 
418  lndgrd = .false.
419  if ( present(landgrid) ) then
420  if ( landgrid ) then
421  lndgrd = .true.
422  endif
423  endif
424 
425  hfact(:,:,:) = 0.0_rp
426  vfact(:,:,:,:,:) = 0.0_rp
427  ncopy(:,:,:) = 0
428 
429  do j = 1, myja
430  do i = 1, myia
431 
432  ! nearest block search
433  call intrpnest_search_nearest_block( is, ie, js, je, &
434  mylat(i,j), mylon(i,j), &
435  inlat(:,:), inlon(:,:), &
436  inia, inja )
437 
438  ! main search
439  call intrpnest_search_horiz( hfact(i,j,:), &
440  igrd(i,j,:), &
441  jgrd(i,j,:), &
442  mylat(i,j), &
443  mylon(i,j), &
444  inlat, &
445  inlon, &
446  is, ie, &
447  js, je )
448 
449 
450  call intrpnest_search_vert( vfact, &
451  kgrd, &
452  ncopy(i,j,:), &
453  igrd(i,j,:), &
454  jgrd(i,j,:), &
455  myhgt(:,i,j), &
456  inhgt, &
457  i, j, &
458  myks, myke, &
459  inka, &
460  lndgrd )
461 
462  enddo
463  enddo
464 
465  return
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
integer, public js
start point of inner domain: y, local
module PROCESS
integer, public ie
end point of inner domain: x, local
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intrpnest_domain_compatibility()

subroutine, public scale_interpolation_nest::intrpnest_domain_compatibility ( real(rp), dimension(:,:), intent(in)  lon_org,
real(rp), dimension(:,:), intent(in)  lat_org,
real(rp), dimension(:,:,:), intent(in)  lev_org,
real(rp), dimension(:,:), intent(in)  lon_loc,
real(rp), dimension(:,:), intent(in)  lat_loc,
real(rp), dimension(:,:,:), intent(in)  lev_loc,
logical, intent(in), optional  skip_x,
logical, intent(in), optional  skip_y,
logical, intent(in), optional  skip_z 
)

Definition at line 1931 of file scale_interpolation_nest.F90.

References scale_const::const_d2r, and scale_process::prc_mpistop().

Referenced by mod_copytopo::copytopo(), and mod_realinput::parentatomsetup().

1931  use scale_process, only: &
1932  prc_mpistop
1933  use scale_const, only: &
1934  d2r => const_d2r
1935  implicit none
1936  real(RP), intent(in) :: lon_org(:,:)
1937  real(RP), intent(in) :: lat_org(:,:)
1938  real(RP), intent(in) :: lev_org(:,:,:)
1939  real(RP), intent(in) :: lon_loc(:,:)
1940  real(RP), intent(in) :: lat_loc(:,:)
1941  real(RP), intent(in) :: lev_loc(:,:,:)
1942  logical, intent(in), optional :: skip_x
1943  logical, intent(in), optional :: skip_y
1944  logical, intent(in), optional :: skip_z
1945 
1946  real(RP) :: max_ref, min_ref
1947  real(RP) :: max_loc, min_loc
1948 
1949  logical :: do_xdirec
1950  logical :: do_ydirec
1951  logical :: do_zdirec
1952  !---------------------------------------------------------------------------
1953 
1954  do_xdirec = .true.
1955  if ( present(skip_x) ) then
1956  if ( skip_x ) then
1957  do_xdirec = .false.
1958  endif
1959  endif
1960 
1961  do_ydirec = .true.
1962  if ( present(skip_y) ) then
1963  if ( skip_y ) then
1964  do_ydirec = .false.
1965  endif
1966  endif
1967 
1968  do_zdirec = .true.
1969  if ( present(skip_z) ) then
1970  if ( skip_z ) then
1971  do_zdirec = .false.
1972  endif
1973  endif
1974 
1975  if ( do_xdirec ) then
1976  max_ref = maxval( lon_org(:,:) / d2r )
1977  min_ref = minval( lon_org(:,:) / d2r )
1978  max_loc = maxval( lon_loc(:,:) / d2r )
1979  min_loc = minval( lon_loc(:,:) / d2r )
1980 
1981  if ( max_ref < max_loc .OR. min_ref > min_loc ) then
1982  write(*,*) 'xxx ERROR: REQUESTED DOMAIN IS TOO MUCH BROAD'
1983  write(*,*) 'xxx -- LONGITUDINAL direction over the limit'
1984  write(*,*) 'xxx -- reference max: ', max_ref
1985  write(*,*) 'xxx -- reference min: ', min_ref
1986  write(*,*) 'xxx -- local max: ', max_loc
1987  write(*,*) 'xxx -- local min: ', min_loc
1988  call prc_mpistop
1989  endif
1990  endif
1991 
1992  if ( do_ydirec ) then
1993  max_ref = maxval( lat_org(:,:) / d2r )
1994  min_ref = minval( lat_org(:,:) / d2r )
1995  max_loc = maxval( lat_loc(:,:) / d2r )
1996  min_loc = minval( lat_loc(:,:) / d2r )
1997 
1998  if ( max_ref < max_loc .OR. min_ref > min_loc ) then
1999  write(*,*) 'xxx ERROR: REQUESTED DOMAIN IS TOO MUCH BROAD'
2000  write(*,*) 'xxx -- LATITUDINAL direction over the limit'
2001  write(*,*) 'xxx -- reference max: ', max_ref
2002  write(*,*) 'xxx -- reference min: ', min_ref
2003  write(*,*) 'xxx -- local max: ', max_loc
2004  write(*,*) 'xxx -- local min: ', min_loc
2005  call prc_mpistop
2006  endif
2007  endif
2008 
2009  if ( do_zdirec ) then
2010  max_ref = maxval( lev_org(:,:,:) )
2011  !max_loc = maxval( lev_loc(KS-1:KE+1,:,:) ) ! HALO + 1
2012  max_loc = maxval( lev_loc(:,:,:) ) ! HALO + 1
2013  !min_ref = minval( lev_org(:,:,:) )
2014  !min_loc = minval( lev_loc(3:KA,:,:) ) ! HALO + 1
2015 
2016  if ( max_ref < max_loc ) then
2017  !if ( max_ref < max_loc .OR. min_ref > min_loc ) then
2018  write(*,*) 'xxx ERROR: REQUESTED DOMAIN IS TOO MUCH BROAD'
2019  write(*,*) 'xxx -- VERTICAL direction over the limit'
2020  write(*,*) 'xxx -- reference max: ', max_ref
2021  !write(*,*) 'xxx -- reference min: ', min_ref
2022  write(*,*) 'xxx -- local max: ', max_loc
2023  !write(*,*) 'xxx -- local min: ', min_loc
2024  call prc_mpistop
2025  endif
2026  endif
2027 
2028  return
subroutine, public prc_mpistop
Abort MPI.
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:35
module PROCESS
module CONSTANT
Definition: scale_const.F90:14
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ intrpnest_interp_2d

procedure(intrpnest_intfc_interp_2d), pointer, public scale_interpolation_nest::intrpnest_interp_2d => NULL()

Definition at line 161 of file scale_interpolation_nest.F90.

Referenced by mod_copytopo::copytopo(), intrpnest_setup(), mod_realinput::land_interporation(), mod_realinput_scale::parentatominputscale(), and mod_realinput::parentatomsetup().

161  procedure(intrpnest_intfc_interp_2d), pointer :: intrpnest_interp_2d => null()

◆ intrpnest_interp_3d

procedure(intrpnest_intfc_interp_3d), pointer, public scale_interpolation_nest::intrpnest_interp_3d => NULL()

Definition at line 196 of file scale_interpolation_nest.F90.

Referenced by intrpnest_setup(), mod_realinput::land_interporation(), scale_grid_nest::nest_comm_intercomm_nestdown_3d(), mod_realinput_scale::parentatominputscale(), and mod_realinput::parentatomsetup().

196  procedure(intrpnest_intfc_interp_3d), pointer :: intrpnest_interp_3d => null()
procedure(intrpnest_intfc_interp_3d), pointer, public intrpnest_interp_3d