diff --git a/applications/solvers/compressible/rhoCentralFoam/Allwclean b/applications/solvers/compressible/rhoCentralFoam/Allwclean
index 6ccfad7e88..b9be2951e1 100755
--- a/applications/solvers/compressible/rhoCentralFoam/Allwclean
+++ b/applications/solvers/compressible/rhoCentralFoam/Allwclean
@@ -4,6 +4,5 @@ cd "${0%/*}" || exit # Run from this directory
wclean libso BCs
wclean
-wclean rhoCentralDyMFoam
#------------------------------------------------------------------------------
diff --git a/applications/solvers/compressible/rhoCentralFoam/Allwmake b/applications/solvers/compressible/rhoCentralFoam/Allwmake
index 58d48467be..2145b78e85 100755
--- a/applications/solvers/compressible/rhoCentralFoam/Allwmake
+++ b/applications/solvers/compressible/rhoCentralFoam/Allwmake
@@ -5,8 +5,7 @@ cd "${0%/*}" || exit # Run from this directory
(
wmake $targetType BCs \
- && wmake $targetType \
- && wmake $targetType rhoCentralDyMFoam \
+ && wmake $targetType
)
#------------------------------------------------------------------------------
diff --git a/applications/solvers/compressible/rhoCentralFoam/Make/options b/applications/solvers/compressible/rhoCentralFoam/Make/options
index b18659e4c8..2b1b8035dc 100644
--- a/applications/solvers/compressible/rhoCentralFoam/Make/options
+++ b/applications/solvers/compressible/rhoCentralFoam/Make/options
@@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
- -I$(LIB_SRC)/dynamicMesh/lnInclude
+ -I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
@@ -18,4 +18,6 @@ EXE_LIBS = \
-lspecie \
-lrhoCentralFoam \
-lturbulenceModels \
- -lcompressibleTurbulenceModels
+ -lcompressibleTurbulenceModels \
+ -ldynamicFvMesh \
+ -ltopoChangerFvMesh
diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/Make/files b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/Make/files
deleted file mode 100644
index f78400aa8d..0000000000
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-rhoCentralDyMFoam.C
-
-EXE = $(FOAM_APPBIN)/rhoCentralDyMFoam
diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/Make/options b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/Make/options
deleted file mode 100644
index 1489edb1b5..0000000000
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/Make/options
+++ /dev/null
@@ -1,26 +0,0 @@
-EXE_INC = \
- -I.. \
- -I../BCs/lnInclude \
- -I$(LIB_SRC)/finiteVolume/lnInclude \
- -I$(LIB_SRC)/meshTools/lnInclude \
- -I$(LIB_SRC)/transportModels/compressible/lnInclude \
- -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
- -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
- -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
- -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
- -I$(LIB_SRC)/dynamicMesh/lnInclude \
- -I$(LIB_SRC)/dynamicFvMesh/lnInclude
-
-EXE_LIBS = \
- -lfiniteVolume \
- -lfvOptions \
- -lmeshTools \
- -lcompressibleTransportModels \
- -lfluidThermophysicalModels \
- -lspecie \
- -lrhoCentralFoam \
- -lturbulenceModels \
- -lcompressibleTurbulenceModels \
- -ldynamicMesh \
- -ldynamicFvMesh \
- -ltopoChangerFvMesh
diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
deleted file mode 100644
index 662287d831..0000000000
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
+++ /dev/null
@@ -1,288 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2011-2016 OpenFOAM Foundation
--------------------------------------------------------------------------------
-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 .
-
-Application
- rhoCentralDyMFoam
-
-Group
- grpCompressibleSolvers grpMovingMeshSolvers
-
-Description
- Density-based compressible flow solver based on central-upwind
- schemes of Kurganov and Tadmor
- with support for mesh-motion and topology changes.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-#include "dynamicFvMesh.H"
-#include "psiThermo.H"
-#include "turbulentFluidThermoModel.H"
-#include "fixedRhoFvPatchScalarField.H"
-#include "directionInterpolate.H"
-#include "localEulerDdtScheme.H"
-#include "fvcSmooth.H"
-#include "motionSolver.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-int main(int argc, char *argv[])
-{
- argList::addNote
- (
- "Density-based compressible flow solver based on central-upwind"
- " schemes of Kurganov and Tadmor.\n"
- "With support for mesh-motion and topology changes."
- );
-
- #define NO_CONTROL
- #include "postProcess.H"
-
- #include "setRootCaseLists.H"
- #include "createTime.H"
- #include "createDynamicFvMesh.H"
- #include "createFields.H"
- #include "createFieldRefs.H"
- #include "createTimeControls.H"
-
- turbulence->validate();
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
- #include "readFluxScheme.H"
-
- const dimensionedScalar v_zero(dimVolume/dimTime, Zero);
-
- // Courant numbers used to adjust the time-step
- scalar CoNum = 0.0;
- scalar meanCoNum = 0.0;
-
- Info<< "\nStarting time loop\n" << endl;
-
- while (runTime.run())
- {
- #include "readTimeControls.H"
- #include "setDeltaT.H"
-
- ++runTime;
-
- Info<< "Time = " << runTime.timeName() << nl << endl;
-
- // Do any mesh changes
- mesh.update();
-
- // --- Directed interpolation of primitive fields onto faces
-
- surfaceScalarField rho_pos(interpolate(rho, pos));
- surfaceScalarField rho_neg(interpolate(rho, neg));
-
- surfaceVectorField rhoU_pos(interpolate(rhoU, pos, U.name()));
- surfaceVectorField rhoU_neg(interpolate(rhoU, neg, U.name()));
-
- volScalarField rPsi("rPsi", 1.0/psi);
- surfaceScalarField rPsi_pos(interpolate(rPsi, pos, T.name()));
- surfaceScalarField rPsi_neg(interpolate(rPsi, neg, T.name()));
-
- surfaceScalarField e_pos(interpolate(e, pos, T.name()));
- surfaceScalarField e_neg(interpolate(e, neg, T.name()));
-
- surfaceVectorField U_pos("U_pos", rhoU_pos/rho_pos);
- surfaceVectorField U_neg("U_neg", rhoU_neg/rho_neg);
-
- surfaceScalarField p_pos("p_pos", rho_pos*rPsi_pos);
- surfaceScalarField p_neg("p_neg", rho_neg*rPsi_neg);
-
- surfaceScalarField phiv_pos("phiv_pos", U_pos & mesh.Sf());
- surfaceScalarField phiv_neg("phiv_neg", U_neg & mesh.Sf());
-
- // Make fluxes relative to mesh-motion
- if (mesh.moving())
- {
- phiv_pos -= mesh.phi();
- phiv_neg -= mesh.phi();
- }
- // Note: extracted out the orientation so becomes unoriented
- phiv_pos.setOriented(false);
- phiv_neg.setOriented(false);
-
- volScalarField c("c", sqrt(thermo.Cp()/thermo.Cv()*rPsi));
- surfaceScalarField cSf_pos
- (
- "cSf_pos",
- interpolate(c, pos, T.name())*mesh.magSf()
- );
- surfaceScalarField cSf_neg
- (
- "cSf_neg",
- interpolate(c, neg, T.name())*mesh.magSf()
- );
-
- surfaceScalarField ap
- (
- "ap",
- max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero)
- );
- surfaceScalarField am
- (
- "am",
- min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero)
- );
-
- surfaceScalarField a_pos("a_pos", ap/(ap - am));
-
- surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap)));
-
- surfaceScalarField aSf("aSf", am*a_pos);
-
- if (fluxScheme == "Tadmor")
- {
- aSf = -0.5*amaxSf;
- a_pos = 0.5;
- }
-
- surfaceScalarField a_neg("a_neg", 1.0 - a_pos);
-
- phiv_pos *= a_pos;
- phiv_neg *= a_neg;
-
- surfaceScalarField aphiv_pos("aphiv_pos", phiv_pos - aSf);
- surfaceScalarField aphiv_neg("aphiv_neg", phiv_neg + aSf);
-
- // Reuse amaxSf for the maximum positive and negative fluxes
- // estimated by the central scheme
- amaxSf = max(mag(aphiv_pos), mag(aphiv_neg));
-
- #include "centralCourantNo.H"
-
- phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg;
-
- surfaceVectorField phiU(aphiv_pos*rhoU_pos + aphiv_neg*rhoU_neg);
- // Note: reassembled orientation from the pos and neg parts so becomes
- // oriented
- phiU.setOriented(true);
-
- surfaceVectorField phiUp(phiU + (a_pos*p_pos + a_neg*p_neg)*mesh.Sf());
-
- surfaceScalarField phiEp
- (
- "phiEp",
- aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos)
- + aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg)
- + aSf*p_pos - aSf*p_neg
- );
-
- // Make flux for pressure-work absolute
- if (mesh.moving())
- {
- surfaceScalarField phia(a_pos*p_pos + a_neg*p_neg);
- phia.setOriented(true);
-
- phiEp += mesh.phi()*phia;
- }
-
- volScalarField muEff("muEff", turbulence->muEff());
- volTensorField tauMC("tauMC", muEff*dev2(Foam::T(fvc::grad(U))));
-
- // --- Solve density
- solve(fvm::ddt(rho) + fvc::div(phi));
-
- // --- Solve momentum
- solve(fvm::ddt(rhoU) + fvc::div(phiUp));
-
- U.ref() =
- rhoU()
- /rho();
- U.correctBoundaryConditions();
- rhoU.boundaryFieldRef() == rho.boundaryField()*U.boundaryField();
-
- if (!inviscid)
- {
- solve
- (
- fvm::ddt(rho, U) - fvc::ddt(rho, U)
- - fvm::laplacian(muEff, U)
- - fvc::div(tauMC)
- );
- rhoU = rho*U;
- }
-
- // --- Solve energy
- surfaceScalarField sigmaDotU
- (
- "sigmaDotU",
- (
- fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U)
- + fvc::dotInterpolate(mesh.Sf(), tauMC)
- )
- & (a_pos*U_pos + a_neg*U_neg)
- );
-
- solve
- (
- fvm::ddt(rhoE)
- + fvc::div(phiEp)
- - fvc::div(sigmaDotU)
- );
-
- e = rhoE/rho - 0.5*magSqr(U);
- e.correctBoundaryConditions();
- thermo.correct();
- rhoE.boundaryFieldRef() ==
- rho.boundaryField()*
- (
- e.boundaryField() + 0.5*magSqr(U.boundaryField())
- );
-
- if (!inviscid)
- {
- solve
- (
- fvm::ddt(rho, e) - fvc::ddt(rho, e)
- - fvm::laplacian(turbulence->alphaEff(), e)
- );
- thermo.correct();
- rhoE = rho*(e + 0.5*magSqr(U));
- }
-
- p.ref() =
- rho()
- /psi();
- p.correctBoundaryConditions();
- rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField();
-
- turbulence->correct();
-
- runTime.write();
-
- runTime.printExecutionTime(Info);
- }
-
- Info<< "End\n" << endl;
-
- return 0;
-}
-
-
-// ************************************************************************* //
diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
index 0cb9966a13..84379df585 100644
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
+++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
+ Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -30,12 +31,14 @@ Group
grpCompressibleSolvers
Description
- Density-based compressible flow solver based on central-upwind
- schemes of Kurganov and Tadmor.
+ Density-based compressible flow solver based on
+ central-upwind schemes of Kurganov and Tadmor with
+ support for mesh-motion and topology changes.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
+#include "dynamicFvMesh.H"
#include "psiThermo.H"
#include "turbulentFluidThermoModel.H"
#include "fixedRhoFvPatchScalarField.H"
@@ -49,8 +52,9 @@ int main(int argc, char *argv[])
{
argList::addNote
(
- "Density-based compressible flow solver based on central-upwind"
- " schemes of Kurganov and Tadmor."
+ "Density-based compressible flow solver based on"
+ " central-upwind schemes of Kurganov and Tadmor with"
+ " support for mesh-motion and topology changes."
);
#define NO_CONTROL
@@ -59,7 +63,7 @@ int main(int argc, char *argv[])
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
- #include "createMesh.H"
+ #include "createDynamicFvMesh.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createTimeControls.H"
@@ -80,6 +84,18 @@ int main(int argc, char *argv[])
while (runTime.run())
{
+ #include "readTimeControls.H"
+
+ if (!LTS)
+ {
+ #include "setDeltaT.H"
+
+ ++runTime;
+
+ // Do any mesh changes
+ mesh.update();
+ }
+
// --- Directed interpolation of primitive fields onto faces
surfaceScalarField rho_pos(interpolate(rho, pos));
@@ -107,6 +123,15 @@ int main(int argc, char *argv[])
surfaceScalarField phiv_neg("phiv_neg", U_neg & mesh.Sf());
phiv_neg.setOriented(false);
+ // Make fluxes relative to mesh-motion
+ if (mesh.moving())
+ {
+ surfaceScalarField meshPhi(mesh.phi());
+ meshPhi.setOriented(false);
+ phiv_pos -= meshPhi;
+ phiv_neg -= meshPhi;
+ }
+
volScalarField c("c", sqrt(thermo.Cp()/thermo.Cv()*rPsi));
surfaceScalarField cSf_pos
(
@@ -157,18 +182,13 @@ int main(int argc, char *argv[])
amaxSf = max(mag(aphiv_pos), mag(aphiv_neg));
#include "centralCourantNo.H"
- #include "readTimeControls.H"
if (LTS)
{
#include "setRDeltaT.H"
- }
- else
- {
- #include "setDeltaT.H"
- }
- ++runTime;
+ ++runTime;
+ }
Info<< "Time = " << runTime.timeName() << nl << endl;
@@ -189,6 +209,14 @@ int main(int argc, char *argv[])
+ aSf*p_pos - aSf*p_neg
);
+ // Make flux for pressure-work absolute
+ if (mesh.moving())
+ {
+ surfaceScalarField meshPhi(mesh.phi());
+ meshPhi.setOriented(false);
+ phiEp += meshPhi*(a_pos*p_pos + a_neg*p_neg);
+ }
+
volScalarField muEff("muEff", turbulence->muEff());
volTensorField tauMC("tauMC", muEff*dev2(Foam::T(fvc::grad(U))));
diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options
index 59302f6e45..c5cad12447 100644
--- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options
@@ -1,8 +1,11 @@
EXE_INC = \
-I../buoyantBoussinesqSimpleFoam \
+ -I../../incompressible/pimpleFoam \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/finiteVolume/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/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
@@ -13,6 +16,8 @@ EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
+ -ldynamicMesh \
+ -ldynamicFvMesh \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C
index 4ac185c121..58d5deef52 100644
--- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C
+++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
+ Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -30,7 +31,8 @@ Group
grpHeatTransferSolvers
Description
- Transient solver for buoyant, turbulent flow of incompressible fluids.
+ Transient solver for buoyant, turbulent flow of incompressible fluids,
+ with optional mesh motion and mesh topology changes.
Uses the Boussinesq approximation:
\f[
@@ -51,9 +53,11 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
+#include "dynamicFvMesh.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "radiationModel.H"
+#include "CorrectPhi.H"
#include "fvOptions.H"
#include "pimpleControl.H"
@@ -64,7 +68,8 @@ int main(int argc, char *argv[])
argList::addNote
(
"Transient solver for buoyant, turbulent flow"
- " of incompressible fluids.\n"
+ " of incompressible fluids, with optional mesh"
+ " motion and mesh topology changes.\n"
"Uses the Boussinesq approximation."
);
@@ -73,10 +78,10 @@ int main(int argc, char *argv[])
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
- #include "createMesh.H"
- #include "createControl.H"
+ #include "createDynamicFvMesh.H"
+ #include "createDyMControls.H"
#include "createFields.H"
- #include "createTimeControls.H"
+ #include "createUfIfPresent.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
#include "initContinuityErrs.H"
@@ -89,7 +94,7 @@ int main(int argc, char *argv[])
while (runTime.run())
{
- #include "readTimeControls.H"
+ #include "readDyMControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
@@ -100,6 +105,34 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
+ if (pimple.firstIter() || moveMeshOuterCorrectors)
+ {
+ // Do any mesh changes
+ mesh.controlledUpdate();
+
+ if (mesh.changing())
+ {
+ MRF.update();
+
+ if (correctPhi)
+ {
+ // Calculate absolute flux
+ // from the mapped surface velocity
+ phi = mesh.Sf() & Uf();
+
+ #include "correctPhi.H"
+
+ // Make the flux relative to the mesh motion
+ fvc::makeRelative(phi, U);
+ }
+
+ if (checkMeshCourantNo)
+ {
+ #include "meshCourantNo.H"
+ }
+ }
+ }
+
#include "UEqn.H"
#include "TEqn.H"
diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H
index 0eeb6e15a3..d6f04136dd 100644
--- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H
+++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H
@@ -42,6 +42,12 @@
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions();
fvOptions.correct(U);
+
+ // Correct Uf if the mesh is moving
+ fvc::correctUf(Uf, U, phi);
+
+ // Make the fluxes relative to the mesh motion
+ fvc::makeRelative(phi, U);
}
}
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
index d3224df411..a9b16d2f25 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
@@ -1,4 +1,5 @@
EXE_INC = \
+ -I../../compressible/rhoPimpleFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
@@ -7,6 +8,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
+ -I$(LIB_SRC)/dynamicMesh/lnInclude \
+ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \
@@ -21,4 +24,7 @@ EXE_LIBS = \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-latmosphericModels \
+ -ldynamicMesh \
+ -ldynamicFvMesh \
+ -ltopoChangerFvMesh \
-lregionFaModels
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C
index 691916c17e..70595ebba3 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
+ Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -30,8 +31,9 @@ Group
grpHeatTransferSolvers
Description
- Transient solver for buoyant, turbulent flow of compressible fluids for
- ventilation and heat-transfer.
+ Transient solver for buoyant, turbulent flow of compressible fluids
+ for ventilation and heat-transfer, with optional mesh motion
+ and mesh topology changes.
Turbulence is modelled using a run-time selectable compressible RAS or
LES model.
@@ -39,12 +41,16 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
+#include "dynamicFvMesh.H"
#include "rhoThermo.H"
#include "turbulentFluidThermoModel.H"
#include "radiationModel.H"
+#include "CorrectPhi.H"
#include "fvOptions.H"
#include "pimpleControl.H"
#include "pressureControl.H"
+#include "localEulerDdtScheme.H"
+#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -53,7 +59,8 @@ int main(int argc, char *argv[])
argList::addNote
(
"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"
@@ -61,36 +68,105 @@ int main(int argc, char *argv[])
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
- #include "createMesh.H"
- #include "createControl.H"
+ #include "createDynamicFvMesh.H"
+ #include "createDyMControls.H"
+ #include "initContinuityErrs.H"
#include "createFields.H"
#include "createFieldRefs.H"
- #include "initContinuityErrs.H"
- #include "createTimeControls.H"
- #include "compressibleCourantNo.H"
- #include "setInitialDeltaT.H"
+ #include "createRhoUfIfPresent.H"
turbulence->validate();
+ if (!LTS)
+ {
+ #include "compressibleCourantNo.H"
+ #include "setInitialDeltaT.H"
+ }
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
- #include "readTimeControls.H"
- #include "compressibleCourantNo.H"
- #include "setDeltaT.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 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;
Info<< "Time = " << runTime.timeName() << nl << endl;
- #include "rhoEqn.H"
-
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
+ if (pimple.firstIter() || moveMeshOuterCorrectors)
+ {
+ // Store momentum to set rhoUf for introduced faces.
+ autoPtr 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 "EEqn.H"
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H
index 22dc129a87..813d1c3240 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H
@@ -1,3 +1,5 @@
+#include "createRDeltaT.H"
+
Info<< "Reading thermophysical properties\n" << endl;
autoPtr pThermo(rhoThermo::New(mesh));
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
index 886f9c6a5f..733e97028d 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
@@ -28,6 +28,8 @@ MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
+fvc::makeRelative(phiHbyA, rho, U);
+
fvScalarMatrix p_rghDDtEqn
(
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
@@ -104,7 +106,15 @@ else
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/tutorials/compressible/rhoCentralDyMFoam/movingCone/0/T b/tutorials/compressible/rhoCentralFoam/movingCone/0/T
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/0/T
rename to tutorials/compressible/rhoCentralFoam/movingCone/0/T
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/0/U b/tutorials/compressible/rhoCentralFoam/movingCone/0/U
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/0/U
rename to tutorials/compressible/rhoCentralFoam/movingCone/0/U
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/0/p b/tutorials/compressible/rhoCentralFoam/movingCone/0/p
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/0/p
rename to tutorials/compressible/rhoCentralFoam/movingCone/0/p
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/0/pointMotionUx b/tutorials/compressible/rhoCentralFoam/movingCone/0/pointMotionUx
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/0/pointMotionUx
rename to tutorials/compressible/rhoCentralFoam/movingCone/0/pointMotionUx
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/constant/dynamicMeshDict b/tutorials/compressible/rhoCentralFoam/movingCone/constant/dynamicMeshDict
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/constant/dynamicMeshDict
rename to tutorials/compressible/rhoCentralFoam/movingCone/constant/dynamicMeshDict
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/constant/thermophysicalProperties b/tutorials/compressible/rhoCentralFoam/movingCone/constant/thermophysicalProperties
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/constant/thermophysicalProperties
rename to tutorials/compressible/rhoCentralFoam/movingCone/constant/thermophysicalProperties
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/constant/turbulenceProperties b/tutorials/compressible/rhoCentralFoam/movingCone/constant/turbulenceProperties
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/constant/turbulenceProperties
rename to tutorials/compressible/rhoCentralFoam/movingCone/constant/turbulenceProperties
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/system/blockMeshDict b/tutorials/compressible/rhoCentralFoam/movingCone/system/blockMeshDict
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/system/blockMeshDict
rename to tutorials/compressible/rhoCentralFoam/movingCone/system/blockMeshDict
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/system/controlDict b/tutorials/compressible/rhoCentralFoam/movingCone/system/controlDict
similarity index 97%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/system/controlDict
rename to tutorials/compressible/rhoCentralFoam/movingCone/system/controlDict
index 1342119574..45ca953a39 100644
--- a/tutorials/compressible/rhoCentralDyMFoam/movingCone/system/controlDict
+++ b/tutorials/compressible/rhoCentralFoam/movingCone/system/controlDict
@@ -14,7 +14,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-application rhoCentralDyMFoam;
+application rhoCentralFoam;
startFrom startTime;
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/system/cuttingPlane b/tutorials/compressible/rhoCentralFoam/movingCone/system/cuttingPlane
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/system/cuttingPlane
rename to tutorials/compressible/rhoCentralFoam/movingCone/system/cuttingPlane
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/system/fvSchemes b/tutorials/compressible/rhoCentralFoam/movingCone/system/fvSchemes
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/system/fvSchemes
rename to tutorials/compressible/rhoCentralFoam/movingCone/system/fvSchemes
diff --git a/tutorials/compressible/rhoCentralDyMFoam/movingCone/system/fvSolution b/tutorials/compressible/rhoCentralFoam/movingCone/system/fvSolution
similarity index 100%
rename from tutorials/compressible/rhoCentralDyMFoam/movingCone/system/fvSolution
rename to tutorials/compressible/rhoCentralFoam/movingCone/system/fvSolution