buoyantFoam: Merged buoyantSimpleFoam and buoyantPimpleFoam

Solver for steady or transient buoyant, turbulent flow of compressible fluids
for ventilation and heat-transfer, with optional mesh motion and mesh topology
changes.  Created by merging buoyantSimpleFoam and buoyantPimpleFoam to provide
a more general solver and simplify maintenance.
This commit is contained in:
Henry Weller
2022-02-18 12:20:54 +00:00
parent 46895490c7
commit d40ecd78eb
274 changed files with 268 additions and 489 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -179,7 +179,7 @@ int main(int argc, char *argv[])
// --- Pressure corrector loop // --- Pressure corrector loop
while (pimple.correct()) while (pimple.correct())
{ {
#include "../../../heatTransfer/buoyantPimpleFoam/pEqn.H" #include "../../../heatTransfer/buoyantFoam/pEqn.H"
} }
if (pimple.turbCorr()) if (pimple.turbCorr())

View File

@ -0,0 +1,3 @@
buoyantFoam.C
EXE = $(FOAM_APPBIN)/buoyantFoam

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,12 +22,12 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application Application
buoyantPimpleFoam buoyantFoam
Description Description
Transient solver for buoyant, turbulent flow of compressible fluids for Solver for steady or transient buoyant, turbulent flow of compressible
ventilation and heat-transfer, with optional mesh motion and fluids for ventilation and heat-transfer, with optional mesh motion and mesh
mesh topology changes. topology changes.
Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
pseudo-transient simulations. pseudo-transient simulations.

View File

@ -1,3 +0,0 @@
buoyantPimpleFoam.C
EXE = $(FOAM_APPBIN)/buoyantPimpleFoam

View File

@ -1,27 +0,0 @@
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::div(phi, he)
+ (
he.name() == "e"
? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
+ thermophysicalTransport->divq(he)
==
rho*(U&g)
+ fvModels.source(rho, he)
);
EEqn.relax();
fvConstraints.constrain(EEqn);
EEqn.solve();
fvConstraints.constrain(he);
thermo.correct();
}

View File

@ -1,3 +0,0 @@
buoyantSimpleFoam.C
EXE = $(FOAM_APPBIN)/buoyantSimpleFoam

View File

@ -1,23 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvModels \
-lfvConstraints \
-lsampling \
-lmeshTools \
-lthermophysicalTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lmomentumTransportModels \
-lcompressibleMomentumTransportModels \
-lmeshTools

View File

@ -1,35 +0,0 @@
// Solve the Momentum equation
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)
+ MRF.DDt(rho, U)
+ turbulence->divDevTau(U)
==
fvModels.source(rho, U)
);
fvVectorMatrix& UEqn = tUEqn.ref();
UEqn.relax();
fvConstraints.constrain(UEqn);
if (simple.momentumPredictor())
{
solve
(
UEqn
==
fvc::reconstruct
(
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
fvConstraints.constrain(U);
}

View File

@ -1,91 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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 <http://www.gnu.org/licenses/>.
Application
buoyantSimpleFoam
Description
Steady-state solver for buoyant, turbulent flow of compressible fluids,
including radiation, for ventilation and heat-transfer.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "compressibleMomentumTransportModels.H"
#include "fluidThermophysicalTransportModel.H"
#include "simpleControl.H"
#include "pressureReference.H"
#include "hydrostaticInitialisation.H"
#include "fvModels.H"
#include "fvConstraints.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "initContinuityErrs.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (simple.loop(runTime))
{
Info<< "Time = " << runTime.userTimeName() << nl << endl;
fvModels.correct();
// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "EEqn.H"
#include "pEqn.H"
}
turbulence->correct();
thermophysicalTransport->correct();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1 +0,0 @@
const volScalarField& psi = thermo.psi();

View File

@ -1,105 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh));
fluidThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField& p = thermo.p();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermo.rho()
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::momentumTransportModel> turbulence
(
compressible::momentumTransportModel::New
(
rho,
U,
phi,
thermo
)
);
Info<< "Creating thermophysical transport model\n" << endl;
autoPtr<fluidThermophysicalTransportModel> thermophysicalTransport
(
fluidThermophysicalTransportModel::New(turbulence(), thermo)
);
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
#include "readpRef.H"
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
pressureReference pressureReference
(
p,
p_rgh,
simple.dict(),
thermo.incompressible()
);
mesh.setFluxRequired(p_rgh.name());
hydrostaticInitialisation
(
p_rgh,
p,
rho,
U,
gh,
ghf,
pRef,
thermo,
simple.dict()
);
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
#include "createMRF.H"
#include "createFvModels.H"
#include "createFvConstraints.H"
#include "checkRadiationModel.H"

View File

@ -1,115 +0,0 @@
rho = thermo.rho();
if (!simple.transonic())
{
rho.relax();
}
const volScalarField rAU("rAU", 1.0/UEqn.A());
const surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
tUEqn.clear();
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::interpolate(rho)*fvc::flux(HbyA)
);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
bool closedVolume = adjustPhi(phiHbyA, U, p_rgh);
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
phiHbyA += phig;
// Update the pressure BCs to ensure flux consistency
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
fvScalarMatrix p_rghEqn(p_rgh, dimMass/dimTime);
if (simple.transonic())
{
surfaceScalarField phid
(
"phid",
(fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
);
phiHbyA -= fvc::interpolate(psi*p_rgh)*phiHbyA/fvc::interpolate(rho);
while (simple.correctNonOrthogonal())
{
p_rghEqn =
fvc::div(phiHbyA) + fvm::div(phid, p_rgh)
- fvm::laplacian(rhorAUf, p_rgh)
==
fvModels.source(psi, p_rgh, rho.name());
// Relax the pressure equation to ensure diagonal-dominance
p_rghEqn.relax();
p_rghEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
p_rghEqn.solve();
}
}
else
{
while (simple.correctNonOrthogonal())
{
p_rghEqn =
fvc::div(phiHbyA)
- fvm::laplacian(rhorAUf, p_rgh)
==
fvModels.source(psi, p_rgh, rho.name());
p_rghEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
p_rghEqn.solve();
}
}
phi = phiHbyA + p_rghEqn.flux();
p = p_rgh + rho*gh + pRef;
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p_rgh.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
U.correctBoundaryConditions();
fvConstraints.constrain(U);
fvConstraints.constrain(p);
// For closed-volume compressible cases adjust the pressure level
// to obey overall mass continuity
if (closedVolume && !thermo.incompressible())
{
p += (initialMass - fvc::domainIntegrate(thermo.rho()))
/fvc::domainIntegrate(psi);
p_rgh = p - rho*gh - pRef;
p.correctBoundaryConditions();
}
rho = thermo.rho();
if (!simple.transonic())
{
rho.relax();
}

View File

@ -52,7 +52,7 @@ else
// --- PISO loop // --- PISO loop
while (pimple.correct()) while (pimple.correct())
{ {
#include "../../buoyantPimpleFoam/pEqn.H" #include "../../buoyantFoam/pEqn.H"
} }
if (pimples.pimpleTurbCorr(i)) if (pimples.pimpleTurbCorr(i))

39
bin/buoyantPimpleFoam Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# 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 <http://www.gnu.org/licenses/>.
#
# Script
# buoyantPimpleFoam
#
# Description
# Script to inform the user that the buoyantPimpleFoam solver
# has been replaced by the more general buoyantFoam which can be used
# for both steady and transient cases.
#
#------------------------------------------------------------------------------
echo "The buoyantPimpleFoam solver has been replaced"
echo "by the more general buoyantFoam solver"
echo "which can be used for both steady and transient cases."
#------------------------------------------------------------------------------

39
bin/buoyantSimpleFoam Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# 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 <http://www.gnu.org/licenses/>.
#
# Script
# buoyantSimpleFoam
#
# Description
# Script to inform the user that the buoyantSimpleFoam solver
# has been replaced by the more general buoyantFoam which can be used
# for both steady and transient cases.
#
#------------------------------------------------------------------------------
echo "The buoyantSimpleFoam solver has been replaced"
echo "by the more general buoyantFoam solver"
echo "which can be used for both steady and transient cases."
#------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org # \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -282,7 +282,7 @@ _boxTurb_ ()
} }
complete -o filenames -o nospace -F _boxTurb_ boxTurb complete -o filenames -o nospace -F _boxTurb_ boxTurb
_buoyantPimpleFoam_ () _buoyantFoam_ ()
{ {
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}" local prev="${COMP_WORDS[COMP_CWORD-1]}"
@ -305,7 +305,7 @@ _buoyantPimpleFoam_ ()
esac esac
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
} }
complete -o filenames -o nospace -F _buoyantPimpleFoam_ buoyantPimpleFoam complete -o filenames -o nospace -F _buoyantFoam_ buoyantFoam
_buoyantReactingFoam_ () _buoyantReactingFoam_ ()
{ {
@ -332,31 +332,6 @@ _buoyantReactingFoam_ ()
} }
complete -o filenames -o nospace -F _buoyantReactingFoam_ buoyantReactingFoam complete -o filenames -o nospace -F _buoyantReactingFoam_ buoyantReactingFoam
_buoyantSimpleFoam_ ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
local line=${COMP_LINE}
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
opts="-case -doc -fileHandler -help -hostRoots -libs -listFunctionObjects -listFvConstraints -listFvModels -listMomentumTransportModels -listScalarBCs -listSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -roots -srcDoc"
for o in $used ; do opts="${opts/$o/}" ; done
extra=""
[ "$COMP_CWORD" = 1 ] || \
case "$prev" in
-case)
opts="" ; extra="-d" ;;
-fileHandler)
opts="uncollated collated masterUncollated" ; extra="" ;;
-hostRoots|-libs|-roots)
opts="" ; extra="" ;;
*) ;;
esac
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
}
complete -o filenames -o nospace -F _buoyantSimpleFoam_ buoyantSimpleFoam
_cavitatingFoam_ () _cavitatingFoam_ ()
{ {
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"

View File

@ -1,7 +1,7 @@
Overview Overview
======= =======
+ This is a template case for a closed volume + This is a template case for a closed volume
+ Setup to run buoyantSimpleFoam + Setup to run buoyantFoam
+ The case is designed to be meshed with snappyHexMesh + The case is designed to be meshed with snappyHexMesh
+ snappyHexMesh is setup to use a single trisurface file named CAD.obj + snappyHexMesh is setup to use a single trisurface file named CAD.obj
+ Copy the CAD.obj file to the constant/geometry directory + Copy the CAD.obj file to the constant/geometry directory

View File

@ -13,7 +13,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application buoyantSimpleFoam; application buoyantFoam;
startFrom latestTime; startFrom latestTime;

View File

@ -44,7 +44,8 @@ divSchemes
div(phi,e) $turbulence; div(phi,e) $turbulence;
div(phi,Ekp) bounded Gauss linear; div(phi,K) bounded Gauss linear;
div(phi,(p|rho)) bounded Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
} }

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application buoyantPimpleFoam; application buoyantFoam;
startFrom startTime; startFrom startTime;

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application buoyantPimpleFoam; application buoyantFoam;
startFrom latestTime; startFrom latestTime;

View File

@ -13,7 +13,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application buoyantSimpleFoam; application buoyantFoam;
startFrom startTime; startFrom startTime;

View File

@ -35,7 +35,7 @@ solvers
} }
} }
SIMPLE PIMPLE
{ {
momentumPredictor no; momentumPredictor no;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;

Some files were not shown because too many files have changed in this diff Show More