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