Octopus
regridding_oct_m Module Reference

Implementation details for regridding. More...

Detailed Description

Implementation details for regridding.

For commensurate grids, restriction and prolongation are chosen such that they are adjoint operators.

  1. Simple mapping:

    • find all points of output mesh that are also on the local input mesh
    • get their partition number on the output mesh
    • use the partition_transfer class to communicate those points
    • use the corresponding mappings for the input and output buffers

  2. Restriction: mapping from fine to coarse meshes.

    The strategy is as follows:

    • find all points of the coarse mesh that correspond to local points of the fine mesh
    • find all points of the coarse mesh around those that have been found that are connected by an order-1 cube stencil - the idea is that those points have contributions in the restriction operation from points on the fine mesh
    • create the stencil for the restriction and compute the weights; the size is 2*(eta-1)+1 in each dimension, where eta is the ratio of the grid spacings
    • save the indices of all of these points for communication
    • when doing the transfer:
      • apply the restriction by looping over the locally matching coarse points and applying the restriction stencil, adding up the contribution from the points on the fine mesh
      • communicate those values
      • do a reduction of the received values; each rank can receive contributions from different ranks, depending on the parallelization
  3. Prolongation: mapping from coarse to fine meshes using linear interpolation in nd space

    The strategy is slightly different from the restriction operator:

    • first, get all local coarse points corresponding to local fine points on the output mesh, thus loop over the output mesh here
    • get all points on the coarse input mesh reachable by a cube stencil
    • these are now the points needed for the output mesh
    • use the inverse partition transfer to communicate the points; this is needed because the normal partition transfer can only communicate points that are locally available, but we also potentially need some from other cores
    • when doing the transfer, loop over the coarse points and apply the transfer stencil (which corresponds to linear interpolation) to the adjacent fine mesh points. For each point of the fine mesh, the contributions of the coarse mesh points are accumulated.

For curvilinear or non-commmensurate grids, a generic interpolation scheme is used:

  • for each point in the output mesh, either take the value from the input mesh if it is present there as well or get the hexahedron with the 8 vertices surrounding it on the input mesh
  • determine the interpolation coefficients on these hexahedra and apply the interpolation when doing the transfer This scheme is simpler than the one above, but it is not adjoint in both directions.

Data Types

interface  regridding_t
 contains the information of the meshes and provides the transfer functions More...
 

Functions/Subroutines

class(regridding_t) function, pointer regridding_init (mesh_out, mesh_in, space_in, namespace)
 Generate a re-mapping of points from mesh_in to mesh_out. More...
 
subroutine regridding_finalize (this)
 
subroutine dregridding_do_transfer_1 (this, ff_out, ff_in)
 transfer fields of rank 1 More...
 
subroutine dregridding_do_transfer_2 (this, ff_out, ff_in)
 transfer fields of rank 2 More...
 
subroutine zregridding_do_transfer_1 (this, ff_out, ff_in)
 transfer fields of rank 1 More...
 
subroutine zregridding_do_transfer_2 (this, ff_out, ff_in)
 transfer fields of rank 2 More...
 

Variables

integer, parameter linear = 0
 
integer, parameter nearest_neighbor = 1
 
integer, parameter scale_none = 0
 
integer, parameter scale_norm2 = 1
 

Function/Subroutine Documentation

◆ regridding_init()

class(regridding_t) function, pointer regridding_oct_m::regridding_init ( class(mesh_t), intent(in), target  mesh_out,
class(mesh_t), intent(in), target  mesh_in,
class(space_t), intent(in)  space_in,
type(namespace_t), intent(in)  namespace 
)

Generate a re-mapping of points from mesh_in to mesh_out.

Definition at line 236 of file regridding.F90.

◆ regridding_finalize()

subroutine regridding_oct_m::regridding_finalize ( type(regridding_t), intent(inout)  this)

Definition at line 728 of file regridding.F90.

◆ dregridding_do_transfer_1()

subroutine regridding_oct_m::dregridding_do_transfer_1 ( class(regridding_t), intent(in)  this,
real(real64), dimension(:), intent(inout)  ff_out,
real(real64), dimension(:), intent(in)  ff_in 
)

transfer fields of rank 1

Definition at line 795 of file regridding.F90.

◆ dregridding_do_transfer_2()

subroutine regridding_oct_m::dregridding_do_transfer_2 ( class(regridding_t), intent(in)  this,
real(real64), dimension(:, :), intent(inout)  ff_out,
real(real64), dimension(:, :), intent(in)  ff_in 
)

transfer fields of rank 2

Definition at line 961 of file regridding.F90.

◆ zregridding_do_transfer_1()

subroutine regridding_oct_m::zregridding_do_transfer_1 ( class(regridding_t), intent(in)  this,
complex(real64), dimension(:), intent(inout)  ff_out,
complex(real64), dimension(:), intent(in)  ff_in 
)

transfer fields of rank 1

Definition at line 1049 of file regridding.F90.

◆ zregridding_do_transfer_2()

subroutine regridding_oct_m::zregridding_do_transfer_2 ( class(regridding_t), intent(in)  this,
complex(real64), dimension(:, :), intent(inout)  ff_out,
complex(real64), dimension(:, :), intent(in)  ff_in 
)

transfer fields of rank 2

Definition at line 1215 of file regridding.F90.

Variable Documentation

◆ linear

integer, parameter regridding_oct_m::linear = 0

Definition at line 226 of file regridding.F90.

◆ nearest_neighbor

integer, parameter regridding_oct_m::nearest_neighbor = 1

Definition at line 226 of file regridding.F90.

◆ scale_none

integer, parameter regridding_oct_m::scale_none = 0

Definition at line 226 of file regridding.F90.

◆ scale_norm2

integer, parameter regridding_oct_m::scale_norm2 = 1

Definition at line 226 of file regridding.F90.