c0dc374d98
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
80 lines
2 KiB
C
80 lines
2 KiB
C
{
|
|
volScalarField rUA = 1.0/UEqn.A();
|
|
|
|
surfaceScalarField psisf = fvc::interpolate(psis);
|
|
surfaceScalarField rhof = fvc::interpolate(rho);
|
|
|
|
// Needs to be outside of loop since p is changing, but psi and rho are not.
|
|
surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p);
|
|
|
|
while (pimple.correct())
|
|
{
|
|
U = rUA*UEqn.H();
|
|
|
|
// Calculate phi for boundary conditions
|
|
phi = rhof*fvc::interpolate(U) & mesh.Sf();
|
|
|
|
surfaceScalarField phid2 = rhoReff/rhof*phi;
|
|
|
|
surfaceScalarField phid("phid", psisf/rhof*phi);
|
|
|
|
// Make fluxes relative within the MRF zone
|
|
mrfZones.relativeFlux(rhoReff, phi);
|
|
mrfZones.relativeFlux(psisf, phid);
|
|
mrfZones.relativeFlux(rhoReff, phid2);
|
|
|
|
p.storePrevIter();
|
|
|
|
while (pimple.correctNonOrthogonal())
|
|
{
|
|
fvScalarMatrix pEqn
|
|
(
|
|
fvm::ddt(psis, p)
|
|
+ fvm::div(phid, p)
|
|
// Convective flux relaxation terms
|
|
+ fvm::SuSp(-divPhid, p)
|
|
+ divPhid*p
|
|
+ fvc::div(phid2)
|
|
- fvm::laplacian(rho*rUA, p)
|
|
);
|
|
|
|
pEqn.solve();
|
|
|
|
// Calculate the flux
|
|
if (pimple.finalNonOrthogonalIter())
|
|
{
|
|
phi = phid2 + pEqn.flux();
|
|
}
|
|
}
|
|
|
|
# include "compressibleContinuityErrs.H"
|
|
|
|
// Relax the pressure
|
|
p.relax();
|
|
|
|
U -= rUA*fvc::grad(p);
|
|
U.correctBoundaryConditions();
|
|
}
|
|
|
|
// Bound the pressure
|
|
if (min(p) < pMin || max(p) > pMax)
|
|
{
|
|
p.max(pMin);
|
|
p.min(pMax);
|
|
p.correctBoundaryConditions();
|
|
}
|
|
|
|
// Bound the velocity
|
|
volScalarField magU = mag(U);
|
|
|
|
if (max(magU) > UMax)
|
|
{
|
|
volScalarField Ulimiter = pos(magU - UMax)*UMax/(magU + smallU)
|
|
+ neg(magU - UMax);
|
|
Ulimiter.max(scalar(0));
|
|
Ulimiter.min(scalar(1));
|
|
|
|
U *= Ulimiter;
|
|
U.correctBoundaryConditions();
|
|
}
|
|
}
|