The monotonicity preserving (MP) limiter can be applied to various
reconstruction methods, therefore it is good to put it in a separate
subroutine.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If there are two roots, make sure that x(1) corresponds to the formula
with '-' sign, and x(2) corresponds to the formula with '+' sign, i.e.
Δ = a₁² - 4 a₂ a₀
x₁ = - (a₁ - sqrt(Δ)) / (2 a₂)
x₂ = - (a₁ + sqrt(Δ)) / (2 a₂)
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Subtract the cell value from the stencil and add it back after the
interpolated values once the interpolation is done. This significantly
decreases the interpolation errors in uniform areas where the variables
are different from zero.
Check the monotonicity by comparing to eps and not to zero. This does
not force the interpolation to go back to the TVD one if the difference
between the interpolated value and cell centered one is of the order of
numerical error.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If the parallel component of magnetic field is too small, the
intermediate states might produce numerical instabilities, since they
are obtained by the division by a small factor.
In order to remove this situation, we apply full HLLD solver for strong
enough Alfvén wave. If it is weak, the HLLC solver is applied.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If the parallel component of magnetic field is too small, the
intermediate states might produce numerical instabilities, since they
are obtained by the division by a small factor.
In order to remove this situation, we apply full HLLD solver for strong
enough Alfvén wave. If it is weak, the HLL solver is applied.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If the parallel component of magnetic field is too small, the
intermediate states might produce numerical instabilities, since they
are obtained by the division by a small factor.
In order to remove this situation, we apply full HLLD solver for strong
enough Alfvén wave. If it is weak, the HLL solver is applied.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
For one of the degenerate situations the state vector was not
calculated. This introduced numerical instabilities. This change fixes
it.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
We should take half of the TVD limited derivatives in order to compare
properly with the high order interpolated derivative. Fix it.
Also, TVD limit both states if the high order interpolation of any of
them overshoot.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
In the sum of the J² we used Fortran subroutine sum() and the sum was
done along the 2nd index. However, the interpretation of this index is
uncertain when the first array rank is 1.
Therefore, instead of using subroutine sum(), the calculation is done
directly.
After this change there are no strange effects appearing on the
boundaries of the blocks.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This additional multi-dimensional limiting can be applied to any
reconstruction method. It is controlled by the parameter 'mlp_limiting'
by setting 'on' or 'off'.
The implementation is based on Gerlinger (2012).
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>