ENH: Updated solvers using fieldSources

This commit is contained in:
andy
2011-11-03 16:58:53 +00:00
parent 0f865796e6
commit 4b527e3e27
21 changed files with 56 additions and 32 deletions

View File

@ -5,12 +5,13 @@ 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)
); );
sources.apply(UEqn());
UEqn().relax(); UEqn().relax();
sources.constrain(UEqn());
volScalarField rAU(1.0/UEqn().A()); volScalarField rAU(1.0/UEqn().A());
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())

View File

@ -4,11 +4,12 @@
( (
fvm::div(phi, U) fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
+ sources(U)
); );
mrfZones.addCoriolis(UEqn()); mrfZones.addCoriolis(UEqn());
sources.apply(UEqn()); sources.constrain(UEqn());
UEqn().relax(); UEqn().relax();

View File

@ -5,10 +5,11 @@
fvm::div(phi, Urel) fvm::div(phi, Urel)
+ turbulence->divDevReff(Urel) + turbulence->divDevReff(Urel)
+ SRF->Su() + SRF->Su()
+ sources(Urel)
); );
sources.apply(UrelEqn());
UrelEqn().relax(); UrelEqn().relax();
sources.constrain(UrelEqn());
solve(UrelEqn() == -fvc::grad(p)); solve(UrelEqn() == -fvc::grad(p));

View File

@ -4,10 +4,11 @@
( (
fvm::div(phi, U) fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
+ sources(U)
); );
sources.apply(UEqn());
UEqn().relax(); UEqn().relax();
sources.constrain(UEqn());
solve(UEqn() == -fvc::grad(p)); solve(UEqn() == -fvc::grad(p));

View File

@ -4,12 +4,13 @@
( (
fvm::div(phi, U) fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
+ sources(U)
); );
sources.apply(UEqn());
UEqn().relax(); UEqn().relax();
sources.constrain(UEqn());
// Include the porous media resistance and solve the momentum equation // Include the porous media resistance and solve the momentum equation
// either implicit in the tensorial resistance or transport using by // either implicit in the tensorial resistance or transport using by
// including the spherical part of the resistance in the momentum diagonal // including the spherical part of the resistance in the momentum diagonal

View File

@ -4,12 +4,13 @@
fvm::ddt(rho, U) fvm::ddt(rho, U)
+ fvm::div(phi, U) + fvm::div(phi, U)
+ turbulence->divDevRhoReff(U) + turbulence->divDevRhoReff(U)
+ sources(rho, U)
== ==
rho.dimensionedInternalField()*g rho.dimensionedInternalField()*g
+ parcels.SU(U) + parcels.SU(U)
); );
sources.apply(UEqn); sources.constrain(UEqn);
pZones.addResistance(UEqn); pZones.addResistance(UEqn);

View File

@ -28,12 +28,13 @@ if (solveSpecies)
fvm::ddt(rho, Yi) fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi) + mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(turbulence->muEff(), Yi) - fvm::laplacian(turbulence->muEff(), Yi)
+ sources(Yi)
== ==
parcels.SYi(i, Yi) parcels.SYi(i, Yi)
+ combustion->R(Yi) + combustion->R(Yi)
); );
sources.apply(YEqn); sources.constrain(YEqn);
YEqn.solve(mesh.solver("Yi")); YEqn.solve(mesh.solver("Yi"));

View File

@ -4,6 +4,7 @@
fvm::ddt(rho, hs) fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs) + mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs) - fvm::laplacian(turbulence->alphaEff(), hs)
+ sources(rho, hs)
== ==
DpDt DpDt
+ parcels.Sh(hs) + parcels.Sh(hs)
@ -11,7 +12,7 @@
+ combustion->Sh() + combustion->Sh()
); );
sources.apply(hsEqn); sources.constrain(hsEqn);
hsEqn.solve(); hsEqn.solve();

View File

@ -27,12 +27,11 @@
( (
fvc::ddt(rho) + psi*correction(fvm::ddt(p)) fvc::ddt(rho) + psi*correction(fvm::ddt(p))
+ fvc::div(phi) + fvc::div(phi)
+ sources(psi, p, rho.name())
== ==
parcels.Srho() parcels.Srho()
); );
sources.apply(pDDtEqn, rho.name());
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
@ -41,6 +40,8 @@
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
); );
sources.constrain(pDDtEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -34,11 +34,12 @@ Description
( (
fvm::ddt(rho) fvm::ddt(rho)
+ fvc::div(phi) + fvc::div(phi)
+ sources(rho)
== ==
parcels.Srho(rho) parcels.Srho(rho)
); );
sources.apply(rhoEqn); sources.constrain(rhoEqn);
rhoEqn.solve(); rhoEqn.solve();

View File

@ -76,7 +76,7 @@ Info<< "Time scales min/max:" << endl;
( (
DpDt DpDt
+ parcels.hsTrans()/(mesh.V()*runTime.deltaT()) + parcels.hsTrans()/(mesh.V()*runTime.deltaT())
// + energySource.Su() // + sources(rho, hs)
+ combustion->Sh()() + combustion->Sh()()
) )
/rho /rho

View File

@ -3,16 +3,17 @@
fvm::ddt(rho, U) fvm::ddt(rho, U)
+ fvm::div(phi, U) + fvm::div(phi, U)
+ turbulence->divDevRhoReff(U) + turbulence->divDevRhoReff(U)
+ sources(rho, U)
== ==
rho.dimensionedInternalField()*g rho.dimensionedInternalField()*g
+ coalParcels.SU(U) + coalParcels.SU(U)
+ limestoneParcels.SU(U) + limestoneParcels.SU(U)
); );
sources.apply(UEqn);
UEqn.relax(); UEqn.relax();
sources.constrain(UEqn);
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p));

View File

@ -27,14 +27,16 @@ tmp<fv::convectionScheme<scalar> > mvConvection
fvm::ddt(rho, Yi) fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi) + mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(turbulence->muEff(), Yi) - fvm::laplacian(turbulence->muEff(), Yi)
+ sources(rho, Yi)
== ==
coalParcels.SYi(i, Yi) coalParcels.SYi(i, Yi)
+ combustion->R(Yi) + combustion->R(Yi)
); );
sources.apply(YiEqn);
YiEqn.relax(); YiEqn.relax();
sources.constrain(YiEqn);
YiEqn.solve(mesh.solver("Yi")); YiEqn.solve(mesh.solver("Yi"));
Yi.max(0.0); Yi.max(0.0);

View File

@ -4,6 +4,7 @@
fvm::ddt(rho, hs) fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs) + mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs) - fvm::laplacian(turbulence->alphaEff(), hs)
+ sources(rho, hs)
== ==
DpDt DpDt
+ combustion->Sh() + combustion->Sh()
@ -12,9 +13,10 @@
+ radiation->Shs(thermo) + radiation->Shs(thermo)
); );
sources.apply(hsEqn);
hsEqn.relax(); hsEqn.relax();
sources.constrain(hsEqn);
hsEqn.solve(); hsEqn.solve();
thermo.correct(); thermo.correct();

View File

@ -22,11 +22,12 @@ if (pimple.transonic())
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
+ sources(psi, p, rho.name())
== ==
coalParcels.Srho() coalParcels.Srho()
); );
sources.apply(pEqn, rho.name()); sources.constrain(pEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
@ -39,8 +40,8 @@ if (pimple.transonic())
else else
{ {
phi = phi =
fvc::interpolate(rho)* fvc::interpolate(rho)
( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
); );
@ -52,11 +53,12 @@ else
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
+ sources(psi, p, rho.name())
== ==
coalParcels.Srho() coalParcels.Srho()
); );
sources.apply(pEqn, rho.name()); sources.constrain(pEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));

View File

@ -34,11 +34,12 @@ Description
( (
fvm::ddt(rho) fvm::ddt(rho)
+ fvc::div(phi) + fvc::div(phi)
+ sources(rho)
== ==
coalParcels.Srho(rho) coalParcels.Srho(rho)
); );
sources.apply(rhoEqn); sources.constrain(rhoEqn);
rhoEqn.solve(); rhoEqn.solve();
} }

View File

@ -4,12 +4,13 @@
fvm::ddt(rho, U) fvm::ddt(rho, U)
+ fvm::div(phi, U) + fvm::div(phi, U)
+ turbulence->divDevRhoReff(U) + turbulence->divDevRhoReff(U)
+ sources(rho, U)
== ==
rho.dimensionedInternalField()*g rho.dimensionedInternalField()*g
+ parcels.SU(U) + parcels.SU(U)
); );
sources.apply(UEqn); sources.constrain(UEqn);
pZones.addResistance(UEqn); pZones.addResistance(UEqn);

View File

@ -29,12 +29,13 @@ if (solveSpecies)
fvm::ddt(rho, Yi) fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi) + mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(turbulence->muEff(), Yi) - fvm::laplacian(turbulence->muEff(), Yi)
+ sources(rho, Yi)
== ==
parcels.SYi(i, Yi) parcels.SYi(i, Yi)
+ combustion->R(Yi) + combustion->R(Yi)
); );
sources.apply(YiEqn); sources.constrain(YiEqn);
YiEqn.solve(mesh.solver("Yi")); YiEqn.solve(mesh.solver("Yi"));

View File

@ -34,6 +34,7 @@
fvm::ddt(rho, hs) fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs) + mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs) - fvm::laplacian(turbulence->alphaEff(), hs)
+ sources(rho, hs)
== ==
pWork() pWork()
+ parcels.Sh(hs) + parcels.Sh(hs)
@ -41,7 +42,7 @@
+ combustion->Sh() + combustion->Sh()
); );
sources.apply(hsEqn); sources.constrain(hsEqn);
hsEqn.solve(); hsEqn.solve();

View File

@ -27,11 +27,11 @@
( (
fvc::ddt(rho) + psi*correction(fvm::ddt(p)) fvc::ddt(rho) + psi*correction(fvm::ddt(p))
+ fvc::div(phi) + fvc::div(phi)
+ sources(psi, p, rho.name())
== ==
parcels.Srho() parcels.Srho()
); );
sources.apply(pDDtEqn, rho.name());
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
@ -41,6 +41,8 @@
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
); );
sources.constrain(pDDtEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -34,11 +34,12 @@ Description
( (
fvm::ddt(rho) fvm::ddt(rho)
+ fvc::div(phi) + fvc::div(phi)
+ sources(rho)
== ==
parcels.Srho(rho) parcels.Srho(rho)
); );
sources.apply(rhoEqn); sources.constrain(rhoEqn);
rhoEqn.solve(); rhoEqn.solve();
} }