EQUATIONS: Improve unphysical cell correction.

If there are no enough physical neighbors, the cell cannot be corrected
and the code simply stops. Allow the code to continue the execution in
such a case by simply correcting the unphysical cells by replacing the
negative values of positive variables with a lower bounds, dmin and
pmin, for density and pressure, respectively.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2018-08-21 22:45:49 -03:00
parent ae06f4fb73
commit 808c1583ba

View File

@ -139,7 +139,7 @@ module equations
! the lower limits for density and pressure to be treated as physical
!
real(kind=8) , save :: dmin = 1.0d-08, pmin = 1.0d-08
real(kind=8) , save :: dmin = 1.0d-16, pmin = 1.0d-16
! the upper limits for the Lorentz factor and corresponding |v|²
!
@ -1218,13 +1218,17 @@ module equations
else
! print error, since no physical cells found for averaging
! limit density or pressure to minimum value, since the averaging over
! neighbours failed
!
write(msg,'(a,1x,a)') &
"Cannot correct the unphysical cell." &
, "Not sufficient number of physical neighbors!"
call print_error(loc, trim(msg))
stop
"Not sufficient number of physical neighbors!" &
, "Applying lower bounds for positive variables."
call print_warning(loc, trim(msg))
q(1:nv,n) = qq(1:nv,i,j,k)
q(idn ,n) = max(dmin, qq(idn,i,j,k))
if (ipr > 0) q(ipr,n) = max(pmin, qq(ipr,i,j,k))
end if ! not sufficient number of physical cells for averaging