This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/multiphase/cavitatingFoam/pEqn.H
Henrik Rusche c0dc374d98 Merge PISO/PIMPLE solver updates. Author: Vanja Skuric. Merge: Henrik Rusche
Conflicts:
	applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C
	applications/solvers/compressible/steadyCompressibleFoam/pEqn.H
	applications/solvers/compressible/steadyCompressibleMRFFoam/createFields.H
	applications/solvers/compressible/steadyCompressibleMRFFoam/pEqn.H
	applications/solvers/compressible/steadyCompressibleSRFFoam/createFields.H
	applications/solvers/compressible/steadyCompressibleSRFFoam/pEqn.H
	applications/solvers/coupled/MRFPorousFoam/createFields.H
	applications/solvers/coupled/pUCoupledFoam/createFields.H
	tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution
	tutorials/compressible/steadyCompressibleFoam/transonicBump/system/fvSchemes
	tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/system/fvSchemes
	tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/system/fvSchemes
	tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes
	tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes
	tutorials/equationReader/equationReaderDemo/pitzDaily/system/fvSchemes
	tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/system/fvSchemes
	tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes
	tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes
	tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSchemes
	tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSchemes
	tutorials/incompressible/pUCoupledFoam/cavity/system/fvSchemes
	tutorials/viscoelastic/viscoelasticFluidFoam/XPP_SE/system/fvSchemes
2016-05-29 16:37:07 +02:00

90 lines
2.1 KiB
C

{
if (pimple.firstIter())
{
p =
(
rho
- (1.0 - gamma)*rhol0
- ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
)/psi;
}
surfaceScalarField rhof = fvc::interpolate(rho, "rhof");
volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField rUAf("rUAf", rhof*fvc::interpolate(rUA));
volVectorField HbyA = rUA*UEqn.H();
phiv = (fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phiv);
surfaceScalarField phiGradp = rUAf*mesh.magSf()*fvc::snGrad(p);
phiv -= phiGradp/rhof;
# include "resetPhivPatches.H"
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
- (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
+ fvc::div(phiv, rho)
+ fvc::div(phiGradp)
- fvm::laplacian(rUAf, p)
);
pEqn.solve
(
mesh.solutionDict().solver(p.select(pimple.finalInnerIter()))
);
if (pimple.finalNonOrthogonalIter())
{
phiv += (phiGradp + pEqn.flux())/rhof;
}
}
Info<< "Predicted p max-min : " << max(p).value()
<< " " << min(p).value() << endl;
rho == max
(
psi*p
+ (1.0 - gamma)*rhol0
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
rhoMin
);
# include "gammaPsi.H"
p =
(
rho
- (1.0 - gamma)*rhol0
- ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
)/psi;
p.correctBoundaryConditions();
Info<< "Phase-change corrected p max-min : " << max(p).value()
<< " " << min(p).value() << endl;
// Correct velocity
U = HbyA - rUA*fvc::grad(p);
// Remove the swirl component of velocity for "wedge" cases
if (pimple.dict().found("removeSwirl"))
{
label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl")));
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
U.field().replace(swirlCmpt, 0.0);
}
U.correctBoundaryConditions();
Info<< "max(U) " << max(mag(U)).value() << endl;
}