### New solver: rhoPorousMRFPimpleFoam

```Added compressibility support to MRFZone.
Required generalisation of the oneField concept.
Also clean-up the use of one and zero for consistency.
Simple mixerVessel2D tutorial case supplied.```
parent b3fd9c59
 rhoPorousMRFPimpleFoam.C EXE = \$(FOAM_APPBIN)/rhoPorousMRFPimpleFoam
 EXE_INC = \ -I../rhoPimpleFoam \ -I\$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I\$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I\$(LIB_SRC)/finiteVolume/cfdTools \ -I\$(LIB_SRC)/finiteVolume/lnInclude \ -I\$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ -lmeshTools
 // Solve the Momentum equation tmp UEqn ( pZones.ddt(rho, U) + fvm::div(phi, U) + turbulence->divDevRhoReff(U) ); if (oCorr == nOuterCorr-1) { UEqn().relax(1); } else { UEqn().relax(); } mrfZones.addCoriolis(rho, UEqn()); pZones.addResistance(UEqn()); volScalarField rUA = 1.0/UEqn().A(); if (momentumPredictor) { if (oCorr == nOuterCorr-1) { solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); } else { solve(UEqn() == -fvc::grad(p)); } } else { U = rUA*(UEqn().H() - fvc::grad(p)); U.correctBoundaryConditions(); }
 Info<< "Reading thermophysical properties\n" << endl; autoPtr pThermo ( basicPsiThermo::New(mesh) ); basicPsiThermo& thermo = pThermo(); volScalarField& p = thermo.p(); volScalarField& h = thermo.h(); const volScalarField& psi = thermo.psi(); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), thermo.rho() ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); #include "compressibleCreatePhi.H" dimensionedScalar pMin ( mesh.solutionDict().subDict("PIMPLE").lookup("pMin") ); Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( compressible::turbulenceModel::New ( rho, U, phi, thermo ) ); //dimensionedScalar initialMass = fvc::domainIntegrate(rho); Info<< "Creating field DpDt\n" << endl; volScalarField DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); MRFZones mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); porousZones pZones(mesh); Switch pressureImplicitPorosity(false);
 rho = thermo.rho(); volScalarField rUA = 1.0/UEqn().A(); U = rUA*UEqn().H(); if (nCorr <= 1) { UEqn.clear(); } if (transonic) { surfaceScalarField phid ( "phid", fvc::interpolate(psi) *( (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, rho, U, phi) ) ); mrfZones.relativeFlux(fvc::interpolate(psi), phid); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(rho*rUA, p) ); if ( oCorr == nOuterCorr-1 && corr == nCorr-1 && nonOrth == nNonOrthCorr ) { pEqn.solve(mesh.solver("pFinal")); } else { pEqn.solve(); } if (nonOrth == nNonOrthCorr) { phi == pEqn.flux(); } } } else { phi = fvc::interpolate(rho)* ( (fvc::interpolate(U) & mesh.Sf()) //+ fvc::ddtPhiCorr(rUA, rho, U, phi) ); mrfZones.relativeFlux(fvc::interpolate(rho), phi); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { // Pressure corrector fvScalarMatrix pEqn ( fvm::ddt(psi, p) + fvc::div(phi) - fvm::laplacian(rho*rUA, p) ); if ( oCorr == nOuterCorr-1 && corr == nCorr-1 && nonOrth == nNonOrthCorr ) { pEqn.solve(mesh.solver("pFinal")); } else { pEqn.solve(); } if (nonOrth == nNonOrthCorr) { phi += pEqn.flux(); } } } #include "rhoEqn.H" #include "compressibleContinuityErrs.H" //if (oCorr != nOuterCorr-1) { // Explicitly relax pressure for momentum corrector p.relax(); rho = thermo.rho(); rho.relax(); Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; } U -= rUA*fvc::grad(p); U.correctBoundaryConditions(); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); bound(p, pMin); // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity /* if (closedVolume) { p += (initialMass - fvc::domainIntegrate(psi*p)) /fvc::domainIntegrate(psi); } */