Module of abstract objets defining Lagrangian data structure. A lagrangian object: - is defined at mininum by an id, 3D position, and coordinates of cell in underlying grid where it's located. - objects with id>0 are considered as active objects. - objects with id=0 are considered inactive, and scheduled for removal. - ogjects with id<0 represent ghostobjects.
A lagrangian set: - represents a cloud of lagrangian objects. - manages addition and removal of lagrangian objects. - offers method for operations related to the underlying grid, such as periodicity adjustment, localization on grid, filtering. - offers methods to help with parallel (MPI) operations. - offers method for IO.
The objects defined in this subroutine are Abstract, meaning they cannot be directly instantiated. Users need to define an extension of these objects. Some procedures are deferred, meaning that users are forced to implement their version of these procedures when they do their extension.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private, | parameter | :: | RESIZE_INCREMENT | = | 0.3_wp |
Increment for resizing lagrangian arrays: 30% up or 30% smaller |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | r |
Distance from center |
Kernel value
(Deferred) Sets up parameters used to create the MPI derived type.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
Set of Lagrangian objects |
||
| type(MPI_DATATYPE), | intent(out), | allocatable | :: | types(:) |
Array of types |
|
| integer, | intent(out), | allocatable | :: | lengths(:) |
Array of lengths |
|
| integer(kind=MPI_ADDRESS_KIND), | intent(out), | allocatable | :: | displacement(:) |
Array of displacements |
(Deferred) Sets the type of the polymorphic sample.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
(Deferred) Performs assignemnt of an extended type.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_obj), | intent(inout) | :: | this |
A Lagrangian object |
||
| class(lagrangian_obj), | intent(in) | :: | val |
Value to be assigned |
(Deferred) Reads lagrangian objects from file in parallel.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| integer, | intent(out) | :: | iter |
Iteration at write |
||
| real(kind=wp), | intent(out) | :: | time |
Time at write |
||
| integer, | intent(in), | optional | :: | step |
Optional step |
(Deferred) Writes Lagrangian objects to file in parallel.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| integer, | intent(in) | :: | iter |
Iteration at write |
||
| real(kind=wp), | intent(in) | :: | time |
Time at write |
(Deferred) Returns the MPI rank that owns the lagrangian object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(in) | :: | this |
A set of Lagrangian objects |
||
| class(lagrangian_obj), | intent(in) | :: | lagobj |
Lagrangian obj to locate |
rank that should own lagobj
Base lagrangian object. The object's ID indicates the status: active (id>0), inactive (id=0), ghostobject (id<0).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | c(3) |
nearest cell |
|||
| integer(kind=leapI8), | public | :: | id |
Identifying number (inactive if <0) |
|||
| real(kind=wp), | public | :: | p(3) |
position |
| procedure, public :: Extrapolate => lagrangian_obj_Extrapolate | |
| procedure, public :: Interpolate => lagrangian_obj_Interpolate | |
| procedure, public :: Locate => lagrangian_obj_Locate | |
| procedure(lagrangian_obj_assign), public, deferred :: assign | |
| generic, public :: assignment(=) => assign |
Base structure for a collection of Lagrangian objects.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(block_obj), | public, | pointer | :: | block | => | null() |
Associated block structure |
| integer, | public | :: | count | = | 0 |
Total count across all MPI ranks |
|
| integer, | public | :: | count_ | = | 0 |
Local count for this rank |
|
| integer, | public, | allocatable | :: | count_proc(:) |
Nbr of lagrangian objects per proc |
||
| procedure(kernel_1D), | public, | pointer, nopass | :: | g1ex | => | int_g1_triangle |
1D kernel used in extrapolations |
| procedure(kernel_1D), | public, | pointer, nopass | :: | g1in | => | g1_triangle |
1D kernel used in interpolations |
| logical, | public | :: | is_initialized | = | .false. |
Flag to determine whether this has been initialized |
|
| real(kind=wp), | public | :: | l_filter |
Half filter width |
|||
| character(len=:), | public, | allocatable | :: | name |
Name of the Lagrangian set |
||
| logical, | public | :: | overwrite | = | .true. |
Switch to overwrite IO files |
|
| class(lagrangian_obj), | public, | allocatable | :: | p(:) |
Array of Lagrangian_obj or any extended type |
||
| type(parallel_obj), | public, | pointer | :: | parallel | => | null() |
Associated parallel structure |
| character(len=str64), | public | :: | read_file |
File to read |
|||
| class(lagrangian_obj), | public, | allocatable | :: | sample |
Sample used in allocation of polymorphic data |
||
| integer, | public | :: | stib | = | 3 |
Stencil size for filtering |
|
| character(len=str64), | public | :: | write_file |
File to write |
|||
| integer, | private | :: | MPI_SIZE | = | 44 |
MPI size |
|
| type(MPI_Datatype), | private | :: | MPI_TYPE |
MPI variable type |
Interpolates a field f defined on an Eulerian stencil to the location of a lagrangian object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_obj), | intent(in) | :: | this |
A Lagrangian object |
||
| real(kind=wp), | intent(in) | :: | l_filter |
Filter size |
||
| integer, | intent(in) | :: | slo(3) |
Stencil lower bound |
||
| integer, | intent(in) | :: | shi(3) |
Stencil higher bound |
||
| type(block_obj), | intent(in), | pointer | :: | block |
A block object |
|
| procedure(kernel_1D), | intent(in), | pointer | :: | g1in |
Filter kernel |
|
| real(kind=wp), | intent(in) | :: | f(slo(1):shi(1),slo(2):shi(2),slo(3):shi(3)) |
Quantity to interpolate |
Locates a Lagrangian object on an external grid. Returns the location of the cell containing the object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_obj), | intent(in) | :: | this |
A Lagrangian object |
||
| class(block_obj), | intent(in) | :: | block |
External block |
Result
Returns whether overwriting is true or false.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(in) | :: | this |
A set of Lagrangian objects |
Overwrite value
Returns the MPI rank that should own this lagrangian object based on which block it belongs to.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(in) | :: | this |
A set of Lagrangian objects |
||
| class(lagrangian_obj), | intent(in) | :: | lagobj |
Lagrangian obj to locate |
rank that should own lagobj
Returns the base name of file to read.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(in) | :: | this |
A set of Lagrangian objects |
Name of file
Returns the base name of file to write.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(in) | :: | this |
A set of Lagrangian objects |
Name of file
Gets a bump function centered on the lagrangian object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_obj), | intent(in) | :: | this |
A Lagrangian object |
||
| real(kind=wp), | intent(in) | :: | l_filter |
Filter size |
||
| integer, | intent(in) | :: | slo(3) |
Stencil lower bound |
||
| integer, | intent(in) | :: | shi(3) |
Stencil higher bound |
||
| type(block_obj), | intent(in), | pointer | :: | block |
A block object |
|
| procedure(kernel_1D), | intent(in), | pointer | :: | int_g1ex |
Integrated filter kernel |
|
| real(kind=wp), | intent(out), | allocatable | :: | bump(:,:,:) |
The bump function |
Applies periodic boundary conditions.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
Communicates lagrangian objects across MPI_rank. This subroutine relies on a rank locator procedure (GetOwnerRankOpt) to determine the rank that should own each Lagrangian object. The default rank locator is the one provided by the block object associated with this Lagrangian_set. From there, each rank will send objects that they no longer own and receive objects from other ranks that belongs to it. Note that this subroutine allocates an array (buf_send) of size (MAX NUMBER of OBJECTS to SEND) x (NUMBER OF MPI RANKS) For massively parallel simulations, this may cause out of memory issues. In those cases, care must be exercised to reduce the number of objects to be sent at any given time (e.g.: by doing communications in small batches).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| procedure(locator), | optional | :: | GetOwnerRankOpt |
MPI Rank locator for communications |
Creates an MPI data type for parallel communication of the Lagrangian objects.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
Finalizes the structure and frees memory.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
Frees the MPI data type.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
Prints diagnostics information about the derived type to the standard output.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
Initialize lagrangian objects related IO.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| character(len=*), | intent(in) | :: | name |
Variable name |
||
| type(block_obj), | intent(in), | target | :: | block |
A block object |
|
| type(parallel_obj), | intent(in), | target | :: | parallel |
Parallel structure to link with |
Localizes all Lagrangian object on the grid. For each Lagrangian object in the set, this subroutine finds the cell (staggering=0) where this object is located and updates its cell indices.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
Sorting routine: stacks active lagrangian objects (i.e., who's id is >=1) at the beginning of the array then resizes. Objects with id <= 0 (such as ghost objects) are removed by this subroutine.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
Changes the size of an array of Lagrangian objects. To avoid excessive reallocating, the object array will be reallocated only if the new size is (1+RESIZE_INCREMENT) larger or (1-RESIZE_INCREMENT) smaller than previous size. When the size change does not justify reallocating, the excess objects at the end tail of the object array will be marked as inactive with a large negative ID.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| integer, | intent(in) | :: | n |
New target size |
Sets the interpolation and extrapolation filter kernels. Default is the Triangle kernel.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| integer, | intent(in) | :: | kernel_interp |
Filter kernel for interpolations |
||
| integer, | intent(in) | :: | kernel_extrap |
Filter kernel for extrapolations |
Adjusts the filter half size. Note that the block needs to contain enough ghost cells to be able to represent a filter kernel centered on the edge of the domain. Otherwise, an error will be returnned. The larger the filter size, the more ghost cells are required.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
Set of Lagrangian objects |
||
| real(kind=wp), | intent(in) | :: | l_filter |
Filter size |
Sets file overwritting.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| logical, | intent(in) | :: | overwrite |
Overwrite value |
Sets the base name of file to read.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| character(len=*), | intent(in) | :: | name |
Name of file |
Sets the base name of file to write.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| character(len=*), | intent(in) | :: | name |
Name of file |
Updates the total count of Lagrangian objects.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
Updates ghost objects. Copies objects that lie "dist"-away from the block's boundaries to neighboring MPI-ranks and designate copies as Ghost Objects (id<0). This subroutine will also update the local count (i.e., this%count_) to (NBR of ACTIVE OBJECTS) + (NBR of GHOST OBJECTS). However, the global count (this%count) will remain unchanged (i.e., equal to the total count of active ojbects only)0
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| real(kind=wp), | intent(in) | :: | dist |
Distance from boundaries |
Updates ghost objects in the idir direction. Copies objects that lie "dist"-away from the block's boundaries in idir-direction to neighboring MPI-ranks. Copied objects get a negative ID to designate them as ghost objects
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
||
| real(kind=wp), | intent(in) | :: | dist |
Distance from boundaries |
||
| integer, | intent(in) | :: | idir |
Direction of communication |