MRFZone: rationalize to allow support for general frame acceleration

This commit is contained in:
Henry
2015-05-29 15:31:53 +01:00
parent 38177526ff
commit 38171e0c7a
17 changed files with 82 additions and 75 deletions

View File

@ -3,13 +3,12 @@
tmp<fvVectorMatrix> UEqn tmp<fvVectorMatrix> UEqn
( (
fvm::div(phi, U) fvm::div(phi, U)
+ MRF.DDt(U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
== ==
fvOptions(U) fvOptions(U)
); );
mrfZones.addCoriolis(UEqn());
UEqn().relax(); UEqn().relax();
// Include the porous media resistance and solve the momentum equation // Include the porous media resistance and solve the momentum equation

View File

@ -1,5 +1,5 @@
IOMRFZoneList mrfZones(mesh); IOMRFZoneList MRF(mesh);
mrfZones.correctBoundaryVelocity(U); MRF.correctBoundaryVelocity(U);
IOporosityModelList pZones(mesh); IOporosityModelList pZones(mesh);
Switch pressureImplicitPorosity(false); Switch pressureImplicitPorosity(false);

View File

@ -11,7 +11,7 @@ else
UEqn.clear(); UEqn.clear();
surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf());
mrfZones.makeRelative(phiHbyA); MRF.makeRelative(phiHbyA);
adjustPhi(phiHbyA, U, p); adjustPhi(phiHbyA, U, p);

View File

@ -7,5 +7,5 @@ forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
+ fvc::div(phase.phi(), phase.U()) + fvc::div(phase.phi(), phase.U())
- fvc::div(phase.phi())*phase.U(); - fvc::div(phase.phi())*phase.U();
mrfZones.addCoriolis(phase.U(), phase.DDtU()); MRF.addAcceleration(phase.U(), phase.DDtU());
} }

View File

@ -0,0 +1,6 @@
forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
{
MRF.correctBoundaryVelocity(iter().U());
}
MRF.correctBoundaryVelocity(U);

View File

@ -1,4 +1,4 @@
#include "mrfZonesCorrectBCs.H" #include "MRFCorrectBCs.H"
PtrList<fvVectorMatrix> UEqns(fluid.phases().size()); PtrList<fvVectorMatrix> UEqns(fluid.phases().size());
autoPtr<multiphaseSystem::dragCoeffFields> dragCoeffs(fluid.dragCoeffs()); autoPtr<multiphaseSystem::dragCoeffFields> dragCoeffs(fluid.dragCoeffs());
@ -51,7 +51,7 @@ forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
) )
) )
); );
mrfZones.addCoriolis MRF.addAcceleration
( (
alpha*(1 + (1/phase.rho())*fluid.Cvm(phase)), alpha*(1 + (1/phase.rho())*fluid.Cvm(phase)),
UEqns[phasei] UEqns[phasei]

View File

@ -1,8 +1,8 @@
IOMRFZoneList mrfZones(mesh); IOMRFZoneList MRF(mesh);
forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
{ {
mrfZones.correctBoundaryVelocity(iter().U()); MRF.correctBoundaryVelocity(iter().U());
} }
mrfZones.correctBoundaryVelocity(U); MRF.correctBoundaryVelocity(U);

View File

@ -1,6 +0,0 @@
forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
{
mrfZones.correctBoundaryVelocity(iter().U());
}
mrfZones.correctBoundaryVelocity(U);

View File

@ -35,8 +35,8 @@
{ {
phaseModel& phase = iter(); phaseModel& phase = iter();
mrfZones.makeAbsolute(phase.phi().oldTime()); MRF.makeAbsolute(phase.phi().oldTime());
mrfZones.makeAbsolute(phase.phi()); MRF.makeAbsolute(phase.phi());
HbyAs.set(phasei, new volVectorField(phase.U())); HbyAs.set(phasei, new volVectorField(phase.U()));
phiHbyAs.set(phasei, new surfaceScalarField(1.0*phase.phi())); phiHbyAs.set(phasei, new surfaceScalarField(1.0*phase.phi()));
@ -100,9 +100,9 @@
(fvc::interpolate(HbyAs[phasei]) & mesh.Sf()) (fvc::interpolate(HbyAs[phasei]) & mesh.Sf())
+ rAlphaAUfs[phasei]*fvc::ddtCorr(phase.U(), phase.phi()) + rAlphaAUfs[phasei]*fvc::ddtCorr(phase.U(), phase.phi())
); );
mrfZones.makeRelative(phiHbyAs[phasei]); MRF.makeRelative(phiHbyAs[phasei]);
mrfZones.makeRelative(phase.phi().oldTime()); MRF.makeRelative(phase.phi().oldTime());
mrfZones.makeRelative(phase.phi()); MRF.makeRelative(phase.phi());
phiHbyAs[phasei] += phiHbyAs[phasei] +=
rAlphaAUfs[phasei] rAlphaAUfs[phasei]
@ -205,7 +205,7 @@
( (
p_rgh.boundaryField(), p_rgh.boundaryField(),
( (
phiHbyA.boundaryField() - mrfZones.relative(phib) phiHbyA.boundaryField() - MRF.relative(phib)
)/(mesh.magSf().boundaryField()*rAUf.boundaryField()) )/(mesh.magSf().boundaryField()*rAUf.boundaryField())
); );
} }

View File

@ -1,4 +1,4 @@
IOMRFZoneList mrfZones(mesh); IOMRFZoneList MRF(mesh);
mrfZones.correctBoundaryVelocity(U1); MRF.correctBoundaryVelocity(U1);
mrfZones.correctBoundaryVelocity(U2); MRF.correctBoundaryVelocity(U2);
mrfZones.correctBoundaryVelocity(U); MRF.correctBoundaryVelocity(U);

View File

@ -3,11 +3,11 @@
fvc::ddt(U1) fvc::ddt(U1)
+ fvc::div(phi1, U1) + fvc::div(phi1, U1)
- fvc::div(phi1)*U1; - fvc::div(phi1)*U1;
mrfZones.addCoriolis(U1, DDtU1); MRF.addAcceleration(U1, DDtU1);
DDtU2 = DDtU2 =
fvc::ddt(U2) fvc::ddt(U2)
+ fvc::div(phi2, U2) + fvc::div(phi2, U2)
- fvc::div(phi2)*U2; - fvc::div(phi2)*U2;
mrfZones.addCoriolis(U2, DDtU2); MRF.addAcceleration(U2, DDtU2);
} }

View File

@ -1,6 +1,6 @@
mrfZones.correctBoundaryVelocity(U1); MRF.correctBoundaryVelocity(U1);
mrfZones.correctBoundaryVelocity(U2); MRF.correctBoundaryVelocity(U2);
mrfZones.correctBoundaryVelocity(U); MRF.correctBoundaryVelocity(U);
fvVectorMatrix U1Eqn(U1, rho1.dimensions()*U1.dimensions()*dimVol/dimTime); fvVectorMatrix U1Eqn(U1, rho1.dimensions()*U1.dimensions()*dimVol/dimTime);
fvVectorMatrix U2Eqn(U2, rho2.dimensions()*U2.dimensions()*dimVol/dimTime); fvVectorMatrix U2Eqn(U2, rho2.dimensions()*U2.dimensions()*dimVol/dimTime);
@ -15,7 +15,7 @@ volScalarField Kd(fluid.Kd());
( (
fvm::ddt(alpha1, rho1, U1) + fvm::div(alphaRhoPhi1, U1) fvm::ddt(alpha1, rho1, U1) + fvm::div(alphaRhoPhi1, U1)
- fvm::Sp(contErr1, U1) - fvm::Sp(contErr1, U1)
+ mrfZones(alpha1*rho1 + Vm, U1) + MRF.DDt(alpha1*rho1 + Vm, U1)
+ phase1.turbulence().divDevRhoReff(U1) + phase1.turbulence().divDevRhoReff(U1)
== ==
- Vm - Vm
@ -39,7 +39,7 @@ volScalarField Kd(fluid.Kd());
( (
fvm::ddt(alpha2, rho2, U2) + fvm::div(alphaRhoPhi2, U2) fvm::ddt(alpha2, rho2, U2) + fvm::div(alphaRhoPhi2, U2)
- fvm::Sp(contErr2, U2) - fvm::Sp(contErr2, U2)
+ mrfZones(alpha2*rho2 + Vm, U2) + MRF.DDt(alpha2*rho2 + Vm, U2)
+ phase2.turbulence().divDevRhoReff(U2) + phase2.turbulence().divDevRhoReff(U2)
== ==
- Vm - Vm

View File

@ -92,8 +92,8 @@ while (pimple.correct())
#include "correctContErrs.H" #include "correctContErrs.H"
// Correct fixed-flux BCs to be consistent with the velocity BCs // Correct fixed-flux BCs to be consistent with the velocity BCs
mrfZones.correctBoundaryFlux(U1, phi1); MRF.correctBoundaryFlux(U1, phi1);
mrfZones.correctBoundaryFlux(U2, phi2); MRF.correctBoundaryFlux(U2, phi2);
volVectorField HbyA1 volVectorField HbyA1
( (
@ -175,7 +175,7 @@ while (pimple.correct())
(fvc::interpolate(HbyA1) & mesh.Sf()) (fvc::interpolate(HbyA1) & mesh.Sf())
+ phiCorrCoeff1*fvc::interpolate(alpha1.oldTime()*rho1.oldTime()*rAU1) + phiCorrCoeff1*fvc::interpolate(alpha1.oldTime()*rho1.oldTime()*rAU1)
*( *(
mrfZones.absolute(phi1.oldTime()) MRF.absolute(phi1.oldTime())
- (fvc::interpolate(U1.oldTime()) & mesh.Sf()) - (fvc::interpolate(U1.oldTime()) & mesh.Sf())
)/runTime.deltaT() )/runTime.deltaT()
- phiF1() - phiF1()
@ -189,7 +189,7 @@ while (pimple.correct())
(fvc::interpolate(HbyA2) & mesh.Sf()) (fvc::interpolate(HbyA2) & mesh.Sf())
+ phiCorrCoeff2*fvc::interpolate(alpha2.oldTime()*rho2.oldTime()*rAU2) + phiCorrCoeff2*fvc::interpolate(alpha2.oldTime()*rho2.oldTime()*rAU2)
*( *(
mrfZones.absolute(phi2.oldTime()) MRF.absolute(phi2.oldTime())
- (fvc::interpolate(U2.oldTime()) & mesh.Sf()) - (fvc::interpolate(U2.oldTime()) & mesh.Sf())
)/runTime.deltaT() )/runTime.deltaT()
- phiF2() - phiF2()
@ -205,10 +205,10 @@ while (pimple.correct())
surfaceScalarField phiHbyA surfaceScalarField phiHbyA
( (
"phiHbyA", "phiHbyA",
alphaf1*(phiHbyA1 + rAUKd1*mrfZones.absolute(phi2)) alphaf1*(phiHbyA1 + rAUKd1*MRF.absolute(phi2))
+ alphaf2*(phiHbyA2 + rAUKd2*mrfZones.absolute(phi1)) + alphaf2*(phiHbyA2 + rAUKd2*MRF.absolute(phi1))
); );
mrfZones.makeRelative(phiHbyA); MRF.makeRelative(phiHbyA);
// Construct pressure "diffusivity" // Construct pressure "diffusivity"
surfaceScalarField rAUf surfaceScalarField rAUf

View File

@ -1,6 +1,6 @@
mrfZones.correctBoundaryVelocity(U1); MRF.correctBoundaryVelocity(U1);
mrfZones.correctBoundaryVelocity(U2); MRF.correctBoundaryVelocity(U2);
mrfZones.correctBoundaryVelocity(U); MRF.correctBoundaryVelocity(U);
fvVectorMatrix U1Eqn(U1, rho1.dimensions()*U1.dimensions()*dimVol/dimTime); fvVectorMatrix U1Eqn(U1, rho1.dimensions()*U1.dimensions()*dimVol/dimTime);
fvVectorMatrix U2Eqn(U2, rho2.dimensions()*U2.dimensions()*dimVol/dimTime); fvVectorMatrix U2Eqn(U2, rho2.dimensions()*U2.dimensions()*dimVol/dimTime);
@ -11,20 +11,20 @@ fvVectorMatrix U2Eqn(U2, rho2.dimensions()*U2.dimensions()*dimVol/dimTime);
fvVectorMatrix UgradU1 fvVectorMatrix UgradU1
( (
fvm::div(phi1, U1) - fvm::Sp(fvc::div(phi1), U1) fvm::div(phi1, U1) - fvm::Sp(fvc::div(phi1), U1)
+ mrfZones(U1) + MRF.DDt(U1)
); );
fvVectorMatrix UgradU2 fvVectorMatrix UgradU2
( (
fvm::div(phi2, U2) - fvm::Sp(fvc::div(phi2), U2) fvm::div(phi2, U2) - fvm::Sp(fvc::div(phi2), U2)
+ mrfZones(U2) + MRF.DDt(U2)
); );
{ {
U1Eqn = U1Eqn =
( (
fvm::div(alphaRhoPhi1, U1) - fvm::Sp(fvc::div(alphaRhoPhi1), U1) fvm::div(alphaRhoPhi1, U1) - fvm::Sp(fvc::div(alphaRhoPhi1), U1)
+ mrfZones(alpha1*rho1, U1) + MRF.DDt(alpha1*rho1, U1)
+ phase1.turbulence().divDevRhoReff(U1) + phase1.turbulence().divDevRhoReff(U1)
+ Vm*(UgradU1 - (UgradU2 & U2)) + Vm*(UgradU1 - (UgradU2 & U2))
); );
@ -38,7 +38,7 @@ fvVectorMatrix U2Eqn(U2, rho2.dimensions()*U2.dimensions()*dimVol/dimTime);
U2Eqn = U2Eqn =
( (
fvm::div(alphaRhoPhi2, U2) - fvm::Sp(fvc::div(alphaRhoPhi2), U2) fvm::div(alphaRhoPhi2, U2) - fvm::Sp(fvc::div(alphaRhoPhi2), U2)
+ mrfZones(alpha2*rho2, U2) + MRF.DDt(alpha2*rho2, U2)
+ phase2.turbulence().divDevRhoReff(U2) + phase2.turbulence().divDevRhoReff(U2)
+ Vm*(UgradU2 - (UgradU1 & U1)) + Vm*(UgradU2 - (UgradU1 & U1))
); );

View File

@ -99,8 +99,8 @@ while (pimple.correct())
surfaceScalarField rhof2(fvc::interpolate(rho2)); surfaceScalarField rhof2(fvc::interpolate(rho2));
// Correct fixed-flux BCs to be consistent with the velocity BCs // Correct fixed-flux BCs to be consistent with the velocity BCs
mrfZones.correctBoundaryFlux(U1, phi1); MRF.correctBoundaryFlux(U1, phi1);
mrfZones.correctBoundaryFlux(U2, phi2); MRF.correctBoundaryFlux(U2, phi2);
surfaceScalarField alpharAUf1 surfaceScalarField alpharAUf1
( (
@ -155,10 +155,10 @@ while (pimple.correct())
rAUf1 rAUf1
*( *(
(alphaRhof10 + Vmf) (alphaRhof10 + Vmf)
*mrfZones.absolute(phi1.oldTime())/runTime.deltaT() *MRF.absolute(phi1.oldTime())/runTime.deltaT()
+ (fvc::interpolate(U1Eqn.H()) & mesh.Sf()) + (fvc::interpolate(U1Eqn.H()) & mesh.Sf())
+ Vmf*ddtPhi2 + Vmf*ddtPhi2
+ Kdf*mrfZones.absolute(phi2) + Kdf*MRF.absolute(phi2)
- Ff1() - Ff1()
); );
@ -173,10 +173,10 @@ while (pimple.correct())
rAUf2 rAUf2
*( *(
(alphaRhof20 + Vmf) (alphaRhof20 + Vmf)
*mrfZones.absolute(phi2.oldTime())/runTime.deltaT() *MRF.absolute(phi2.oldTime())/runTime.deltaT()
+ (fvc::interpolate(U2Eqn.H()) & mesh.Sf()) + (fvc::interpolate(U2Eqn.H()) & mesh.Sf())
+ Vmf*ddtPhi1 + Vmf*ddtPhi1
+ Kdf*mrfZones.absolute(phi1) + Kdf*MRF.absolute(phi1)
- Ff2() - Ff2()
); );
@ -186,7 +186,7 @@ while (pimple.correct())
"phiHbyA", "phiHbyA",
alphaf1*(phiHbyA1 - phig1) + alphaf2*(phiHbyA2 - phig2) alphaf1*(phiHbyA1 - phig1) + alphaf2*(phiHbyA2 - phig2)
); );
mrfZones.makeRelative(phiHbyA); MRF.makeRelative(phiHbyA);
phiHbyA1 -= phig1; phiHbyA1 -= phig1;
phiHbyA2 -= phig2; phiHbyA2 -= phig2;
@ -296,14 +296,14 @@ while (pimple.correct())
( (
phiHbyA1 phiHbyA1
+ alpharAUf1*mSfGradp + alpharAUf1*mSfGradp
- rAUf1*Kdf*mrfZones.absolute(phi2) - rAUf1*Kdf*MRF.absolute(phi2)
); );
surfaceScalarField phi2s surfaceScalarField phi2s
( (
phiHbyA2 phiHbyA2
+ alpharAUf2*mSfGradp + alpharAUf2*mSfGradp
- rAUf2*Kdf*mrfZones.absolute(phi1) - rAUf2*Kdf*MRF.absolute(phi1)
); );
surfaceScalarField phir surfaceScalarField phir
@ -315,11 +315,11 @@ while (pimple.correct())
phi1 = phi - alphaf2*phir; phi1 = phi - alphaf2*phir;
phi2 = phi + alphaf1*phir; phi2 = phi + alphaf1*phir;
U1 = fvc::reconstruct(mrfZones.absolute(phi1)); U1 = fvc::reconstruct(MRF.absolute(phi1));
U1.correctBoundaryConditions(); U1.correctBoundaryConditions();
fvOptions.correct(U1); fvOptions.correct(U1);
U2 = fvc::reconstruct(mrfZones.absolute(phi2)); U2 = fvc::reconstruct(MRF.absolute(phi2));
U2.correctBoundaryConditions(); U2.correctBoundaryConditions();
fvOptions.correct(U2); fvOptions.correct(U2);

View File

@ -126,7 +126,7 @@ bool Foam::MRFZoneList::writeData(Ostream& os) const
} }
void Foam::MRFZoneList::addCoriolis void Foam::MRFZoneList::addAcceleration
( (
const volVectorField& U, const volVectorField& U,
volVectorField& ddtU volVectorField& ddtU
@ -139,7 +139,7 @@ void Foam::MRFZoneList::addCoriolis
} }
void Foam::MRFZoneList::addCoriolis(fvVectorMatrix& UEqn) const void Foam::MRFZoneList::addAcceleration(fvVectorMatrix& UEqn) const
{ {
forAll(*this, i) forAll(*this, i)
{ {
@ -148,7 +148,7 @@ void Foam::MRFZoneList::addCoriolis(fvVectorMatrix& UEqn) const
} }
void Foam::MRFZoneList::addCoriolis void Foam::MRFZoneList::addAcceleration
( (
const volScalarField& rho, const volScalarField& rho,
fvVectorMatrix& UEqn fvVectorMatrix& UEqn
@ -161,7 +161,7 @@ void Foam::MRFZoneList::addCoriolis
} }
Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::operator() Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::DDt
( (
const volVectorField& U const volVectorField& U
) )
@ -191,13 +191,13 @@ Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::operator()
} }
Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::operator() Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::DDt
( (
const volScalarField& rho, const volScalarField& rho,
const volVectorField& U const volVectorField& U
) )
{ {
return rho*operator()(U); return rho*DDt(U);
} }

View File

@ -93,23 +93,31 @@ public:
//- Reset the source list //- Reset the source list
void reset(const dictionary& dict); void reset(const dictionary& dict);
//- Add the Coriolis force contribution to the acceleration field //- Add the frame acceleration
void addCoriolis(const volVectorField& U, volVectorField& ddtU) const; void addAcceleration
(
const volVectorField& U,
volVectorField& ddtU
) const;
//- Add the Coriolis force contribution to the momentum equation //- Add the frame acceleration contribution to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const; void addAcceleration(fvVectorMatrix& UEqn) const;
//- Add the Coriolis force contribution to the momentum equation //- Add the frame acceleration contribution to the momentum equation
void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const; void addAcceleration
(
const volScalarField& rho,
fvVectorMatrix& UEqn
) const;
//- Return the frame acceleration //- Return the frame acceleration
tmp<volVectorField> operator() tmp<volVectorField> DDt
( (
const volVectorField& U const volVectorField& U
); );
//- Return the frame acceleration force //- Return the frame acceleration
tmp<volVectorField> operator() tmp<volVectorField> DDt
( (
const volScalarField& rho, const volScalarField& rho,
const volVectorField& U const volVectorField& U