diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options index 5a6dbd5a1df97280dcd10b5582e59a4d8bf8b5ec..d836d1aae026eeb0c21bc3685e7509b871735581 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options @@ -2,6 +2,8 @@ EXE_INC = \ -I../reactingParcelFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ @@ -27,6 +29,8 @@ EXE_LIBS = \ -lfiniteVolume \ -lfvOptions \ -lmeshTools \ + -ldynamicMesh \ + -ldynamicFvMesh \ -lsampling \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index b6854000777335e3126e72438844a73836ede8f0..0344f9b1a41a170b197e75500146a4e57e6e8e49 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -81,7 +81,15 @@ else if (pimple.SIMPLErho()) rho = thermo.rho(); } +// Correct rhoUf if the mesh is moving +fvc::correctRhoUf(rhoUf, rho, U, phi); + if (thermo.dpdt()) { dpdt = fvc::ddt(p); + + if (mesh.moving()) + { + dpdt -= fvc::div(fvc::meshPhi(rho, U), p); + } } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options index 1bbc23c2279bbcaad2d69b260a3333eb33770e1d..de0941c2da30f0f25e4a81e938e137f2846831d0 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options @@ -3,6 +3,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ @@ -28,6 +30,8 @@ EXE_LIBS = \ -lfvOptions \ -lsampling \ -lmeshTools \ + -ldynamicMesh \ + -ldynamicFvMesh \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ -lspecie \ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index cdb809ae66687ed4e9369a25c8fc539023b17bdb..5f9e6899af0a7625051356700a923db8b76e3f56 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -5,8 +5,8 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2011-2020 OpenFOAM Foundation + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,8 +37,8 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "dynamicFvMesh.H" #include "turbulentFluidThermoModel.H" - #include "surfaceFilmModel.H" #include "rhoReactionThermo.H" #include "CombustionModel.H" @@ -47,6 +47,7 @@ Description #include "fvOptions.H" #include "pimpleControl.H" #include "pressureControl.H" +#include "CorrectPhi.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" #include "cloudMacros.H" @@ -76,13 +77,13 @@ int main(int argc, char *argv[]) #include "addCheckCaseOptions.H" #include "setRootCaseLists.H" #include "createTime.H" - #include "createMesh.H" - #include "createControl.H" - #include "createTimeControls.H" + #include "createDynamicFvMesh.H" + #include "createDyMControls.H" #include "createFields.H" #include "createFieldRefs.H" #include "createRegionControls.H" #include "initContinuityErrs.H" + #include "createRhoUfIfPresent.H" turbulence->validate(); @@ -98,7 +99,23 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "readTimeControls.H" + #include "readDyMControls.H" + + // Store divrhoU from the previous mesh + // so that it can be mapped and used in correctPhi + // to ensure the corrected phi has the same divergence + autoPtr<volScalarField> divrhoU; + if (solvePrimaryRegion && correctPhi) + { + divrhoU.reset + ( + new volScalarField + ( + "divrhoU", + fvc::div(fvc::absolute(phi, rho, U)) + ) + ); + } if (LTS) { @@ -114,6 +131,44 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; + // Store momentum to set rhoUf for introduced faces. + autoPtr<volVectorField> rhoU; + if (solvePrimaryRegion && rhoUf.valid()) + { + rhoU.reset(new volVectorField("rhoU", rho*U)); + } + + // Store the particle positions + parcels.storeGlobalPositions(); + + // Do any mesh changes + mesh.update(); + + if (solvePrimaryRegion && mesh.changing()) + { + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; + + 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" + } + } + parcels.evolve(); surfaceFilm.evolve(); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H index fbb69464c2d323246a8fcf9b9790d77161b0b884..5977b18fe67dde0922adfaf598f3fa510ef72233 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H @@ -103,7 +103,7 @@ License ); } - // Update tho boundary values of the reciprocal time-step + // Update the boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); // Spatially smooth the time scale field