Updated version of buoyantBoussinesqSimpleFoam
This commit is contained in:
parent
ae2913e622
commit
56a81f1825
4 changed files with 40 additions and 36 deletions
|
@ -8,12 +8,11 @@
|
|||
fvScalarMatrix TEqn
|
||||
(
|
||||
fvm::div(phi, T)
|
||||
- fvm::Sp(fvc::div(phi), T)
|
||||
+ fvm::SuSp(-fvc::div(phi), T)
|
||||
- fvm::laplacian(kappaEff, T)
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
|
||||
TEqn.solve();
|
||||
|
||||
rhok = 1.0 - beta*(T - TRef);
|
||||
|
|
|
@ -6,17 +6,10 @@
|
|||
+ turbulence->divDevReff()
|
||||
);
|
||||
|
||||
UEqn().relax();
|
||||
|
||||
solve
|
||||
(
|
||||
UEqn()
|
||||
relax(UEqn())
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
fvc::interpolate(rhok)*(g & mesh.Sf())
|
||||
- fvc::snGrad(p)*mesh.magSf()
|
||||
)
|
||||
)
|
||||
-fvc::grad(p)
|
||||
+ fvc::reconstruct(fvc::interpolate(rhok)*(g & mesh.Sf()))
|
||||
);
|
||||
|
|
|
@ -54,15 +54,15 @@ Description
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
# include "readGravitationalAcceleration.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -74,9 +74,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Pressure-velocity SIMPLE corrector
|
||||
{
|
||||
#include "UEqn.H"
|
||||
#include "TEqn.H"
|
||||
#include "pEqn.H"
|
||||
# include "TEqn.H"
|
||||
# include "UEqn.H"
|
||||
# include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
|
|
@ -1,22 +1,31 @@
|
|||
{
|
||||
volScalarField rUA("rUA", 1.0/UEqn().A());
|
||||
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
|
||||
p.boundaryField().updateCoeffs();
|
||||
|
||||
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();
|
||||
|
||||
phi = fvc::interpolate(U) & mesh.Sf();
|
||||
simple.calcSteadyConsistentFlux(phi, U);
|
||||
adjustPhi(phi, U, p);
|
||||
|
||||
surfaceScalarField buoyancyPhi =
|
||||
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
|
||||
rAUf*fvc::interpolate(rhok)*(g & mesh.Sf());
|
||||
phi += buoyancyPhi;
|
||||
|
||||
while (simple.correctNonOrthogonal())
|
||||
{
|
||||
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);
|
||||
|
@ -27,16 +36,19 @@
|
|||
{
|
||||
// Calculate the conservative fluxes
|
||||
phi -= pEqn.flux();
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
// U += rAU*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rAUf);
|
||||
// U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
# include "continuityErrs.H"
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U += rAU*(fvc::reconstruct(buoyancyPhi/rAUf) - fvc::grad(p));
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
|
Reference in a new issue