Commit 3bbe379d authored by Dave Moxey's avatar Dave Moxey
Browse files

Removing a few unneeded multiples from HLL/HLLC solvers.

Fixed compiler warning in RiemannSolver.
parent f20110cf
......@@ -398,7 +398,7 @@ namespace Nektar
tn[2] = normals[2][i];
FromToRotation(tn, xdir, tmp);
for (int j = 0; j < 9; ++j)
for (j = 0; j < 9; ++j)
{
m_rotMat[j][i] = tmp[j];
}
......
......@@ -108,30 +108,30 @@ namespace Nektar
// Maximum wave speeds
NekDouble SL = std::min(uL-cL, uRoe-cRoe);
NekDouble SR = std::max(uR+cR, uRoe+cRoe);
NekDouble SM = (pR - pL + rhouL * (SL - uL) - rhouR * (SR - uR)) /
(rhoL * (SL - uL) - rhoR * (SR - uR));
// HLLC Riemann fluxes (positive case)
if (SL >= 0)
{
rhof = rhoL * uL;
rhouf = rhoL * uL * uL + pL;
rhovf = rhoL * uL * vL;
rhowf = rhoL * uL * wL;
rhof = rhouL;
rhouf = rhouL * uL + pL;
rhovf = rhouL * vL;
rhowf = rhouL * wL;
Ef = uL * (EL + pL);
}
// HLLC Riemann fluxes (negative case)
else if (SR <= 0)
{
rhof = rhoR * uR;
rhouf = rhoR * uR * uR + pR;
rhovf = rhoR * uR * vR;
rhowf = rhoR * uR * wR;
rhof = rhouR;
rhouf = rhouR * uR + pR;
rhovf = rhouR * vR;
rhowf = rhouR * wR;
Ef = uR * (ER + pR);
}
// HLLC Riemann fluxes (general case (SL < 0 | SR > 0)
else
{
NekDouble SM = (pR - pL + rhouL * (SL - uL) - rhouR * (SR - uR)) /
(rhoL * (SL - uL) - rhoR * (SR - uR));
NekDouble rhoML = rhoL * (SL - uL) / (SL - SM);
NekDouble rhouML = rhoML * SM;
NekDouble rhovML = rhoML * vL;
......@@ -148,18 +148,18 @@ namespace Nektar
if (SL < 0.0 && SM >= 0.0)
{
rhof = rhoL * uL + SL * (rhoML - rhoL);
rhouf = rhoL * uL * uL + pL + SL * (rhouML - rhouL);
rhovf = rhoL * uL * vL + SL * (rhovML - rhovL);
rhowf = rhoL * uL * wL + SL * (rhowML - rhowL);
rhof = rhouL + SL * (rhoML - rhoL);
rhouf = rhouL * uL + pL + SL * (rhouML - rhouL);
rhovf = rhouL * vL + SL * (rhovML - rhovL);
rhowf = rhouL * wL + SL * (rhowML - rhowL);
Ef = uL * (EL + pL) + SL * (EML - EL);
}
else if(SM < 0.0 && SR > 0.0)
{
rhof = rhoR * uR + SR * (rhoMR - rhoR);
rhouf = rhoR * uR * uR + pR + SR * (rhouMR - rhouR);
rhovf = rhoR * uR * vR + SR * (rhovMR - rhovR);
rhowf = rhoR * uR * wR + SR * (rhowMR - rhowR);
rhof = rhouR + SR * (rhoMR - rhoR);
rhouf = rhouR * uR + pR + SR * (rhouMR - rhouR);
rhovf = rhouR * vR + SR * (rhovMR - rhovR);
rhowf = rhouR * wR + SR * (rhowMR - rhowR);
Ef = uR * (ER + pR) + SR * (EMR - ER);
}
}
......
......@@ -108,43 +108,39 @@ namespace Nektar
// Maximum wave speeds
NekDouble SL = std::min(uL-cL, uRoe-cRoe);
NekDouble SR = std::max(uR+cR, uRoe+cRoe);
// HLL Riemann fluxes (positive case)
if (SL >= 0)
{
rhof = rhoL * uL;
rhouf = rhoL * uL * uL + pL;
rhovf = rhoL * uL * vL;
rhowf = rhoL * uL * wL;
rhof = rhouL;
rhouf = rhouL * uL + pL;
rhovf = rhouL * vL;
rhowf = rhouL * wL;
Ef = uL * (EL + pL);
}
// HLL Riemann fluxes (negative case)
else if (SR <= 0)
{
rhof = rhoR * uR;
rhouf = rhoR * uR * uR + pR;
rhovf = rhoR * uR * vR;
rhowf = rhoR * uR * wR;
rhof = rhouR;
rhouf = rhouR * uR + pR;
rhovf = rhouR * vR;
rhowf = rhouR * wR;
Ef = uR * (ER + pR);
}
// HLL Riemann fluxes (general case (SL < 0 | SR > 0)
else
{
rhof = (SR * (rhoL * uL) -
SL * (rhoR * uR) +
SR * SL * (rhoR - rhoL)) / (SR - SL);
rhouf = (SR * (rhoL * uL * uL + pL) -
SL * (rhoR * uR * uR + pR) +
SR * SL * (rhouR - rhouL)) / (SR - SL);
rhovf = (SR * (rhoL * uL * vL) -
SL * (rhoR * uR * vR) +
SR * SL * (rhovR - rhovL)) / (SR - SL);
Ef = (SR * (uL * EL + uL * pL) -
SL * (uR * ER + uR * pR) +
SR * SL * (ER - EL)) / (SR - SL);
NekDouble tmp1 = 1.0 / (SR - SL);
NekDouble tmp2 = SR * SL;
rhof = (SR * rhouL - SL * rhouR + tmp2 * (rhoR - rhoL)) * tmp1;
rhouf = (SR * (rhouL * uL + pL) - SL * (rhouR * uR + pR) +
tmp2 * (rhouR - rhouL)) * tmp1;
rhovf = (SR * rhouL * vL - SL * rhouR * vR +
tmp2 * (rhovR - rhovL)) * tmp1;
rhowf = (SR * rhouL * wL - SL * rhouR * wR +
tmp2 * (rhowR - rhowL)) * tmp1;
Ef = (SR * uL * (EL + pL) - SL * uR * (ER + pR) +
tmp2 * (ER - EL)) * tmp1;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment