ENH: buoyantPimpleFoam: add dynamic-mesh motion capabilities
This commit is contained in:
parent
19705bdd64
commit
445baaf277
@ -1,4 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I../../compressible/rhoPimpleFoam \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
@ -7,6 +8,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||||
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/regionFaModels\lnInclude
|
-I$(LIB_SRC)/regionFaModels\lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
@ -21,4 +24,7 @@ EXE_LIBS = \
|
|||||||
-lturbulenceModels \
|
-lturbulenceModels \
|
||||||
-lcompressibleTurbulenceModels \
|
-lcompressibleTurbulenceModels \
|
||||||
-latmosphericModels \
|
-latmosphericModels \
|
||||||
|
-ldynamicMesh \
|
||||||
|
-ldynamicFvMesh \
|
||||||
|
-ltopoChangerFvMesh \
|
||||||
-lregionFaModels
|
-lregionFaModels
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,8 +31,9 @@ Group
|
|||||||
grpHeatTransferSolvers
|
grpHeatTransferSolvers
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Transient solver for buoyant, turbulent flow of compressible fluids for
|
Transient solver for buoyant, turbulent flow of compressible fluids
|
||||||
ventilation and heat-transfer.
|
for ventilation and heat-transfer, with optional mesh motion
|
||||||
|
and mesh topology changes.
|
||||||
|
|
||||||
Turbulence is modelled using a run-time selectable compressible RAS or
|
Turbulence is modelled using a run-time selectable compressible RAS or
|
||||||
LES model.
|
LES model.
|
||||||
@ -39,12 +41,16 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
|
#include "dynamicFvMesh.H"
|
||||||
#include "rhoThermo.H"
|
#include "rhoThermo.H"
|
||||||
#include "turbulentFluidThermoModel.H"
|
#include "turbulentFluidThermoModel.H"
|
||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
|
#include "CorrectPhi.H"
|
||||||
#include "fvOptions.H"
|
#include "fvOptions.H"
|
||||||
#include "pimpleControl.H"
|
#include "pimpleControl.H"
|
||||||
#include "pressureControl.H"
|
#include "pressureControl.H"
|
||||||
|
#include "localEulerDdtScheme.H"
|
||||||
|
#include "fvcSmooth.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -53,7 +59,8 @@ int main(int argc, char *argv[])
|
|||||||
argList::addNote
|
argList::addNote
|
||||||
(
|
(
|
||||||
"Transient solver for buoyant, turbulent fluid flow"
|
"Transient solver for buoyant, turbulent fluid flow"
|
||||||
" of compressible fluids, including radiation."
|
" of compressible fluids, including radiation,"
|
||||||
|
" with optional mesh motion and mesh topology changes."
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "postProcess.H"
|
#include "postProcess.H"
|
||||||
@ -61,36 +68,105 @@ int main(int argc, char *argv[])
|
|||||||
#include "addCheckCaseOptions.H"
|
#include "addCheckCaseOptions.H"
|
||||||
#include "setRootCaseLists.H"
|
#include "setRootCaseLists.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createDynamicFvMesh.H"
|
||||||
#include "createControl.H"
|
#include "createDyMControls.H"
|
||||||
|
#include "initContinuityErrs.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createFieldRefs.H"
|
#include "createFieldRefs.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "createRhoUfIfPresent.H"
|
||||||
#include "createTimeControls.H"
|
|
||||||
#include "compressibleCourantNo.H"
|
|
||||||
#include "setInitialDeltaT.H"
|
|
||||||
|
|
||||||
turbulence->validate();
|
turbulence->validate();
|
||||||
|
|
||||||
|
if (!LTS)
|
||||||
|
{
|
||||||
|
#include "compressibleCourantNo.H"
|
||||||
|
#include "setInitialDeltaT.H"
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
while (runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
#include "readTimeControls.H"
|
#include "readDyMControls.H"
|
||||||
#include "compressibleCourantNo.H"
|
|
||||||
#include "setDeltaT.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 (correctPhi)
|
||||||
|
{
|
||||||
|
divrhoU.reset
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
"divrhoU",
|
||||||
|
fvc::div(fvc::absolute(phi, rho, U))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LTS)
|
||||||
|
{
|
||||||
|
#include "setRDeltaT.H"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#include "compressibleCourantNo.H"
|
||||||
|
#include "setDeltaT.H"
|
||||||
|
}
|
||||||
|
|
||||||
++runTime;
|
++runTime;
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "rhoEqn.H"
|
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
while (pimple.loop())
|
while (pimple.loop())
|
||||||
{
|
{
|
||||||
|
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||||
|
{
|
||||||
|
// Store momentum to set rhoUf for introduced faces.
|
||||||
|
autoPtr<volVectorField> rhoU;
|
||||||
|
if (rhoUf.valid())
|
||||||
|
{
|
||||||
|
rhoU.reset(new volVectorField("rhoU", rho*U));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do any mesh changes
|
||||||
|
mesh.update();
|
||||||
|
|
||||||
|
if (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 "correctPhi.H"
|
||||||
|
|
||||||
|
// Make the fluxes relative to the mesh-motion
|
||||||
|
fvc::makeRelative(phi, rho, U);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkMeshCourantNo)
|
||||||
|
{
|
||||||
|
#include "meshCourantNo.H"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pimple.firstIter() && !pimple.SIMPLErho())
|
||||||
|
{
|
||||||
|
#include "rhoEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "EEqn.H"
|
#include "EEqn.H"
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
Info<< "Reading thermophysical properties\n" << endl;
|
Info<< "Reading thermophysical properties\n" << endl;
|
||||||
|
|
||||||
autoPtr<rhoThermo> pThermo(rhoThermo::New(mesh));
|
autoPtr<rhoThermo> pThermo(rhoThermo::New(mesh));
|
||||||
|
@ -28,6 +28,8 @@ MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
|
|||||||
// Update the pressure BCs to ensure flux consistency
|
// Update the pressure BCs to ensure flux consistency
|
||||||
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
|
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
|
||||||
|
|
||||||
|
fvc::makeRelative(phiHbyA, rho, U);
|
||||||
|
|
||||||
fvScalarMatrix p_rghDDtEqn
|
fvScalarMatrix p_rghDDtEqn
|
||||||
(
|
(
|
||||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||||
@ -104,7 +106,15 @@ else
|
|||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
|
// Correct rhoUf if the mesh is moving
|
||||||
|
fvc::correctRhoUf(rhoUf, rho, U, phi);
|
||||||
|
|
||||||
if (thermo.dpdt())
|
if (thermo.dpdt())
|
||||||
{
|
{
|
||||||
dpdt = fvc::ddt(p);
|
dpdt = fvc::ddt(p);
|
||||||
|
|
||||||
|
if (mesh.moving())
|
||||||
|
{
|
||||||
|
dpdt -= fvc::div(fvc::meshPhi(rho, U), p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user