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>
Subroutine update_increment() was using time information which broke the
source term contribution. It has been moved to module EVOLUTION and its
arguments have been simplified.
The time step is now directly taken into account in the time integration
subroutines.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If option "fix_positivity" is on, we check if the pressure obtained from
conservative variables is positive. If it is negative, it is replaced by
a value corresponding to the maximum allowed sonic Mach number, provided
by option "msmax". The new value of pressure and corresponding total
energy is set in all unphysical cells then.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If we set option "clip_extrema" to "on", we turn on the extrema clipping
or in other words, the reconstruction is limited in order to keep left
and right states to lay between their cell centered neighbors.
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>