diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H b/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H index 9767adda1dd21581ef6367a6d8cdf5f723852563..9afcd58a66efaf0aa09bae9ecb5c39d095bf7099 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H @@ -2,7 +2,7 @@ CorrectPhi ( U, phi, - p, + p_rgh, dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), geometricZeroField(), pimple diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H b/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H index 5087d815952a35c6b8a8bf28e4af175de19b71b2..249673a9b2dd70a85ac2a39169f106f593f3bac1 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/createFields.H @@ -1,11 +1,9 @@ - #include "readGravitationalAcceleration.H" - - Info<< "Reading field p\n" << endl; - volScalarField p + Info<< "Reading field p_rgh\n" << endl; + volScalarField p_rgh ( IOobject ( - "p", + "p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, @@ -65,12 +63,6 @@ fluid.lookupOrDefault<scalar>("maxSlamVelocity", GREAT) ); - // dimensionedScalar pMin - // ( - // "pMin", - // dimPressure, - // fluid.lookup("pMin") - // ); volScalarField rho ( @@ -85,12 +77,39 @@ fluid.rho() ); - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell(p, pimple.dict(), pRefCell, pRefValue); // Construct incompressible turbulence model autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, fluid) ); + + + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + #include "gh.H" + + + volScalarField p + ( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + p_rgh + rho*gh + ); + + label pRefCell = 0; + scalar pRefValue = 0.0; + setRefCell + ( + p, + p_rgh, + pimple.dict(), + pRefCell, + pRefValue + ); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H index e8112b300aa85a5d287e573017f5bb3488a88112..5305e7387e6943f2b83239fd883c6caf30dd8935 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H @@ -1,6 +1,6 @@ { - // rho1 = rho10 + psi1*p; - // rho2 = rho20 + psi2*p; + // rho1 = rho10 + psi1*p_rgh; + // rho2 = rho20 + psi2*p_rgh; // tmp<fvScalarMatrix> pEqnComp1; // tmp<fvScalarMatrix> pEqnComp2; @@ -14,14 +14,14 @@ // surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi2); // pEqnComp1 = - // fvc::ddt(rho1) + psi1*correction(fvm::ddt(p)) - // + fvc::div(phid1, p) - // - fvc::Sp(fvc::div(phid1), p); + // fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh)) + // + fvc::div(phid1, p_rgh) + // - fvc::Sp(fvc::div(phid1), p_rgh); // pEqnComp2 = - // fvc::ddt(rho2) + psi2*correction(fvm::ddt(p)) - // + fvc::div(phid2, p) - // - fvc::Sp(fvc::div(phid2), p); + // fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh)) + // + fvc::div(phid2, p_rgh) + // - fvc::Sp(fvc::div(phid2), p_rgh); // } PtrList<surfaceScalarField> alphafs(fluid.phases().size()); @@ -58,6 +58,9 @@ dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0) ); + volScalarField rho("rho", fluid.rho()); + surfaceScalarField ghSnGradRho(ghf*fvc::snGrad(rho)*mesh.magSf()); + phasei = 0; forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) { @@ -104,9 +107,10 @@ phiHbyAs[phasei] += rAlphaAUfs[phasei] *( - fluid.surfaceTension(phase)*mesh.magSf()/phase.rho() - + (g & mesh.Sf()) - ); + fluid.surfaceTension(phase)*mesh.magSf() + + (phase.rho() - fvc::interpolate(rho))*(g & mesh.Sf()) + - ghSnGradRho + )/phase.rho(); multiphaseSystem::dragModelTable::const_iterator dmIter = fluid.dragModels().begin(); @@ -199,7 +203,7 @@ setSnGrad<fixedFluxPressureFvPatchScalarField> ( - p.boundaryField(), + p_rgh.boundaryField(), ( phiHbyA.boundaryField() - mrfZones.relative(phib) )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) @@ -211,7 +215,7 @@ fvScalarMatrix pEqnIncomp ( fvc::div(phiHbyA) - - fvm::laplacian(rAUf, p) + - fvm::laplacian(rAUf, p_rgh) ); pEqnIncomp.setReference(pRefCell, pRefValue); @@ -223,7 +227,7 @@ // + (alpha2/rho2)*pEqnComp2() // ) + pEqnIncomp, - mesh.solver(p.select(pimple.finalInnerIter())) + mesh.solver(p_rgh.select(pimple.finalInnerIter())) ); if (pimple.finalNonOrthogonalIter()) @@ -254,7 +258,10 @@ // - pos(alpha1)*(pEqnComp1 & p)/rho1 // ); - p.relax(); + p_rgh.relax(); + + p = p_rgh + rho*gh; + mSfGradp = pEqnIncomp.flux()/rAUf; U = dimensionedVector("U", dimVelocity, vector::zero); @@ -269,9 +276,14 @@ HbyAs[phasei] + fvc::reconstruct ( - rAlphaAUfs[phasei]*(g & mesh.Sf()) - + rAlphaAUfs[phasei]*mSfGradp/phase.rho() - ); + rAlphaAUfs[phasei] + *( + (phase.rho() - fvc::interpolate(rho)) + *(g & mesh.Sf()) + - ghSnGradRho + + mSfGradp + ) + )/phase.rho(); //phase.U() = fvc::reconstruct(phase.phi()); phase.U().correctBoundaryConditions(); @@ -287,9 +299,9 @@ #include "continuityErrs.H" - // rho1 = rho10 + psi1*p; - // rho2 = rho20 + psi2*p; + // rho1 = rho10 + psi1*p_rgh; + // rho2 = rho20 + psi2*p_rgh; - // Dp1Dt = fvc::DDt(phi1, p); - // Dp2Dt = fvc::DDt(phi2, p); + // Dp1Dt = fvc::DDt(phi1, p_rgh); + // Dp2Dt = fvc::DDt(phi2, p_rgh); } diff --git a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/0/p b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/0/p_rgh similarity index 98% rename from tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/0/p rename to tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/0/p_rgh index 278db348b8d23f65b5c4c722224f9a40143ee86b..73510043119421e384e1427b59f6ea3cacdd6e66 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/0/p +++ b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/0/p_rgh @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSchemes b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSchemes index feb67860ae39c145326f42328e8989a75d8bf8d5..a9532d13760c2a9eabc84745e1fd0ce742cb0ac0 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSchemes +++ b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSchemes @@ -55,7 +55,7 @@ snGradSchemes fluxRequired { default no; - p ; + p_rgh ; pcorr ; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution index 74edd57bbf5843bbc4ad09fa7b2fe7fff5c427e6..6ed886cf3fb03008553a257026c597bf1e7fe446 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution +++ b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/system/fvSolution @@ -22,7 +22,7 @@ solvers nAlphaSubCycles 2; } - p + p_rgh { solver GAMG; smoother DIC; @@ -37,16 +37,16 @@ solvers relTol 0.01; } - pFinal + p_rghFinal { - $p; + $p_rgh; tolerance 1e-9; relTol 0; } pcorr { - $p; + $p_rgh; tolerance 1e-5; relTol 0; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/0.org/p b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/0.org/p_rgh similarity index 98% rename from tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/0.org/p rename to tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/0.org/p_rgh index a4f1d992e5291dbcb03c92c04884447fa7a5a18c..22671e295d29c2fce1e5a0f8dee6cf0c33418547 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/0.org/p +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/0.org/p_rgh @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSchemes b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSchemes index 5a4bb79d9628ec2e14f036974ba794d9b805986f..95a8eb87f13d5580c96072122ecb4f5811e971ac 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSchemes +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSchemes @@ -53,7 +53,7 @@ snGradSchemes fluxRequired { default no; - p; + p_rgh; pcorr; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution index 94423be84d3c0342998a107f1e9c221dcf442a66..827873c725ce021725452c48a63357e6c54196b8 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/system/fvSolution @@ -22,7 +22,7 @@ solvers nAlphaSubCycles 3; } - p + p_rgh { solver GAMG; tolerance 1e-7; @@ -37,7 +37,7 @@ solvers mergeLevels 1; } - pFinal + p_rghFinal { solver PCG; preconditioner @@ -62,7 +62,7 @@ solvers pcorr { - $pFinal; + $p_rghFinal; tolerance 1e-5; relTol 0; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/0.org/p b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/0.org/p_rgh similarity index 94% rename from tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/0.org/p rename to tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/0.org/p_rgh index a4f1d992e5291dbcb03c92c04884447fa7a5a18c..cfabea4db1c624bd7b28007c7e1c119856b1a412 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/0.org/p +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/0.org/p_rgh @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,8 +42,8 @@ boundaryField { type totalPressure; p0 uniform 0; - U U.air; - phi phi.air; + U U; + phi phi; rho rho; psi none; gamma 1; diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/controlDict b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/controlDict index 902244128790ada7cfd7bb009c8fa1cc6ef243fb..9020d64f8cd214e06d3b17ea8cfd827ddc7a52d0 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/controlDict +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/controlDict @@ -33,7 +33,7 @@ writeInterval 0.01; purgeWrite 0; -writeFormat ascii; +writeFormat binary; writePrecision 6; diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSchemes b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSchemes index 5a4bb79d9628ec2e14f036974ba794d9b805986f..95a8eb87f13d5580c96072122ecb4f5811e971ac 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSchemes +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSchemes @@ -53,7 +53,7 @@ snGradSchemes fluxRequired { default no; - p; + p_rgh; pcorr; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSolution b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSolution index 94423be84d3c0342998a107f1e9c221dcf442a66..827873c725ce021725452c48a63357e6c54196b8 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSolution +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/system/fvSolution @@ -22,7 +22,7 @@ solvers nAlphaSubCycles 3; } - p + p_rgh { solver GAMG; tolerance 1e-7; @@ -37,7 +37,7 @@ solvers mergeLevels 1; } - pFinal + p_rghFinal { solver PCG; preconditioner @@ -62,7 +62,7 @@ solvers pcorr { - $pFinal; + $p_rghFinal; tolerance 1e-5; relTol 0; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/0/p b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/0/p_rgh similarity index 98% rename from tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/0/p rename to tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/0/p_rgh index 32d92ebc3637af3a1e125f0f79d738521aac9fd8..1e32488272935c1c47ff98f43710ebaffe09d38c 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/0/p +++ b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/0/p_rgh @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSchemes b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSchemes index 5a4bb79d9628ec2e14f036974ba794d9b805986f..95a8eb87f13d5580c96072122ecb4f5811e971ac 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSchemes +++ b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSchemes @@ -53,7 +53,7 @@ snGradSchemes fluxRequired { default no; - p; + p_rgh; pcorr; } diff --git a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSolution b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSolution index 4c352dce5f874c1c50aa6f1e2494cb94e9264a01..de5c1c53adaee05fe7f0997bf1e9487d74ed2dd2 100644 --- a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSolution +++ b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/system/fvSolution @@ -22,7 +22,7 @@ solvers nAlphaSubCycles 2; } - p + p_rgh { solver GAMG; tolerance 1e-7; @@ -37,7 +37,7 @@ solvers mergeLevels 1; } - pFinal + p_rghFinal { solver PCG; preconditioner @@ -62,7 +62,7 @@ solvers pcorr { - $pFinal; + $p_rghFinal; tolerance 1e-5; relTol 0; }