Updated version of buoyantBoussinesqSimpleFoam

This commit is contained in:
Hrvoje Jasak 2019-09-26 11:21:23 +01:00
parent ae2913e622
commit 56a81f1825
4 changed files with 40 additions and 36 deletions

View file

@ -8,12 +8,11 @@
fvScalarMatrix TEqn fvScalarMatrix TEqn
( (
fvm::div(phi, T) fvm::div(phi, T)
- fvm::Sp(fvc::div(phi), T) + fvm::SuSp(-fvc::div(phi), T)
- fvm::laplacian(kappaEff, T) - fvm::laplacian(kappaEff, T)
); );
TEqn.relax(); TEqn.relax();
TEqn.solve(); TEqn.solve();
rhok = 1.0 - beta*(T - TRef); rhok = 1.0 - beta*(T - TRef);

View file

@ -6,17 +6,10 @@
+ turbulence->divDevReff() + turbulence->divDevReff()
); );
UEqn().relax();
solve solve
( (
UEqn() relax(UEqn())
== ==
fvc::reconstruct -fvc::grad(p)
( + fvc::reconstruct(fvc::interpolate(rhok)*(g & mesh.Sf()))
(
fvc::interpolate(rhok)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
)
)
); );

View file

@ -74,8 +74,8 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector // Pressure-velocity SIMPLE corrector
{ {
#include "UEqn.H"
# include "TEqn.H" # include "TEqn.H"
# include "UEqn.H"
# include "pEqn.H" # include "pEqn.H"
} }

View file

@ -1,22 +1,31 @@
{ {
volScalarField rUA("rUA", 1.0/UEqn().A()); p.boundaryField().updateCoeffs();
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
U = rUA*UEqn().H(); volScalarField rAU("rAU", 1.0/UEqn().A());
surfaceScalarField rAUf("(1|A(U))", fvc::interpolate(rAU));
U = rAU*UEqn().H();
UEqn.clear(); UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf(); simple.calcSteadyConsistentFlux(phi, U);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
surfaceScalarField buoyancyPhi = surfaceScalarField buoyancyPhi =
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf()); rAUf*fvc::interpolate(rhok)*(g & mesh.Sf());
phi += buoyancyPhi; phi += buoyancyPhi;
while (simple.correctNonOrthogonal()) while (simple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUAf, p) == fvc::div(phi) fvm::laplacian
(
rAUf/simple.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -27,16 +36,19 @@
{ {
// Calculate the conservative fluxes // Calculate the conservative fluxes
phi -= pEqn.flux(); phi -= pEqn.flux();
}
// U += rAU*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rAUf);
// U.correctBoundaryConditions();
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
// Correct the momentum source with the pressure gradient flux // Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure // calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf); U += rAU*(fvc::reconstruct(buoyancyPhi/rAUf) - fvc::grad(p));
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
}
#include "continuityErrs.H"
}