From 1b37e6dc47e29321e5d26c7dc35f5e70a2c0615b Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 20 Feb 2015 09:28:31 -0200 Subject: [PATCH] =?UTF-8?q?EQUATIONS:=20Optimize=20SRHD=202D(W,u=C2=B2)=20?= =?UTF-8?q?variable=20solver=20even=20more.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This optimizations incorporate pressure directly into the F(W,u²) function, while allows to reduce a few operations more. Signed-off-by: Grzegorz Kowal --- src/equations.F90 | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/equations.F90 b/src/equations.F90 index 4928442..9667ae5 100644 --- a/src/equations.F90 +++ b/src/equations.F90 @@ -3909,6 +3909,12 @@ module equations ! ! using the Newton-Raphson 2D iterative method. ! +! All evaluated equations incorporate already the pressure of the form +! +! P(W,|V|²) = (γ - 1)/γ (W - Γ D) / (1 + |u|²) +! +! in order to optimize calculations. +! ! Arguments: ! ! mm, en - input coefficients for |M|² and E, respectively; @@ -3933,7 +3939,7 @@ module equations logical :: keep integer :: it, cn real(kind=8) :: wl, wu, fl, fu - real(kind=8) :: ww, uu, up, gm, dm, pr + real(kind=8) :: ww, uu, up, gm, gd real(kind=8) :: f, dfw, dfu, df real(kind=8) :: g, dgw, dgu, dg real(kind=8) :: det, jfw, jfu, jgw, jgu @@ -3989,28 +3995,23 @@ module equations ! do while(keep) -! calculate W², (1 + |u|²), and the Lorentz factor +! calculate W², (1 + |u|²), and the Lorentz factor, and some repeated +! expressions ! ww = w * w up = 1.0d+00 + uu gm = sqrt(up) - dm = gm * dn - -! calculate the thermal pressure -! -! P(W,|V|²) = (γ - 1)/γ (W - D Γ) / (1 + |u|²) -! - pr = gammaxi * (w - dm) / up + gd = gammaxi * dn ! calculate F(W,|V|²) and G(W,|V|²) ! - f = (w - en - pr) * up + f = (up - gammaxi) * w - up * en + gm * gd g = uu * ww - up * mm ! calculate dF(W,|u|²)/dW and dF(W,|u|²)/d|u|² ! dfw = up - gammaxi - dfu = w - en - pr + gammaxi * (w - 0.5d+00 * dm) / up + dfu = w - en + 0.5d+00 * gd / gm ! calculate dG(W,|u|²)/dW and dG(W,|u|²)/d|u|² !