Consistency update: simpleSRFFoam

This commit is contained in:
Vuko Vukcevic 2017-01-16 14:49:03 +01:00
parent d05f9fc208
commit 5ba5d4ab07
3 changed files with 21 additions and 74 deletions

View file

@ -1,15 +1,11 @@
// Solve the momentum equation // Solve the momentum equation
tmp<fvVectorMatrix> HUrelEqn tmp<fvVectorMatrix> UrelEqn
( (
fvm::div(phi, Urel) fvm::div(phi, Urel)
+ turbulence->divDevReff() + turbulence->divDevReff()
+ SRF->Su() + SRF->Su()
); );
// Get under-relaxation factor
const scalar UUrf =
mesh.solutionDict().equationRelaxationFactor(Urel.name());
// Momentum solution // Momentum solution
solve(relax(HUrelEqn(), UUrf) == -fvc::grad(p)); solve(relax(UrelEqn()) == -fvc::grad(p));

View file

@ -1,36 +1,32 @@
p.boundaryField().updateCoeffs(); p.boundaryField().updateCoeffs();
// Prepare clean 1/Ap without contribution from under-relaxation volScalarField rAUrel = 1.0/UrelEqn().A();
// HJ, 26/Oct/2015 Urel = rAUrel*UrelEqn().H();
volScalarField rUA UrelEqn.clear();
(
"(1|A(Urel))",
1/HUrelEqn().A()
);
// Store velocity under-relaxation point before using U for the flux // Calculate under-relaxation consistent flux
// precursor simple.calcSteadyConsistentFlux(phi, Urel);
Urel.storePrevIter();
Urel = rUA*HUrelEqn().H();
HUrelEqn.clear();
phi = fvc::interpolate(Urel) & mesh.Sf();
// Global flux balance
adjustPhi(phi, Urel, p); adjustPhi(phi, Urel, p);
// Non-orthogonal pressure corrector loop // Non-orthogonal pressure corrector loop
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) while (simple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian
(
fvc::interpolate(rAUrel)/simple.aCoeff(),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(); pEqn.solve();
if (nonOrth == nNonOrthCorr) if (simple.finalNonOrthogonalIter())
{ {
phi -= pEqn.flux(); phi -= pEqn.flux();
} }
@ -41,8 +37,5 @@
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
// Momentum corrector // Reconstruct consistent velocity after pressure equation
// Note: since under-relaxation does not change aU, H/a in U can be simple.reconstructSteadyVelocity(Urel, rAUrel, p);
// re-used. HJ, 22/Jan/2016
Urel = UUrf*(Urel - rUA*fvc::grad(p)) + (1 - UUrf)*Urel.prevIter();
Urel.correctBoundaryConditions();

View file

@ -65,50 +65,8 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector // Pressure-velocity SIMPLE corrector
{ {
// Momentum predictor # include "UEqn.H"
tmp<fvVectorMatrix> UrelEqn # include "pEqn.H"
(
fvm::div(phi, Urel)
+ turbulence->divDevReff()
+ SRF->Su()
);
UrelEqn().relax();
solve(UrelEqn() == -fvc::grad(p));
p.boundaryField().updateCoeffs();
volScalarField AUrel = UrelEqn().A();
Urel = UrelEqn().H()/AUrel;
UrelEqn.clear();
phi = fvc::interpolate(Urel) & mesh.Sf();
adjustPhi(phi, Urel, p);
// Non-orthogonal pressure corrector loop
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(1.0/AUrel, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
Urel -= fvc::grad(p)/AUrel;
Urel.correctBoundaryConditions();
} }
turbulence->correct(); turbulence->correct();