Defines structured blocks. A block contains three axes and may be standalone or as part of an domain partition.
Axes define mid points, nodal points, and spacing as following:
xm(lo) xm(hi)
| |
|-----|-----|------|------|
| <-dxm-> |
x(lo) x(hi+1)
Additionally, ghostcells can be added to the extremities of the axes to faciliate parallel operations.
A standalone (serial) block contains three axes for each direction, information on the number of grid points in each direction, information on periodicity, and positions of corner points. Many serial blocks can be instantiated as the same time.
pmax
x2(hi+1) |-----|-----|------|------|
| | | | |
|-----|-----|------|------|
| | | | |
|-----|-----|------|------|
| | | | |
|-----|-----|------|------|
| | | | |
|-----|-----|------|------|
| | | | |
x2(lo) |-----|-----|------|------|
pmin
x(lo) x(hi+1)
A partitioned block represents a sub-block from a larger global block. It only contains information about its own sub-grid. E.g.:
2-by-2 domain decomposition
|-----------|-----------|
| | |
| RANK=3 | RANK=4 |
| | |
|-----------|-----------|
| | |
| RANK=1 | RANK=2 |
| | |
|-----------|-----------|
Defines a 1D axis
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public, | pointer, contiguous | :: | dxm(:) | => | null() |
Cell spacings |
| integer, | public | :: | hi |
Higher bound |
|||
| integer, | public | :: | lo |
Lower bound |
|||
| integer, | public | :: | ngc |
Number of ghostcells |
|||
| real(kind=wp), | public, | pointer, contiguous | :: | x(:) | => | null() |
Nodal points |
| real(kind=wp), | public, | pointer, contiguous | :: | xm(:) | => | null() |
Mid points |
| procedure, public :: Finalize => axis_obj_Final | |
| procedure, public :: Initialize => axis_obj_Init |
A block object
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(axis_obj), | public | :: | axis(3) |
Axes in x1, x2, and x3 directions |
|||
| type(axis_obj), | public | :: | axis_partition(3) |
Axes of the main partition, (spacing equal to 1 sub-block) |
|||
| real(kind=wp), | public | :: | dx(3) |
Minimum mesh spacing in each direction |
|||
| real(kind=wp), | public, | contiguous, pointer | :: | dxm(:) | => | null() |
Convenience pointer to x-cell spacings |
| real(kind=wp), | public, | contiguous, pointer | :: | dym(:) | => | null() |
Convenience pointer to y-cell spacings |
| real(kind=wp), | public, | contiguous, pointer | :: | dzm(:) | => | null() |
Convenience pointer to z-cell spacings |
| type(MPI_Datatype), | public | :: | gc_slab_i(3) |
MPI derived type for integer gc |
|||
| type(MPI_Datatype), | public | :: | gc_slab_r(3) |
MPI derived type for wp real gc |
|||
| type(hdf5_obj), | public, | pointer | :: | hdf5 | => | null() |
HDF5 object for IO |
| integer, | public | :: | hi(3) |
Array upper bound |
|||
| logical, | public | :: | is_initialized | = | .false. |
Flag to determine whether this has been initialized |
|
| logical, | public | :: | is_partitioned | = | .false. |
Flag for parallel partitioning |
|
| integer, | public | :: | lo(3) |
Array lower bound |
|||
| integer, | public | :: | ngc | = | 2 |
Number of ghostcells |
|
| type(parallel_obj), | public, | pointer | :: | parallel | => | null() |
Associated parallel structure |
| logical, | public | :: | periods(3) | = | .false. |
Periodicity in each direction |
|
| real(kind=wp), | public | :: | pmax(3) |
Min and max locations across all blocks |
|||
| real(kind=wp), | public | :: | pmin(3) |
Min and max locations across all blocks |
|||
| real(kind=wp), | public, | contiguous, pointer | :: | x(:) | => | null() |
Convenience pointer to x-nodal points |
| real(kind=wp), | public | :: | xhi(3) |
Coordinate of the top right corner |
|||
| real(kind=wp), | public | :: | xlo(3) |
Coordinate of the bottom left corner |
|||
| real(kind=wp), | public, | contiguous, pointer | :: | xm(:) | => | null() |
Convenience pointer to x-mid points |
| real(kind=wp), | public | :: | xmax |
Min and max locations across all blocks |
|||
| real(kind=wp), | public | :: | xmin |
Min and max locations across all blocks |
|||
| real(kind=wp), | public, | contiguous, pointer | :: | y(:) | => | null() |
Convenience pointer to y-nodal points |
| real(kind=wp), | public, | contiguous, pointer | :: | ym(:) | => | null() |
Convenience pointer to y-mid points |
| real(kind=wp), | public | :: | ymax |
Min and max locations across all blocks |
|||
| real(kind=wp), | public | :: | ymin |
Min and max locations across all blocks |
|||
| real(kind=wp), | public, | contiguous, pointer | :: | z(:) | => | null() |
Convenience pointer to z-nodal points |
| real(kind=wp), | public, | contiguous, pointer | :: | zm(:) | => | null() |
Convenience pointer to z-mid points |
| real(kind=wp), | public | :: | zmax |
Min and max locations across all blocks |
|||
| real(kind=wp), | public | :: | zmin |
Min and max locations across all blocks |
Returns the coordinates of the cell that contains the position p. This subroutine ignores gost cells. As such, it will always return an internal cell of the domain. If the point is located in a ghost cell, the returned cell will be an internal boundary cell that is closest to that ghost cell.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(in) | :: | this |
A block object |
||
| real(kind=wp), | intent(in) | :: | p(3) |
Position to locate |
Cell coordinates
Returns the coordinates of the cell that contains the position p, inclusive of ghost cells.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(in) | :: | this |
A block object |
||
| real(kind=wp), | intent(in) | :: | p(3) |
Position to locate |
Cell coordinates
Returns block ID and rank of the block where the point is located using a binary search alogirthm. Note that this function assumes that the point is within the domain, i.e., (pmin <= p <= pmax) and that any treatment for periodicity has been previously applied.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(in) | :: | this |
A block object |
||
| real(kind=wp), | intent(in) | :: | p(3) |
Position to locate |
MPI rank
Finalizes object and frees data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(axis_obj), | intent(inout) | :: | this |
A axis object |
Initialize axis.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(axis_obj), | intent(inout) | :: | this |
A axis object |
||
| integer, | intent(in) | :: | lo |
Array lower bound |
||
| integer, | intent(in) | :: | hi |
Array higher bound |
||
| integer, | intent(in) | :: | ngc |
Number of ghost cells |
Finalizes the block object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
Prints to stdout information about this block
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(in) | :: | this |
A block object |
Initializes block object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
||
| integer, | intent(in) | :: | ngc |
Number of ghostcells |
||
| type(parallel_obj), | intent(in), | target | :: | parallel |
Parallel structure to link with |
[DEPRECATED] Initializes block object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
||
| real(kind=wp), | intent(in) | :: | xlo(3) |
Coordinates of the bottom left corner |
||
| real(kind=wp), | intent(in) | :: | xhi(3) |
Coordinates of the top right corner |
||
| integer, | intent(in) | :: | lo(3) |
Array lower bound |
||
| integer, | intent(in) | :: | hi(3) |
Array upper bound |
||
| integer, | intent(in) | :: | ngc |
Number of ghostcells |
||
| type(parallel_obj), | intent(in), | target | :: | parallel |
Parallel structure to link with |
Partitions a parent block into sub-blocks based on a given decomposition Nb(3) for parallel simulations. This will also define the partition axes, and update local bounds/extents, and global bounds/extents.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
||
| integer, | intent(in) | :: | Nb(3) |
Number of blocks in each direction |
Reads block data using HDF5.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
||
| character(len=*), | intent(in) | :: | name |
Name of file to write |
Associate convenience pointers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
Sets block periodicity in each direction.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
||
| logical, | intent(in) | :: | periods(3) |
Periodicity |
Defines MPI derived type for communicating ghostcells.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
Initializes a uniform grid on this block.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
||
| real(kind=wp), | intent(in) | :: | xlo(3) |
Coordinates of the bottom left corner |
||
| real(kind=wp), | intent(in) | :: | xhi(3) |
Coordinates of the top right corner |
||
| integer, | intent(in) | :: | lo(3) |
Array lower bound |
||
| integer, | intent(in) | :: | hi(3) |
Array upper bound |
Computes the bounds of the sub-block form the bounds of the parent block. Each sub-block gets about the same number of grid points in each direction.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | coord(3) |
Coordinates of MPI rank on MPI grid |
||
| integer, | intent(in) | :: | Nb(3) |
Number of blocks in each direction |
||
| integer, | intent(in) | :: | minlo(3) |
Global lo bounds |
||
| integer, | intent(in) | :: | maxhi(3) |
Global hi bounds |
||
| integer, | intent(out) | :: | sublo(3) |
lo bounds of sub-block |
||
| integer, | intent(out) | :: | subhi(3) |
hi bounds of sub-block |
Updates the dimensional extents of the block.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
Updates the ghostcell values of local grid owned by the current MPI rank. Note that each MPI rank stores only its portion of the grid, thus needs to have proper ghostcell values.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
Updates mid points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
Updates grid spacing arrays.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(inout) | :: | this |
A block object |
Writes block data using HDF5.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(in) | :: | this |
A block object |
||
| character(len=*), | intent(in) | :: | name |
Name of file to write |