From 5964d507202b5534364a7f02ceec4e81739b0cfa Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Tue, 7 Aug 2018 14:13:34 -0300 Subject: [PATCH] EVOLUTION: Fix unphysical cells after mesh update. Unphysical cells can appear due to various reasons, e.g conservative to primitive variable conversion in recently created block after mesh refinements. Such unphysical cells can be immediately propagated to neighbor blocks through boundary update, blocks which have not been marked as recently updated. In such situation, the unphysical cells are not corrected in these neighbors. This change fixes this by marking all neighbors of blocks created in the mesh update to be verified for unphysical cells too. Signed-off-by: Grzegorz Kowal --- src/blocks.F90 | 2 +- src/evolution.F90 | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/blocks.F90 b/src/blocks.F90 index 181fd64..f529178 100644 --- a/src/blocks.F90 +++ b/src/blocks.F90 @@ -343,7 +343,7 @@ module blocks public :: set_last_id, get_last_id, get_mblocks, get_dblocks, get_nleafs public :: set_blocks_update public :: change_blocks_process - public :: set_neighbors_refine + public :: set_neighbors_refine, set_neighbors_update public :: metablock_set_id, metablock_set_process, metablock_set_level public :: metablock_set_configuration, metablock_set_refinement public :: metablock_set_position, metablock_set_coordinates diff --git a/src/evolution.F90 b/src/evolution.F90 index c38b3f4..dc86c5c 100644 --- a/src/evolution.F90 +++ b/src/evolution.F90 @@ -1988,6 +1988,7 @@ module evolution ! include external procedures ! + use blocks , only : set_neighbors_update use boundaries , only : boundary_variables use equations , only : update_primitive_variables use equations , only : fix_unphysical_cells, correct_unphysical_states @@ -2037,12 +2038,28 @@ module evolution ! correct unphysical states if detected ! if (fix_unphysical_cells) then + +! if an unphysical cell appeared in a block while updating its primitive +! variables it could be propagated to its neighbors through boundary update; +! mark all neighbors of such a block to be verified and corrected for +! unphysical cells too +! + pmeta => list_meta + do while (associated(pmeta)) + + if (pmeta%update) call set_neighbors_update(pmeta) + + pmeta => pmeta%next + end do + +! verify and correct, if necessary, unphysical cells in recently updated blocks +! pdata => list_data do while (associated(pdata)) pmeta => pdata%meta - if (pmeta%update) call correct_unphysical_states(pmeta%id & - , pdata%q, pdata%u) + if (pmeta%update) & + call correct_unphysical_states(pmeta%id, pdata%q, pdata%u) pdata => pdata%next end do