diff --git a/applications/solvers/compressible/rhoPimpleFoam/Allwmake b/applications/solvers/compressible/rhoPimpleFoam/Allwmake index ac06b7350a..1b272c17f0 100755 --- a/applications/solvers/compressible/rhoPimpleFoam/Allwmake +++ b/applications/solvers/compressible/rhoPimpleFoam/Allwmake @@ -5,5 +5,6 @@ set -x wmake wmake rhoPimplecFoam wmake rhoLTSPimpleFoam +wmake rhoPimpleDyMFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/Make/files b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/Make/files new file mode 100644 index 0000000000..034b5c2b1b --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/Make/files @@ -0,0 +1,3 @@ +rhoPimpleDyMFoam.C + +EXE = $(FOAM_APPBIN)/rhoPimpleDyMFoam diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/Make/options new file mode 100644 index 0000000000..2093b620b5 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/Make/options @@ -0,0 +1,27 @@ +EXE_INC = \ + -I.. \ + -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 \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fvOptions/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +EXE_LIBS = \ + -lfluidThermophysicalModels \ + -lspecie \ + -lcompressibleTurbulenceModel \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -lfiniteVolume \ + -lmeshTools \ + -lsampling \ + -lfvOptions \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -ldynamicMesh \ + -lmeshTools diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/correctPhi.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/correctPhi.H new file mode 100644 index 0000000000..24316a1685 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/correctPhi.H @@ -0,0 +1,59 @@ +{ + if (mesh.changing()) + { + forAll(U.boundaryField(), patchi) + { + if (U.boundaryField()[patchi].fixesValue()) + { + U.boundaryField()[patchi].initEvaluate(); + } + } + + forAll(U.boundaryField(), patchi) + { + if (U.boundaryField()[patchi].fixesValue()) + { + U.boundaryField()[patchi].evaluate(); + + phi.boundaryField()[patchi] = + rho.boundaryField()[patchi] + *( + U.boundaryField()[patchi] + & mesh.Sf().boundaryField()[patchi] + ); + } + } + } + + volScalarField pcorr + ( + IOobject + ( + "pcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("pcorr", p.dimensions(), 0.0), + pcorrTypes + ); + + dimensionedScalar Dp("Dp", dimTime, 1.0); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pcorrEqn + ( + fvm::laplacian(Dp, pcorr) == fvc::div(phi) - divrhoU + ); + + pcorrEqn.solve(); + + if (pimple.finalNonOrthogonalIter()) + { + phi -= pcorrEqn.flux(); + } + } +} diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/createPcorrTypes.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/createPcorrTypes.H new file mode 100644 index 0000000000..a602fd4843 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/createPcorrTypes.H @@ -0,0 +1,13 @@ + wordList pcorrTypes + ( + p.boundaryField().size(), + zeroGradientFvPatchScalarField::typeName + ); + + for (label i=0; i("correctPhi", true); + + bool checkMeshCourantNo = + pimple.dict().lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C new file mode 100644 index 0000000000..fb74f2b39a --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + rhoPimpleFoam + +Description + Transient solver for laminar or turbulent flow of compressible fluids + for HVAC and similar applications. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient simulations. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "psiThermo.H" +#include "turbulenceModel.H" +#include "bound.H" +#include "pimpleControl.H" +#include "fvIOoptionList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "initContinuityErrs.H" + + pimpleControl pimple(mesh); + + #include "readControls.H" + #include "createFields.H" + #include "createFvOptions.H" + #include "createPcorrTypes.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" + + // Create old-time absolute flux for ddtPhiCorr + surfaceScalarField phiAbs("phiAbs", phi); + + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + #include "compressibleCourantNo.H" + + // Make the fluxes absolute before mesh-motion + fvc::makeAbsolute(phi, rho, U); + + // Update absolute flux for ddtPhiCorr + phiAbs = phi; + + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + { + // Store divrhoU from the previous time-step/mesh for the correctPhi + volScalarField divrhoU(fvc::div(phi)); + + // Do any mesh changes + mesh.update(); + + if (mesh.changing() && correctPhi) + { + #include "correctPhi.H" + } + } + + // Make the fluxes relative to the mesh-motion + fvc::makeRelative(phi, rho, U); + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + + if (pimple.nCorrPIMPLE() <= 1) + { + #include "rhoEqn.H" + Info<< "rhoEqn max/min : " << max(rho).value() + << " " << min(rho).value() << endl; + } + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "UEqn.H" + #include "EEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options index 5cc44fea11..263fd7375f 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options @@ -1,25 +1,24 @@ EXE_INC = \ -I.. \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ EXE_LIBS = \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ - -ldynamicMesh \ - -lmeshTools \ -lincompressibleTransportModels \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ -lfiniteVolume \ -lfvOptions \ - -lsampling + -lsampling \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -ldynamicMesh \ + -lmeshTools diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H deleted file mode 100644 index eaaa3e60c9..0000000000 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H +++ /dev/null @@ -1,23 +0,0 @@ -// Solve the Momentum equation - -tmp UEqn -( - fvm::ddt(U) - + fvm::div(phi, U) - + turbulence->divDevReff(U) - == - fvOptions(U) -); - -UEqn().relax(); - -fvOptions.constrain(UEqn()); - -rAU = 1.0/UEqn().A(); - -if (pimple.momentumPredictor()) -{ - solve(UEqn() == -fvc::grad(p)); - - fvOptions.correct(U); -} diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H index 9bed803d1e..e1e897c18b 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H @@ -22,20 +22,6 @@ } } - wordList pcorrTypes - ( - p.boundaryField().size(), - zeroGradientFvPatchScalarField::typeName - ); - - forAll(p.boundaryField(), patchI) - { - if (p.boundaryField()[patchI].fixesValue()) - { - pcorrTypes[patchI] = fixedValueFvPatchScalarField::typeName; - } - } - volScalarField pcorr ( IOobject @@ -51,11 +37,13 @@ pcorrTypes ); + dimensionedScalar Dp("Dp", dimTime, 1.0); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( - fvm::laplacian(rAU, pcorr) == fvc::div(phi) + fvm::laplacian(Dp, pcorr) == fvc::div(phi) ); pcorrEqn.setReference(pRefCell, pRefValue); @@ -68,6 +56,4 @@ } } -phi.oldTime() = phi; - #include "continuityErrs.H" diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H index 16b3bd977d..082ec86ea8 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H @@ -40,19 +40,3 @@ ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); - - Info<< "Reading field rAU if present\n" << endl; - volScalarField rAU - ( - IOobject - ( - "rAU", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - mesh, - runTime.deltaT(), - zeroGradientFvPatchScalarField::typeName - ); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createPcorrTypes.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createPcorrTypes.H new file mode 100644 index 0000000000..a602fd4843 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createPcorrTypes.H @@ -0,0 +1,13 @@ + wordList pcorrTypes + ( + p.boundaryField().size(), + zeroGradientFvPatchScalarField::typeName + ); + + for (label i=0; i