INT: reactingParcelFoam: add dynamicMeshMotion capabilities

This commit is contained in:
Kutalmis Bercin
2020-10-29 14:13:03 +00:00
committed by Andrew Heather
parent 6ca6b34add
commit 5e539b30a9
5 changed files with 79 additions and 8 deletions

View File

@ -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 \

View File

@ -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);
}
}

View File

@ -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 \

View File

@ -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();

View File

@ -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