This subroutines scans over all leaf blocks and their corner neighbor
pointers and updates corner boundary regions between blocks at the same
refinement level.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This subroutines takes the variable array of the neighbor and extracts
the corner region corresponding to the corner position.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This field stores the location of the corner neighbour pointer and is
used in determining which face, edge or corner we are referring to when
we perform MPI boundary update.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
In generate_mesh() after creating the base structure of the blocks, we
associate their neighbor pointers (faces, edges, and corners) with the
proper neighbors.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
During the derefinement process, we first update the face, edge, and
corner neighbor pointer of the parent block. When this step is done, we
update the corresponsing pointers of the neighbors.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
In order to avoid inconsistencies in the face, edge and corner neighbor
pointer update in refine_block(), like updating the neighbour's pointer
in the middle while it might be still needed in another pointer update,
separate the children and neighbor pointers update.
First, update the face, edge and corner neighbor pointers for the newly
created children only, and when this step is done, update the neighbor'
face, edge and corner pointers.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If we refine the lowest block, which neighbor fields point to itself,
we should point them to the proper children. Include this case in
refine_block() for 2D.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit updated the child edge and corner pointers in refine_block()
for 2D case. It updates corresponding neighbor edge and corner pointers
as well.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The fields of the meta block structure pointing to face, edge and corner
neighbors have new interpretation now. In face and edge fields, first 2
or 3 indices (for 2D and 3D, respectively) describe the corner
coordinates to which the considered face or edge is linked. Then the
last index describe of the direction of the normal to the block face, or
in other words on which plane of the corner the face border plane is
considered, in the case of face neighbor. In the case of the edge
neighbour, the last pointer describe the direction along which the edge
is positioned.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit extends the meta block structure by fields in which we store
pointers to face, edge and corner neighbors.
In the current implementation the boundary update is only done for block
faces, meaning that the corners are not properly updated between the blocks
on different levels. This, of course, can create unexpected problems,
like improper interpolation in the ghost zones, resulting in NaNs there.
The fields for neighbor pointers should allow for a quick access to neighbors
for full, properly done, boundary update.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The actual block prolongation has been moved from update_mesh() to a
separate one called refine_selected_blocks().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The actual block restriction has been moved from update_mesh() to
a separate one called derefine_selected_blocks().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Update the leaf state and counter nleafs in metablock_set_leaf() and
metablock_unset_leaf() only if they really change the state.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Similarily to dblocks, mblocks should count the number of allocated meta
block which are stored in the meta block list, therefore it should be
updated in append_metablock(), remove_metablock(), insert_metablock_*(),
etc.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The data block counter dblocks shouldn't be update in
allocate_datablock() and deallocate_datablock(), since these subroutines
can be used to allocate temporary data blocks. Instead, the counter
dblocks should count only allocated data blocks which are stored in the
list_data data block list.
Therefore, move the update of dblocks to append_datablock() and
remove_datablock().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
After checking refinement flags and process neighbors, we need to check
if all siblings of blocks which were selected for derefinement, are
eligible for derefinement too, i.e. lay at the same level, and are also
selected for derefinement. After this step, we bring all siblings to the
same processor, so the derefinement can be done efficiently.
In this commit, the above step is moved from update_mesh() to
prepare_sibling_derefinement().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The second part of update_mesh(), in which we update neighbor refinement
flags, has been moved to a new subroutine update_neighbor_refinement().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The first part of update_mesh(), where we check and update the
refinement flags, has been moved to a new private subroutine
check_data_block_refinement().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Otherwise we can get some kind of mass leaking problem, like in the case
of Kelvin-Helmholtz test.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Variable statistics, like average, minimum, and maximum values are now
stored in a separate file 'statistics_??.dat'.
Statistics of density, pressure, velocity, magnetic field, divergence
potential and Mach numbers, if they are applicable, are stored.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Also calculate properly the domain sizes xlen, ylen, and zlen and use
them to generate coordinates.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>