Afivo  0.3
Data Types | Functions/Subroutines | Variables
m_af_stencil Module Reference

This module contains functionality for dealing with numerical stencils. More...

Data Types

interface  af_subr_stencil
 Subroutine for setting a stencil on a box. More...
 

Functions/Subroutines

subroutine, public af_stencil_print_info (tree)
 Print statistics about the stencils in the tree. More...
 
pure integer function, public af_stencil_index (box, key)
 Get index of a stencil, or af_stencil_none is not present. More...
 
subroutine, public af_stencil_store (tree, key, set_stencil)
 Store a constant stencil. More...
 
subroutine, public af_stencil_prepare_store (box, key, ix)
 Prepare to store a stencil. More...
 
subroutine, public af_stencil_allocate_coeff (stencil, nc, use_f, n_sparse)
 Allocate storage for stencil coefficients. More...
 
subroutine, public af_stencil_remove (tree, key)
 Remove a stencil. More...
 
subroutine, public af_stencil_store_box (box, key, set_stencil)
 Store a stencil for a box. More...
 
subroutine af_stencil_remove_box (box, key)
 Remove a stencil from a box. This will change the order of other stencils. More...
 
subroutine, public af_stencil_check_box (box, key, ix)
 Check if a stencil was correctly stored for a box. More...
 
subroutine, public af_stencil_apply (tree, key, iv, i_out)
 
subroutine, public af_stencil_apply_box (box, key, iv, i_out)
 
subroutine stencil_apply_357 (box, stencil, iv, i_out)
 Apply a 3/5/7-point stencil in 1D/2D/3D. More...
 
subroutine, public af_stencil_prolong_box (box_p, box_c, key, iv, iv_to, add)
 
subroutine stencil_prolong_234 (box_p, box_c, stencil, iv, iv_to, add)
 Linear prolongation using nearest NDIM+1 neighbors. More...
 
subroutine stencil_prolong_248 (box_p, box_c, stencil, iv, iv_to, add)
 (Bi-/tri-)linear prolongation using nearest 2**NDIM neighbors More...
 
subroutine, public af_stencil_gsrb_box (box, key, redblack, iv, i_rhs)
 Perform Gauss-Seidel red-black on a stencil. More...
 
subroutine stencil_gsrb_357 (box, stencil, redblack, iv, i_rhs)
 Perform Gauss-Seidel red-black on a 3/5/7-point stencil in 1D/2D/3D. More...
 
subroutine, public af_stencil_try_constant (box, ix, abs_tol, success)
 Convert a variable stencil to constant one if possible. More...
 
subroutine, public af_stencil_get_box (box, key, v)
 Get the stencil for a box. More...
 
subroutine stencil_get_357 (box, stencil, v)
 Get the stencil for all cells in a box. More...
 

Variables

integer, parameter stencil_list_initial_size = 10
 Initial size of stencil list. More...
 
integer, parameter, public stencil_constant = 1
 Constant stencil. More...
 
integer, parameter, public stencil_variable = 2
 Variable stencil. More...
 
integer, parameter, public stencil_sparse = 3
 Sparse stencil. More...
 
integer, parameter, private num_shapes = 5
 Number of predefined stencil shapes. More...
 
integer, parameter, public af_stencil_357 = 1
 3/5/7 point stencil in 1D/2D/3D More...
 
integer, parameter, public af_stencil_p234 = 2
 Prolongation stencil using nearest 2, 3, 4 neighbors in 1D-3D. More...
 
integer, parameter, public af_stencil_p248 = 3
 Prolongation stencil using nearest 2, 4, 8 neighbors in 1D-3D. More...
 
integer, parameter, public af_stencil_246 = 4
 Stencil for direct neighbors. More...
 
integer, parameter, public af_stencil_mask = 5
 Stencil for masking. More...
 
integer, dimension(num_shapes), parameter, public af_stencil_sizes = [2*NDIM+1, NDIM+1, 2**NDIM, 2*NDIM, 1]
 Number of coefficients in the stencils. More...
 

Detailed Description

This module contains functionality for dealing with numerical stencils.

Function/Subroutine Documentation

◆ af_stencil_print_info()

subroutine, public m_af_stencil::af_stencil_print_info ( type(af_t), intent(in)  tree)

Print statistics about the stencils in the tree.

Definition at line 65 of file m_af_stencil.f90.

◆ af_stencil_index()

pure integer function, public m_af_stencil::af_stencil_index ( type(box_t), intent(in)  box,
integer, intent(in)  key 
)

Get index of a stencil, or af_stencil_none is not present.

Definition at line 109 of file m_af_stencil.f90.

◆ af_stencil_store()

subroutine, public m_af_stencil::af_stencil_store ( type(af_t), intent(inout)  tree,
integer, intent(in)  key,
procedure(af_subr_stencil set_stencil 
)

Store a constant stencil.

Parameters
[in]keyStencil key
set_stencilMethod to set a stencil

Definition at line 124 of file m_af_stencil.f90.

◆ af_stencil_prepare_store()

subroutine, public m_af_stencil::af_stencil_prepare_store ( type(box_t), intent(inout)  box,
integer, intent(in)  key,
integer, intent(out)  ix 
)

Prepare to store a stencil.

Parameters
[in]keyStencil key
[out]ixIndex to store stencil

Definition at line 144 of file m_af_stencil.f90.

◆ af_stencil_allocate_coeff()

subroutine, public m_af_stencil::af_stencil_allocate_coeff ( type(stencil_t), intent(inout)  stencil,
integer, intent(in)  nc,
logical, intent(in), optional  use_f,
integer, intent(in), optional  n_sparse 
)

Allocate storage for stencil coefficients.

Parameters
[in]ncNumber of cells per box dimension
[in]use_fWhether storage for the extra arrays f and bc_correction is required (only for variable stencils)
[in]n_sparseNumber of entries for sparse stencil

Definition at line 171 of file m_af_stencil.f90.

◆ af_stencil_remove()

subroutine, public m_af_stencil::af_stencil_remove ( type(af_t), intent(inout)  tree,
integer, intent(in)  key 
)

Remove a stencil.

Parameters
[in]keyStencil key

Definition at line 227 of file m_af_stencil.f90.

◆ af_stencil_store_box()

subroutine, public m_af_stencil::af_stencil_store_box ( type(box_t), intent(inout)  box,
integer, intent(in)  key,
procedure(af_subr_stencil set_stencil 
)

Store a stencil for a box.

Parameters
[in]keyStencil key
set_stencilMethod to set a stencil

Definition at line 245 of file m_af_stencil.f90.

◆ af_stencil_remove_box()

subroutine m_af_stencil::af_stencil_remove_box ( type(box_t), intent(inout)  box,
integer, intent(in)  key 
)
private

Remove a stencil from a box. This will change the order of other stencils.

Parameters
[in]keyStencil key

Definition at line 257 of file m_af_stencil.f90.

◆ af_stencil_check_box()

subroutine, public m_af_stencil::af_stencil_check_box ( type(box_t), intent(in)  box,
integer, intent(in)  key,
integer, intent(in)  ix 
)

Check if a stencil was correctly stored for a box.

Parameters
[in]keyStencil key
[in]ixStencil index

Definition at line 278 of file m_af_stencil.f90.

◆ af_stencil_apply()

subroutine, public m_af_stencil::af_stencil_apply ( type(af_t), intent(inout)  tree,
integer, intent(in)  key,
integer, intent(in)  iv,
integer, intent(in)  i_out 
)
Parameters
[in,out]treeOperate on this box
[in]keyStencil key
[in]ivInput variable
[in]i_outOutput variable

Definition at line 310 of file m_af_stencil.f90.

◆ af_stencil_apply_box()

subroutine, public m_af_stencil::af_stencil_apply_box ( type(box_t), intent(inout)  box,
integer, intent(in)  key,
integer, intent(in)  iv,
integer, intent(in)  i_out 
)
Parameters
[in,out]boxOperate on this box
[in]keyStencil key
[in]ivInput variable
[in]i_outOutput variable

Definition at line 330 of file m_af_stencil.f90.

◆ stencil_apply_357()

subroutine m_af_stencil::stencil_apply_357 ( type(box_t), intent(inout)  box,
type(stencil_t), intent(in)  stencil,
integer, intent(in)  iv,
integer, intent(in)  i_out 
)
private

Apply a 3/5/7-point stencil in 1D/2D/3D.

Parameters
[in,out]boxOperate on this box
[in]ivInput variable
[in]i_outOutput variable

Definition at line 349 of file m_af_stencil.f90.

◆ af_stencil_prolong_box()

subroutine, public m_af_stencil::af_stencil_prolong_box ( type(box_t), intent(in)  box_p,
type(box_t), intent(inout)  box_c,
integer, intent(in)  key,
integer, intent(in)  iv,
integer, intent(in)  iv_to,
logical, intent(in), optional  add 
)
Parameters
[in]box_pParent box
[in,out]box_cChild box
[in]keyStencil key
[in]ivInput variable
[in]iv_toDestination variable
[in]addAdd to old values

Definition at line 534 of file m_af_stencil.f90.

◆ stencil_prolong_234()

subroutine m_af_stencil::stencil_prolong_234 ( type(box_t), intent(in)  box_p,
type(box_t), intent(inout)  box_c,
type(stencil_t), intent(in)  stencil,
integer, intent(in)  iv,
integer, intent(in)  iv_to,
logical, intent(in)  add 
)
private

Linear prolongation using nearest NDIM+1 neighbors.

Parameters
[in]box_pParent box
[in,out]box_cChild box
[in]ivInput variable
[in]iv_toDestination variable
[in]addAdd to old values

Definition at line 564 of file m_af_stencil.f90.

◆ stencil_prolong_248()

subroutine m_af_stencil::stencil_prolong_248 ( type(box_t), intent(in)  box_p,
type(box_t), intent(inout)  box_c,
type(stencil_t), intent(in)  stencil,
integer, intent(in)  iv,
integer, intent(in)  iv_to,
logical, intent(in)  add 
)
private

(Bi-/tri-)linear prolongation using nearest 2**NDIM neighbors

Parameters
[in]box_pParent box
[in,out]box_cChild box
[in]ivInput variable
[in]iv_toDestination variable
[in]addAdd to old values

Definition at line 677 of file m_af_stencil.f90.

◆ af_stencil_gsrb_box()

subroutine, public m_af_stencil::af_stencil_gsrb_box ( type(box_t), intent(inout)  box,
integer, intent(in)  key,
integer, intent(in)  redblack,
integer, intent(in)  iv,
integer, intent(in)  i_rhs 
)

Perform Gauss-Seidel red-black on a stencil.

Parameters
[in,out]boxOperate on this box
[in]keyStencil key
[in]redblackEven or odd integer
[in]ivSolve for variable
[in]i_rhsRight-hand side

Definition at line 800 of file m_af_stencil.f90.

◆ stencil_gsrb_357()

subroutine m_af_stencil::stencil_gsrb_357 ( type(box_t), intent(inout)  box,
type(stencil_t), intent(in)  stencil,
integer, intent(in)  redblack,
integer, intent(in)  iv,
integer, intent(in)  i_rhs 
)
private

Perform Gauss-Seidel red-black on a 3/5/7-point stencil in 1D/2D/3D.

Parameters
[in,out]boxOperate on this box
[in]redblackEven or odd integer
[in]ivSolve for variable
[in]i_rhsRight-hand side

Definition at line 820 of file m_af_stencil.f90.

◆ af_stencil_try_constant()

subroutine, public m_af_stencil::af_stencil_try_constant ( type(box_t), intent(inout)  box,
integer, intent(in)  ix,
real(dp), intent(in)  abs_tol,
logical  success 
)

Convert a variable stencil to constant one if possible.

Parameters
[in]ixStencil index
[in]abs_tolAbsolute tolerance
successWhether the stencil was converted

Definition at line 983 of file m_af_stencil.f90.

◆ af_stencil_get_box()

subroutine, public m_af_stencil::af_stencil_get_box ( type(box_t), intent(inout)  box,
integer, intent(in)  key,
real(dp), dimension(:, dtimes(:)), intent(inout)  v 
)

Get the stencil for a box.

Parameters
[in,out]boxOperate on this box
[in]keyStencil key
[in,out]vStencil coefficients

Definition at line 1013 of file m_af_stencil.f90.

◆ stencil_get_357()

subroutine m_af_stencil::stencil_get_357 ( type(box_t), intent(inout)  box,
type(stencil_t), intent(in)  stencil,
real(dp), dimension(:, dtimes(:)), intent(inout)  v 
)
private

Get the stencil for all cells in a box.

Parameters
[in,out]vStencil coefficients

Definition at line 1032 of file m_af_stencil.f90.

Variable Documentation

◆ stencil_list_initial_size

integer, parameter m_af_stencil::stencil_list_initial_size = 10
private

Initial size of stencil list.

Definition at line 10 of file m_af_stencil.f90.

◆ stencil_constant

integer, parameter, public m_af_stencil::stencil_constant = 1

Constant stencil.

Definition at line 12 of file m_af_stencil.f90.

◆ stencil_variable

integer, parameter, public m_af_stencil::stencil_variable = 2

Variable stencil.

Definition at line 13 of file m_af_stencil.f90.

◆ stencil_sparse

integer, parameter, public m_af_stencil::stencil_sparse = 3

Sparse stencil.

Definition at line 14 of file m_af_stencil.f90.

◆ num_shapes

integer, parameter, private m_af_stencil::num_shapes = 5
private

Number of predefined stencil shapes.

Definition at line 17 of file m_af_stencil.f90.

◆ af_stencil_357

integer, parameter, public m_af_stencil::af_stencil_357 = 1

3/5/7 point stencil in 1D/2D/3D

Definition at line 20 of file m_af_stencil.f90.

◆ af_stencil_p234

integer, parameter, public m_af_stencil::af_stencil_p234 = 2

Prolongation stencil using nearest 2, 3, 4 neighbors in 1D-3D.

Definition at line 23 of file m_af_stencil.f90.

◆ af_stencil_p248

integer, parameter, public m_af_stencil::af_stencil_p248 = 3

Prolongation stencil using nearest 2, 4, 8 neighbors in 1D-3D.

Definition at line 26 of file m_af_stencil.f90.

◆ af_stencil_246

integer, parameter, public m_af_stencil::af_stencil_246 = 4

Stencil for direct neighbors.

Definition at line 29 of file m_af_stencil.f90.

◆ af_stencil_mask

integer, parameter, public m_af_stencil::af_stencil_mask = 5

Stencil for masking.

Definition at line 32 of file m_af_stencil.f90.

◆ af_stencil_sizes

integer, dimension(num_shapes), parameter, public m_af_stencil::af_stencil_sizes = [2*NDIM+1, NDIM+1, 2**NDIM, 2*NDIM, 1]

Number of coefficients in the stencils.

Definition at line 35 of file m_af_stencil.f90.