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>
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>
We prepare a set of indices for all faces in the block. Those indices
point to edges and corners for each face, and are set one during the
first execution. Then, we simply iterate over faces and call
iterate_over_face() in order to apply subroutine pprocedure to edges and
corners connected to a given face.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Add subroutines to iterate over all block neighbors and check if they
reference to correct meta blocks. The neighbor consistency check is
done after initial mesh generation and each time the mesh has been
updated.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
In 2D case, if we update corners using only X-edge neighbors, we get
some rare problems with symmetry. If we additionally use Y-edge
neighbors, to update corners, those problems disappear. This should be
additionally tested for both, 2D and 3D cases.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The job restart with smaller number of processors than the number of
files didn't work well, since all metablocks of all remaining files
where set to the last process before actually reading the corresponding
data blocks. This resulted in a crash in redistribute_blocks() due to
pointer not associated.
The fix lets the meta blocks to be restored with the original process
numbers. While reading files with the indices larger than the index of
the last process, all meta blocks which corresponding data blocks are
stored in the read file, are set to the process number of the reading
process. After reading data blocks from each file, the blocks are
redistributed. However, only data blocks belonging to the active
processes are redistributed.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
In this patch we make a general subroutine iterating over all neighbors
iterate_over_neighbors() which takes as arguments a pointer to the block
which neighbors are evaluated and pointer to subroutine which should be
called with each neighbor. So far two such subroutines are used, one to
select the proper refinement flag, and another to select the neighbor
for update.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Those arrays are prepared only at the first execution and then stored in
memory, therefore there is no need to preparing them each time
refine_block() is called. This removes also one 'select which' condition
check.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If we take the whole domain and divide it between blocks of the size
corresponding to the current lever, the field %coords identifies the
position of the current block in the domain.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This patch marks all refined or derefined blocks to be updated. All
their face, edge, and corner neighbors are marked for update as well, in
order to keep the boundary consistency.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This subroutine marks or unmarks all blocks on the meta block list to be
updated depending on the input argument.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Those two subroutines insert a new meta block after or before the block
which is provided by additional pointer.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>