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

This module contains the basic types and constants that are used in the 3-dimensional version of Afivo, together with some basic routines. The dimension-independent types and constant are place in m_afivo_types. More...

Data Types

type  a3_cc_methods
 Collection of methods for a cell-centered variable. More...
 
type  a3_loc_t
 Type specifying the location of a cell. More...
 
interface  a3_subr
 Subroutine that gets a box. More...
 
interface  a3_subr_arg
 Subroutine that gets a box and an array of reals. More...
 
interface  a3_subr_bc
 To fill ghost cells near physical boundaries. More...
 
interface  a3_subr_boxes
 Subroutine that gets a list of boxes and a box id. More...
 
interface  a3_subr_boxes_arg
 Subroutine that gets a list of boxes, an id and an array of reals. More...
 
interface  a3_subr_egc
 Subroutine for getting extra ghost cell data (> 1) near physical boundaries. More...
 
interface  a3_subr_prolong
 Subroutine for prolongation. More...
 
interface  a3_subr_rb
 To fill ghost cells near refinement boundaries. More...
 
interface  a3_subr_ref
 Subroutine for setting refinement flags. More...
 
interface  a3_subr_restrict
 Subroutine for restriction. More...
 
type  a3_t
 Type which stores all the boxes and levels, as well as some information about the number of boxes, variables and levels. More...
 
type  box3_t
 The basic building block of afivo: a box with cell-centered and face centered data, and information about its position, neighbors, children etc. More...
 

Functions/Subroutines

subroutine a3_print_info (tree)
 Get tree info. More...
 
pure integer function a3_box_bytes (n_cell, n_var_cell, n_var_face)
 
pure integer function a3_num_boxes_used (tree)
 
pure integer function a3_num_leaves_used (tree)
 
pure integer function a3_num_cells_used (tree)
 
pure real(dp) function a3_total_volume (tree)
 
elemental logical function a3_has_children (box)
 Return .true. if a box has children. More...
 
pure logical function, dimension(size(nbs)) a3_phys_boundary (boxes, id, nbs)
 Return .true. where there is a physical/periodic boundary. Detecting physical boundaries is straightforward (simply test whether neighbors(i) < af_no_box), but periodic boundaries require a comparison of their spatial index. More...
 
pure integer function, dimension(3) a3_get_child_offset (box, nb)
 Get the offset of a box with respect to its parent (e.g. in 2d, there can be a child at offset 0,0, one at n_cell/2,0, one at 0,n_cell/2 and one at n_cell/2, n_cell/2) More...
 
pure integer function, dimension(3) a3_get_ix_on_parent (box, ix)
 Given a cell index on box, get index of the closest cell at its parent. More...
 
pure integer function, dimension(3) a3_get_ix_on_neighb (box, ix, nb)
 Given a cell index on box, get index on a neighbor. More...
 
pure integer function, dimension(3) a3_neighb_offset (nbs)
 Given a list of neighbor directions, compute the index offset. More...
 
pure integer function a3_ix_to_ichild (ix)
 Compute the 'child index' for a box with spatial index ix. With 'child index' we mean the index in the children(:) array of its parent. More...
 
pure integer function, dimension(3) a3_cc_ix (box, r)
 Get the cell index in which r lies. This routine does not check whether r is actually located inside the box. More...
 
pure real(dp) function, dimension(3) a3_r_cc (box, cc_ix)
 Get the location of the cell center with index cc_ix. More...
 
pure real(dp) function, dimension(3) a3_r_fc (box, dim, fc_ix)
 Get the location of the face parallel to dim with index fc_ix. More...
 
pure real(dp) function, dimension(3) a3_rr_cc (box, cc_ix)
 Get a general location with index cc_ix (like a3_r_cc but using reals) More...
 
pure real(dp) function, dimension(3) a3_r_center (box)
 Return the coordinate of the center of a box. More...
 
pure real(dp) function a3_min_dr (tree)
 Return finest dr that is used in the tree. More...
 
pure real(dp) function a3_lvl_dr (tree, lvl)
 Return dr at lvl. More...
 
subroutine a3_set_box_gc (box, nb, iv, gc_scalar, gc_array)
 

Variables

integer, parameter a3_num_children = 8
 
integer, parameter a3_child_lowx_lowy_lowz = 1
 
integer, parameter a3_child_highx_lowy_lowz = 2
 
integer, parameter a3_child_lowx_highy_lowz = 3
 
integer, parameter a3_child_highx_highy_lowz = 4
 
integer, parameter a3_child_lowx_lowy_highz = 5
 
integer, parameter a3_child_highx_lowy_highz = 6
 
integer, parameter a3_child_lowx_highy_highz = 7
 
integer, parameter a3_child_highx_highy_highz = 8
 
integer, dimension(3, 8), parameter a3_child_dix = reshape( [0,0,0, 1,0,0, 0,1,0, 1,1,0, 0,0,1, 1,0,1, 0,1,1, 1,1,1], [3,8])
 
integer, dimension(4, 6), parameter a3_child_adj_nb = reshape( [1,3,5,7, 2,4,6,8, 1,2,5,6, 3,4,7,8, 1,2,3,4, 5,6,7,8], [4,6])
 
integer, dimension(3, 8), parameter a3_nb_adj_child = reshape( [1,3,5, 2,3,5, 1,4,5, 2,4,5, 1,3,6, 2,3,6, 1,4,6, 2,4,6], [3,8])
 
logical, dimension(3, 8), parameter a3_child_low = reshape([ .true., .true., .true., .false., .true., .true., .true., .false., .true., .false., .false., .true., .true., .true., .false., .false., .true., .false., .true., .false., .false., .false., .false., .false.], [3, 8])
 
integer, dimension(3, 8), parameter a3_child_high_01 = reshape([ 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1], [3, 8])
 
integer, parameter a3_num_neighbors = 6
 
integer, parameter a3_neighb_lowx = 1
 
integer, parameter a3_neighb_highx = 2
 
integer, parameter a3_neighb_lowy = 3
 
integer, parameter a3_neighb_highy = 4
 
integer, parameter a3_neighb_lowz = 5
 
integer, parameter a3_neighb_highz = 6
 
integer, dimension(3, 6), parameter a3_neighb_dix = reshape( [-1,0,0, 1,0,0, 0,-1,0, 0,1,0, 0,0,-1, 0,0,1], [3,6])
 
logical, dimension(6), parameter a3_neighb_low = [.true., .false., .true., .false., .true., .false.]
 
integer, dimension(3), parameter a3_low_neighbs = [1, 3, 5]
 
integer, dimension(3), parameter a3_high_neighbs = [2, 4, 6]
 
integer, dimension(6), parameter a3_neighb_high_01 = [0, 1, 0, 1, 0, 1]
 
integer, dimension(6), parameter a3_neighb_high_pm = [-1, 1, -1, 1, -1, 1]
 
integer, dimension(6), parameter a3_neighb_rev = [2, 1, 4, 3, 6, 5]
 
integer, dimension(6), parameter a3_neighb_dim = [1, 1, 2, 2, 3, 3]
 
integer, parameter a3_num_edges = 12
 
integer, dimension(12), parameter a3_edge_dim = [1,1,1,1, 2,2,2,2, 3,3,3,3]
 
integer, dimension(3, 12), parameter a3_edge_dir = reshape( [0,-1,-1, 0,1,-1, 0,-1,1, 0,1,1, -1,0,-1, 1,0,-1, -1,0,1, 1,0,1, -1,-1,0, 1,-1,0, -1,1,0, 1,1,0], [3, 12])
 
integer, dimension(2, 12), parameter a3_nb_adj_edge = reshape( [3,5, 4,5, 3,6, 4,6, 1,5, 2,5, 1,6, 2,6, 1,3, 2,3, 1,4, 2,4], [2,12])
 
integer, dimension(3, 12), parameter a3_edge_min_ix = reshape( [0,0,0, 0,1,0, 0,0,1, 0,1,1, 0,0,0, 1,0,0, 0,0,1, 1,0,1, 0,0,0, 1,0,0, 0,1,0, 1,1,0], [3,12])
 

Detailed Description

This module contains the basic types and constants that are used in the 3-dimensional version of Afivo, together with some basic routines. The dimension-independent types and constant are place in m_afivo_types.

Function/Subroutine Documentation

§ a3_print_info()

subroutine m_a3_types::a3_print_info ( type(a3_t), intent(in)  tree)

Get tree info.

Parameters
[in]treeThe tree

Definition at line 260 of file m_a3_types.f90.

§ a3_box_bytes()

pure integer function m_a3_types::a3_box_bytes ( integer, intent(in)  n_cell,
integer, intent(in)  n_var_cell,
integer, intent(in)  n_var_face 
)
Parameters
[in]n_cellnumber of cells per dimension
[in]n_var_cellnumber of cell-centered variables
[in]n_var_facenumber of face-centered variables

Definition at line 291 of file m_a3_types.f90.

§ a3_num_boxes_used()

pure integer function m_a3_types::a3_num_boxes_used ( type(a3_t), intent(in)  tree)

Definition at line 303 of file m_a3_types.f90.

§ a3_num_leaves_used()

pure integer function m_a3_types::a3_num_leaves_used ( type(a3_t), intent(in)  tree)

Definition at line 313 of file m_a3_types.f90.

§ a3_num_cells_used()

pure integer function m_a3_types::a3_num_cells_used ( type(a3_t), intent(in)  tree)

Definition at line 323 of file m_a3_types.f90.

§ a3_total_volume()

pure real(dp) function m_a3_types::a3_total_volume ( type(a3_t), intent(in)  tree)

Definition at line 330 of file m_a3_types.f90.

§ a3_has_children()

elemental logical function m_a3_types::a3_has_children ( type(box3_t), intent(in)  box)

Return .true. if a box has children.

Definition at line 353 of file m_a3_types.f90.

§ a3_phys_boundary()

pure logical function, dimension(size(nbs)) m_a3_types::a3_phys_boundary ( type(box3_t), dimension(:), intent(in)  boxes,
integer, intent(in)  id,
integer, dimension(:), intent(in)  nbs 
)

Return .true. where there is a physical/periodic boundary. Detecting physical boundaries is straightforward (simply test whether neighbors(i) < af_no_box), but periodic boundaries require a comparison of their spatial index.

Parameters
[in]boxesList of boxes
[in]idBox to inspect
[in]nbsNeighbor directions

Definition at line 365 of file m_a3_types.f90.

§ a3_get_child_offset()

pure integer function, dimension(3) m_a3_types::a3_get_child_offset ( type(box3_t), intent(in)  box,
integer, intent(in), optional  nb 
)

Get the offset of a box with respect to its parent (e.g. in 2d, there can be a child at offset 0,0, one at n_cell/2,0, one at 0,n_cell/2 and one at n_cell/2, n_cell/2)

Parameters
[in]boxA child box
[in]nbOptional: get index on parent neighbor

Definition at line 407 of file m_a3_types.f90.

§ a3_get_ix_on_parent()

pure integer function, dimension(3) m_a3_types::a3_get_ix_on_parent ( type(box3_t), intent(in)  box,
integer, dimension(3), intent(in)  ix 
)

Given a cell index on box, get index of the closest cell at its parent.

Parameters
[in]boxA child box
[in]ixIndex on child box

Definition at line 422 of file m_a3_types.f90.

§ a3_get_ix_on_neighb()

pure integer function, dimension(3) m_a3_types::a3_get_ix_on_neighb ( type(box3_t), intent(in)  box,
integer, dimension(3), intent(in)  ix,
integer, intent(in)  nb 
)

Given a cell index on box, get index on a neighbor.

Parameters
[in]boxA box
[in]ixIndex on box
[in]nbNeighbor identifier

Definition at line 430 of file m_a3_types.f90.

§ a3_neighb_offset()

pure integer function, dimension(3) m_a3_types::a3_neighb_offset ( integer, dimension(:), intent(in)  nbs)

Given a list of neighbor directions, compute the index offset.

Parameters
[in]nbsList of neighbor directions

Definition at line 442 of file m_a3_types.f90.

§ a3_ix_to_ichild()

pure integer function m_a3_types::a3_ix_to_ichild ( integer, dimension(3), intent(in)  ix)

Compute the 'child index' for a box with spatial index ix. With 'child index' we mean the index in the children(:) array of its parent.

Parameters
[in]ixSpatial index of the box

Definition at line 455 of file m_a3_types.f90.

§ a3_cc_ix()

pure integer function, dimension(3) m_a3_types::a3_cc_ix ( type(box3_t), intent(in)  box,
real(dp), dimension(3), intent(in)  r 
)

Get the cell index in which r lies. This routine does not check whether r is actually located inside the box.

Definition at line 464 of file m_a3_types.f90.

§ a3_r_cc()

pure real(dp) function, dimension(3) m_a3_types::a3_r_cc ( type(box3_t), intent(in)  box,
integer, dimension(3), intent(in)  cc_ix 
)

Get the location of the cell center with index cc_ix.

Definition at line 472 of file m_a3_types.f90.

§ a3_r_fc()

pure real(dp) function, dimension(3) m_a3_types::a3_r_fc ( type(box3_t), intent(in)  box,
integer, intent(in)  dim,
integer, dimension(3), intent(in)  fc_ix 
)

Get the location of the face parallel to dim with index fc_ix.

Definition at line 480 of file m_a3_types.f90.

§ a3_rr_cc()

pure real(dp) function, dimension(3) m_a3_types::a3_rr_cc ( type(box3_t), intent(in)  box,
real(dp), dimension(3), intent(in)  cc_ix 
)

Get a general location with index cc_ix (like a3_r_cc but using reals)

Definition at line 490 of file m_a3_types.f90.

§ a3_r_center()

pure real(dp) function, dimension(3) m_a3_types::a3_r_center ( type(box3_t), intent(in)  box)

Return the coordinate of the center of a box.

Definition at line 498 of file m_a3_types.f90.

§ a3_min_dr()

pure real(dp) function m_a3_types::a3_min_dr ( type(a3_t), intent(in)  tree)

Return finest dr that is used in the tree.

Returns
Output: dr at the finest lvl of the tree

Definition at line 505 of file m_a3_types.f90.

§ a3_lvl_dr()

pure real(dp) function m_a3_types::a3_lvl_dr ( type(a3_t), intent(in)  tree,
integer, intent(in)  lvl 
)

Return dr at lvl.

Returns
Output: dr at the finest lvl of the tree

Definition at line 512 of file m_a3_types.f90.

§ a3_set_box_gc()

subroutine m_a3_types::a3_set_box_gc ( type(box3_t), intent(inout)  box,
integer, intent(in)  nb,
integer, intent(in)  iv,
real(dp), intent(in), optional  gc_scalar,
real(dp), dimension(box%n_cell, box%n_cell), intent(in), optional  gc_array 
)
Parameters
[in,out]boxBox to operate on
[in]nbGhost cell direction
[in]ivGhost cell variable
[in]gc_scalarScalar value for ghost cells
[in]gc_arrayArray for ghost cells

Definition at line 519 of file m_a3_types.f90.

Variable Documentation

§ a3_num_children

integer, parameter m_a3_types::a3_num_children = 8

Definition at line 14 of file m_a3_types.f90.

§ a3_child_lowx_lowy_lowz

integer, parameter m_a3_types::a3_child_lowx_lowy_lowz = 1

Definition at line 15 of file m_a3_types.f90.

§ a3_child_highx_lowy_lowz

integer, parameter m_a3_types::a3_child_highx_lowy_lowz = 2

Definition at line 16 of file m_a3_types.f90.

§ a3_child_lowx_highy_lowz

integer, parameter m_a3_types::a3_child_lowx_highy_lowz = 3

Definition at line 17 of file m_a3_types.f90.

§ a3_child_highx_highy_lowz

integer, parameter m_a3_types::a3_child_highx_highy_lowz = 4

Definition at line 18 of file m_a3_types.f90.

§ a3_child_lowx_lowy_highz

integer, parameter m_a3_types::a3_child_lowx_lowy_highz = 5

Definition at line 19 of file m_a3_types.f90.

§ a3_child_highx_lowy_highz

integer, parameter m_a3_types::a3_child_highx_lowy_highz = 6

Definition at line 20 of file m_a3_types.f90.

§ a3_child_lowx_highy_highz

integer, parameter m_a3_types::a3_child_lowx_highy_highz = 7

Definition at line 21 of file m_a3_types.f90.

§ a3_child_highx_highy_highz

integer, parameter m_a3_types::a3_child_highx_highy_highz = 8

Definition at line 22 of file m_a3_types.f90.

§ a3_child_dix

integer, dimension(3, 8), parameter m_a3_types::a3_child_dix = reshape( [0,0,0, 1,0,0, 0,1,0, 1,1,0, 0,0,1, 1,0,1, 0,1,1, 1,1,1], [3,8])

Definition at line 25 of file m_a3_types.f90.

§ a3_child_adj_nb

integer, dimension(4, 6), parameter m_a3_types::a3_child_adj_nb = reshape( [1,3,5,7, 2,4,6,8, 1,2,5,6, 3,4,7,8, 1,2,3,4, 5,6,7,8], [4,6])

Definition at line 29 of file m_a3_types.f90.

§ a3_nb_adj_child

integer, dimension(3, 8), parameter m_a3_types::a3_nb_adj_child = reshape( [1,3,5, 2,3,5, 1,4,5, 2,4,5, 1,3,6, 2,3,6, 1,4,6, 2,4,6], [3,8])

Definition at line 32 of file m_a3_types.f90.

§ a3_child_low

logical, dimension(3, 8), parameter m_a3_types::a3_child_low = reshape([ .true., .true., .true., .false., .true., .true., .true., .false., .true., .false., .false., .true., .true., .true., .false., .false., .true., .false., .true., .false., .false., .false., .false., .false.], [3, 8])

Definition at line 35 of file m_a3_types.f90.

§ a3_child_high_01

integer, dimension(3, 8), parameter m_a3_types::a3_child_high_01 = reshape([ 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1], [3, 8])

Definition at line 41 of file m_a3_types.f90.

§ a3_num_neighbors

integer, parameter m_a3_types::a3_num_neighbors = 6

Definition at line 48 of file m_a3_types.f90.

§ a3_neighb_lowx

integer, parameter m_a3_types::a3_neighb_lowx = 1

Definition at line 49 of file m_a3_types.f90.

§ a3_neighb_highx

integer, parameter m_a3_types::a3_neighb_highx = 2

Definition at line 50 of file m_a3_types.f90.

§ a3_neighb_lowy

integer, parameter m_a3_types::a3_neighb_lowy = 3

Definition at line 51 of file m_a3_types.f90.

§ a3_neighb_highy

integer, parameter m_a3_types::a3_neighb_highy = 4

Definition at line 52 of file m_a3_types.f90.

§ a3_neighb_lowz

integer, parameter m_a3_types::a3_neighb_lowz = 5

Definition at line 53 of file m_a3_types.f90.

§ a3_neighb_highz

integer, parameter m_a3_types::a3_neighb_highz = 6

Definition at line 54 of file m_a3_types.f90.

§ a3_neighb_dix

integer, dimension(3, 6), parameter m_a3_types::a3_neighb_dix = reshape( [-1,0,0, 1,0,0, 0,-1,0, 0,1,0, 0,0,-1, 0,0,1], [3,6])

Definition at line 56 of file m_a3_types.f90.

§ a3_neighb_low

logical, dimension(6), parameter m_a3_types::a3_neighb_low = [.true., .false., .true., .false., .true., .false.]

Definition at line 59 of file m_a3_types.f90.

§ a3_low_neighbs

integer, dimension(3), parameter m_a3_types::a3_low_neighbs = [1, 3, 5]

Definition at line 62 of file m_a3_types.f90.

§ a3_high_neighbs

integer, dimension(3), parameter m_a3_types::a3_high_neighbs = [2, 4, 6]

Definition at line 64 of file m_a3_types.f90.

§ a3_neighb_high_01

integer, dimension(6), parameter m_a3_types::a3_neighb_high_01 = [0, 1, 0, 1, 0, 1]

Definition at line 66 of file m_a3_types.f90.

§ a3_neighb_high_pm

integer, dimension(6), parameter m_a3_types::a3_neighb_high_pm = [-1, 1, -1, 1, -1, 1]

Definition at line 68 of file m_a3_types.f90.

§ a3_neighb_rev

integer, dimension(6), parameter m_a3_types::a3_neighb_rev = [2, 1, 4, 3, 6, 5]

Definition at line 70 of file m_a3_types.f90.

§ a3_neighb_dim

integer, dimension(6), parameter m_a3_types::a3_neighb_dim = [1, 1, 2, 2, 3, 3]

Definition at line 72 of file m_a3_types.f90.

§ a3_num_edges

integer, parameter m_a3_types::a3_num_edges = 12

Definition at line 75 of file m_a3_types.f90.

§ a3_edge_dim

integer, dimension(12), parameter m_a3_types::a3_edge_dim = [1,1,1,1, 2,2,2,2, 3,3,3,3]

Definition at line 77 of file m_a3_types.f90.

§ a3_edge_dir

integer, dimension(3, 12), parameter m_a3_types::a3_edge_dir = reshape( [0,-1,-1, 0,1,-1, 0,-1,1, 0,1,1, -1,0,-1, 1,0,-1, -1,0,1, 1,0,1, -1,-1,0, 1,-1,0, -1,1,0, 1,1,0], [3, 12])

Definition at line 80 of file m_a3_types.f90.

§ a3_nb_adj_edge

integer, dimension(2, 12), parameter m_a3_types::a3_nb_adj_edge = reshape( [3,5, 4,5, 3,6, 4,6, 1,5, 2,5, 1,6, 2,6, 1,3, 2,3, 1,4, 2,4], [2,12])

Definition at line 85 of file m_a3_types.f90.

§ a3_edge_min_ix

integer, dimension(3, 12), parameter m_a3_types::a3_edge_min_ix = reshape( [0,0,0, 0,1,0, 0,0,1, 0,1,1, 0,0,0, 1,0,0, 0,0,1, 1,0,1, 0,0,0, 1,0,0, 0,1,0, 1,1,0], [3,12])

Definition at line 90 of file m_a3_types.f90.