From a620e93fa781921c549c716a0eeb5faa7c45db04 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 16 Dec 2020 11:24:00 +0000 Subject: [PATCH] reactingFoam: Added frozenFlow option with frozenFlow set true in the PIMPLE sub-dictionary of fvSolution the p-U system is not solved and the energy-composition system including reactions is solved with the fixed flow. --- .../solvers/combustion/reactingFoam/YEqn.H | 42 ++++--- .../combustion/reactingFoam/correctPhi.H | 1 + .../combustion/reactingFoam/reactingFoam.C | 112 ++++++++++-------- 3 files changed, 81 insertions(+), 74 deletions(-) create mode 100644 applications/solvers/combustion/reactingFoam/correctPhi.H diff --git a/applications/solvers/combustion/reactingFoam/YEqn.H b/applications/solvers/combustion/reactingFoam/YEqn.H index d8f9453940..5e737ee443 100644 --- a/applications/solvers/combustion/reactingFoam/YEqn.H +++ b/applications/solvers/combustion/reactingFoam/YEqn.H @@ -9,34 +9,32 @@ tmp> mvConvection ) ); +reaction->correct(); + +forAll(Y, i) { - reaction->correct(); - - forAll(Y, i) + if (composition.solve(i)) { - if (composition.solve(i)) - { - volScalarField& Yi = Y[i]; + volScalarField& Yi = Y[i]; - fvScalarMatrix YiEqn - ( - fvm::ddt(rho, Yi) - + mvConvection->fvmDiv(phi, Yi) - + thermophysicalTransport->divj(Yi) - == - reaction->R(Yi) - + fvOptions(rho, Yi) - ); + fvScalarMatrix YiEqn + ( + fvm::ddt(rho, Yi) + + mvConvection->fvmDiv(phi, Yi) + + thermophysicalTransport->divj(Yi) + == + reaction->R(Yi) + + fvOptions(rho, Yi) + ); - YiEqn.relax(); + YiEqn.relax(); - fvOptions.constrain(YiEqn); + fvOptions.constrain(YiEqn); - YiEqn.solve("Yi"); + YiEqn.solve("Yi"); - fvOptions.correct(Yi); - } + fvOptions.correct(Yi); } - - composition.normalise(); } + +composition.normalise(); diff --git a/applications/solvers/combustion/reactingFoam/correctPhi.H b/applications/solvers/combustion/reactingFoam/correctPhi.H new file mode 100644 index 0000000000..f907eed8bd --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/correctPhi.H @@ -0,0 +1 @@ +#include "../../compressible/rhoPimpleFoam/correctPhi.H" diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index a315264ff7..233cd85b5e 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -101,63 +101,71 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) + if (pimple.frozenFlow()) { - if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) - { - // Store momentum to set rhoUf for introduced faces. - autoPtr rhoU; - if (rhoUf.valid()) - { - rhoU = new volVectorField("rhoU", rho*U); - } - - // Do any mesh changes - mesh.update(); - - if (mesh.changing()) - { - MRF.update(); - - if (correctPhi) - { - // Calculate absolute flux - // from the mapped surface velocity - phi = mesh.Sf() & rhoUf(); - - #include "../../compressible/rhoPimpleFoam/correctPhi.H" - - // Make the fluxes relative to the mesh-motion - fvc::makeRelative(phi, rho, U); - } - - if (checkMeshCourantNo) - { - #include "meshCourantNo.H" - } - } - } - - if (pimple.firstPimpleIter() && !pimple.simpleRho()) - { - #include "rhoEqn.H" - } - - #include "UEqn.H" #include "YEqn.H" #include "EEqn.H" - - // --- Pressure corrector loop - while (pimple.correct()) + } + else + { + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { - #include "../../compressible/rhoPimpleFoam/pEqn.H" - } + if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) + { + // Store momentum to set rhoUf for introduced faces. + autoPtr rhoU; + if (rhoUf.valid()) + { + rhoU = new volVectorField("rhoU", rho*U); + } - if (pimple.turbCorr()) - { - turbulence->correct(); - thermophysicalTransport->correct(); + // Do any mesh changes + mesh.update(); + + if (mesh.changing()) + { + MRF.update(); + + if (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); + } + + if (checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + } + } + + if (pimple.firstPimpleIter() && !pimple.simpleRho()) + { + #include "rhoEqn.H" + } + + #include "UEqn.H" + #include "YEqn.H" + #include "EEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "../../compressible/rhoPimpleFoam/pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + thermophysicalTransport->correct(); + } } }