diff --git a/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C b/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C index 3711035270..b024dc0f54 100644 --- a/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C +++ b/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C @@ -35,6 +35,7 @@ Foam::compressibleInterPhaseTransportModel::compressibleInterPhaseTransportModel const surfaceScalarField& phi, const surfaceScalarField& rhoPhi, const surfaceScalarField& alphaPhi1, + const surfaceScalarField& alphaPhi2, const surfaceScalarField& alphaRhoPhi1, const surfaceScalarField& alphaRhoPhi2, const compressibleTwoPhaseVoFMixture& mixture @@ -44,6 +45,7 @@ Foam::compressibleInterPhaseTransportModel::compressibleInterPhaseTransportModel mixture_(mixture), phi_(phi), alphaPhi1_(alphaPhi1), + alphaPhi2_(alphaPhi2), alphaRhoPhi1_(alphaRhoPhi1), alphaRhoPhi2_(alphaRhoPhi2) { diff --git a/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H b/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H index 4c14dab3cb..3a002ec46e 100644 --- a/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H +++ b/applications/modules/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H @@ -72,13 +72,16 @@ class compressibleInterPhaseTransportModel //- Mixture volumetric flux const surfaceScalarField& phi_; - //- Phase volumetric flux + //- Phase-1 volumetric flux const surfaceScalarField& alphaPhi1_; - //- Phase-1 mass-flux (constructed for two-phase transport) + //- Phase-2 volumetric flux + const surfaceScalarField& alphaPhi2_; + + //- Phase-1 mass flux const surfaceScalarField& alphaRhoPhi1_; - //- Phase-2 mass-flux (constructed for two-phase transport) + //- Phase-2 mass flux const surfaceScalarField& alphaRhoPhi2_; //- Mixture transport model (constructed for mixture transport) @@ -105,6 +108,7 @@ public: const surfaceScalarField& phi, const surfaceScalarField& rhoPhi, const surfaceScalarField& alphaPhi1, + const surfaceScalarField& alphaPhi2, const surfaceScalarField& alphaRhoPhi1, const surfaceScalarField& alphaRhoPhi2, const compressibleTwoPhaseVoFMixture& mixture diff --git a/applications/modules/compressibleVoF/compressibleVoF.C b/applications/modules/compressibleVoF/compressibleVoF.C index 418bf7dcba..9df49c6732 100644 --- a/applications/modules/compressibleVoF/compressibleVoF.C +++ b/applications/modules/compressibleVoF/compressibleVoF.C @@ -88,7 +88,7 @@ Foam::solvers::compressibleVoF::compressibleVoF(fvMesh& mesh) alphaRhoPhi2 ( IOobject::groupName("alphaRhoPhi", alpha2.group()), - fvc::interpolate(mixture_.thermo2().rho())*(phi - alphaPhi1) + fvc::interpolate(mixture_.thermo2().rho())*alphaPhi2 ), K("K", 0.5*magSqr(U)), @@ -100,6 +100,7 @@ Foam::solvers::compressibleVoF::compressibleVoF(fvMesh& mesh) phi, rhoPhi, alphaPhi1, + alphaPhi2, alphaRhoPhi1, alphaRhoPhi2, mixture_ @@ -144,7 +145,7 @@ void Foam::solvers::compressibleVoF::prePredictor() const volScalarField& rho2 = mixture_.thermo2().rho(); alphaRhoPhi1 = fvc::interpolate(rho1)*alphaPhi1; - alphaRhoPhi2 = fvc::interpolate(rho2)*(phi - alphaPhi1); + alphaRhoPhi2 = fvc::interpolate(rho2)*alphaPhi2; rhoPhi = alphaRhoPhi1 + alphaRhoPhi2; diff --git a/applications/modules/compressibleVoF/pressureCorrector.C b/applications/modules/compressibleVoF/pressureCorrector.C index 618368a844..7b73395916 100644 --- a/applications/modules/compressibleVoF/pressureCorrector.C +++ b/applications/modules/compressibleVoF/pressureCorrector.C @@ -54,8 +54,6 @@ void Foam::solvers::compressibleVoF::pressureCorrector() const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU())); - const surfaceScalarField alphaPhi2("alphaPhi2", phi - alphaPhi1); - while (pimple.correct()) { const volVectorField HbyA(constrainHbyA(rAU()*UEqn.H(), U, p_rgh)); diff --git a/applications/modules/incompressibleDriftFlux/incompressibleDriftFlux.C b/applications/modules/incompressibleDriftFlux/incompressibleDriftFlux.C index 2fe782b86f..84123c5885 100644 --- a/applications/modules/incompressibleDriftFlux/incompressibleDriftFlux.C +++ b/applications/modules/incompressibleDriftFlux/incompressibleDriftFlux.C @@ -193,7 +193,9 @@ void Foam::solvers::incompressibleDriftFlux::prePredictor() alpha1Eqn.solve(alpha1.name() + "Diffusion"); alphaPhi1 += alpha1Eqn.flux(); - alpha2 = 1.0 - alpha1; + + alpha2 = scalar(1) - alpha1; + alphaPhi2 = phi - alphaPhi1; Info<< "Phase-1 volume fraction = " << alpha1.weightedAverage(mesh.Vsc()).value() @@ -207,8 +209,8 @@ void Foam::solvers::incompressibleDriftFlux::prePredictor() const dimensionedScalar& rho1 = mixture.rho1(); const dimensionedScalar& rho2 = mixture.rho2(); - // Calculate the mass-flux from the accumulated alphaPhi1 - rhoPhi = (alphaPhi1*(rho1 - rho2) + phi*rho2); + // Calculate the mass-flux + rhoPhi = alphaPhi1*rho1 + alphaPhi2*rho2; relativeVelocity->correct(); diff --git a/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C b/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C index 6fc83777d8..92bac05794 100644 --- a/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C +++ b/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C @@ -34,13 +34,15 @@ incompressibleInterPhaseTransportModel const volVectorField& U, const surfaceScalarField& phi, const surfaceScalarField& alphaPhi1, + const surfaceScalarField& alphaPhi2, const incompressibleTwoPhaseVoFMixture& mixture ) : twoPhaseTransport_(false), mixture_(mixture), phi_(phi), - alphaPhi1_(alphaPhi1) + alphaPhi1_(alphaPhi1), + alphaPhi2_(alphaPhi2) { { IOdictionary momentumTransport @@ -71,15 +73,6 @@ incompressibleInterPhaseTransportModel const volScalarField& alpha1(mixture_.alpha1()); const volScalarField& alpha2(mixture_.alpha2()); - alphaPhi2_ = - ( - new surfaceScalarField - ( - IOobject::groupName("alphaPhi", alpha2.group()), - (phi_ - alphaPhi1_) - ) - ); - turbulence1_ = ( phaseIncompressible::momentumTransportModel::New @@ -98,7 +91,7 @@ incompressibleInterPhaseTransportModel ( alpha2, U, - alphaPhi2_(), + alphaPhi2_, phi, mixture.nuModel2() ) @@ -140,15 +133,6 @@ Foam::incompressibleInterPhaseTransportModel::divDevTau } -void Foam::incompressibleInterPhaseTransportModel::correctPhasePhi() -{ - if (twoPhaseTransport_) - { - alphaPhi2_.ref() = (phi_ - alphaPhi1_); - } -} - - void Foam::incompressibleInterPhaseTransportModel::predict() { if (twoPhaseTransport_) diff --git a/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H b/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H index 5355ff7bfd..d5df8da43a 100644 --- a/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H +++ b/applications/modules/incompressibleVoF/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H @@ -69,11 +69,11 @@ class incompressibleInterPhaseTransportModel //- Mixture volumetric flux const surfaceScalarField& phi_; - //- Phase volumetric flux + //- Phase-1 volumetric flux const surfaceScalarField& alphaPhi1_; - //- Phase-2 mass-flux (constructed from alphaPhi1_ and phi_) - tmp alphaPhi2_; + //- Phase-2 volumetric flux + const surfaceScalarField& alphaPhi2_; //- Mixture transport model (constructed for mixture transport) autoPtr turbulence_; @@ -95,6 +95,7 @@ public: const volVectorField& U, const surfaceScalarField& phi, const surfaceScalarField& alphaPhi1, + const surfaceScalarField& alphaPhi2, const incompressibleTwoPhaseVoFMixture& mixture ); @@ -114,10 +115,6 @@ public: volVectorField& U ) const; - //- Correct the phase mass-fluxes - // (required for the two-phase transport option) - void correctPhasePhi(); - //- Predict the phase or mixture transport models void predict(); diff --git a/applications/modules/incompressibleVoF/incompressibleVoF.C b/applications/modules/incompressibleVoF/incompressibleVoF.C index fe57ef96dc..5ed712687a 100644 --- a/applications/modules/incompressibleVoF/incompressibleVoF.C +++ b/applications/modules/incompressibleVoF/incompressibleVoF.C @@ -81,6 +81,7 @@ Foam::solvers::incompressibleVoF::incompressibleVoF(fvMesh& mesh) U, phi, alphaPhi1, + alphaPhi2, mixture ) { @@ -134,8 +135,8 @@ void Foam::solvers::incompressibleVoF::prePredictor() const dimensionedScalar& rho1 = mixture.rho1(); const dimensionedScalar& rho2 = mixture.rho2(); - // Calculate the mass-flux from the accumulated alphaPhi1 - rhoPhi = (alphaPhi1*(rho1 - rho2) + phi*rho2); + // Calculate the mass-flux + rhoPhi = alphaPhi1*rho1 + alphaPhi2*rho2; if (pimple.predictTransport()) { diff --git a/applications/modules/twoPhaseSolver/alphaPredictor.C b/applications/modules/twoPhaseSolver/alphaPredictor.C index 288d34facf..c91ad831d4 100644 --- a/applications/modules/twoPhaseSolver/alphaPredictor.C +++ b/applications/modules/twoPhaseSolver/alphaPredictor.C @@ -225,7 +225,8 @@ void Foam::solvers::twoPhaseSolver::alphaSolve // Cache the upwind-flux talphaPhi1Corr0 = talphaPhi1UD; - alpha2 = 1.0 - alpha1; + alpha2 = scalar(1) - alpha1; + alphaPhi2 = phi - alphaPhi1; correctInterface(); } @@ -328,7 +329,8 @@ void Foam::solvers::twoPhaseSolver::alphaSolve } } - alpha2 = 1.0 - alpha1; + alpha2 = scalar(1) - alpha1; + alphaPhi2 = phi - alphaPhi1; // Correct only the mixture interface for the interface compression flux correctInterface(); @@ -363,6 +365,7 @@ void Foam::solvers::twoPhaseSolver::alphaSolve // Calculate the end-of-time-step alpha flux alphaPhi1 = (alphaPhi1 - (1.0 - cnCoeff)*alphaPhi1.oldTime())/cnCoeff; + alphaPhi2 = phi - alphaPhi1; } } @@ -420,6 +423,7 @@ void Foam::solvers::twoPhaseSolver::alphaPredictor() } alphaPhi1 = talphaPhi1(); + alphaPhi2 = phi - talphaPhi1(); } else { diff --git a/applications/modules/twoPhaseSolver/twoPhaseSolver.C b/applications/modules/twoPhaseSolver/twoPhaseSolver.C index d1bc255bf1..4ef40ae9d7 100644 --- a/applications/modules/twoPhaseSolver/twoPhaseSolver.C +++ b/applications/modules/twoPhaseSolver/twoPhaseSolver.C @@ -74,6 +74,16 @@ Foam::solvers::twoPhaseSolver::twoPhaseSolver IOobject::AUTO_WRITE ), phi*fvc::interpolate(alpha1) + ), + alphaPhi2 + ( + IOobject + ( + IOobject::groupName("alphaPhi", alpha2.group()), + runTime.name(), + mesh + ), + phi - alphaPhi1 ) { mesh.schemes().setFluxRequired(alpha1.name()); diff --git a/applications/modules/twoPhaseSolver/twoPhaseSolver.H b/applications/modules/twoPhaseSolver/twoPhaseSolver.H index 8f3ce7e2c0..d805ffcdbe 100644 --- a/applications/modules/twoPhaseSolver/twoPhaseSolver.H +++ b/applications/modules/twoPhaseSolver/twoPhaseSolver.H @@ -95,6 +95,9 @@ protected: // Phase-1 volumetric flux surfaceScalarField alphaPhi1; + // Phase-2 volumetric flux + surfaceScalarField alphaPhi2; + // Cached temporary fields