From e26498eed358e9f9571e8d5d9174b69f4d85cc85 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Mon, 16 Feb 2015 21:47:15 +0000 Subject: [PATCH] Rationalized sprayFoam family of solvers and added sprayDyMFoam --- .../solvers/lagrangian/sprayFoam/Make/options | 9 +- .../sprayFoam/sprayDyMFoam/Make/files | 3 + .../sprayFoam/sprayDyMFoam/Make/options | 61 ++++++++ .../lagrangian/sprayFoam/sprayDyMFoam/pEqn.H | 118 ++++++++++++++ .../sprayFoam/sprayDyMFoam/sprayDyMFoam.C | 147 ++++++++++++++++++ .../sprayFoam/sprayEngineFoam/Make/options | 1 + .../sprayFoam/aachenBomb/system/fvSolution | 4 - 7 files changed, 334 insertions(+), 9 deletions(-) create mode 100644 applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/files create mode 100644 applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options create mode 100644 applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H create mode 100644 applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C diff --git a/applications/solvers/lagrangian/sprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/Make/options index 404a0d37319..ac5b3ae3a08 100644 --- a/applications/solvers/lagrangian/sprayFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/Make/options @@ -26,11 +26,7 @@ EXE_INC = \ -I$(LIB_SRC)/fvOptions/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude - EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ -llagrangian \ @@ -51,5 +47,8 @@ EXE_LIBS = \ -lODE \ -lregionModels \ -lsurfaceFilmModels \ + -lcombustionModels \ + -lfiniteVolume \ -lfvOptions \ - -lcombustionModels + -lmeshTools \ + -lsampling diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/files b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/files new file mode 100644 index 00000000000..b8c30b71e92 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/files @@ -0,0 +1,3 @@ +sprayDyMFoam.C + +EXE = $(FOAM_APPBIN)/sprayDyMFoam diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options new file mode 100644 index 00000000000..6121be58c61 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options @@ -0,0 +1,61 @@ +EXE_INC = \ + -I.. \ + -I../../reactingParcelFoam \ + -I../../../compressible/rhoPimpleFoam/rhoPimpleDyMFoam \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I${LIB_SRC}/meshTools/lnInclude \ + -I${LIB_SRC}/sampling/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/lagrangian/spray/lnInclude \ + -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/fvOptions/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lturbulenceModels \ + -lcompressibleTurbulenceModels \ + -llagrangian \ + -llagrangianIntermediate \ + -llagrangianTurbulence \ + -llagrangianSpray \ + -lspecie \ + -lfluidThermophysicalModels \ + -lliquidProperties \ + -lliquidMixtureProperties \ + -lsolidProperties \ + -lsolidMixtureProperties \ + -lthermophysicalFunctions \ + -lreactionThermophysicalModels \ + -lSLGThermo \ + -lchemistryModel \ + -lradiationModels \ + -lODE \ + -lregionModels \ + -lsurfaceFilmModels \ + -lcombustionModels \ + -lfiniteVolume \ + -lfvOptions \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -ldynamicMesh \ + -lmeshTools diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H new file mode 100644 index 00000000000..10aaff112d4 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H @@ -0,0 +1,118 @@ +rho = thermo.rho(); +rho = max(rho, rhoMin); +rho = min(rho, rhoMax); +rho.relax(); + +volScalarField rAU(1.0/UEqn().A()); +surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); + +volVectorField HbyA("HbyA", U); +HbyA = rAU*UEqn().H(); + +if (pimple.nCorrPISO() <= 1) +{ + UEqn.clear(); +} + +if (pimple.transonic()) +{ + surfaceScalarField phid + ( + "phid", + fvc::interpolate(psi) + *( + (fvc::interpolate(HbyA) & mesh.Sf()) + + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho) + ) + ); + + fvc::makeRelative(phid, psi, U); + fvOptions.makeRelative(fvc::interpolate(psi), phid); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvm::div(phid, p) + - fvm::laplacian(rhorAUf, p) + == + parcels.Srho() + + fvOptions(psi, p, rho.name()) + ); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi == pEqn.flux(); + } + } +} +else +{ + surfaceScalarField phiHbyA + ( + "phiHbyA", + (fvc::interpolate(rho*HbyA) & mesh.Sf()) + + rhorAUf*fvc::ddtCorr(rho, U, rhoUf) + ); + + fvc::makeRelative(phiHbyA, rho, U); + fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvc::div(phiHbyA) + - fvm::laplacian(rhorAUf, p) + == + parcels.Srho() + + fvOptions(psi, p, rho.name()) + ); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqn.flux(); + } + } +} + +#include "rhoEqn.H" +#include "compressibleContinuityErrs.H" + +// Explicitly relax pressure for momentum corrector +p.relax(); + +// Recalculate density from the relaxed pressure +rho = thermo.rho(); +rho = max(rho, rhoMin); +rho = min(rho, rhoMax); +rho.relax(); +Info<< "rho max/min : " << max(rho).value() + << " " << min(rho).value() << endl; + +U = HbyA - rAU*fvc::grad(p); +U.correctBoundaryConditions(); +fvOptions.correct(U); +K = 0.5*magSqr(U); + +{ + rhoUf = fvc::interpolate(rho*U); + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf)); +} + +if (thermo.dpdt()) +{ + dpdt = fvc::ddt(p); + + if (mesh.moving()) + { + dpdt -= fvc::div(fvc::meshPhi(rho, U), p); + } +} diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C new file mode 100644 index 00000000000..3d12451ffa5 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/sprayDyMFoam.C @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. + +Application + sprayDyMFoam + +Description + Transient PIMPLE solver for compressible, laminar or turbulent flow with + spray parcels and support for moving meshes. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "turbulenceModel.H" +#include "basicSprayCloud.H" +#include "psiCombustionModel.H" +#include "radiationModel.H" +#include "SLGThermo.H" +#include "pimpleControl.H" +#include "CorrectPhi.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 "readTimeControls.H" + #include "readGravitationalAcceleration.H" + #include "createFields.H" + #include "createRhoUf.H" + #include "createFvOptions.H" + #include "createClouds.H" + #include "createRadiationModel.H" + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + + { + // Store divrhoU from the previous time-step/mesh for the correctPhi + volScalarField divrhoU + ( + "divrhoU", + fvc::div(fvc::absolute(phi, rho, U)) + ); + + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + // Store momentum to set rhoUf for introduced faces. + volVectorField rhoU("rhoU", rho*U); + + // Do any mesh changes + mesh.update(); + + if (mesh.changing() && correctPhi) + { + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & rhoUf; + + #include "correctPhi.H" + + // Make the fluxes relative to the mesh-motion + fvc::makeRelative(phi, rho, U); + } + } + + parcels.evolve(); + + #include "rhoEqn.H" + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "UEqn.H" + #include "YEqn.H" + #include "EEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + rho = thermo.rho(); + + if (runTime.write()) + { + combustion->dQ()().write(); + } + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options index 487508d3071..d9a4851b74b 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I.. \ + -I../sprayDyMFoam \ -I../../reactingParcelFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSolution b/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSolution index 51cbc83c22f..3c6aa13b4f6 100644 --- a/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSolution +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/system/fvSolution @@ -98,10 +98,6 @@ PIMPLE relaxationFactors { - fields - { - ".*Final" 1; - } equations { ".*Final" 1; -- GitLab