Afivo  0.3
Functions/Subroutines
m_af_ghostcell Module Reference

This module contains routines related to the filling of ghost cells. Note that corner ghost cells are not used in Afivo. More...

Functions/Subroutines

subroutine, public af_gc_tree (tree, ivs, corners, leaves_only)
 Fill ghost cells for variables ivs on the sides of all boxes, using subr_rb on refinement boundaries and subr_bc on physical boundaries. More...
 
subroutine, public af_gc_lvl (tree, lvl, ivs, corners)
 Fill ghost cells for variables ivs on the sides of all boxes. More...
 
subroutine, public af_gc_box (tree, id, ivs, corners)
 Fill ghost cells for variables ivs. More...
 
subroutine af_gc_box_corner (boxes, id, ivs)
 Fill corner ghost cells for variable iv on corners/edges of a box. If there is no box to copy the data from, use linear extrapolation. This routine assumes ghost cells on the sides of the box are available. More...
 
subroutine bc_to_gc (box, nb, iv, bc_val, bc_type)
 Convert a boundary condition to ghost cell data. More...
 
subroutine bc_to_gc2 (nc, cc, nb, bc_val, bc_type, dr)
 Convert a boundary condition to two layers of ghost cell data. More...
 
subroutine, public af_gc_prolong_copy (boxes, id, nb, iv, op_mask)
 Partial prolongation to the ghost cells of box id from parent. More...
 
subroutine, public af_gc_interp (boxes, id, nb, iv, op_mask)
 Interpolate between fine points and coarse neighbors to fill ghost cells near refinement boundaries. More...
 
subroutine, public af_gc_interp_lim (boxes, id, nb, iv, op_mask)
 Interpolate between fine points and coarse neighbors to fill ghost cells near refinement boundaries. The ghost values are less than twice the coarse values. More...
 
subroutine, public af_bc_neumann_zero (box, nb, iv, coords, bc_val, bc_type)
 This fills ghost cells near physical boundaries using Neumann zero. More...
 
subroutine, public af_bc_dirichlet_zero (box, nb, iv, coords, bc_val, bc_type)
 This fills ghost cells near physical boundaries using Dirichlet zero. More...
 
subroutine, public af_bc_set_continuous (box, nb, iv, coords, bc_val, bc_type)
 This fills ghost cells near physical boundaries using the same slope. More...
 
subroutine copy_from_nb (box, box_nb, dnb, lo, hi, ivs)
 
subroutine, public af_gc2_box (tree, id, ivs, cc)
 Get array of cell-centered variables with multiple ghost cells, excluding corners. More...
 
subroutine gc2_prolong_rb (tree, id, nb, iv, nc, cc)
 Conservative prolongation with a limited slope for ghost cells near refinement boundaries. More...
 
subroutine af_corner_gc_extrap (box, ix, ivs)
 This fills corner ghost cells using linear extrapolation. The ghost cells on the sides already need to be filled. More...
 
subroutine af_edge_gc_extrap (box, lo, dim, ivs)
 This fills edge ghost cells using linear extrapolation. The ghost cells on the sides already need to be filled. This routine basically performs the same operation as af_corner_gc_extrap does in 2D. More...
 

Detailed Description

This module contains routines related to the filling of ghost cells. Note that corner ghost cells are not used in Afivo.

Function/Subroutine Documentation

◆ af_gc_tree()

subroutine, public m_af_ghostcell::af_gc_tree ( type(af_t), intent(inout)  tree,
integer, dimension(:), intent(in)  ivs,
logical, intent(in), optional  corners,
logical, intent(in), optional  leaves_only 
)

Fill ghost cells for variables ivs on the sides of all boxes, using subr_rb on refinement boundaries and subr_bc on physical boundaries.

Parameters
[in,out]treeTree to fill ghost cells on
[in]ivsVariables for which ghost cells are set
[in]cornersFill corner ghost cells (default: yes)
[in]leaves_onlyFill only leaves' ghost cells (default: false)

Definition at line 25 of file m_af_ghostcell.f90.

◆ af_gc_lvl()

subroutine, public m_af_ghostcell::af_gc_lvl ( type(af_t), intent(inout)  tree,
integer, intent(in)  lvl,
integer, dimension(:), intent(in)  ivs,
logical, intent(in), optional  corners 
)

Fill ghost cells for variables ivs on the sides of all boxes.

Parameters
[in,out]treeTree to fill ghost cells on
[in]lvlFill on this refinement level
[in]ivsVariables for which ghost cells are set
[in]cornersFill corner ghost cells (default: yes)

Definition at line 49 of file m_af_ghostcell.f90.

◆ af_gc_box()

subroutine, public m_af_ghostcell::af_gc_box ( type(af_t), intent(inout)  tree,
integer, intent(in)  id,
integer, dimension(:), intent(in)  ivs,
logical, intent(in), optional  corners 
)

Fill ghost cells for variables ivs.

Parameters
[in,out]treeTree to fill ghost cells on
[in]idId of box for which we set ghost cells
[in]ivsVariables for which ghost cells are set
[in]cornersFill corner ghost cells (default: yes)

Definition at line 64 of file m_af_ghostcell.f90.

◆ af_gc_box_corner()

subroutine m_af_ghostcell::af_gc_box_corner ( type(box_t), dimension(:), intent(inout)  boxes,
integer, intent(in)  id,
integer, dimension(:), intent(in)  ivs 
)
private

Fill corner ghost cells for variable iv on corners/edges of a box. If there is no box to copy the data from, use linear extrapolation. This routine assumes ghost cells on the sides of the box are available.

Parameters
[in,out]boxesList of all the boxes
[in]idId of box for which we set ghost cells
[in]ivsVariable for which ghost cells are set

Definition at line 125 of file m_af_ghostcell.f90.

◆ bc_to_gc()

subroutine m_af_ghostcell::bc_to_gc ( type(box_t), intent(inout)  box,
integer, intent(in)  nb,
integer, intent(in)  iv,
real(dp), dimension(box%n_cell**(ndim-1)), intent(in)  bc_val,
integer, intent(in)  bc_type 
)
private

Convert a boundary condition to ghost cell data.

Parameters
[in]ivVariable to fill
[in]nbNeighbor direction
[in]bc_typeType of b.c.

Definition at line 173 of file m_af_ghostcell.f90.

◆ bc_to_gc2()

subroutine m_af_ghostcell::bc_to_gc2 ( integer, intent(in)  nc,
real(dp), dimension(dtimes(-1:nc+2)), intent(inout)  cc,
integer, intent(in)  nb,
real(dp), dimension(nc**(ndim-1)), intent(in)  bc_val,
integer, intent(in)  bc_type,
real(dp), dimension(ndim), intent(in)  dr 
)
private

Convert a boundary condition to two layers of ghost cell data.

Parameters
[in]ncNumber of cells
[in,out]ccCell-centered data
[in]nbNeighbor direction
[in]bc_valBoundary condition
[in]bc_typeType of b.c.
[in]drGrid spacing

Definition at line 282 of file m_af_ghostcell.f90.

◆ af_gc_prolong_copy()

subroutine, public m_af_ghostcell::af_gc_prolong_copy ( type(box_t), dimension(:), intent(inout)  boxes,
integer, intent(in)  id,
integer, intent(in)  nb,
integer, intent(in)  iv,
integer, intent(in)  op_mask 
)

Partial prolongation to the ghost cells of box id from parent.

Parameters
[in,out]boxesList of all boxes
[in]idId of child
[in]ivVariable to fill
[in]nbNeighbor to get data from
[in]op_maskMultigrid operator mask

Definition at line 378 of file m_af_ghostcell.f90.

◆ af_gc_interp()

subroutine, public m_af_ghostcell::af_gc_interp ( type(box_t), dimension(:), intent(inout)  boxes,
integer, intent(in)  id,
integer, intent(in)  nb,
integer, intent(in)  iv,
integer, intent(in)  op_mask 
)

Interpolate between fine points and coarse neighbors to fill ghost cells near refinement boundaries.

Parameters
[in,out]boxesList of all boxes
[in]idId of box
[in]nbGhost cell direction
[in]ivGhost cell variable
[in]op_maskMultigrid operator mask

Definition at line 394 of file m_af_ghostcell.f90.

◆ af_gc_interp_lim()

subroutine, public m_af_ghostcell::af_gc_interp_lim ( type(box_t), dimension(:), intent(inout)  boxes,
integer, intent(in)  id,
integer, intent(in)  nb,
integer, intent(in)  iv,
integer, intent(in)  op_mask 
)

Interpolate between fine points and coarse neighbors to fill ghost cells near refinement boundaries. The ghost values are less than twice the coarse values.

Parameters
[in,out]boxesList of all boxes
[in]idId of box
[in]nbGhost cell direction
[in]ivGhost cell variable
[in]op_maskMultigrid operator mask

Definition at line 503 of file m_af_ghostcell.f90.

◆ af_bc_neumann_zero()

subroutine, public m_af_ghostcell::af_bc_neumann_zero ( type(box_t), intent(in)  box,
integer, intent(in)  nb,
integer, intent(in)  iv,
real(dp), dimension(ndim, box%n_cell**(ndim-1)), intent(in)  coords,
real(dp), dimension(box%n_cell**(ndim-1)), intent(out)  bc_val,
integer, intent(out)  bc_type 
)

This fills ghost cells near physical boundaries using Neumann zero.

Definition at line 615 of file m_af_ghostcell.f90.

◆ af_bc_dirichlet_zero()

subroutine, public m_af_ghostcell::af_bc_dirichlet_zero ( type(box_t), intent(in)  box,
integer, intent(in)  nb,
integer, intent(in)  iv,
real(dp), dimension(ndim, box%n_cell**(ndim-1)), intent(in)  coords,
real(dp), dimension(box%n_cell**(ndim-1)), intent(out)  bc_val,
integer, intent(out)  bc_type 
)

This fills ghost cells near physical boundaries using Dirichlet zero.

Definition at line 628 of file m_af_ghostcell.f90.

◆ af_bc_set_continuous()

subroutine, public m_af_ghostcell::af_bc_set_continuous ( type(box_t), intent(in)  box,
integer, intent(in)  nb,
integer, intent(in)  iv,
real(dp), dimension(ndim, box%n_cell**(ndim-1)), intent(in)  coords,
real(dp), dimension(box%n_cell**(ndim-1)), intent(out)  bc_val,
integer, intent(out)  bc_type 
)

This fills ghost cells near physical boundaries using the same slope.

Definition at line 641 of file m_af_ghostcell.f90.

◆ copy_from_nb()

subroutine m_af_ghostcell::copy_from_nb ( type(box_t), intent(inout)  box,
type(box_t), intent(in)  box_nb,
integer, dimension(ndim), intent(in)  dnb,
integer, dimension(ndim), intent(in)  lo,
integer, dimension(ndim), intent(in)  hi,
integer, dimension(:), intent(in)  ivs 
)
private
Parameters
[in,out]boxBox on which to fill ghost cells
[in]box_nbNeighbouring box
[in]dnbNeighbor spatial index offset
[in]loGhost cell low index
[in]hiGhost cell high index
[in]ivsGhost cell variable

Definition at line 654 of file m_af_ghostcell.f90.

◆ af_gc2_box()

subroutine, public m_af_ghostcell::af_gc2_box ( type(af_t), intent(inout)  tree,
integer, intent(in)  id,
integer, dimension(:), intent(in)  ivs,
real(dp), dimension(dtimes(-1:tree%n_cell+2), size(ivs)), intent(inout)  cc 
)

Get array of cell-centered variables with multiple ghost cells, excluding corners.

Parameters
[in,out]treeTree to fill ghost cells on
[in]idId of box for which we set ghost cells
[in]ivsVariables for which ghost cells are set

Definition at line 672 of file m_af_ghostcell.f90.

◆ gc2_prolong_rb()

subroutine m_af_ghostcell::gc2_prolong_rb ( type(af_t), intent(in)  tree,
integer, intent(in)  id,
integer, intent(in)  nb,
integer, intent(in)  iv,
integer, intent(in)  nc,
real(dp), dimension(dtimes(-1:nc+2)), intent(inout)  cc 
)
private

Conservative prolongation with a limited slope for ghost cells near refinement boundaries.

This method assumes that the ghost cells for leaves on a coarser level have already been set, which is typically the case.

Todo:
make compatible with arbitrary number of ghost cells
Parameters
[in]idIndex of box to fill ghost cells for
[in]nbNeighbor direction
[in]ivIndex of variable
[in]ncNumber of cells
[in,out]ccEnlarged array

Definition at line 753 of file m_af_ghostcell.f90.

◆ af_corner_gc_extrap()

subroutine m_af_ghostcell::af_corner_gc_extrap ( type(box_t), intent(inout)  box,
integer, dimension(ndim), intent(in)  ix,
integer, dimension(:), intent(in)  ivs 
)

This fills corner ghost cells using linear extrapolation. The ghost cells on the sides already need to be filled.

Parameters
[in,out]boxBox to fill ghost cells for
[in]ixCell-index of corner
[in]ivsVariable to fill

Definition at line 860 of file m_af_ghostcell.f90.

◆ af_edge_gc_extrap()

subroutine m_af_ghostcell::af_edge_gc_extrap ( type(box_t), intent(inout)  box,
integer, dimension(ndim), intent(in)  lo,
integer, intent(in)  dim,
integer, dimension(:), intent(in)  ivs 
)
private

This fills edge ghost cells using linear extrapolation. The ghost cells on the sides already need to be filled. This routine basically performs the same operation as af_corner_gc_extrap does in 2D.

Parameters
[in,out]boxBox to operate on
[in]loLowest index of edge ghost cells
[in]dimDimension parallel to edge
[in]ivsVariable to fill

Definition at line 885 of file m_af_ghostcell.f90.