mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated SIMPLE solvers to new simpleControl framework
This commit is contained in:
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
solve
|
solve
|
||||||
(
|
(
|
||||||
|
|||||||
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
solve
|
solve
|
||||||
(
|
(
|
||||||
|
|||||||
@ -17,7 +17,7 @@ if (simple.transonic())
|
|||||||
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
|
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
|
||||||
);
|
);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
@ -32,7 +32,7 @@ if (simple.transonic())
|
|||||||
|
|
||||||
pEqn.solve();
|
pEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi == pEqn.flux();
|
phi == pEqn.flux();
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ else
|
|||||||
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
||||||
closedVolume = adjustPhi(phi, U, p);
|
closedVolume = adjustPhi(phi, U, p);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
@ -54,7 +54,7 @@ else
|
|||||||
|
|
||||||
pEqn.solve();
|
pEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ if (simple.transonic())
|
|||||||
);
|
);
|
||||||
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
|
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
tmp<fvScalarMatrix> tpEqn;
|
tmp<fvScalarMatrix> tpEqn;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ if (simple.transonic())
|
|||||||
|
|
||||||
tpEqn().solve();
|
tpEqn().solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi == tpEqn().flux();
|
phi == tpEqn().flux();
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ else
|
|||||||
|
|
||||||
closedVolume = adjustPhi(phi, U, p);
|
closedVolume = adjustPhi(phi, U, p);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
tmp<fvScalarMatrix> tpEqn;
|
tmp<fvScalarMatrix> tpEqn;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ else
|
|||||||
|
|
||||||
tpEqn().solve();
|
tpEqn().solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= tpEqn().flux();
|
phi -= tpEqn().flux();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ bool closedVolume = false;
|
|||||||
|
|
||||||
if (simple.transonic())
|
if (simple.transonic())
|
||||||
{
|
{
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
surfaceScalarField phid
|
surfaceScalarField phid
|
||||||
(
|
(
|
||||||
@ -44,17 +44,9 @@ if (simple.transonic())
|
|||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
// Retain the residual from the first iteration
|
pEqn.solve();
|
||||||
if (nonOrth == 0)
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi == phic + pEqn.flux();
|
phi == phic + pEqn.flux();
|
||||||
}
|
}
|
||||||
@ -62,7 +54,7 @@ if (simple.transonic())
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
phi = fvc::interpolate(rho*U) & mesh.Sf();
|
phi = fvc::interpolate(rho*U) & mesh.Sf();
|
||||||
closedVolume = adjustPhi(phi, U, p);
|
closedVolume = adjustPhi(phi, U, p);
|
||||||
@ -77,18 +69,9 @@ else
|
|||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
// Retain the residual from the first iteration
|
pEqn.solve();
|
||||||
if (nonOrth == 0)
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (simple.finalNonOrthogonalIter())
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
|
||||||
{
|
{
|
||||||
phi += pEqn.flux();
|
phi += pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
runTime++;
|
runTime++;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf));
|
solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
||||||
phi -= buoyancyPhi;
|
phi -= buoyancyPhi;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
@ -24,7 +24,7 @@
|
|||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
p_rghEqn.solve();
|
p_rghEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
// Calculate the conservative fluxes
|
// Calculate the conservative fluxes
|
||||||
phi -= p_rghEqn.flux();
|
phi -= p_rghEqn.flux();
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
surfaceScalarField buoyancyPhi(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
surfaceScalarField buoyancyPhi(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
||||||
phi -= buoyancyPhi;
|
phi -= buoyancyPhi;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
p_rghEqn.solve();
|
p_rghEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
// Calculate the conservative fluxes
|
// Calculate the conservative fluxes
|
||||||
phi -= p_rghEqn.flux();
|
phi -= p_rghEqn.flux();
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
||||||
phi -= buoyancyPhi;
|
phi -= buoyancyPhi;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
@ -24,7 +24,7 @@
|
|||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
p_rghEqn.solve();
|
p_rghEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
// Calculate the conservative fluxes
|
// Calculate the conservative fluxes
|
||||||
phi -= p_rghEqn.flux();
|
phi -= p_rghEqn.flux();
|
||||||
|
|||||||
@ -120,7 +120,7 @@ int main(int argc, char *argv[])
|
|||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
// Non-orthogonal pressure corrector loop
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
|
|||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
pEqn.solve();
|
pEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ int main(int argc, char *argv[])
|
|||||||
adjustPhi(phia, Ua, pa);
|
adjustPhi(phia, Ua, pa);
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
// Non-orthogonal pressure corrector loop
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix paEqn
|
fvScalarMatrix paEqn
|
||||||
(
|
(
|
||||||
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
|||||||
paEqn.setReference(paRefCell, paRefValue);
|
paEqn.setReference(paRefCell, paRefValue);
|
||||||
paEqn.solve();
|
paEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phia -= paEqn.flux();
|
phia -= paEqn.flux();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
// Non-orthogonal pressure corrector loop
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
@ -20,7 +20,7 @@
|
|||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
pEqn.solve();
|
pEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
adjustPhi(phi, Urel, p);
|
adjustPhi(phi, Urel, p);
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
// Non-orthogonal pressure corrector loop
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
pEqn.solve();
|
pEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
// Non-orthogonal pressure corrector loop
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
pEqn.solve();
|
pEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ UEqn.clear();
|
|||||||
phi = fvc::interpolate(U) & mesh.Sf();
|
phi = fvc::interpolate(U) & mesh.Sf();
|
||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
while (simple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
tmp<fvScalarMatrix> tpEqn;
|
tmp<fvScalarMatrix> tpEqn;
|
||||||
|
|
||||||
@ -25,17 +25,10 @@ for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tpEqn().setReference(pRefCell, pRefValue);
|
tpEqn().setReference(pRefCell, pRefValue);
|
||||||
// retain the residual from the first iteration
|
|
||||||
if (nonOrth == 0)
|
|
||||||
{
|
|
||||||
tpEqn().solve();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tpEqn().solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == simple.nNonOrthCorr())
|
tpEqn().solve();
|
||||||
|
|
||||||
|
if (simple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= tpEqn().flux();
|
phi -= tpEqn().flux();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user