ENH: Updated use of field sources in simple/pimple solvers

This commit is contained in:
andy
2012-01-26 16:23:34 +00:00
parent f2e65c6adc
commit 9c8e2fa709
17 changed files with 30 additions and 21 deletions

View File

@ -9,4 +9,6 @@
UrelEqn().relax(); UrelEqn().relax();
solve(UrelEqn() == -fvc::grad(p)); sources.constrain(UrelEqn());
solve(UrelEqn() == -fvc::grad(p) + sources(Urel));

View File

@ -1,5 +1,5 @@
volScalarField rAUrel(1.0/UrelEqn().A()); volScalarField rAUrel(1.0/UrelEqn().A());
Urel = rAUrel*UrelEqn().H(); Urel = rAUrel*(UrelEqn() == sources(Urel))().H();
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPISO() <= 1)
{ {
@ -37,3 +37,4 @@ p.relax();
// Momentum corrector // Momentum corrector
Urel -= rAUrel*fvc::grad(p); Urel -= rAUrel*fvc::grad(p);
Urel.correctBoundaryConditions(); Urel.correctBoundaryConditions();
sources.correct(Urel);

View File

@ -5,8 +5,6 @@ tmp<fvVectorMatrix> UEqn
fvm::ddt(U) fvm::ddt(U)
+ fvm::div(phi, U) + fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
==
sources(U)
); );
UEqn().relax(); UEqn().relax();
@ -17,5 +15,5 @@ volScalarField rAU(1.0/UEqn().A());
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn() == -fvc::grad(p)); solve(UEqn() == -fvc::grad(p) + sources(U));
} }

View File

@ -1,4 +1,4 @@
U = rAU*UEqn().H(); U = rAU*(UEqn() == sources(U))().H();
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPISO() <= 1)
{ {
@ -36,3 +36,4 @@ p.relax();
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);

View File

@ -9,9 +9,11 @@ tmp<fvVectorMatrix> UEqn
UEqn().relax(); UEqn().relax();
sources.constrain(UEqn());
rAU = 1.0/UEqn().A(); rAU = 1.0/UEqn().A();
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn() == -fvc::grad(p)); solve(UEqn() == -fvc::grad(p) + sources(U));
} }

View File

@ -1,4 +1,4 @@
U = rAU*UEqn().H(); U = rAU*(UEqn() == sources(U))().H();
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPISO() <= 1)
{ {
@ -46,3 +46,4 @@ fvc::makeRelative(phi, U);
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);

View File

@ -3,8 +3,6 @@ tmp<fvVectorMatrix> UEqn
fvm::ddt(U) fvm::ddt(U)
+ fvm::div(phi, U) + fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
==
sources(U)
); );
@ -14,5 +12,5 @@ sources.constrain(UEqn());
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn() == -fvc::grad(p_gh)); solve(UEqn() == -fvc::grad(p_gh) + sources(U));
} }

View File

@ -1,7 +1,7 @@
volScalarField rAU(1.0/UEqn().A()); volScalarField rAU(1.0/UEqn().A());
surfaceScalarField rAUf(rAU.name() + 'f', fvc::interpolate(rAU)); surfaceScalarField rAUf(rAU.name() + 'f', fvc::interpolate(rAU));
U = rAU*UEqn().H(); U = rAU*(UEqn() == sources(U))().H();
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPISO() <= 1)
{ {
@ -41,3 +41,4 @@ p = p_gh + (g & (mesh.C() + zeta - refLevel));
U -= rAU*fvc::grad(p_gh); U -= rAU*fvc::grad(p_gh);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);

View File

@ -34,4 +34,5 @@
// Momentum corrector // Momentum corrector
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);
} }

View File

@ -34,4 +34,5 @@
// Momentum corrector // Momentum corrector
Urel -= rAUrel*fvc::grad(p); Urel -= rAUrel*fvc::grad(p);
Urel.correctBoundaryConditions(); Urel.correctBoundaryConditions();
sources.correct(Urel);
} }

View File

@ -34,4 +34,5 @@
// Momentum corrector // Momentum corrector
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);
} }

View File

@ -7,7 +7,6 @@
== ==
rho.dimensionedInternalField()*g rho.dimensionedInternalField()*g
+ parcels.SU(U) + parcels.SU(U)
+ sources(rho, U)
); );
sources.constrain(UEqn); sources.constrain(UEqn);
@ -16,5 +15,5 @@
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p) + sources(rho, U));
} }

View File

@ -6,7 +6,7 @@
thermo.rho() -= psi*p; thermo.rho() -= psi*p;
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H(); U = rAU*(UEqn == sources(rho, U))().H();
if (pZones.size() > 0) if (pZones.size() > 0)
{ {
@ -60,6 +60,7 @@
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);
rho = thermo.rho(); rho = thermo.rho();
rho = max(rho, rhoMin); rho = max(rho, rhoMin);

View File

@ -7,7 +7,6 @@
rho.dimensionedInternalField()*g rho.dimensionedInternalField()*g
+ coalParcels.SU(U) + coalParcels.SU(U)
+ limestoneParcels.SU(U) + limestoneParcels.SU(U)
+ sources(rho, U)
); );
UEqn.relax(); UEqn.relax();
@ -16,6 +15,6 @@
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p) + sources(rho, U));
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
} }

View File

@ -1,7 +1,7 @@
rho = thermo.rho(); rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H(); U = rAU*(UEqn == sources(rho, U))().H();
if (pimple.transonic()) if (pimple.transonic())
{ {
@ -74,6 +74,8 @@ else
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);

View File

@ -7,7 +7,6 @@
== ==
rho.dimensionedInternalField()*g rho.dimensionedInternalField()*g
+ parcels.SU(U) + parcels.SU(U)
+ sources(rho, U)
); );
UEqn.relax(); UEqn.relax();
@ -18,7 +17,7 @@
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p) + sources(rho, U));
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
} }

View File

@ -6,7 +6,7 @@
thermo.rho() -= psi*p; thermo.rho() -= psi*p;
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H(); U = rAU*(UEqn == sources(rho, U))().H();
if (pZones.size() > 0) if (pZones.size() > 0)
{ {
@ -59,6 +59,8 @@
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);