Appearance
adam_field_object
ADAM, field class definition.
A structured block is composed of hexahedron finite volumes with quadrilateral faces using the following internal numeration for nodes and faces:
/|\Z
| F(4) _ F(6)
| /|\ /!
| 7 | / 8
| *------------------*
| /| | / /|
| / | | / / |
| / | | / / |
| / | | / / |
| / | | + / |
| / | | / |
| / | + / |
| / 3| / |4
| / * --------/--------*
| F(1)<----/----+ / / /
| *------------------* +-------->F(2)
| 5| / |6 /
| | / | /
| | / + | /
| | / | | /
| | / + | | /
| | / / | | /
| | / / | | /
| |/ / | |/
| *------------------*
| 1 / | 2
| / \|/
| _ Y |/_ F(3)
| /| F(5)
| /
| /
|/ X
O----------------------------------------------------->Each hexadron cells is faces-connected to its neighboring, thus the cells build a structured block with implicit connectivity, e.g. in 2D space a FriVolous block could be as the following:
_ J
/| _____
5+ ...*----*----*----*----*... |
/ / / / / / |
/ / / / / / |
4+ ...*----*----*----*----*... |
/ / / / / / |
/ / / / / / |
3+ ...*----*----*----*----*... | Structured block of 4x4 Finite Volumes
/ / / FV / / / |
/ / / / / / |
2+ ...*----*----*----*----*... |
/ / / / / / |
/ / / / / / |
1+ ...*----*----*----*----*... |
/ . . . . . |
/ . . . . . _____
O-------+----+----+----+----+-------------> I
1 2 3 4 5Source: src/lib/common/adam_field_object.F90
Dependencies
Contents
- field_object
- adapt
- blocks_reorder
- compute_metrics
- compute_normL2_residuals
- initialize
- load_blocks
- load_from_ini_file
- mark_sphere
- mark_all_blocks
- mpi_gather_refinements_needed
- get_refinements_needed
- mpi_redistribute
- save_blocks
- update_ghost_local
- reduce_ghost_local
- reduce_ghost_mpi
- check_reduce_ghost_maps
- update_ghost_mpi
- derefine1D
- derefine2D
- derefine3D
- refine1D
- refine2D
- refine3D
- refine_conservative
- update_coordinates
- description
- do_caxis_intersect
- do_cplane_intersect
- do_ray_intersect
- interp_seam_ghost
- restrict_seam_high_order
- mc_slope
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
INI_SECTION_NAME | character(len=5) | parameter | INI (config) file section name containing configs. |
Derived Types
field_object
Field class definition.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
nv | integer(kind=I4P) | Number of field variables. | |
nv_pic | integer(kind=I4P) | Number of PIC (Particle In Cell) variables. | |
block_weight | integer(kind=I4P) | Block weight, cells_number * variables_number. | |
block_weight_pic | integer(kind=I4P) | Block weight, particles_number * pic_variables_number. | |
nb | integer(kind=I4P) | Number of all blocks that can be stored. | |
blocks_number | integer(kind=I4P) | Number of blocks actually stored. | |
np | integer(kind=I4P) | Number of all particles that can be stored for each block. | |
code | integer(kind=I8P) | allocatable | Morton codes [nb]. |
coordinates | integer(kind=I4P) | allocatable | Coordinates IJKL for each block [4,nb]. |
particles_number | integer(kind=I4P) | allocatable | Number of partcles actually stored in each block [nb]. |
emin | real(kind=R8P) | allocatable | Coordinates of minimum abscissa of each block [3,nb]. |
emax | real(kind=R8P) | allocatable | Coordinates of maximum abscissa of each block [3,nb]. |
dxyz | real(kind=R8P) | allocatable | Space steps of each block [3,nb]. |
x_node | real(kind=R8P) | allocatable | X node coordinates [0-ngc:ni+ngc,nb]. |
y_node | real(kind=R8P) | allocatable | Y node coordinates [0-ngc:nj+ngc,nb]. |
z_node | real(kind=R8P) | allocatable | Z node coordinates [0-ngc:nk+ngc,nb]. |
x_cell | real(kind=R8P) | allocatable | X cell coordinates [1-ngc:ni+ngc,nb]. |
y_cell | real(kind=R8P) | allocatable | Y cell coordinates [1-ngc:nj+ngc,nb]. |
z_cell | real(kind=R8P) | allocatable | Z cell coordinates [1-ngc:nk+ngc,nb]. |
req_send_recv | integer(kind=I4P) | allocatable | MPI request send/receive flags. |
blocks_numbers | integer(kind=I4P) | allocatable | Number of blocks actually stored in all processes. |
refinements_needed | integer(kind=I4P) | allocatable | Refinements needed of my blocks. |
refinements_needed_all | integer(kind=I4P) | allocatable | Refinements needed of all blocks. |
disp_count | integer(kind=I4P) | allocatable | Displacement of blocks that are received from process. |
inner_blocks_number | integer(kind=I4P) | Number of inner blocks where I need fecs. | |
q_work | real(kind=R8P) | allocatable | Field cell centered variables, working buffer memory. |
residuals | real(kind=R8P) | allocatable | Field residuals, normalized. |
ngc | integer(kind=I4P) | pointer | Number of ghost cells. |
ni | integer(kind=I4P) | pointer | Number of cells in i direction. |
nj | integer(kind=I4P) | pointer | Number of cells in j direction. |
nk | integer(kind=I4P) | pointer | Number of cells in k direction. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
adapt | pass(self) | Adapt field accordingly to refine/derefine necessity. |
blocks_reorder | pass(self) | Reorder blocks indexes in field. |
compute_metrics | pass(self) | Compute metrics of each block. |
compute_normL2_residuals | pass(self) | Compute L2 norm of residuals. |
description | pass(self) | Return pretty-printed object description. |
do_caxis_intersect | pass(self) | Return true if a block is intersected by coordinate-axis. |
do_cplane_intersect | pass(self) | Return true if a block is intersected by coordinate-plane. |
do_ray_intersect | pass(self) | Return true if a block is intersected by ray. |
initialize | pass(self) | Initialize the field. |
load_blocks | pass(self) | Load blocks data, used for restarting. |
load_from_ini_file | pass(self) | Load object data from INI file. |
mark_all_blocks | pass(self) | Mark all blocks to be refined, derefined, ecc. |
mark_sphere | pass(self) | Mark blocks to be refined/derefined by sphere distance. |
get_refinements_needed | pass(self) | Return gathered refinement flags and displacements. |
mpi_gather_refinements_needed | pass(self) | Gather blocks refinement needed status between MPI processes. |
mpi_redistribute | pass(self) | Redistribute blocks to processes. |
save_blocks | pass(self) | Save blocks data, used for restarting. |
check_reduce_ghost_maps | pass(self) | Check that every ghost is folded by one map row at most. |
reduce_ghost_local | pass(self) | Fold deposited ghosts back onto their owner cells locally. |
reduce_ghost_mpi | pass(self) | Fold deposited ghosts back onto their owner cells of other ranks. |
update_ghost_local | pass(self) | Update ghosts locally. |
update_ghost_mpi | pass(self) | Update ghosts MPI. |
derefine1D | pass(self) | Derefine blocks, 1D. |
derefine2D | pass(self) | Derefine blocks, 2D. |
derefine3D | pass(self) | Derefine blocks, 3D. |
refine1D | pass(self) | Refine blocks, 1D. |
refine2D | pass(self) | Refine blocks, 2D. |
refine3D | pass(self) | Refine blocks, 3D. |
refine_conservative | pass(self) | Refine blocks, conservative limited prolongation. |
update_coordinates | pass(self) | Update coordinates using the updated data in maps. |
Subroutines
adapt
Adapt field accordingly to refine/derefine necessity.
prolongation selects how a refined block's children are filled: AMR_PROLONGATION_LINEAR (default, tensor linear interpolation, not conservative) or AMR_PROLONGATION_CONSERVATIVE (limited linear slopes whose children average to the parent, issue #74 D-M5-2). Derefinement is the mean of the children in both cases.
fortran
subroutine adapt(self, grid, plan, q, prolongation)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
plan | type(refinement_plan_object) | in | Refinement plan produced by tree%adapt. | |
q | real(kind=R8P) | inout | Field cell centered variables. | |
prolongation | integer(kind=I4P) | in | optional | Prolongation kind, AMR_PROLONGATION_*. |
Call graph
blocks_reorder
Reorder blocks indexes in field.
fortran
subroutine blocks_reorder(self, grid, maps, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
maps | type(maps_object) | in | Maps (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
compute_metrics
Compute metrics of each block.
fortran
subroutine compute_metrics(self, grid)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). |
Call graph
compute_normL2_residuals
Compute L2 norm of residuals.
fortran
subroutine compute_normL2_residuals(self, grid, dq, norm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
dq | real(kind=R8P) | in | Residuals. | |
norm | real(kind=R8P) | inout | Residuals norm. |
Call graph
initialize
Initialize field.
add_adam mirrors tree_object%initialize's optional dummy of the same name (same default .true.). When true, the tree gains an ADAM ancestor node (Morton code -1) attributed to MPI rank 0. The field reflects this by setting blocks_number = 1 ON RANK 0 ONLY (the one that owns the ADAM block); other ranks keep blocks_number = 0. This matches the blocks_numbers(0) = 1 below at line 511 and the code(1) = -1 ADAM-block convention. When add_adam = .false., the tree starts empty and the field follows suit (blocks_number = 0 on every rank). The two add_adam defaults must agree to keep tree/field state consistent at end-of-initialize; callers that pass add_adam to one MUST pass the same value to the other.
fortran
subroutine initialize(self, grid, maps, tree, nb, file_parameters, nv, verbose, add_adam)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | target | Grid (sibling realm component, threaded in). |
maps | type(maps_object) | in | Maps (sibling realm component, threaded in). | |
tree | type(tree_object) | in | Tree (sibling realm component, threaded in). | |
nb | integer(kind=I4P) | in | Number of all blocks that can be stored. | |
file_parameters | type(file_ini) | inout | INI file handler. | |
nv | integer(kind=I4P) | in | optional | Number of field variables. |
verbose | logical | in | optional | Trigger verbose output. |
add_adam | logical | in | optional | Add ADAM ancestor block (mirrors tree initialize's add_adam, |
Call graph
load_blocks
Load blocks data, used for restarting.
Note: blocks memory must be already initialized with enough memory (proper nv,ni,nj,nk,ngc and nb>=blocks number).
fortran
subroutine load_blocks(self, grid, basename, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
basename | character(len=*) | in | Output base name. | |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
load_from_ini_file
Load object data from INI file.
fortran
subroutine load_from_ini_file(self, file_parameters, nv, go_on_fail)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
file_parameters | type(file_ini) | inout | INI file handler. | |
nv | integer(kind=I4P) | in | optional | Number of field variables. |
go_on_fail | logical | in | optional | Go on if load fails. |
Call graph
mark_sphere
Mark blocks to be refined/derefined by sphere distance.
fortran
subroutine mark_sphere(self, grid, center, radius, threshold)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
center | real(kind=R8P) | in | Sphere center coordinates [x,y,z]. | |
radius | real(kind=R8P) | in | Sphere radius. | |
threshold | real(kind=R8P) | in | optional | Threshold for sphere proximity. |
Call graph
mark_all_blocks
Mark all blocks to be refined, derefined, ecc.
fortran
subroutine mark_all_blocks(self, mark)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The tree. | |
mark | integer(kind=I4P) | in | Mark to be imposed [TO_BE_REFINED,...]. |
mpi_gather_refinements_needed
Gather blocks refinement needed status between MPI processes.
fortran
subroutine mpi_gather_refinements_needed(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. |
Call graph
get_refinements_needed
Return gathered refinement flags and process displacements. Provides an accessor so callers do not reach into field internals. Call mpi_gather_refinements_needed before invoking this procedure.
fortran
subroutine get_refinements_needed(self, flags, disp)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | in | The field. | |
flags | integer(kind=I4P) | out | allocatable | Refinements needed of all blocks. |
disp | integer(kind=I4P) | out | allocatable | Displacement of received blocks per process. |
Call graph
mpi_redistribute
Redistribute blocks to processes. @TODO: Morton codes are not yet redistributed, must be fixed.
fortran
subroutine mpi_redistribute(self, grid, maps, tree, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
maps | type(maps_object) | in | Maps (sibling realm component, threaded in). | |
tree | type(tree_object) | in | Tree (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
save_blocks
Save blocks data, used for restarting.
Every rank writes its file, with zero blocks if it owns none (issue #42): load_blocks reads one file per rank, so a rank that skipped the save aborted the restart, and a file left by an earlier save of that rank (when it still owned blocks) would have been read as current. status='replace' truncates a longer old file.
fortran
subroutine save_blocks(self, grid, basename, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
basename | character(len=*) | in | Output base name. | |
q | real(kind=R8P) | in | Field cell centered variables. |
Call graph
update_ghost_local
Update (local) ghost cells.
fortran
subroutine update_ghost_local(self, grid, maps, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | in | The base backend. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
maps | type(maps_object) | in | Maps (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field component to be updated. |
Call graph
reduce_ghost_local
Fold (local) ghost cells back onto the cells they mirror: the transpose of update_ghost_local.
Meant for quantities deposited by sources owned by one block (e.g. PIC charge/current), whose stencil spills into the ghost cells of the owner block: those contributions belong to the interior cells of the neighbour block that the ghosts mirror. For every same-level map row the ghost value is added to its donor cell, then the ghost is refilled with the (now complete) donor value, so that the result equals a single-block deposit of the same sources. Ghosts without a map row (physical boundaries) are left untouched. Only variables v_first:v_last are processed. Rows of 2:1 seams (coarse<->fine) have no transpose implemented yet: their presence is an error.
fortran
subroutine reduce_ghost_local(self, grid, maps, q, v_first, v_last)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
maps | type(maps_object) | in | Maps (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field component to be reduced. | |
v_first | integer(kind=I4P) | in | First variable to reduce. | |
v_last | integer(kind=I4P) | in | Last variable to reduce. |
Call graph
reduce_ghost_mpi
Fold the ghost cells filled by other ranks back onto their donor cells: the transpose of update_ghost_mpi.
MPI twin of reduce_ghost_local, for deposited quantities (e.g. PIC charge/current). The forward maps and buffers are reused with the roles swapped: every received ghost is packed into its receive-buffer slot, the receive segments travel back to the ranks that sent them, and each send-map row adds its slot to the donor cell. Superseded slots of the deduplicated receive map stay zero. The ghosts are NOT refilled: the caller completes the reduction with update_ghost_local + update_ghost_mpi once every fold (local and MPI) is done. Collective: every rank must call it. Only same-level rows are supported (2:1 seams have no transpose yet); see check_reduce_ghost_maps for the disjointness of the local and MPI maps that makes the two folds add each ghost exactly once.
fortran
subroutine reduce_ghost_mpi(self, grid, maps, q, v_first, v_last)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
maps | type(maps_object) | inout | Maps (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field component to be reduced. | |
v_first | integer(kind=I4P) | in | First variable to reduce. | |
v_last | integer(kind=I4P) | in | Last variable to reduce. |
Call graph
check_reduce_ghost_maps
Check that the transposed ghost updates (reduce_ghost_local + reduce_ghost_mpi) fold every ghost cell once at most: a ghost listed by two map rows (two local rows, two MPI rows, or one of each) would be added twice. The forward update tolerates such duplicates (last writer wins), the transpose does not. Only same-level maps are meaningful here.
fortran
subroutine check_reduce_ghost_maps(self, grid, maps)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
maps | type(maps_object) | in | Maps (sibling realm component, threaded in). |
Call graph
update_ghost_mpi
Update ghost cells within other processes.
fortran
subroutine update_ghost_mpi(self, grid, maps, q, step)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The base backend. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
maps | type(maps_object) | inout | Maps (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field component to be updated. | |
step | integer(kind=I4P) | in | optional | Step to be perfordmed in asyncronous comp. |
Call graph
derefine1D
Derefine blocks.
Note: blocks number is not updated: mpi redistribute does it. This is dangerous...
fortran
subroutine derefine1D(self, grid, ratio, block_to_derefine, block_derefined, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
ratio | integer(kind=I4P) | in | Refinement ratio. | |
block_to_derefine | integer(kind=I8P) | in | allocatable | List of blocks to be derefined. |
block_derefined | integer(kind=I8P) | in | allocatable | List of derefined blocks with Morton code. |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
derefine2D
Derefine blocks.
Note: blocks number is not updated: mpi redistribute does it. This is dangerous...
fortran
subroutine derefine2D(self, grid, ratio, block_to_derefine, block_derefined, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
ratio | integer(kind=I4P) | in | Refinement ratio. | |
block_to_derefine | integer(kind=I8P) | in | allocatable | List of blocks to be derefined. |
block_derefined | integer(kind=I8P) | in | allocatable | List of derefined blocks with Morton code. |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
derefine3D
Derefine blocks.
Note: blocks number is not updated: mpi redistribute does it. This is dangerous...
fortran
subroutine derefine3D(self, grid, ratio, block_to_derefine, block_derefined, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
ratio | integer(kind=I4P) | in | Refinement ratio. | |
block_to_derefine | integer(kind=I8P) | in | allocatable | List of blocks to be derefined. |
block_derefined | integer(kind=I8P) | in | allocatable | List of derefined blocks with Morton code. |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
refine1D
Refine blocks.
Note: blocks number is not updated: mpi redistribute does it. This is dangerous...
fortran
subroutine refine1D(self, grid, ratio, block_to_refine, block_refined, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
ratio | integer(kind=I4P) | in | Refinement ratio. | |
block_to_refine | integer(kind=I8P) | in | allocatable | List of blocks to be refined. |
block_refined | integer(kind=I8P) | in | allocatable | List of refined blocks with Morton code. |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
refine2D
Refine blocks.
Note: blocks number is not updated: mpi redistribute does it. This is dangerous...
fortran
subroutine refine2D(self, grid, ratio, block_to_refine, block_refined, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
ratio | integer(kind=I4P) | in | Refinement ratio. | |
block_to_refine | integer(kind=I8P) | in | allocatable | List of blocks to be refined. |
block_refined | integer(kind=I8P) | in | allocatable | List of refined blocks with Morton code. |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
refine3D
Refine blocks.
Note: blocks number is not updated: mpi redistribute does it. This is dangerous...
fortran
subroutine refine3D(self, grid, ratio, block_to_refine, block_refined, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
ratio | integer(kind=I4P) | in | Refinement ratio. | |
block_to_refine | integer(kind=I8P) | in | allocatable | List of blocks to be refined. |
block_refined | integer(kind=I8P) | in | allocatable | List of refined blocks with Morton code. |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
refine_conservative
Refine blocks by a conservative limited linear prolongation (issue #74, D-M5-2).
Each parent cell is split along the refined axes (ratio 2: i; 4: i, j; 8: i, j, k) into children set, variable by variable, to q + phi * sum_d sigma_d * s_d / 4: s_d is the monotonized-central (MC) slope of the parent along axis d, in parent-cell units, from its two face neighbours (the first ghost layer included), and sigma_d = -1, +1 the side of the child. The offsets cancel over the children, so their mean is the parent: the mean restriction of derefine*D undoes this prolongation, and the discrete integral sum(q dV) is unchanged, to round-off. phi in [0, 1] scales the slopes so that no child leaves the range of the parent and its face neighbours (Barth and Jespersen 1989): the MC limit alone bounds each axis, not the sum over the axes, which a corner child takes. A variable that is positive on the parent and its neighbours stays positive. Linear data are reproduced exactly: the MC slope of linear data is its centred difference, and a corner child moves by at most 3/4 of the largest neighbour difference, so phi = 1. Like the linear prolongation, it reads the parent's first ghost layer, which the caller must have refreshed.
Note: blocks number is not updated: mpi redistribute does it.
fortran
subroutine refine_conservative(self, grid, ratio, block_to_refine, block_refined, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
ratio | integer(kind=I4P) | in | Refinement ratio, 2, 4 or 8. | |
block_to_refine | integer(kind=I8P) | in | allocatable | List of blocks to be refined. |
block_refined | integer(kind=I8P) | in | allocatable | List of refined blocks with Morton code. |
q | real(kind=R8P) | inout | Field cell centered variables. |
Call graph
update_coordinates
Update coordinates using the updated data in maps (that in turn is updated by tree).
fortran
subroutine update_coordinates(self, maps, tree)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
maps | type(maps_object) | in | Maps (sibling realm component, threaded in). | |
tree | type(tree_object) | in | Tree (sibling realm component, threaded in). |
Call graph
Functions
description
Return a pretty-formatted object description.
Attributes: pure
Returns: character(len=:)
fortran
function description(self) result(desc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | in | The field. |
Call graph
do_caxis_intersect
Return true if a block is intersected by coordinate-axis.
Returns: logical
fortran
function do_caxis_intersect(self, b, caxis_origin, caxis_direction, caxis_block_indexes) result(do_intersect)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
b | integer(kind=I4P) | in | Block index. | |
caxis_origin | real(kind=R8P) | in | Coordinate-axis origin. | |
caxis_direction | real(kind=R8P) | in | Coordinate-axis direction. | |
caxis_block_indexes | integer(kind=I4P) | out | optional | Block-local indexes of caxis intersection. |
do_cplane_intersect
Return true if a block is intersected by coordinate-plane.
Returns: logical
fortran
function do_cplane_intersect(self, grid, b, cplane_origin, cplane_normal, cplane_block_indexes) result(do_intersect)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
b | integer(kind=I4P) | in | Block index. | |
cplane_origin | real(kind=R8P) | in | Coordinate-plane origin. | |
cplane_normal | real(kind=R8P) | in | Coordinate-plane normal. | |
cplane_block_indexes | integer(kind=I4P) | out | optional | Block-local indexes of cplane intersection. |
Call graph
do_ray_intersect
Return true if a block is intersected by ray from ray_origin and oriented as ray_direction vector.
Returns: logical
fortran
function do_ray_intersect(self, b, ray_origin, ray_direction) result(do_intersect)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(field_object) | inout | The field. | |
b | integer(kind=I4P) | in | Block index. | |
ray_origin | real(kind=R8P) | in | Ray origin. | |
ray_direction | real(kind=R8P) | in | Ray direction. |
Call graph
interp_seam_ghost
Evaluate the coarse->fine seam ghost interpolant for one (variable, fine ghost) pair (issue #21 N2): gather the donor footprint around the anchor (i_send,j_send,k_send) of block b_send and compose the 1D weights of the active regime. The anchor and the shift-clamped positions in meta guarantee the footprint reads REAL donor cells only (G3).
Attributes: pure
Returns: real(kind=R8P)
fortran
function interp_seam_ghost(regime, meta, ngc, q, v, i_send, j_send, k_send, b_send) result(value_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
regime | integer(kind=I4P) | in | Active fill regime (SEAM_FILL_*). | |
meta | integer(kind=I4P) | in | Packed interpolation metadata (see seam_meta_pack). | |
ngc | integer(kind=I4P) | in | Ghost cells number (bounds of q). | |
q | real(kind=R8P) | in | Field variables. | |
v | integer(kind=I4P) | in | Variable index. | |
i_send | integer(kind=I4P) | in | Anchor donor cell, i. | |
j_send | integer(kind=I4P) | in | Anchor donor cell, j. | |
k_send | integer(kind=I4P) | in | Anchor donor cell, k. | |
b_send | integer(kind=I4P) | in | Donor block index. |
Call graph
restrict_seam_high_order
Evaluate the high-order restriction of one (variable, coarse ghost) pair to the coarse centre, which sits midway between the fine cells first and first + 1 of each refined direction ((i_send,j_send,k_send) is the first fine cell of block b_send); the footprint first - code .. first - code + 5 is kept inside the donor block by the codes of meta (seam_restriction_code), which also carries the regime (seam_restriction_meta_pack):
- 6-point Lagrange (issue #68 C1): the tensor product of the 1D weights
SEAM_W_LAGRANGE6, summed direction by direction (x innermost), the same order as the FNL twin; - WENO (issue #68 C3):
seam_restriction_weno6on the gathered footprint. An unrefined direction (codeSEAM_RESTRICT_IDENTITY) reads the cell itself only.
Attributes: pure
Returns: real(kind=R8P)
fortran
function restrict_seam_high_order(meta, ngc, q, v, i_send, j_send, k_send, b_send) result(value_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
meta | integer(kind=I4P) | in | Packed restriction codes and regime (seam_restriction_meta_pack). | |
ngc | integer(kind=I4P) | in | Ghost cells number (bounds of q). | |
q | real(kind=R8P) | in | Field variables. | |
v | integer(kind=I4P) | in | Variable index. | |
i_send | integer(kind=I4P) | in | First fine cell of the restricted pair, i. | |
j_send | integer(kind=I4P) | in | First fine cell of the restricted pair, j. | |
k_send | integer(kind=I4P) | in | First fine cell of the restricted pair, k. | |
b_send | integer(kind=I4P) | in | Donor block index. |
Call graph
mc_slope
Monotonized-central limited slope (van Leer 1977) from the backward and forward differences.
Zero at an extremum (the differences disagree in sign), else the smallest of the centred difference and twice each one-sided difference, with their common sign.
Attributes: elemental
Returns: real(kind=R8P)
fortran
function mc_slope(dm, dp) result(slope)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dm | real(kind=R8P) | in | Backward difference, q(i) - q(i-1). | |
dp | real(kind=R8P) | in | Forward difference, q(i+1) - q(i). |
Call graph