This rewrite removes the dependency on |v|² and its derivative in the
energy function and replaces it with the Lorentz factor. It also
slightly simplifies the energy function.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If the energy function is positive for the lower bracket, it means that
the solution for energy function is unphysical (p<0). In this case use
the lower bracket which guarantees that the cell is physical.
The total energy should be corrected in this case, but this will be done
later.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The new subroutine finds the initial brackets and estimates the root
value of the enthalpy which are used in the primitive variables solver
for SRMHD.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The fluxes of the momenta had the second terms wrongly calculated. The
new calculation uses equations from Mignone & Bodo (2006).
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This change implements the initial bracketing the enthalpy. The minimum
enthalpy is found by solving the pressure positivity equation, which
guarantees also the physicality of velocity. The upper bracket is found
from the energy equation. Then, the brackets are shifted up until the
root region is found.
The 1D and 2D Newton-Raphson methods have been slightly improved as
well. The 1Dw method use the information about brackets to limit the
next step. If the solution shoots out of the brackets, the bisection
method is applied. In the 2Dwv method, we print warnings when the
variables become unphysical.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
If the primitive variable solvers cannot find the physical solution,
print an error message together with the values of the conservative
variables for a problematic cell.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The new lower bracket for W guarantees that both pressure and velocity
are physical. We also make sure, that the upper bracket is always larger
than the lower one.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
The maximum number of iterations, and the number of extra iterations are
called nrmax, and nrext, respectively.
The can be changed by setting parameters "nr_maxit" and "nr_extra" in
the parameter file.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This optimizations incorporate pressure directly into the F(W,u²)
function, while allows to reduce a few operations more.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
Before we perform Newton-Raphson step to find the roots W, we can use
some estimates of the brackets, and from them we can calculate the
initial guess for W.
This change implements this step for all special relativity HD primitive
variable solvers.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
One of the derivative was calculated in a wrong way. This patch also
incorporates the pressure derivatives directly in the derivatives of
functions F(W,u²) and G(W,u²), which allows to some microoptimizations.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>