Add the OpenFOAM source tree
This commit is contained in:
37
Allwmake
Executable file
37
Allwmake
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
wmakeCheckPwd "$WM_PROJECT_DIR" || {
|
||||
echo "Error: Current directory is not \$WM_PROJECT_DIR"
|
||||
echo " The environment variables are inconsistent with the installation."
|
||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
||||
echo "Error: FOAM_EXT_LIBBIN not set"
|
||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# wmake is required for subsequent targets
|
||||
( cd wmake/src && make )
|
||||
|
||||
# build ThirdParty sources
|
||||
if [ -d "$WM_THIRD_PARTY_DIR" ]
|
||||
then
|
||||
$WM_THIRD_PARTY_DIR/Allwmake
|
||||
else
|
||||
echo "no ThirdParty sources found - skipping"
|
||||
fi
|
||||
|
||||
# build OpenFOAM libraries and applications
|
||||
src/Allwmake $*
|
||||
applications/Allwmake $*
|
||||
|
||||
if [ "$1" = doc ]
|
||||
then
|
||||
doc/Allwmake $*
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
22
applications/Allwmake
Executable file
22
applications/Allwmake
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
wmakeCheckPwd "$WM_PROJECT_DIR/applications" || {
|
||||
echo "Error: Current directory is not \$WM_PROJECT_DIR/applications"
|
||||
echo " The environment variables are inconsistent with the installation."
|
||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
||||
echo "Error: FOAM_EXT_LIBBIN not set"
|
||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
wmake all utilities $*
|
||||
wmake all solvers $*
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
3
applications/solvers/DNS/dnsFoam/Make/files
Normal file
3
applications/solvers/DNS/dnsFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
dnsFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/dnsFoam
|
||||
7
applications/solvers/DNS/dnsFoam/Make/options
Normal file
7
applications/solvers/DNS/dnsFoam/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/randomProcesses/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lrandomProcesses
|
||||
29
applications/solvers/DNS/dnsFoam/createFields.H
Normal file
29
applications/solvers/DNS/dnsFoam/createFields.H
Normal file
@ -0,0 +1,29 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
138
applications/solvers/DNS/dnsFoam/dnsFoam.C
Normal file
138
applications/solvers/DNS/dnsFoam/dnsFoam.C
Normal file
@ -0,0 +1,138 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
dnsFoam
|
||||
|
||||
Description
|
||||
Direct numerical simulation solver for boxes of isotropic turbulence
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "Kmesh.H"
|
||||
#include "UOprocess.H"
|
||||
#include "fft.H"
|
||||
#include "calcEk.H"
|
||||
#include "graph.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMeshNoClear.H"
|
||||
#include "readTransportProperties.H"
|
||||
#include "createFields.H"
|
||||
#include "readTurbulenceProperties.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< nl << "Starting time loop" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readPISOControls.H"
|
||||
|
||||
force.internalField() = ReImSum
|
||||
(
|
||||
fft::reverseTransform
|
||||
(
|
||||
K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
|
||||
)
|
||||
);
|
||||
|
||||
#include "globalProperties.H"
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(nu, U)
|
||||
==
|
||||
force
|
||||
);
|
||||
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=1; corr<=1; corr++)
|
||||
{
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ rAUf*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
phi = phiHbyA - pEqn.flux();
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
U = HbyA - rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
if (runTime.outputTime())
|
||||
{
|
||||
calcEk(U, K).write
|
||||
(
|
||||
runTime.path()/"graphs"/runTime.timeName(),
|
||||
"Ek",
|
||||
runTime.graphFormat()
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
20
applications/solvers/DNS/dnsFoam/globalProperties.H
Normal file
20
applications/solvers/DNS/dnsFoam/globalProperties.H
Normal file
@ -0,0 +1,20 @@
|
||||
Info<< "k("
|
||||
<< runTime.timeName()
|
||||
<< ") = "
|
||||
<< 3.0/2.0*average(magSqr(U)).value() << endl;
|
||||
|
||||
Info<< "epsilon("
|
||||
<< runTime.timeName()
|
||||
<< ") = "
|
||||
<< (
|
||||
0.5*nu*average
|
||||
(
|
||||
magSqr(fvc::grad(U) + fvc::grad(U)().T())
|
||||
)
|
||||
).value() << endl;
|
||||
|
||||
Info<< "U.f("
|
||||
<< runTime.timeName()
|
||||
<< ") = "
|
||||
<< 181.0*average(U & force).value() << endl;
|
||||
|
||||
18
applications/solvers/DNS/dnsFoam/readTransportProperties.H
Normal file
18
applications/solvers/DNS/dnsFoam/readTransportProperties.H
Normal file
@ -0,0 +1,18 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar nu
|
||||
(
|
||||
transportProperties.lookup("nu")
|
||||
);
|
||||
21
applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H
Normal file
21
applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H
Normal file
@ -0,0 +1,21 @@
|
||||
Info<< "Reading turbulenceProperties\n" << endl;
|
||||
|
||||
IOdictionary turbulenceProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"turbulenceProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
volVectorField force
|
||||
(
|
||||
U/dimensionedScalar("dt", dimTime, runTime.deltaTValue())
|
||||
);
|
||||
|
||||
Kmesh K(mesh);
|
||||
UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties);
|
||||
3
applications/solvers/basic/laplacianFoam/Make/files
Normal file
3
applications/solvers/basic/laplacianFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
laplacianFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/laplacianFoam
|
||||
3
applications/solvers/basic/laplacianFoam/Make/options
Normal file
3
applications/solvers/basic/laplacianFoam/Make/options
Normal file
@ -0,0 +1,3 @@
|
||||
EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = -lfiniteVolume
|
||||
37
applications/solvers/basic/laplacianFoam/createFields.H
Normal file
37
applications/solvers/basic/laplacianFoam/createFields.H
Normal file
@ -0,0 +1,37 @@
|
||||
Info<< "Reading field T\n" << endl;
|
||||
|
||||
volScalarField T
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading diffusivity DT\n" << endl;
|
||||
|
||||
dimensionedScalar DT
|
||||
(
|
||||
transportProperties.lookup("DT")
|
||||
);
|
||||
76
applications/solvers/basic/laplacianFoam/laplacianFoam.C
Normal file
76
applications/solvers/basic/laplacianFoam/laplacianFoam.C
Normal file
@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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
|
||||
laplacianFoam
|
||||
|
||||
Description
|
||||
Solves a simple Laplace equation, e.g. for thermal diffusion in a solid.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createFields.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nCalculating temperature distribution\n" << endl;
|
||||
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
while (simple.correctNonOrthogonal())
|
||||
{
|
||||
solve
|
||||
(
|
||||
fvm::ddt(T) - fvm::laplacian(DT, T)
|
||||
);
|
||||
}
|
||||
|
||||
#include "write.H"
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
46
applications/solvers/basic/laplacianFoam/write.H
Normal file
46
applications/solvers/basic/laplacianFoam/write.H
Normal file
@ -0,0 +1,46 @@
|
||||
if (runTime.outputTime())
|
||||
{
|
||||
volVectorField gradT(fvc::grad(T));
|
||||
|
||||
volScalarField gradTx
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gradTx",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
gradT.component(vector::X)
|
||||
);
|
||||
|
||||
volScalarField gradTy
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gradTy",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
gradT.component(vector::Y)
|
||||
);
|
||||
|
||||
volScalarField gradTz
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gradTz",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
gradT.component(vector::Z)
|
||||
);
|
||||
|
||||
|
||||
runTime.write();
|
||||
}
|
||||
3
applications/solvers/basic/potentialFoam/Make/files
Normal file
3
applications/solvers/basic/potentialFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
potentialFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/potentialFoam
|
||||
11
applications/solvers/basic/potentialFoam/Make/options
Normal file
11
applications/solvers/basic/potentialFoam/Make/options
Normal file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lfvOptions \
|
||||
-lsampling
|
||||
62
applications/solvers/basic/potentialFoam/createFields.H
Normal file
62
applications/solvers/basic/potentialFoam/createFields.H
Normal file
@ -0,0 +1,62 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
p = dimensionedScalar("zero", p.dimensions(), 0.0);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
U = dimensionedVector("0", U.dimensions(), vector::zero);
|
||||
|
||||
surfaceScalarField phi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvc::interpolate(U) & mesh.Sf()
|
||||
);
|
||||
|
||||
if (args.optionFound("initialiseUBCs"))
|
||||
{
|
||||
U.correctBoundaryConditions();
|
||||
phi = fvc::interpolate(U) & mesh.Sf();
|
||||
}
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
potentialFlow,
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
129
applications/solvers/basic/potentialFoam/potentialFoam.C
Normal file
129
applications/solvers/basic/potentialFoam/potentialFoam.C
Normal file
@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
potentialFoam
|
||||
|
||||
Description
|
||||
Simple potential flow solver which can be used to generate starting fields
|
||||
for full Navier-Stokes codes.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "fvIOoptionList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption("writep", "write the final pressure field");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"initialiseUBCs",
|
||||
"initialise U boundary conditions"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< nl << "Calculating potential flow" << endl;
|
||||
|
||||
// Since solver contains no time loop it would never execute
|
||||
// function objects so do it ourselves
|
||||
runTime.functionObjects().start();
|
||||
|
||||
fvOptions.makeRelative(phi);
|
||||
|
||||
adjustPhi(phi, U, p);
|
||||
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian
|
||||
(
|
||||
dimensionedScalar
|
||||
(
|
||||
"1",
|
||||
dimTime/p.dimensions()*dimensionSet(0, 2, -2, 0, 0),
|
||||
1
|
||||
),
|
||||
p
|
||||
)
|
||||
==
|
||||
fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
fvOptions.makeAbsolute(phi);
|
||||
|
||||
Info<< "continuity error = "
|
||||
<< mag(fvc::div(phi))().weightedAverage(mesh.V()).value()
|
||||
<< endl;
|
||||
|
||||
U = fvc::reconstruct(phi);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
Info<< "Interpolated U error = "
|
||||
<< (sqrt(sum(sqr((fvc::interpolate(U) & mesh.Sf()) - phi)))
|
||||
/sum(mesh.magSf())).value()
|
||||
<< endl;
|
||||
|
||||
// Force the write
|
||||
U.write();
|
||||
phi.write();
|
||||
|
||||
if (args.optionFound("writep"))
|
||||
{
|
||||
p.write();
|
||||
}
|
||||
|
||||
runTime.functionObjects().end();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
5
applications/solvers/basic/potentialFoam/readControls.H
Normal file
5
applications/solvers/basic/potentialFoam/readControls.H
Normal file
@ -0,0 +1,5 @@
|
||||
const dictionary& potentialFlow =
|
||||
mesh.solutionDict().subDict("potentialFlow");
|
||||
|
||||
const int nNonOrthCorr =
|
||||
potentialFlow.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
@ -0,0 +1,3 @@
|
||||
scalarTransportFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/scalarTransportFoam
|
||||
11
applications/solvers/basic/scalarTransportFoam/Make/options
Normal file
11
applications/solvers/basic/scalarTransportFoam/Make/options
Normal file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
@ -0,0 +1,55 @@
|
||||
Info<< "Reading field T\n" << endl;
|
||||
|
||||
volScalarField T
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading diffusivity DT\n" << endl;
|
||||
|
||||
dimensionedScalar DT
|
||||
(
|
||||
transportProperties.lookup("DT")
|
||||
);
|
||||
|
||||
# include "createPhi.H"
|
||||
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
scalarTransportFoam
|
||||
|
||||
Description
|
||||
Solves a transport equation for a passive scalar
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "fvIOoptionList.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nCalculating scalar transport\n" << endl;
|
||||
|
||||
#include "CourantNo.H"
|
||||
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
while (simple.correctNonOrthogonal())
|
||||
{
|
||||
solve
|
||||
(
|
||||
fvm::ddt(T)
|
||||
+ fvm::div(phi, T)
|
||||
- fvm::laplacian(DT, T)
|
||||
==
|
||||
fvOptions(T)
|
||||
);
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
22
applications/solvers/combustion/PDRFoam/EaEqn.H
Normal file
22
applications/solvers/combustion/PDRFoam/EaEqn.H
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
volScalarField& hea = thermo.he();
|
||||
|
||||
solve
|
||||
(
|
||||
betav*fvm::ddt(rho, hea) + mvConvection->fvmDiv(phi, hea)
|
||||
+ betav*fvc::ddt(rho, K) + fvc::div(phi, K)
|
||||
+ (
|
||||
hea.name() == "ea"
|
||||
? fvc::div
|
||||
(
|
||||
phi/fvc::interpolate(rho),
|
||||
p,
|
||||
"div(phiv,p)"
|
||||
)
|
||||
: -betav*dpdt
|
||||
)
|
||||
- fvm::laplacian(Db, hea)
|
||||
);
|
||||
|
||||
thermo.correct();
|
||||
}
|
||||
27
applications/solvers/combustion/PDRFoam/EauEqn.H
Normal file
27
applications/solvers/combustion/PDRFoam/EauEqn.H
Normal file
@ -0,0 +1,27 @@
|
||||
if (ign.ignited())
|
||||
{
|
||||
volScalarField& heau = thermo.heu();
|
||||
|
||||
solve
|
||||
(
|
||||
betav*fvm::ddt(rho, heau) + mvConvection->fvmDiv(phi, heau)
|
||||
+ (betav*fvc::ddt(rho, K) + fvc::div(phi, K))*rho/thermo.rhou()
|
||||
+ (
|
||||
heau.name() == "eau"
|
||||
? fvc::div
|
||||
(
|
||||
phi/fvc::interpolate(rho),
|
||||
p,
|
||||
"div(phiv,p)"
|
||||
)*rho/thermo.rhou()
|
||||
: -betav*dpdt*rho/thermo.rhou()
|
||||
)
|
||||
- fvm::laplacian(Db, heau)
|
||||
|
||||
// These terms cannot be used in partially-premixed combustion due to
|
||||
// the resultant inconsistency between ft and heau transport.
|
||||
// A possible solution would be to solve for ftu as well as ft.
|
||||
//- fvm::div(muEff*fvc::grad(b)/(b + 0.001), heau)
|
||||
//+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), heau)
|
||||
);
|
||||
}
|
||||
33
applications/solvers/combustion/PDRFoam/Make/files
Normal file
33
applications/solvers/combustion/PDRFoam/Make/files
Normal file
@ -0,0 +1,33 @@
|
||||
XiModels/XiModel/XiModel.C
|
||||
XiModels/XiModel/XiModelNew.C
|
||||
XiModels/fixed/fixed.C
|
||||
XiModels/algebraic/algebraic.C
|
||||
XiModels/transport/transport.C
|
||||
|
||||
XiModels/XiEqModels/XiEqModel/XiEqModel.C
|
||||
XiModels/XiEqModels/XiEqModel/XiEqModelNew.C
|
||||
XiModels/XiEqModels/Gulder/Gulder.C
|
||||
XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.C
|
||||
XiModels/XiEqModels/SCOPEBlendXiEq/SCOPEBlendXiEq.C
|
||||
XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C
|
||||
|
||||
XiModels/XiGModels/XiGModel/XiGModel.C
|
||||
XiModels/XiGModels/XiGModel/XiGModelNew.C
|
||||
XiModels/XiGModels/KTS/KTS.C
|
||||
XiModels/XiGModels/instabilityG/instabilityG.C
|
||||
|
||||
PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C
|
||||
|
||||
PDRModels/dragModels/PDRDragModel/PDRDragModel.C
|
||||
PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C
|
||||
PDRModels/dragModels/basic/basic.C
|
||||
|
||||
PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.C
|
||||
PDRModels/XiGModels/basicXiSubG/basicXiSubG.C
|
||||
|
||||
laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C
|
||||
|
||||
/*PDRFoamAutoRefine.C*/
|
||||
PDRFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/PDRFoam
|
||||
30
applications/solvers/combustion/PDRFoam/Make/options
Normal file
30
applications/solvers/combustion/PDRFoam/Make/options
Normal file
@ -0,0 +1,30 @@
|
||||
EXE_INC = \
|
||||
-IXiModels/XiModel \
|
||||
-IXiModels/XiEqModels/XiEqModel \
|
||||
-IXiModels/XiGModels/XiGModel \
|
||||
-IPDRModels/dragModels/PDRDragModel \
|
||||
-IlaminarFlameSpeed/SCOPE \
|
||||
-I$(LIB_SRC)/engine/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lengine \
|
||||
-lmeshTools \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lreactionThermophysicalModels \
|
||||
-lspecie \
|
||||
-llaminarFlameSpeedModels \
|
||||
-lfiniteVolume \
|
||||
-ldynamicFvMesh
|
||||
156
applications/solvers/combustion/PDRFoam/PDRFoam.C
Normal file
156
applications/solvers/combustion/PDRFoam/PDRFoam.C
Normal file
@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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
|
||||
PDRFoam
|
||||
|
||||
Description
|
||||
Solver for compressible premixed/partially-premixed combustion with
|
||||
turbulence modelling.
|
||||
|
||||
Combusting RANS code using the b-Xi two-equation model.
|
||||
Xi may be obtained by either the solution of the Xi transport
|
||||
equation or from an algebraic exression. Both approaches are
|
||||
based on Gulder's flame speed correlation which has been shown
|
||||
to be appropriate by comparison with the results from the
|
||||
spectral model.
|
||||
|
||||
Strain effects are incorporated directly into the Xi equation
|
||||
but not in the algebraic approximation. Further work need to be
|
||||
done on this issue, particularly regarding the enhanced removal rate
|
||||
caused by flame compression. Analysis using results of the spectral
|
||||
model will be required.
|
||||
|
||||
For cases involving very lean Propane flames or other flames which are
|
||||
very strain-sensitive, a transport equation for the laminar flame
|
||||
speed is present. This equation is derived using heuristic arguments
|
||||
involving the strain time scale and the strain-rate at extinction.
|
||||
the transport velocity is the same as that for the Xi equation.
|
||||
|
||||
For large flames e.g. explosions additional modelling for the flame
|
||||
wrinkling due to surface instabilities may be applied.
|
||||
|
||||
PDR (porosity/distributed resistance) modelling is included to handle
|
||||
regions containing blockages which cannot be resolved by the mesh.
|
||||
|
||||
The fields used by this solver are:
|
||||
|
||||
betav: Volume porosity
|
||||
Lobs: Average diameter of obstacle in cell (m)
|
||||
Aw: Obstacle surface area per unit volume (1/m)
|
||||
CR: Drag tensor (1/m)
|
||||
CT: Turbulence generation parameter (1/m)
|
||||
Nv: Number of obstacles in cell per unit volume (m^-2)
|
||||
nsv: Tensor whose diagonal indicates the number to substract from
|
||||
Nv to get the number of obstacles crossing the flow in each
|
||||
direction.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "psiuReactionThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "laminarFlameSpeed.H"
|
||||
#include "XiModel.H"
|
||||
#include "PDRDragModel.H"
|
||||
#include "ignition.H"
|
||||
#include "Switch.H"
|
||||
#include "bound.H"
|
||||
#include "pimpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readCombustionProperties.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
scalar StCoNum = 0.0;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
Info<< "\n\nTime = " << runTime.timeName() << endl;
|
||||
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "bEqn.H"
|
||||
#include "ftEqn.H"
|
||||
#include "EauEqn.H"
|
||||
#include "EaEqn.H"
|
||||
|
||||
if (!ign.ignited())
|
||||
{
|
||||
thermo.heu() == thermo.he();
|
||||
}
|
||||
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "\nExecutionTime = "
|
||||
<< runTime.elapsedCpuTime()
|
||||
<< " s\n" << endl;
|
||||
}
|
||||
|
||||
Info<< "\n end\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
210
applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C
Normal file
210
applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C
Normal file
@ -0,0 +1,210 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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
|
||||
PDRFoam
|
||||
|
||||
Description
|
||||
Solver for compressible premixed/partially-premixed combustion with
|
||||
turbulence modelling.
|
||||
|
||||
Combusting RANS code using the b-Xi two-equation model.
|
||||
Xi may be obtained by either the solution of the Xi transport
|
||||
equation or from an algebraic exression. Both approaches are
|
||||
based on Gulder's flame speed correlation which has been shown
|
||||
to be appropriate by comparison with the results from the
|
||||
spectral model.
|
||||
|
||||
Strain effects are incorporated directly into the Xi equation
|
||||
but not in the algebraic approximation. Further work need to be
|
||||
done on this issue, particularly regarding the enhanced removal rate
|
||||
caused by flame compression. Analysis using results of the spectral
|
||||
model will be required.
|
||||
|
||||
For cases involving very lean Propane flames or other flames which are
|
||||
very strain-sensitive, a transport equation for the laminar flame
|
||||
speed is present. This equation is derived using heuristic arguments
|
||||
involving the strain time scale and the strain-rate at extinction.
|
||||
the transport velocity is the same as that for the Xi equation.
|
||||
|
||||
For large flames e.g. explosions additional modelling for the flame
|
||||
wrinkling due to surface instabilities may be applied.
|
||||
|
||||
PDR (porosity/distributed resistance) modelling is included to handle
|
||||
regions containing blockages which cannot be resolved by the mesh.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "psiuReactionThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "laminarFlameSpeed.H"
|
||||
#include "XiModel.H"
|
||||
#include "PDRDragModel.H"
|
||||
#include "ignition.H"
|
||||
#include "Switch.H"
|
||||
#include "bound.H"
|
||||
#include "dynamicRefineFvMesh.H"
|
||||
#include "pimpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "readCombustionProperties.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
scalar StCoNum = 0.0;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
bool hasChanged = false;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
// Indicators for refinement. Note: before runTime++
|
||||
// only for postprocessing reasons.
|
||||
tmp<volScalarField> tmagGradP = mag(fvc::grad(p));
|
||||
volScalarField normalisedGradP
|
||||
(
|
||||
"normalisedGradP",
|
||||
tmagGradP()/max(tmagGradP())
|
||||
);
|
||||
normalisedGradP.writeOpt() = IOobject::AUTO_WRITE;
|
||||
tmagGradP.clear();
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "\n\nTime = " << runTime.timeName() << endl;
|
||||
|
||||
{
|
||||
// Make the fluxes absolute
|
||||
fvc::makeAbsolute(phi, rho, U);
|
||||
|
||||
// Test : disable refinement for some cells
|
||||
PackedBoolList& protectedCell =
|
||||
refCast<dynamicRefineFvMesh>(mesh).protectedCell();
|
||||
|
||||
if (protectedCell.empty())
|
||||
{
|
||||
protectedCell.setSize(mesh.nCells());
|
||||
protectedCell = 0;
|
||||
}
|
||||
|
||||
forAll(betav, cellI)
|
||||
{
|
||||
if (betav[cellI] < 0.99)
|
||||
{
|
||||
protectedCell[cellI] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Flux estimate for introduced faces.
|
||||
volVectorField rhoU("rhoU", rho*U);
|
||||
|
||||
// Do any mesh changes
|
||||
bool meshChanged = mesh.update();
|
||||
|
||||
|
||||
if (meshChanged)
|
||||
{
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
if (runTime.write() && hasChanged)
|
||||
{
|
||||
betav.write();
|
||||
Lobs.write();
|
||||
CT.write();
|
||||
drag->writeFields();
|
||||
flameWrinkling->writeFields();
|
||||
hasChanged = false;
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
}
|
||||
|
||||
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "UEqn.H"
|
||||
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "bEqn.H"
|
||||
#include "ftEqn.H"
|
||||
#include "huEqn.H"
|
||||
#include "hEqn.H"
|
||||
|
||||
if (!ign.ignited())
|
||||
{
|
||||
hu == h;
|
||||
}
|
||||
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "\nExecutionTime = "
|
||||
<< runTime.elapsedCpuTime()
|
||||
<< " s\n" << endl;
|
||||
}
|
||||
|
||||
Info<< "\n end\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,169 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicXiSubXiEq.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
defineTypeNameAndDebug(basicSubGrid, 0);
|
||||
addToRunTimeSelectionTable(XiEqModel, basicSubGrid, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::basicSubGrid::basicSubGrid
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiEqModel(XiEqProperties, thermo, turbulence, Su),
|
||||
|
||||
B_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"B",
|
||||
Su.mesh().facesInstance(),
|
||||
Su.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Su.mesh()
|
||||
),
|
||||
|
||||
XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::basicSubGrid::~basicSubGrid()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
|
||||
{
|
||||
const fvMesh& mesh = Su_.mesh();
|
||||
const volVectorField& U = mesh.lookupObject<volVectorField>("U");
|
||||
|
||||
const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv");
|
||||
const volSymmTensorField& nsv =
|
||||
mesh.lookupObject<volSymmTensorField>("nsv");
|
||||
|
||||
volScalarField magU(mag(U));
|
||||
volVectorField Uhat
|
||||
(
|
||||
U/(mag(U) + dimensionedScalar("Usmall", U.dimensions(), 1e-4))
|
||||
);
|
||||
|
||||
const scalarField Cw = pow(mesh.V(), 2.0/3.0);
|
||||
|
||||
tmp<volScalarField> tN
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tN",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", Nv.dimensions(), 0.0),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& N = tN();
|
||||
|
||||
N.internalField() = Nv.internalField()*Cw;
|
||||
|
||||
tmp<volSymmTensorField> tns
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tns",
|
||||
U.mesh().time().timeName(),
|
||||
U.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
U.mesh(),
|
||||
dimensionedSymmTensor
|
||||
(
|
||||
"zero",
|
||||
nsv.dimensions(),
|
||||
pTraits<symmTensor>::zero
|
||||
),
|
||||
zeroGradientFvPatchSymmTensorField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volSymmTensorField& ns = tns();
|
||||
|
||||
ns.internalField() = nsv.internalField()*Cw;
|
||||
|
||||
volScalarField n(max(N - (Uhat & ns & Uhat), scalar(1e-4)));
|
||||
|
||||
volScalarField b((Uhat & B_ & Uhat)/sqrt(n));
|
||||
|
||||
volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));
|
||||
|
||||
volScalarField XiSubEq
|
||||
(
|
||||
scalar(1)
|
||||
+ max(2.2*sqrt(b), min(0.34*magU/up*sqrt(b), scalar(1.6)))
|
||||
* min(n, scalar(1))
|
||||
);
|
||||
|
||||
return (XiSubEq*XiEqModel_->XiEq());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiEqModels::basicSubGrid::read(const dictionary& XiEqProperties)
|
||||
{
|
||||
XiEqModel::read(XiEqProperties);
|
||||
|
||||
return XiEqModel_->read(XiEqModelCoeffs_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,145 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiEqModels::basicSubGrid
|
||||
|
||||
Description
|
||||
Basic sub-grid obstacle flame-wrinking enhancement factor model.
|
||||
Details supplied by J Puttock 2/7/06.
|
||||
|
||||
<b> Sub-grid flame area generation </b>
|
||||
|
||||
\f$ n = N - \hat{\dwea{\vec{U}}}.n_{s}.\hat{\dwea{\vec{U}}} \f$
|
||||
\f$ n_{r} = \sqrt{n} \f$
|
||||
|
||||
where:
|
||||
|
||||
\f$ \hat{\dwea{\vec{U}}} = \dwea{\vec{U}} / \vert \dwea{\vec{U}}
|
||||
\vert \f$
|
||||
|
||||
\f$ b = \hat{\dwea{\vec{U}}}.B.\hat{\dwea{\vec{U}}} / n_{r} \f$
|
||||
|
||||
where:
|
||||
|
||||
\f$ B \f$ is the file "B".
|
||||
|
||||
\f$ N \f$ is the file "N".
|
||||
|
||||
\f$ n_{s} \f$ is the file "ns".
|
||||
|
||||
The flame area enhancement factor \f$ \Xi_{sub} \f$ is expected to
|
||||
approach:
|
||||
|
||||
\f[
|
||||
\Xi_{{sub}_{eq}} =
|
||||
1 + max(2.2 \sqrt{b}, min(0.34 \frac{\vert \dwea{\vec{U}}
|
||||
\vert}{{\vec{U}}^{'}}, 1.6)) \times min(\frac{n}{4}, 1)
|
||||
\f]
|
||||
|
||||
|
||||
SourceFiles
|
||||
basicSubGrid.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basicSubGrid_H
|
||||
#define basicSubGrid_H
|
||||
|
||||
#include "XiEqModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicSubGrid Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class basicSubGrid
|
||||
:
|
||||
public XiEqModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- tblock
|
||||
volSymmTensorField B_;
|
||||
|
||||
//- Equilibrium Xi model due to turbulence
|
||||
autoPtr<XiEqModel> XiEqModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
basicSubGrid(const basicSubGrid&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const basicSubGrid&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("basicSubGrid");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
basicSubGrid
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~basicSubGrid();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking XiEq
|
||||
virtual tmp<volScalarField> XiEq() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiEqProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiEqModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicXiSubG.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiGModels
|
||||
{
|
||||
defineTypeNameAndDebug(basicSubGrid, 0);
|
||||
addToRunTimeSelectionTable(XiGModel, basicSubGrid, dictionary);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModels::basicSubGrid::basicSubGrid
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiGModel(XiGProperties, thermo, turbulence, Su),
|
||||
k1(readScalar(XiGModelCoeffs_.lookup("k1"))),
|
||||
XiGModel_(XiGModel::New(XiGModelCoeffs_, thermo, turbulence, Su))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModels::basicSubGrid::~basicSubGrid()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiGModels::basicSubGrid::G() const
|
||||
{
|
||||
const objectRegistry& db = Su_.db();
|
||||
const volVectorField& U = db.lookupObject<volVectorField>("U");
|
||||
const volScalarField& Nv = db.lookupObject<volScalarField>("Nv");
|
||||
const volScalarField& Lobs = db.lookupObject<volScalarField>("Lobs");
|
||||
|
||||
tmp<volScalarField> tGtot = XiGModel_->G();
|
||||
volScalarField& Gtot = tGtot();
|
||||
|
||||
const scalarField Cw = pow(Su_.mesh().V(), 2.0/3.0);
|
||||
|
||||
tmp<volScalarField> tN
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tN",
|
||||
Su_.mesh().time().timeName(),
|
||||
Su_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
Su_.mesh(),
|
||||
dimensionedScalar("zero", Nv.dimensions(), 0.0),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& N = tN();
|
||||
|
||||
N.internalField() = Nv.internalField()*Cw;
|
||||
|
||||
forAll(N, celli)
|
||||
{
|
||||
if (N[celli] > 1e-3)
|
||||
{
|
||||
Gtot[celli] += k1*mag(U[celli])/Lobs[celli];
|
||||
}
|
||||
}
|
||||
|
||||
return tGtot;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiGModels::basicSubGrid::Db() const
|
||||
{
|
||||
const objectRegistry& db = Su_.db();
|
||||
const volScalarField& Xi = db.lookupObject<volScalarField>("Xi");
|
||||
const volScalarField& rho = db.lookupObject<volScalarField>("rho");
|
||||
const volScalarField& mgb = db.lookupObject<volScalarField>("mgb");
|
||||
const volScalarField& Lobs = db.lookupObject<volScalarField>("Lobs");
|
||||
|
||||
return XiGModel_->Db()
|
||||
+ rho*Su_*(Xi - 1.0)*mgb*(0.5*Lobs)*Lobs/(mgb*Lobs + 1.0);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiGModels::basicSubGrid::read(const dictionary& XiGProperties)
|
||||
{
|
||||
XiGModel::read(XiGProperties);
|
||||
|
||||
XiGModelCoeffs_.lookup("k1") >> k1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiGModels::basicSubGrid
|
||||
|
||||
Description
|
||||
|
||||
Basic sub-grid obstacle flame-wrinking generation rate coefficient model.
|
||||
Details supplied by J Puttock 2/7/06.
|
||||
|
||||
\f$ G_{sub} \f$ denotes the generation coefficient and it is given by
|
||||
|
||||
\f[
|
||||
G_{sub} = k_{1} /frac{\vert \dwea{\vec{U}} \vert}{L_{obs}}
|
||||
\frac{/Xi_{{sub}_{eq}}-1}{/Xi_{sub}}
|
||||
\f]
|
||||
|
||||
and the removal:
|
||||
|
||||
\f[
|
||||
- k_{1} /frac{\vert \dwea{\vec{U}} \vert}{L_{sub}}
|
||||
\frac{\Xi_{sub}-1}{\Xi_{sub}}
|
||||
\f]
|
||||
|
||||
Finally, \f$ G_{sub} \f$ is added to generation rate \f$ G_{in} \f$
|
||||
due to the turbulence.
|
||||
|
||||
SourceFiles
|
||||
basicSubGrid.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basicSubGrid_H
|
||||
#define basicSubGrid_H
|
||||
|
||||
#include "XiGModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiGModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basicSubGrid Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class basicSubGrid
|
||||
:
|
||||
public XiGModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Sub-grid generation rate coefficient
|
||||
scalar k1;
|
||||
|
||||
//- Xi generation rate model due to turbulence
|
||||
autoPtr<XiGModel> XiGModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
basicSubGrid(const basicSubGrid&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const basicSubGrid&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("basicSubGridG");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
basicSubGrid
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~basicSubGrid();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking generation rate
|
||||
virtual tmp<volScalarField> G() const;
|
||||
|
||||
//- Return the flame diffusivity
|
||||
virtual tmp<volScalarField> Db() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiGProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiGModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PDRDragModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(PDRDragModel, 0);
|
||||
defineRunTimeSelectionTable(PDRDragModel, dictionary);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PDRDragModel::PDRDragModel
|
||||
(
|
||||
const dictionary& PDRProperties,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
regIOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"PDRDragModel",
|
||||
U.time().constant(),
|
||||
U.db()
|
||||
)
|
||||
),
|
||||
PDRDragModelCoeffs_
|
||||
(
|
||||
PDRProperties.subDict
|
||||
(
|
||||
word(PDRProperties.lookup("PDRDragModel")) + "Coeffs"
|
||||
)
|
||||
),
|
||||
turbulence_(turbulence),
|
||||
rho_(rho),
|
||||
U_(U),
|
||||
phi_(phi),
|
||||
on_(PDRDragModelCoeffs_.lookup("drag"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PDRDragModel::~PDRDragModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::PDRDragModel::read(const dictionary& PDRProperties)
|
||||
{
|
||||
PDRDragModelCoeffs_ = PDRProperties.subDict(type() + "Coeffs");
|
||||
|
||||
PDRDragModelCoeffs_.lookup("drag") >> on_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,181 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::PDRDragModel
|
||||
|
||||
Description
|
||||
Base-class for sub-grid obstacle drag models. The available drag model is at
|
||||
\link basic.H \endlink.
|
||||
|
||||
SourceFiles
|
||||
PDRDragModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PDRDragModel_H
|
||||
#define PDRDragModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "psiuReactionThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "multivariateSurfaceInterpolationScheme.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PDRDragModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class PDRDragModel
|
||||
:
|
||||
public regIOobject
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
dictionary PDRDragModelCoeffs_;
|
||||
|
||||
const compressible::RASModel& turbulence_;
|
||||
const volScalarField& rho_;
|
||||
const volVectorField& U_;
|
||||
const surfaceScalarField& phi_;
|
||||
|
||||
Switch on_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
PDRDragModel(const PDRDragModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const PDRDragModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("PDRDragModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
PDRDragModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& PDRProperties,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
),
|
||||
(
|
||||
PDRProperties,
|
||||
turbulence,
|
||||
rho,
|
||||
U,
|
||||
phi
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected Xi model
|
||||
static autoPtr<PDRDragModel> New
|
||||
(
|
||||
const dictionary& PDRProperties,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
PDRDragModel
|
||||
(
|
||||
const dictionary& PDRProperties,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PDRDragModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return true if the drag model is switched on
|
||||
bool on() const
|
||||
{
|
||||
return on_;
|
||||
}
|
||||
|
||||
//- Return the momentum drag coefficient
|
||||
virtual tmp<volSymmTensorField> Dcu() const = 0;
|
||||
|
||||
//- Return the momentum drag turbulence generation rate
|
||||
virtual tmp<volScalarField> Gk() const = 0;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& PDRProperties) = 0;
|
||||
|
||||
virtual bool writeData(Ostream&) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void writeFields() const
|
||||
{
|
||||
notImplemented("PDRDragModel::write()");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PDRDragModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
|
||||
(
|
||||
const dictionary& PDRProperties,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
{
|
||||
const word modelType(PDRProperties.lookup("PDRDragModel"));
|
||||
|
||||
Info<< "Selecting flame-wrinkling model " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"PDRDragModel::New"
|
||||
) << "Unknown PDRDragModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid PDRDragModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<PDRDragModel>
|
||||
(cstrIter()(PDRProperties, turbulence, rho, U, phi));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,188 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "basic.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace PDRDragModels
|
||||
{
|
||||
defineTypeNameAndDebug(basic, 0);
|
||||
addToRunTimeSelectionTable(PDRDragModel, basic, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PDRDragModels::basic::basic
|
||||
(
|
||||
const dictionary& PDRProperties,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
PDRDragModel(PDRProperties, turbulence, rho, U, phi),
|
||||
Csu("Csu", dimless, PDRDragModelCoeffs_.lookup("Csu")),
|
||||
Csk("Csk", dimless, PDRDragModelCoeffs_.lookup("Csk")),
|
||||
|
||||
Aw_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Aw",
|
||||
U_.mesh().facesInstance(),
|
||||
U_.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
U_.mesh()
|
||||
),
|
||||
|
||||
CR_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"CR",
|
||||
U_.mesh().facesInstance(),
|
||||
U_.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
U_.mesh()
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PDRDragModels::basic::~basic()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const
|
||||
{
|
||||
tmp<volSymmTensorField> tDragDcu
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tDragDcu",
|
||||
U_.mesh().time().constant(),
|
||||
U_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedSymmTensor
|
||||
(
|
||||
"zero",
|
||||
dimMass/dimTime/pow(dimLength, 3),
|
||||
pTraits<symmTensor>::zero
|
||||
),
|
||||
zeroGradientFvPatchSymmTensorField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volSymmTensorField& DragDcu = tDragDcu();
|
||||
|
||||
if (on_)
|
||||
{
|
||||
const volScalarField& betav =
|
||||
U_.db().lookupObject<volScalarField>("betav");
|
||||
|
||||
DragDcu =
|
||||
(0.5*rho_)*CR_*mag(U_) + (Csu*I)*betav*turbulence_.muEff()*sqr(Aw_);
|
||||
}
|
||||
|
||||
return tDragDcu;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::PDRDragModels::basic::Gk() const
|
||||
{
|
||||
tmp<volScalarField> tGk
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tGk",
|
||||
U_.mesh().time().constant(),
|
||||
U_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimLength/pow(dimTime, 3), 0.0),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& Gk = tGk();
|
||||
|
||||
if (on_)
|
||||
{
|
||||
const volScalarField& betav =
|
||||
U_.db().lookupObject<volScalarField>("betav");
|
||||
|
||||
const volSymmTensorField& CT =
|
||||
U_.db().lookupObject<volSymmTensorField>("CT");
|
||||
|
||||
Gk =
|
||||
(0.5*rho_)*mag(U_)*(U_ & CT & U_)
|
||||
+ Csk*betav*turbulence_.muEff()*sqr(Aw_)*magSqr(U_);
|
||||
}
|
||||
|
||||
return tGk;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::PDRDragModels::basic::read(const dictionary& PDRProperties)
|
||||
{
|
||||
PDRDragModel::read(PDRProperties);
|
||||
|
||||
PDRDragModelCoeffs_.lookup("Csu") >> Csu.value();
|
||||
PDRDragModelCoeffs_.lookup("Csk") >> Csk.value();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::PDRDragModels::basic::writeFields() const
|
||||
{
|
||||
Aw_.write();
|
||||
CR_.write();
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,166 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
Class
|
||||
Foam::PDRDragModels::basic
|
||||
|
||||
Description
|
||||
Basic sub-grid obstacle drag model.
|
||||
Details supplied by J Puttock 2/7/06.
|
||||
|
||||
<b> Sub-grid drag term </b>
|
||||
|
||||
The resistance term (force per unit of volume) is given by:
|
||||
|
||||
\f[
|
||||
R = -\frac{1}{2} \rho \vert \dwea{\vec{U}} \vert \dwea{\vec{U}}.D
|
||||
\f]
|
||||
|
||||
where:
|
||||
|
||||
\f$ D \f$ is the tensor field "CR" in \f$ m^{-1} \f$
|
||||
|
||||
This is term is treated implicitly in UEqn.H
|
||||
|
||||
<b> Sub-grid turbulence generation </b>
|
||||
|
||||
The turbulence source term \f$ G_{R} \f$ occurring in the
|
||||
\f$ \kappa-\epsilon \f$ equations for the generation of turbulence due
|
||||
to interaction with unresolved obstacles :
|
||||
|
||||
\f$ G_{R} = C_{s}\beta_{\nu}
|
||||
\mu_{eff} A_{w}^{2}(\dwea{\vec{U}}-\dwea{\vec{U}_{s}})^2 + \frac{1}{2}
|
||||
\rho \vert \dwea{\vec{U}} \vert \dwea{\vec{U}}.T.\dwea{\vec{U}} \f$
|
||||
|
||||
where:
|
||||
|
||||
\f$ C_{s} \f$ = 1
|
||||
|
||||
\f$ \beta_{\nu} \f$ is the volume porosity (file "betav").
|
||||
|
||||
\f$ \mu_{eff} \f$ is the effective viscosity.
|
||||
|
||||
\f$ A_{w}^{2}\f$ is the obstacle surface area per unit of volume
|
||||
(file "Aw").
|
||||
|
||||
\f$ \dwea{\vec{U}_{s}} \f$ is the slip velocity and is considered
|
||||
\f$ \frac{1}{2}. \dwea{\vec{U}} \f$.
|
||||
|
||||
\f$ T \f$ is a tensor in the file CT.
|
||||
|
||||
The term \f$ G_{R} \f$ is treated explicitly in the \f$ \kappa-\epsilon
|
||||
\f$ Eqs in the \link PDRkEpsilon.C \endlink file.
|
||||
|
||||
|
||||
SourceFiles
|
||||
basic.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basic_H
|
||||
#define basic_H
|
||||
|
||||
#include "PDRDragModel.H"
|
||||
#include "XiEqModel.H"
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace PDRDragModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class basic Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class basic
|
||||
:
|
||||
public PDRDragModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar Csu;
|
||||
dimensionedScalar Csk;
|
||||
|
||||
volScalarField Aw_;
|
||||
volSymmTensorField CR_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
basic(const basic&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const basic&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("basic");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
basic
|
||||
(
|
||||
const dictionary& PDRProperties,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~basic();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the momentum drag coefficient
|
||||
virtual tmp<volSymmTensorField> Dcu() const;
|
||||
|
||||
//- Return the momentum drag turbulence generation rate
|
||||
virtual tmp<volScalarField> Gk() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& PDRProperties);
|
||||
|
||||
//- Write fields
|
||||
void writeFields() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace PDRDragModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,195 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PDRkEpsilon.H"
|
||||
#include "PDRDragModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
#include "backwardsCompatibilityWallFunctions.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(PDRkEpsilon, 0);
|
||||
addToRunTimeSelectionTable(RASModel, PDRkEpsilon, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
PDRkEpsilon::PDRkEpsilon
|
||||
(
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const fluidThermo& thermophysicalModel,
|
||||
const word& turbulenceModelName,
|
||||
const word& modelName
|
||||
)
|
||||
:
|
||||
kEpsilon(rho, U, phi, thermophysicalModel, turbulenceModelName, modelName),
|
||||
|
||||
C4_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"C4",
|
||||
coeffDict_,
|
||||
0.1
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
PDRkEpsilon::~PDRkEpsilon()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool PDRkEpsilon::read()
|
||||
{
|
||||
if (RASModel::read())
|
||||
{
|
||||
C4_.readIfPresent(coeffDict_);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PDRkEpsilon::correct()
|
||||
{
|
||||
if (!turbulence_)
|
||||
{
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
// Re-calculate thermal diffusivity
|
||||
alphat_ = mut_/Prt_;
|
||||
alphat_.correctBoundaryConditions();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RASModel::correct();
|
||||
|
||||
volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_)));
|
||||
|
||||
if (mesh_.moving())
|
||||
{
|
||||
divU += fvc::div(mesh_.phi());
|
||||
}
|
||||
|
||||
tmp<volTensorField> tgradU = fvc::grad(U_);
|
||||
volScalarField G(GName(), mut_*(tgradU() && dev(twoSymm(tgradU()))));
|
||||
tgradU.clear();
|
||||
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Add the blockage generation term so that it is included consistently
|
||||
// in both the k and epsilon equations
|
||||
const volScalarField& betav =
|
||||
U_.db().lookupObject<volScalarField>("betav");
|
||||
|
||||
const volScalarField& Lobs =
|
||||
U_.db().lookupObject<volScalarField>("Lobs");
|
||||
|
||||
const PDRDragModel& drag =
|
||||
U_.db().lookupObject<PDRDragModel>("PDRDragModel");
|
||||
|
||||
volScalarField GR(drag.Gk());
|
||||
|
||||
volScalarField LI
|
||||
(C4_*(Lobs + dimensionedScalar("minLength", dimLength, VSMALL)));
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
(
|
||||
betav*fvm::ddt(rho_, epsilon_)
|
||||
+ fvm::div(phi_, epsilon_)
|
||||
- fvm::laplacian(DepsilonEff(), epsilon_)
|
||||
==
|
||||
C1_*betav*G*epsilon_/k_
|
||||
+ 1.5*pow(Cmu_, 3.0/4.0)*GR*sqrt(k_)/LI
|
||||
- fvm::SuSp(((2.0/3.0)*C1_)*betav*rho_*divU, epsilon_)
|
||||
- fvm::Sp(C2_*betav*rho_*epsilon_/k_, epsilon_)
|
||||
);
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilonMin_);
|
||||
|
||||
|
||||
// Turbulent kinetic energy equation
|
||||
|
||||
tmp<fvScalarMatrix> kEqn
|
||||
(
|
||||
betav*fvm::ddt(rho_, k_)
|
||||
+ fvm::div(phi_, k_)
|
||||
- fvm::laplacian(DkEff(), k_)
|
||||
==
|
||||
betav*G + GR
|
||||
- fvm::SuSp((2.0/3.0)*betav*rho_*divU, k_)
|
||||
- fvm::Sp(betav*rho_*epsilon_/k_, k_)
|
||||
);
|
||||
|
||||
kEqn().relax();
|
||||
solve(kEqn);
|
||||
bound(k_, kMin_);
|
||||
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
// Re-calculate thermal diffusivity
|
||||
alphat_ = mut_/Prt_;
|
||||
alphat_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::PDRkEpsilon
|
||||
|
||||
Description
|
||||
Standard k-epsilon turbulence model with additional source terms
|
||||
corresponding to PDR basic drag model (\link basic.H \endlink)
|
||||
|
||||
The default model coefficients correspond to the following:
|
||||
@verbatim
|
||||
PDRkEpsilonCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
C3 -0.33; // only for compressible
|
||||
C4 0.1;
|
||||
sigmak 1.0; // only for compressible
|
||||
sigmaEps 1.3;
|
||||
Prt 1.0; // only for compressible
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
The turbulence source term \f$ G_{R} \f$ appears in the
|
||||
\f$ \kappa-\epsilon \f$ equation for the generation of turbulence due to
|
||||
interaction with unresolved obstacles.
|
||||
|
||||
In the \f$ \epsilon \f$ equation \f$ C_{1} G_{R} \f$ is added as a source
|
||||
term.
|
||||
|
||||
In the \f$ \kappa \f$ equation \f$ G_{R} \f$ is added as a source term.
|
||||
|
||||
SourceFiles
|
||||
PDRkEpsilon.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef compressiblePDRkEpsilon_H
|
||||
#define compressiblePDRkEpsilon_H
|
||||
|
||||
|
||||
#include "kEpsilon.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PDRkEpsilon Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class PDRkEpsilon
|
||||
:
|
||||
public kEpsilon
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Model coefficients
|
||||
dimensionedScalar C4_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("PDRkEpsilon");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
PDRkEpsilon
|
||||
(
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const fluidThermo& thermophysicalModel,
|
||||
const word& turbulenceModelName = turbulenceModel::typeName,
|
||||
const word& modelName = typeName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PDRkEpsilon();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||
void correct();
|
||||
|
||||
//- Read turbulenceProperties dictionary
|
||||
bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
53
applications/solvers/combustion/PDRFoam/StCourantNo.H
Normal file
53
applications/solvers/combustion/PDRFoam/StCourantNo.H
Normal file
@ -0,0 +1,53 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
Global
|
||||
CourantNo
|
||||
|
||||
Description
|
||||
Calculates and outputs the mean and maximum Courant Numbers.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
scalar meanStCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
scalarField sumPhi
|
||||
(
|
||||
fvc::surfaceSum(mag(phiSt))().internalField()
|
||||
/ rho.internalField()
|
||||
);
|
||||
|
||||
StCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
|
||||
|
||||
meanStCoNum =
|
||||
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
|
||||
}
|
||||
|
||||
Info<< "St courant Number mean: " << meanStCoNum
|
||||
<< " max: " << StCoNum << endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
17
applications/solvers/combustion/PDRFoam/UEqn.H
Normal file
17
applications/solvers/combustion/PDRFoam/UEqn.H
Normal file
@ -0,0 +1,17 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
betav*fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
==
|
||||
betav*rho*g
|
||||
);
|
||||
|
||||
volSymmTensorField invA(inv(I*UEqn.A() + drag->Dcu()));
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
U = invA & (UEqn.H() - betav*fvc::grad(p));
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Gulder.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
defineTypeNameAndDebug(Gulder, 0);
|
||||
addToRunTimeSelectionTable(XiEqModel, Gulder, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::Gulder::Gulder
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiEqModel(XiEqProperties, thermo, turbulence, Su),
|
||||
XiEqCoef_(readScalar(XiEqModelCoeffs_.lookup("XiEqCoef"))),
|
||||
SuMin_(0.01*Su.average()),
|
||||
uPrimeCoef_(readScalar(XiEqModelCoeffs_.lookup("uPrimeCoef"))),
|
||||
subGridSchelkin_
|
||||
(
|
||||
readBool(XiEqModelCoeffs_.lookup("subGridSchelkin"))
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::Gulder::~Gulder()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::Gulder::XiEq() const
|
||||
{
|
||||
volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));
|
||||
const volScalarField& epsilon = turbulence_.epsilon();
|
||||
|
||||
if (subGridSchelkin_)
|
||||
{
|
||||
up.internalField() += calculateSchelkinEffect(uPrimeCoef_);
|
||||
}
|
||||
|
||||
volScalarField tauEta(sqrt(mag(thermo_.muu()/(thermo_.rhou()*epsilon))));
|
||||
|
||||
volScalarField Reta
|
||||
(
|
||||
up
|
||||
/ (
|
||||
sqrt(epsilon*tauEta)
|
||||
+ dimensionedScalar("1e-8", up.dimensions(), 1e-8)
|
||||
)
|
||||
);
|
||||
|
||||
return (1.0 + XiEqCoef_*sqrt(up/(Su_ + SuMin_))*Reta);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiEqModels::Gulder::read(const dictionary& XiEqProperties)
|
||||
{
|
||||
XiEqModel::read(XiEqProperties);
|
||||
|
||||
XiEqModelCoeffs_.lookup("XiEqCoef") >> XiEqCoef_;
|
||||
XiEqModelCoeffs_.lookup("uPrimeCoef") >> uPrimeCoef_;
|
||||
XiEqModelCoeffs_.lookup("subGridSchelkin") >> subGridSchelkin_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiEqModels::Gulder
|
||||
|
||||
Description
|
||||
Simple Gulder model for XiEq based on Gulders correlation
|
||||
with a linear correction function to give a plausible profile for XiEq.
|
||||
|
||||
SourceFiles
|
||||
Gulder.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Gulder_H
|
||||
#define Gulder_H
|
||||
|
||||
#include "XiEqModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Gulder Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Gulder
|
||||
:
|
||||
public XiEqModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Model constant
|
||||
scalar XiEqCoef_;
|
||||
|
||||
//- Minimum laminar burning velocity
|
||||
const dimensionedScalar SuMin_;
|
||||
|
||||
//- Schelkin effect Model constant
|
||||
scalar uPrimeCoef_;
|
||||
|
||||
//- Use sub-grid Schelkin effect
|
||||
bool subGridSchelkin_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
Gulder(const Gulder&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const Gulder&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Gulder");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
Gulder
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~Gulder();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking XiEq
|
||||
virtual tmp<volScalarField> XiEq() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiEqProperties);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiEqModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,93 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SCOPEBlendXiEq.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
defineTypeNameAndDebug(SCOPEBlend, 0);
|
||||
addToRunTimeSelectionTable(XiEqModel, SCOPEBlend, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::SCOPEBlend::SCOPEBlend
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiEqModel(XiEqProperties, thermo, turbulence, Su),
|
||||
XiEqModelL_
|
||||
(
|
||||
XiEqModel::New
|
||||
(
|
||||
XiEqModelCoeffs_.subDict("XiEqModelL"),
|
||||
thermo,
|
||||
turbulence,
|
||||
Su
|
||||
)
|
||||
),
|
||||
XiEqModelH_
|
||||
(
|
||||
XiEqModel::New
|
||||
(
|
||||
XiEqModelCoeffs_.subDict("XiEqModelH"),
|
||||
thermo,
|
||||
turbulence,
|
||||
Su
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::SCOPEBlend::~SCOPEBlend()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEBlend::XiEq() const
|
||||
{
|
||||
return pow
|
||||
(
|
||||
pow4(1.0/XiEqModelL_->XiEq()) + pow4(1.0/XiEqModelH_->XiEq()),
|
||||
-0.25
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,121 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiEqModels::SCOPEBlend
|
||||
|
||||
Description
|
||||
Simple SCOPEBlendXiEq model for XiEq based on SCOPEXiEqs correlation
|
||||
with a linear correction function to give a plausible profile for XiEq.
|
||||
See @link SCOPELaminarFlameSpeed.H @endlink for details on the SCOPE
|
||||
laminar flame speed model.
|
||||
|
||||
SourceFiles
|
||||
SCOPEBlend.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SCOPEBlend_H
|
||||
#define SCOPEBlend_H
|
||||
|
||||
#include "XiEqModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SCOPEBlend Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class SCOPEBlend
|
||||
:
|
||||
public XiEqModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Low turbulence intensity equilibrium Xi model
|
||||
autoPtr<XiEqModel> XiEqModelL_;
|
||||
|
||||
//- High turbulence intensity equilibrium Xi model
|
||||
autoPtr<XiEqModel> XiEqModelH_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
SCOPEBlend(const SCOPEBlend&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const SCOPEBlend&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SCOPEBlend");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
SCOPEBlend
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SCOPEBlend();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking XiEq
|
||||
virtual tmp<volScalarField> XiEq() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiEqProperties)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiEqModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,167 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SCOPEXiEq.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
defineTypeNameAndDebug(SCOPEXiEq, 0);
|
||||
addToRunTimeSelectionTable(XiEqModel, SCOPEXiEq, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::SCOPEXiEq::SCOPEXiEq
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiEqModel(XiEqProperties, thermo, turbulence, Su),
|
||||
XiEqCoef_(readScalar(XiEqModelCoeffs_.lookup("XiEqCoef"))),
|
||||
XiEqExp_(readScalar(XiEqModelCoeffs_.lookup("XiEqExp"))),
|
||||
lCoef_(readScalar(XiEqModelCoeffs_.lookup("lCoef"))),
|
||||
SuMin_(0.01*Su.average()),
|
||||
uPrimeCoef_(readScalar(XiEqModelCoeffs_.lookup("uPrimeCoef"))),
|
||||
subGridSchelkin_
|
||||
(
|
||||
readBool(XiEqModelCoeffs_.lookup("subGridSchelkin"))
|
||||
),
|
||||
MaModel
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"combustionProperties",
|
||||
Su.mesh().time().constant(),
|
||||
Su.mesh(),
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
),
|
||||
thermo
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::SCOPEXiEq::~SCOPEXiEq()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
|
||||
{
|
||||
const volScalarField& k = turbulence_.k();
|
||||
const volScalarField& epsilon = turbulence_.epsilon();
|
||||
|
||||
volScalarField up(sqrt((2.0/3.0)*k));
|
||||
if (subGridSchelkin_)
|
||||
{
|
||||
up.internalField() += calculateSchelkinEffect(uPrimeCoef_);
|
||||
}
|
||||
|
||||
volScalarField l(lCoef_*sqrt(3.0/2.0)*up*k/epsilon);
|
||||
volScalarField Rl(up*l*thermo_.rhou()/thermo_.muu());
|
||||
|
||||
volScalarField upBySu(up/(Su_ + SuMin_));
|
||||
volScalarField K(0.157*upBySu/sqrt(Rl));
|
||||
volScalarField Ma(MaModel.Ma());
|
||||
|
||||
tmp<volScalarField> tXiEq
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"XiEq",
|
||||
epsilon.time().timeName(),
|
||||
epsilon.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
epsilon.mesh(),
|
||||
dimensionedScalar("XiEq", dimless, 0.0)
|
||||
)
|
||||
);
|
||||
volScalarField& xieq = tXiEq();
|
||||
|
||||
forAll(xieq, celli)
|
||||
{
|
||||
if (Ma[celli] > 0.01)
|
||||
{
|
||||
xieq[celli] =
|
||||
XiEqCoef_*pow(K[celli]*Ma[celli], -XiEqExp_)*upBySu[celli];
|
||||
}
|
||||
}
|
||||
|
||||
forAll(xieq.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& xieqp = xieq.boundaryField()[patchi];
|
||||
const scalarField& Kp = K.boundaryField()[patchi];
|
||||
const scalarField& Map = Ma.boundaryField()[patchi];
|
||||
const scalarField& upBySup = upBySu.boundaryField()[patchi];
|
||||
|
||||
forAll(xieqp, facei)
|
||||
{
|
||||
if (Ma[facei] > 0.01)
|
||||
{
|
||||
xieqp[facei] =
|
||||
XiEqCoef_*pow(Kp[facei]*Map[facei], -XiEqExp_)
|
||||
*upBySup[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tXiEq;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiEqModels::SCOPEXiEq::read(const dictionary& XiEqProperties)
|
||||
{
|
||||
XiEqModel::read(XiEqProperties);
|
||||
|
||||
XiEqModelCoeffs_.lookup("XiEqCoef") >> XiEqCoef_;
|
||||
XiEqModelCoeffs_.lookup("XiEqExp") >> XiEqExp_;
|
||||
XiEqModelCoeffs_.lookup("lCoef") >> lCoef_;
|
||||
XiEqModelCoeffs_.lookup("uPrimeCoef") >> uPrimeCoef_;
|
||||
XiEqModelCoeffs_.lookup("subGridSchelkin") >> subGridSchelkin_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiEqModels::SCOPEXiEq
|
||||
|
||||
Description
|
||||
Simple SCOPEXiEq model for XiEq based on SCOPEXiEqs correlation
|
||||
with a linear correction function to give a plausible profile for XiEq.
|
||||
See \link SCOPELaminarFlameSpeed.H \endlink for details on the SCOPE laminar
|
||||
flame speed model.
|
||||
|
||||
SourceFiles
|
||||
SCOPEXiEq.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SCOPEXiEq_H
|
||||
#define SCOPEXiEq_H
|
||||
|
||||
#include "XiEqModel.H"
|
||||
#include "SCOPELaminarFlameSpeed.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SCOPEXiEq Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class SCOPEXiEq
|
||||
:
|
||||
public XiEqModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Model constant
|
||||
scalar XiEqCoef_;
|
||||
|
||||
// Model constant
|
||||
scalar XiEqExp_;
|
||||
|
||||
// Model constant
|
||||
scalar lCoef_;
|
||||
|
||||
//- Minimum Su
|
||||
dimensionedScalar SuMin_;
|
||||
|
||||
//- Schelkin effect Model constant
|
||||
scalar uPrimeCoef_;
|
||||
|
||||
//- Use sub-grid Schelkin effect
|
||||
bool subGridSchelkin_;
|
||||
|
||||
//- The SCOPE laminar flame speed model used to obtain the
|
||||
// Marstein number. Note: the laminar flame speed need not be
|
||||
// obtained form the same model.
|
||||
laminarFlameSpeedModels::SCOPE MaModel;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
SCOPEXiEq(const SCOPEXiEq&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const SCOPEXiEq&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SCOPEXiEq");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
SCOPEXiEq
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SCOPEXiEq();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking XiEq
|
||||
virtual tmp<volScalarField> XiEq() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiEqProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiEqModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,193 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "XiEqModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(XiEqModel, 0);
|
||||
defineRunTimeSelectionTable(XiEqModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModel::XiEqModel
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiEqModelCoeffs_
|
||||
(
|
||||
XiEqProperties.subDict
|
||||
(
|
||||
word(XiEqProperties.lookup("XiEqModel")) + "Coeffs"
|
||||
)
|
||||
),
|
||||
thermo_(thermo),
|
||||
turbulence_(turbulence),
|
||||
Su_(Su),
|
||||
Nv_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Nv",
|
||||
Su.mesh().facesInstance(),
|
||||
Su.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Su.mesh()
|
||||
),
|
||||
nsv_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nsv",
|
||||
Su.mesh().facesInstance(),
|
||||
Su.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Su.mesh()
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModel::~XiEqModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::XiEqModel::read(const dictionary& XiEqProperties)
|
||||
{
|
||||
XiEqModelCoeffs_ = XiEqProperties.subDict(type() + "Coeffs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::XiEqModel::writeFields() const
|
||||
{
|
||||
Nv_.write();
|
||||
nsv_.write();
|
||||
if (Su_.mesh().foundObject<volSymmTensorField>("B"))
|
||||
{
|
||||
const volSymmTensorField& B =
|
||||
Su_.mesh().lookupObject<volSymmTensorField>("B");
|
||||
B.write();
|
||||
}
|
||||
}
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
|
||||
{
|
||||
const fvMesh& mesh = Su_.mesh();
|
||||
|
||||
const volVectorField& U = mesh.lookupObject<volVectorField>("U");
|
||||
|
||||
const volSymmTensorField& CT = mesh.lookupObject<volSymmTensorField>("CT");
|
||||
const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv");
|
||||
const volSymmTensorField& nsv =
|
||||
mesh.lookupObject<volSymmTensorField>("nsv");
|
||||
|
||||
tmp<volScalarField> tN
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tN",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", Nv.dimensions(), 0.0),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& N = tN();
|
||||
|
||||
N.internalField() = Nv.internalField()*pow(mesh.V(), 2.0/3.0);
|
||||
|
||||
tmp<volSymmTensorField> tns
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tns",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedSymmTensor
|
||||
(
|
||||
"zero",
|
||||
nsv.dimensions(),
|
||||
pTraits<symmTensor>::zero
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
volSymmTensorField& ns = tns();
|
||||
|
||||
ns.internalField() = nsv.internalField()*pow(mesh.V(), 2.0/3.0);
|
||||
|
||||
const volVectorField Uhat
|
||||
(
|
||||
U/(mag(U) + dimensionedScalar("Usmall", U.dimensions(), 1e-4))
|
||||
);
|
||||
|
||||
const volScalarField nr(sqrt(max(N - (Uhat & ns & Uhat), scalar(1e-4))));
|
||||
|
||||
const scalarField cellWidth(pow(mesh.V(), 1.0/3.0));
|
||||
|
||||
const scalarField upLocal(uPrimeCoef*sqrt((U & CT & U)*cellWidth));
|
||||
|
||||
const scalarField deltaUp(upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0));
|
||||
|
||||
//Re use tN
|
||||
N.internalField() = upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0);
|
||||
|
||||
return tN;
|
||||
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,179 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiEqModel
|
||||
|
||||
Description
|
||||
Base-class for all XiEq models used by the b-XiEq combustion model.
|
||||
The available models are :
|
||||
\link basicXiSubXiEq.H \endlink
|
||||
\link Gulder.H \endlink
|
||||
\link instabilityXiEq.H \endlink
|
||||
\link SCOPEBlendXiEq.H \endlink
|
||||
\link SCOPEXiEq.H \endlink
|
||||
|
||||
SourceFiles
|
||||
XiEqModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef XiEqModel_H
|
||||
#define XiEqModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "psiuReactionThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class XiEqModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class XiEqModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Dictionary
|
||||
dictionary XiEqModelCoeffs_;
|
||||
|
||||
//- Thermo
|
||||
const psiuReactionThermo& thermo_;
|
||||
|
||||
//- Turbulence
|
||||
const compressible::RASModel& turbulence_;
|
||||
|
||||
//- Laminar burning velocity
|
||||
const volScalarField& Su_;
|
||||
|
||||
//- Volumetric obstacles number
|
||||
volScalarField Nv_;
|
||||
|
||||
//
|
||||
volSymmTensorField nsv_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
XiEqModel(const XiEqModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const XiEqModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("XiEqModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
XiEqModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
),
|
||||
(
|
||||
XiEqProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
Su
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected XiEq model
|
||||
static autoPtr<XiEqModel> New
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
XiEqModel
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~XiEqModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking XiEq
|
||||
virtual tmp<volScalarField> XiEq() const
|
||||
{
|
||||
return turbulence_.muEff();
|
||||
}
|
||||
|
||||
|
||||
//- Return the sub-grid Schelkin effect
|
||||
tmp<volScalarField> calculateSchelkinEffect(const scalar) const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiEqProperties) = 0;
|
||||
|
||||
//- Write fields
|
||||
void writeFields() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "XiEqModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
|
||||
(
|
||||
const dictionary& propDict,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
{
|
||||
const word modelType(propDict.lookup("XiEqModel"));
|
||||
|
||||
Info<< "Selecting flame-wrinkling model " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"XiEqModel::New"
|
||||
"("
|
||||
" const psiuReactionThermo& thermo,"
|
||||
" const compressible::RASModel& turbulence,"
|
||||
" const volScalarField& Su"
|
||||
")"
|
||||
) << "Unknown XiEqModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid XiEqModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<XiEqModel>(cstrIter()(propDict, thermo, turbulence, Su));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "instabilityXiEq.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
defineTypeNameAndDebug(instability, 0);
|
||||
addToRunTimeSelectionTable(XiEqModel, instability, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::instability::instability
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiEqModel(XiEqProperties, thermo, turbulence, Su),
|
||||
XiEqIn(readScalar(XiEqModelCoeffs_.lookup("XiEqIn"))),
|
||||
XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiEqModels::instability::~instability()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::instability::XiEq() const
|
||||
{
|
||||
volScalarField turbXiEq(XiEqModel_->XiEq());
|
||||
return XiEqIn/turbXiEq + turbXiEq;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiEqModels::instability::read(const dictionary& XiEqProperties)
|
||||
{
|
||||
XiEqModel::read(XiEqProperties);
|
||||
|
||||
XiEqModelCoeffs_.lookup("XiEqIn") >> XiEqIn;
|
||||
|
||||
return XiEqModel_->read(XiEqModelCoeffs_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,117 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiEqModels::instability
|
||||
|
||||
Description
|
||||
This is the equilibrium level of the flame wrinkling generated by
|
||||
instability. It is a constant (default 2.5). It is used in
|
||||
@link XiModel.H @endlink.
|
||||
|
||||
SourceFiles
|
||||
instability.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef instability_H
|
||||
#define instability_H
|
||||
|
||||
#include "XiEqModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiEqModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class instability Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class instability
|
||||
:
|
||||
public XiEqModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Equilibrium Xi due to instability only
|
||||
scalar XiEqIn;
|
||||
|
||||
//- Equilibrium Xi model due to all other effects
|
||||
autoPtr<XiEqModel> XiEqModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
instability(const instability&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const instability&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("instability");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
instability
|
||||
(
|
||||
const dictionary& XiEqProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~instability();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking XiEq
|
||||
virtual tmp<volScalarField> XiEq() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiEqProperties);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiEqModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "KTS.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiGModels
|
||||
{
|
||||
defineTypeNameAndDebug(KTS, 0);
|
||||
addToRunTimeSelectionTable(XiGModel, KTS, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModels::KTS::KTS
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiGModel(XiGProperties, thermo, turbulence, Su),
|
||||
GEtaCoef_(readScalar(XiGModelCoeffs_.lookup("GEtaCoef")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModels::KTS::~KTS()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiGModels::KTS::G() const
|
||||
{
|
||||
volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));
|
||||
const volScalarField& epsilon = turbulence_.epsilon();
|
||||
|
||||
volScalarField tauEta(sqrt(mag(thermo_.muu()/(thermo_.rhou()*epsilon))));
|
||||
|
||||
return (GEtaCoef_/tauEta);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiGModels::KTS::read(const dictionary& XiGProperties)
|
||||
{
|
||||
XiGModel::read(XiGProperties);
|
||||
|
||||
XiGModelCoeffs_.lookup("GEtaCoef") >> GEtaCoef_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiGModels::KTS
|
||||
|
||||
Description
|
||||
Simple Kolmogorov time-scale (KTS) model for the flame-wrinling generation
|
||||
rate.
|
||||
|
||||
SourceFiles
|
||||
KTS.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef KTS_H
|
||||
#define KTS_H
|
||||
|
||||
#include "XiGModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiGModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class KTS Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class KTS
|
||||
:
|
||||
public XiGModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar GEtaCoef_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
KTS(const KTS&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const KTS&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("KTS");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
KTS
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~KTS();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking generation rate
|
||||
virtual tmp<volScalarField> G() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiGProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiGModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "XiGModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(XiGModel, 0);
|
||||
defineRunTimeSelectionTable(XiGModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModel::XiGModel
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiGModelCoeffs_
|
||||
(
|
||||
XiGProperties.subDict
|
||||
(
|
||||
word(XiGProperties.lookup("XiGModel")) + "Coeffs"
|
||||
)
|
||||
),
|
||||
thermo_(thermo),
|
||||
turbulence_(turbulence),
|
||||
Su_(Su)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModel::~XiGModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::XiGModel::read(const dictionary& XiGProperties)
|
||||
{
|
||||
XiGModelCoeffs_ = XiGProperties.subDict(type() + "Coeffs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,160 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiGModel
|
||||
|
||||
Description
|
||||
Base-class for all Xi generation models used by the b-Xi combustion model.
|
||||
See Technical Report SH/RE/01R for details on the PDR modelling. For details
|
||||
on the use of XiGModel see \link XiModel.H \endlink. The model available is
|
||||
\link instabilityG.H \endlink
|
||||
|
||||
SourceFiles
|
||||
XiGModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef XiGModel_H
|
||||
#define XiGModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "psiuReactionThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class XiGModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class XiGModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
dictionary XiGModelCoeffs_;
|
||||
|
||||
const psiuReactionThermo& thermo_;
|
||||
const compressible::RASModel& turbulence_;
|
||||
const volScalarField& Su_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
XiGModel(const XiGModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const XiGModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("XiGModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
XiGModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
),
|
||||
(
|
||||
XiGProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
Su
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected XiG model
|
||||
static autoPtr<XiGModel> New
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
XiGModel
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~XiGModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking genration rate
|
||||
virtual tmp<volScalarField> G() const = 0;
|
||||
|
||||
//- Return the flame diffusivity
|
||||
virtual tmp<volScalarField> Db() const
|
||||
{
|
||||
return turbulence_.muEff();
|
||||
}
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiGProperties) = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "XiGModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
|
||||
(
|
||||
const dictionary& propDict,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
{
|
||||
const word modelType(propDict.lookup("XiGModel"));
|
||||
|
||||
Info<< "Selecting flame-wrinkling model " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"XiGModel::New"
|
||||
"("
|
||||
" const psiuReactionThermo& thermo,"
|
||||
" const compressible::RASModel& turbulence,"
|
||||
" const volScalarField& Su"
|
||||
")"
|
||||
) << "Unknown XiGModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid XiGModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<XiGModel>(cstrIter()(propDict, thermo, turbulence, Su));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "instabilityG.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiGModels
|
||||
{
|
||||
defineTypeNameAndDebug(instabilityG, 0);
|
||||
addToRunTimeSelectionTable(XiGModel, instabilityG, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModels::instabilityG::instabilityG
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
)
|
||||
:
|
||||
XiGModel(XiGProperties, thermo, turbulence, Su),
|
||||
GIn_(XiGModelCoeffs_.lookup("GIn")),
|
||||
lambdaIn_(XiGModelCoeffs_.lookup("lambdaIn")),
|
||||
XiGModel_(XiGModel::New(XiGModelCoeffs_, thermo, turbulence, Su))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiGModels::instabilityG::~instabilityG()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiGModels::instabilityG::G() const
|
||||
{
|
||||
volScalarField turbXiG(XiGModel_->G());
|
||||
return (GIn_*GIn_/(GIn_ + turbXiG) + turbXiG);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiGModels::instabilityG::Db() const
|
||||
{
|
||||
const objectRegistry& db = Su_.db();
|
||||
const volScalarField& Xi = db.lookupObject<volScalarField>("Xi");
|
||||
const volScalarField& rho = db.lookupObject<volScalarField>("rho");
|
||||
const volScalarField& mgb = db.lookupObject<volScalarField>("mgb");
|
||||
|
||||
return XiGModel_->Db()
|
||||
+ rho*Su_*(Xi - 1.0)*mgb*(0.5*lambdaIn_)/(mgb + 1.0/lambdaIn_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiGModels::instabilityG::read(const dictionary& XiGProperties)
|
||||
{
|
||||
XiGModel::read(XiGProperties);
|
||||
|
||||
XiGModelCoeffs_.lookup("GIn") >> GIn_;
|
||||
XiGModelCoeffs_.lookup("lambdaIn") >> lambdaIn_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,123 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiGModels::instabilityG
|
||||
|
||||
Description
|
||||
Flame-surface instabilityG flame-wrinking generation rate coefficient model
|
||||
used in \link XiModel.H \endlink.
|
||||
|
||||
See Technical Report SH/RE/01R for details on the PDR modelling.
|
||||
|
||||
SourceFiles
|
||||
instabilityG.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef instabilityG_H
|
||||
#define instabilityG_H
|
||||
|
||||
#include "XiGModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiGModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class instabilityG Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class instabilityG
|
||||
:
|
||||
public XiGModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Flame instabilityG wrinling generation rate coefficient
|
||||
dimensionedScalar GIn_;
|
||||
|
||||
//- InstabilityG length-scale
|
||||
dimensionedScalar lambdaIn_;
|
||||
|
||||
//- Xi generation rate model due to all other processes
|
||||
autoPtr<XiGModel> XiGModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
instabilityG(const instabilityG&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const instabilityG&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("instabilityG");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
instabilityG
|
||||
(
|
||||
const dictionary& XiGProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~instabilityG();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking generation rate
|
||||
virtual tmp<volScalarField> G() const;
|
||||
|
||||
//- Return the flame diffusivity
|
||||
virtual tmp<volScalarField> Db() const;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiGProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiGModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "XiModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(XiModel, 0);
|
||||
defineRunTimeSelectionTable(XiModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModel::XiModel
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
XiModelCoeffs_
|
||||
(
|
||||
XiProperties.subDict
|
||||
(
|
||||
word(XiProperties.lookup("XiModel")) + "Coeffs"
|
||||
)
|
||||
),
|
||||
thermo_(thermo),
|
||||
turbulence_(turbulence),
|
||||
Su_(Su),
|
||||
rho_(rho),
|
||||
b_(b),
|
||||
phi_(phi),
|
||||
Xi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Xi",
|
||||
b.time().timeName(),
|
||||
b.db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
b.mesh()
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModel::~XiModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::XiModel::read(const dictionary& XiProperties)
|
||||
{
|
||||
XiModelCoeffs_ = XiProperties.subDict(type() + "Coeffs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,254 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiModel
|
||||
|
||||
Description
|
||||
Base-class for all Xi models used by the b-Xi combustion model.
|
||||
See Technical Report SH/RE/01R for details on the PDR modelling.
|
||||
|
||||
Xi is given through an algebraic expression (\link algebraic.H \endlink),
|
||||
by solving a transport equation (\link transport.H \endlink) or a
|
||||
fixed value (\link fixed.H \endlink).
|
||||
|
||||
See report TR/HGW/10 for details on the Weller two equations model.
|
||||
|
||||
In the algebraic and transport methods \f$\Xi_{eq}\f$ is calculated in
|
||||
similar way. In the algebraic approach, \f$\Xi_{eq}\f$ is the value used in
|
||||
the \f$ b \f$ transport equation.
|
||||
|
||||
\f$\Xi_{eq}\f$ is calculated as follows:
|
||||
|
||||
\f$\Xi_{eq} = 1 + (1 + 2\Xi_{coeff}(0.5 - \dwea{b}))(\Xi^* - 1)\f$
|
||||
|
||||
where:
|
||||
|
||||
\f$ \dwea{b} \f$ is the regress variable.
|
||||
|
||||
\f$ \Xi_{coeff} \f$ is a model constant.
|
||||
|
||||
\f$ \Xi^* \f$ is the total equilibrium wrinkling combining the effects
|
||||
of the flame inestability and turbulence interaction and is given by
|
||||
|
||||
\f[
|
||||
\Xi^* = \frac {R}{R - G_\eta - G_{in}}
|
||||
\f]
|
||||
|
||||
where:
|
||||
|
||||
\f$ G_\eta \f$ is the generation rate of wrinkling due to turbulence
|
||||
interaction.
|
||||
|
||||
\f$ G_{in} = \kappa \rho_{u}/\rho_{b} \f$ is the generation
|
||||
rate due to the flame inestability.
|
||||
|
||||
By adding the removal rates of the two effects:
|
||||
|
||||
\f[
|
||||
R = G_\eta \frac{\Xi_{\eta_{eq}}}{\Xi_{\eta_{eq}} - 1}
|
||||
+ G_{in} \frac{\Xi_{{in}_{eq}}}{\Xi_{{in}_{eq}} - 1}
|
||||
\f]
|
||||
|
||||
where:
|
||||
|
||||
\f$ R \f$ is the total removal.
|
||||
|
||||
\f$ G_\eta \f$ is a model constant.
|
||||
|
||||
\f$ \Xi_{\eta_{eq}} \f$ is the flame wrinkling due to turbulence.
|
||||
|
||||
\f$ \Xi_{{in}_{eq}} \f$ is the equilibrium level of the flame wrinkling
|
||||
generated by inestability. It is a constant (default 2.5).
|
||||
|
||||
|
||||
SourceFiles
|
||||
XiModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef XiModel_H
|
||||
#define XiModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "psiuReactionThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "multivariateSurfaceInterpolationScheme.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class XiModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class XiModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
dictionary XiModelCoeffs_;
|
||||
|
||||
const psiuReactionThermo& thermo_;
|
||||
const compressible::RASModel& turbulence_;
|
||||
const volScalarField& Su_;
|
||||
const volScalarField& rho_;
|
||||
const volScalarField& b_;
|
||||
const surfaceScalarField& phi_;
|
||||
|
||||
//- Flame wrinking field
|
||||
volScalarField Xi_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
XiModel(const XiModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const XiModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("XiModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
XiModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
),
|
||||
(
|
||||
XiProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
Su,
|
||||
rho,
|
||||
b,
|
||||
phi
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected Xi model
|
||||
static autoPtr<XiModel> New
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
XiModel
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~XiModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame-wrinking Xi
|
||||
virtual const volScalarField& Xi() const
|
||||
{
|
||||
return Xi_;
|
||||
}
|
||||
|
||||
//- Return the flame diffusivity
|
||||
virtual tmp<volScalarField> Db() const
|
||||
{
|
||||
return turbulence_.muEff();
|
||||
}
|
||||
|
||||
//- Add Xi to the multivariateSurfaceInterpolationScheme table
|
||||
// if required
|
||||
virtual void addXi
|
||||
(
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable&
|
||||
)
|
||||
{}
|
||||
|
||||
//- Correct the flame-wrinking Xi
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Correct the flame-wrinking Xi using the given convection scheme
|
||||
virtual void correct(const fv::convectionScheme<scalar>&)
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiProperties) = 0;
|
||||
|
||||
//- Write fields related to Xi model
|
||||
virtual void writeFields() = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "XiModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
|
||||
(
|
||||
const dictionary& propDict,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
{
|
||||
const word modelType(propDict.lookup("XiModel"));
|
||||
|
||||
Info<< "Selecting flame-wrinkling model " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"XiModel::New"
|
||||
) << "Unknown XiModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid XiModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<XiModel>
|
||||
(cstrIter()(propDict, thermo, turbulence, Su, rho, b, phi));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "algebraic.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiModels
|
||||
{
|
||||
defineTypeNameAndDebug(algebraic, 0);
|
||||
addToRunTimeSelectionTable(XiModel, algebraic, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModels::algebraic::algebraic
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi),
|
||||
XiShapeCoef(readScalar(XiModelCoeffs_.lookup("XiShapeCoef"))),
|
||||
XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)),
|
||||
XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModels::algebraic::~algebraic()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiModels::algebraic::Db() const
|
||||
{
|
||||
return XiGModel_->Db();
|
||||
}
|
||||
|
||||
|
||||
void Foam::XiModels::algebraic::correct()
|
||||
{
|
||||
volScalarField XiEqEta(XiEqModel_->XiEq());
|
||||
volScalarField GEta(XiGModel_->G());
|
||||
|
||||
volScalarField R(GEta*XiEqEta/(XiEqEta - 0.999));
|
||||
|
||||
volScalarField XiEqStar(R/(R - GEta));
|
||||
|
||||
Xi_ == 1.0 + (1.0 + (2*XiShapeCoef)*(0.5 - b_))*(XiEqStar - 1.0);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiModels::algebraic::read(const dictionary& XiProperties)
|
||||
{
|
||||
XiModel::read(XiProperties);
|
||||
|
||||
XiModelCoeffs_.lookup("XiShapeCoef") >> XiShapeCoef;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,131 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiModels::algebraic
|
||||
|
||||
Description
|
||||
Simple algebraic model for Xi based on Gulders correlation
|
||||
with a linear correction function to give a plausible profile for Xi.
|
||||
See report TR/HGW/10 for details on the Weller two equations model.
|
||||
See \link XiModel.H \endlink for more details on flame wrinkling modelling.
|
||||
|
||||
SourceFiles
|
||||
algebraic.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef algebraic_H
|
||||
#define algebraic_H
|
||||
|
||||
#include "XiModel.H"
|
||||
#include "XiEqModel.H"
|
||||
#include "XiGModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class algebraic Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class algebraic
|
||||
:
|
||||
public XiModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar XiShapeCoef;
|
||||
|
||||
autoPtr<XiEqModel> XiEqModel_;
|
||||
autoPtr<XiGModel> XiGModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
algebraic(const algebraic&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const algebraic&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("algebraic");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
algebraic
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~algebraic();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame diffusivity
|
||||
virtual tmp<volScalarField> Db() const;
|
||||
|
||||
//- Correct the flame-wrinking Xi
|
||||
virtual void correct();
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiProperties);
|
||||
|
||||
//- Write fields of the XiEq model
|
||||
virtual void writeFields()
|
||||
{
|
||||
XiEqModel_().writeFields();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,72 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixed.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiModels
|
||||
{
|
||||
defineTypeNameAndDebug(fixed, 0);
|
||||
addToRunTimeSelectionTable(XiModel, fixed, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModels::fixed::fixed
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModels::fixed::~fixed()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::XiModels::fixed::read(const dictionary& XiProperties)
|
||||
{
|
||||
return XiModel::read(XiProperties);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
115
applications/solvers/combustion/PDRFoam/XiModels/fixed/fixed.H
Normal file
115
applications/solvers/combustion/PDRFoam/XiModels/fixed/fixed.H
Normal file
@ -0,0 +1,115 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiModels::fixed
|
||||
|
||||
Description
|
||||
Fixed value model for Xi. See \link XiModel.H \endlink for more details
|
||||
on flame wrinkling modelling.
|
||||
|
||||
SourceFiles
|
||||
fixed.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixed_H
|
||||
#define fixed_H
|
||||
|
||||
#include "XiModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixed Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixed
|
||||
:
|
||||
public XiModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
fixed(const fixed&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fixed&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fixed");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
fixed
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fixed();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the flame-wrinking Xi
|
||||
virtual void correct()
|
||||
{}
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiProperties);
|
||||
|
||||
//- Write fields of the XiEq model
|
||||
virtual void writeFields()
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "transport.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiModels
|
||||
{
|
||||
defineTypeNameAndDebug(transport, 0);
|
||||
addToRunTimeSelectionTable(XiModel, transport, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModels::transport::transport
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi),
|
||||
XiShapeCoef(readScalar(XiModelCoeffs_.lookup("XiShapeCoef"))),
|
||||
XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)),
|
||||
XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::XiModels::transport::~transport()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiModels::transport::Db() const
|
||||
{
|
||||
return XiGModel_->Db();
|
||||
}
|
||||
|
||||
|
||||
void Foam::XiModels::transport::correct
|
||||
(
|
||||
const fv::convectionScheme<scalar>& mvConvection
|
||||
)
|
||||
{
|
||||
volScalarField XiEqEta(XiEqModel_->XiEq());
|
||||
volScalarField GEta(XiGModel_->G());
|
||||
|
||||
volScalarField R(GEta*XiEqEta/(XiEqEta - 0.999));
|
||||
|
||||
volScalarField XiEqStar(R/(R - GEta));
|
||||
|
||||
volScalarField XiEq
|
||||
(
|
||||
1.0 + (1.0 + (2*XiShapeCoef)*(0.5 - b_))*(XiEqStar - 1.0)
|
||||
);
|
||||
|
||||
volScalarField G(R*(XiEq - 1.0)/XiEq);
|
||||
|
||||
const objectRegistry& db = b_.db();
|
||||
const volScalarField& betav = db.lookupObject<volScalarField>("betav");
|
||||
const volScalarField& mgb = db.lookupObject<volScalarField>("mgb");
|
||||
const surfaceScalarField& phiSt =
|
||||
db.lookupObject<surfaceScalarField>("phiSt");
|
||||
const volScalarField& Db = db.lookupObject<volScalarField>("Db");
|
||||
const surfaceScalarField& nf = db.lookupObject<surfaceScalarField>("nf");
|
||||
|
||||
surfaceScalarField phiXi
|
||||
(
|
||||
"phiXi",
|
||||
phiSt
|
||||
+ (
|
||||
- fvc::interpolate(fvc::laplacian(Db, b_)/mgb)*nf
|
||||
+ fvc::interpolate(rho_)*fvc::interpolate(Su_*(1.0/Xi_ - Xi_))*nf
|
||||
)
|
||||
);
|
||||
|
||||
solve
|
||||
(
|
||||
betav*fvm::ddt(rho_, Xi_)
|
||||
+ mvConvection.fvmDiv(phi_, Xi_)
|
||||
+ fvm::div(phiXi, Xi_)
|
||||
- fvm::Sp(fvc::div(phiXi), Xi_)
|
||||
==
|
||||
betav*rho_*R
|
||||
- fvm::Sp(betav*rho_*(R - G), Xi_)
|
||||
);
|
||||
|
||||
// Correct boundedness of Xi
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Xi_.max(1.0);
|
||||
Xi_ = min(Xi_, 2.0*XiEq);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::XiModels::transport::read(const dictionary& XiProperties)
|
||||
{
|
||||
XiModel::read(XiProperties);
|
||||
|
||||
XiModelCoeffs_.lookup("XiShapeCoef") >> XiShapeCoef;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,145 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::XiModels::transport
|
||||
|
||||
Description
|
||||
Simple transport model for Xi based on Gulders correlation
|
||||
with a linear correction function to give a plausible profile for Xi.
|
||||
See report TR/HGW/10 for details on the Weller two equations model.
|
||||
See \link XiModel.H \endlink for more details on flame wrinkling modelling.
|
||||
|
||||
SourceFiles
|
||||
transport.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef transport_H
|
||||
#define transport_H
|
||||
|
||||
#include "XiModel.H"
|
||||
#include "XiEqModel.H"
|
||||
#include "XiGModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace XiModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class transport Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class transport
|
||||
:
|
||||
public XiModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
scalar XiShapeCoef;
|
||||
|
||||
autoPtr<XiEqModel> XiEqModel_;
|
||||
autoPtr<XiGModel> XiGModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
transport(const transport&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const transport&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("transport");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
transport
|
||||
(
|
||||
const dictionary& XiProperties,
|
||||
const psiuReactionThermo& thermo,
|
||||
const compressible::RASModel& turbulence,
|
||||
const volScalarField& Su,
|
||||
const volScalarField& rho,
|
||||
const volScalarField& b,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~transport();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the flame diffusivity
|
||||
virtual tmp<volScalarField> Db() const;
|
||||
|
||||
//- Add Xi to the multivariateSurfaceInterpolationScheme table
|
||||
virtual void addXi
|
||||
(
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable& fields
|
||||
)
|
||||
{
|
||||
fields.add(Xi_);
|
||||
}
|
||||
|
||||
//- Correct the flame-wrinking Xi
|
||||
virtual void correct()
|
||||
{
|
||||
notImplemented("transport::correct()");
|
||||
}
|
||||
|
||||
//- Correct the flame-wrinking Xi using the given convection scheme
|
||||
virtual void correct(const fv::convectionScheme<scalar>& mvConvection);
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& XiProperties);
|
||||
|
||||
//- Write fields of the XiEq model
|
||||
virtual void writeFields()
|
||||
{
|
||||
XiEqModel_().writeFields();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace XiModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
108
applications/solvers/combustion/PDRFoam/bEqn.H
Normal file
108
applications/solvers/combustion/PDRFoam/bEqn.H
Normal file
@ -0,0 +1,108 @@
|
||||
tmp<fv::convectionScheme<scalar> > mvConvection
|
||||
(
|
||||
fv::convectionScheme<scalar>::New
|
||||
(
|
||||
mesh,
|
||||
fields,
|
||||
phi,
|
||||
mesh.divScheme("div(phi,ft_b_ha_hau)")
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField Db("Db", turbulence->muEff());
|
||||
|
||||
if (ign.ignited())
|
||||
{
|
||||
// Calculate the unstrained laminar flame speed
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Su = unstrainedLaminarFlameSpeed()();
|
||||
|
||||
const volScalarField& Xi = flameWrinkling->Xi();
|
||||
|
||||
// progress variable
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
volScalarField c("c", 1.0 - b);
|
||||
|
||||
// Unburnt gas density
|
||||
// ~~~~~~~~~~~~~~~~~~~
|
||||
volScalarField rhou(thermo.rhou());
|
||||
|
||||
// Calculate flame normal etc.
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//volVectorField n(fvc::grad(b));
|
||||
volVectorField n(fvc::reconstruct(fvc::snGrad(b)*mesh.magSf()));
|
||||
|
||||
volScalarField mgb("mgb", mag(n));
|
||||
|
||||
dimensionedScalar dMgb("dMgb", mgb.dimensions(), SMALL);
|
||||
|
||||
{
|
||||
volScalarField bc(b*c);
|
||||
|
||||
dMgb += 1.0e-3*
|
||||
(bc*mgb)().weightedAverage(mesh.V())
|
||||
/(bc.weightedAverage(mesh.V()) + SMALL);
|
||||
}
|
||||
|
||||
mgb += dMgb;
|
||||
|
||||
surfaceVectorField Sfhat(mesh.Sf()/mesh.magSf());
|
||||
surfaceVectorField nfVec(fvc::interpolate(n));
|
||||
nfVec += Sfhat*(fvc::snGrad(b) - (Sfhat & nfVec));
|
||||
nfVec /= (mag(nfVec) + dMgb);
|
||||
surfaceScalarField nf("nf", mesh.Sf() & nfVec);
|
||||
n /= mgb;
|
||||
|
||||
#include "StCorr.H"
|
||||
|
||||
// Calculate turbulent flame speed flux
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
surfaceScalarField phiSt("phiSt", fvc::interpolate(rhou*StCorr*St)*nf);
|
||||
|
||||
#include "StCourantNo.H"
|
||||
|
||||
Db = flameWrinkling->Db();
|
||||
|
||||
// Create b equation
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
fvScalarMatrix bEqn
|
||||
(
|
||||
betav*fvm::ddt(rho, b)
|
||||
+ mvConvection->fvmDiv(phi, b)
|
||||
+ fvm::div(phiSt, b)
|
||||
- fvm::Sp(fvc::div(phiSt), b)
|
||||
- fvm::laplacian(Db, b)
|
||||
);
|
||||
|
||||
|
||||
// Add ignition cell contribution to b-equation
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#include "ignite.H"
|
||||
|
||||
// Solve for b
|
||||
// ~~~~~~~~~~~
|
||||
bEqn.solve();
|
||||
|
||||
Info<< "min(b) = " << min(b).value() << endl;
|
||||
|
||||
if (composition.contains("ft"))
|
||||
{
|
||||
volScalarField& ft = composition.Y("ft");
|
||||
|
||||
Info<< "Combustion progress = "
|
||||
<< 100*(1.0 - b)().weightedAverage(mesh.V()*ft).value() << "%"
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Combustion progress = "
|
||||
<< 100*(1.0 - b)().weightedAverage(mesh.V()).value() << "%"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Correct the flame-wrinkling
|
||||
flameWrinkling->correct(mvConvection);
|
||||
|
||||
St = Xi*Su;
|
||||
}
|
||||
199
applications/solvers/combustion/PDRFoam/createFields.H
Normal file
199
applications/solvers/combustion/PDRFoam/createFields.H
Normal file
@ -0,0 +1,199 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<psiuReactionThermo> pThermo
|
||||
(
|
||||
psiuReactionThermo::New(mesh)
|
||||
);
|
||||
psiuReactionThermo& thermo = pThermo();
|
||||
thermo.validate(args.executable(), "ha", "ea");
|
||||
|
||||
basicMultiComponentMixture& composition = thermo.composition();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.rho()
|
||||
);
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
const volScalarField& psi = thermo.psi();
|
||||
|
||||
volScalarField& b = composition.Y("b");
|
||||
Info<< "min(b) = " << min(b).value() << endl;
|
||||
|
||||
Info<< "\nReading 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::RASModel> turbulence
|
||||
(
|
||||
compressible::RASModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dpdt",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
|
||||
);
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
|
||||
Info<< "Creating the unstrained laminar flame speed\n" << endl;
|
||||
autoPtr<laminarFlameSpeed> unstrainedLaminarFlameSpeed
|
||||
(
|
||||
laminarFlameSpeed::New(thermo)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading strained laminar flame speed field Su\n" << endl;
|
||||
volScalarField Su
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field betav\n" << endl;
|
||||
volScalarField betav
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"betav",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field Lobs\n" << endl;
|
||||
volScalarField Lobs
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Lobs",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field CT\n" << endl;
|
||||
volSymmTensorField CT
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"CT",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
IOdictionary PDRProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"PDRProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
//- Create the drag model
|
||||
autoPtr<PDRDragModel> drag = PDRDragModel::New
|
||||
(
|
||||
PDRProperties,
|
||||
turbulence,
|
||||
rho,
|
||||
U,
|
||||
phi
|
||||
);
|
||||
|
||||
//- Create the flame-wrinkling model
|
||||
autoPtr<XiModel> flameWrinkling = XiModel::New
|
||||
(
|
||||
PDRProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
Su,
|
||||
rho,
|
||||
b,
|
||||
phi
|
||||
);
|
||||
|
||||
Info<< "Calculating turbulent flame speed field St\n" << endl;
|
||||
volScalarField St
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"St",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
flameWrinkling->Xi()*Su
|
||||
);
|
||||
|
||||
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
|
||||
|
||||
if (composition.contains("ft"))
|
||||
{
|
||||
fields.add(composition.Y("ft"));
|
||||
}
|
||||
|
||||
fields.add(b);
|
||||
fields.add(thermo.he());
|
||||
fields.add(thermo.heu());
|
||||
flameWrinkling->addXi(fields);
|
||||
11
applications/solvers/combustion/PDRFoam/ftEqn.H
Normal file
11
applications/solvers/combustion/PDRFoam/ftEqn.H
Normal file
@ -0,0 +1,11 @@
|
||||
if (composition.contains("ft"))
|
||||
{
|
||||
volScalarField& ft = composition.Y("ft");
|
||||
|
||||
solve
|
||||
(
|
||||
betav*fvm::ddt(rho, ft)
|
||||
+ mvConvection->fvmDiv(phi, ft)
|
||||
- fvm::laplacian(Db, ft)
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,451 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IFstream.H"
|
||||
#include "SCOPELaminarFlameSpeed.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace laminarFlameSpeedModels
|
||||
{
|
||||
defineTypeNameAndDebug(SCOPE, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
laminarFlameSpeed,
|
||||
SCOPE,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::laminarFlameSpeedModels::SCOPE::polynomial::polynomial
|
||||
(
|
||||
const dictionary& polyDict
|
||||
)
|
||||
:
|
||||
FixedList<scalar, 7>(polyDict.lookup("coefficients")),
|
||||
ll(readScalar(polyDict.lookup("lowerLimit"))),
|
||||
ul(readScalar(polyDict.lookup("upperLimit"))),
|
||||
llv(polyPhi(ll, *this)),
|
||||
ulv(polyPhi(ul, *this)),
|
||||
lu(0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::laminarFlameSpeedModels::SCOPE::SCOPE
|
||||
(
|
||||
const dictionary& dict,
|
||||
const psiuReactionThermo& ct
|
||||
)
|
||||
:
|
||||
laminarFlameSpeed(dict, ct),
|
||||
|
||||
coeffsDict_
|
||||
(
|
||||
dictionary
|
||||
(
|
||||
IFstream
|
||||
(
|
||||
fileName
|
||||
(
|
||||
dict.lookup("fuelFile")
|
||||
)
|
||||
)()
|
||||
).subDict(typeName + "Coeffs")
|
||||
),
|
||||
LFL_(readScalar(coeffsDict_.lookup("lowerFlamabilityLimit"))),
|
||||
UFL_(readScalar(coeffsDict_.lookup("upperFlamabilityLimit"))),
|
||||
SuPolyL_(coeffsDict_.subDict("lowerSuPolynomial")),
|
||||
SuPolyU_(coeffsDict_.subDict("upperSuPolynomial")),
|
||||
Texp_(readScalar(coeffsDict_.lookup("Texp"))),
|
||||
pexp_(readScalar(coeffsDict_.lookup("pexp"))),
|
||||
MaPolyL_(coeffsDict_.subDict("lowerMaPolynomial")),
|
||||
MaPolyU_(coeffsDict_.subDict("upperMaPolynomial"))
|
||||
{
|
||||
SuPolyL_.ll = max(SuPolyL_.ll, LFL_) + SMALL;
|
||||
SuPolyU_.ul = min(SuPolyU_.ul, UFL_) - SMALL;
|
||||
|
||||
SuPolyL_.lu = 0.5*(SuPolyL_.ul + SuPolyU_.ll);
|
||||
SuPolyU_.lu = SuPolyL_.lu - SMALL;
|
||||
|
||||
MaPolyL_.lu = 0.5*(MaPolyL_.ul + MaPolyU_.ll);
|
||||
MaPolyU_.lu = MaPolyL_.lu - SMALL;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "phi Su (T = Tref, p = pref)" << endl;
|
||||
label n = 200;
|
||||
for (int i=0; i<n; i++)
|
||||
{
|
||||
scalar phi = (2.0*i)/n;
|
||||
Info<< phi << token::TAB << SuRef(phi) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::laminarFlameSpeedModels::SCOPE::~SCOPE()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::polyPhi
|
||||
(
|
||||
scalar phi,
|
||||
const polynomial& a
|
||||
)
|
||||
{
|
||||
scalar x = phi - 1.0;
|
||||
|
||||
return
|
||||
a[0]
|
||||
*(
|
||||
scalar(1)
|
||||
+ x*(a[1] + x*(a[2] + x*(a[3] + x*(a[4] + x*(a[5] + x*a[6])))))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::SuRef
|
||||
(
|
||||
scalar phi
|
||||
) const
|
||||
{
|
||||
if (phi < LFL_ || phi > UFL_)
|
||||
{
|
||||
// Return 0 beyond the flamibility limits
|
||||
return scalar(0);
|
||||
}
|
||||
else if (phi < SuPolyL_.ll)
|
||||
{
|
||||
// Use linear interpolation between the low end of the
|
||||
// lower polynomial and the lower flamibility limit
|
||||
return SuPolyL_.llv*(phi - LFL_)/(SuPolyL_.ll - LFL_);
|
||||
}
|
||||
else if (phi > SuPolyU_.ul)
|
||||
{
|
||||
// Use linear interpolation between the upper end of the
|
||||
// upper polynomial and the upper flamibility limit
|
||||
return SuPolyU_.ulv*(UFL_ - phi)/(UFL_ - SuPolyU_.ul);
|
||||
}
|
||||
else if (phi < SuPolyL_.lu)
|
||||
{
|
||||
// Evaluate the lower polynomial
|
||||
return polyPhi(phi, SuPolyL_);
|
||||
}
|
||||
else if (phi > SuPolyU_.lu)
|
||||
{
|
||||
// Evaluate the upper polynomial
|
||||
return polyPhi(phi, SuPolyU_);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("laminarFlameSpeedModels::SCOPE::SuRef(scalar phi)")
|
||||
<< "phi = " << phi
|
||||
<< " cannot be handled by SCOPE function with the "
|
||||
"given coefficients"
|
||||
<< exit(FatalError);
|
||||
|
||||
return scalar(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::Ma
|
||||
(
|
||||
scalar phi
|
||||
) const
|
||||
{
|
||||
if (phi < MaPolyL_.ll)
|
||||
{
|
||||
// Beyond the lower limit assume Ma is constant
|
||||
return MaPolyL_.llv;
|
||||
}
|
||||
else if (phi > MaPolyU_.ul)
|
||||
{
|
||||
// Beyond the upper limit assume Ma is constant
|
||||
return MaPolyU_.ulv;
|
||||
}
|
||||
else if (phi < SuPolyL_.lu)
|
||||
{
|
||||
// Evaluate the lower polynomial
|
||||
return polyPhi(phi, MaPolyL_);
|
||||
}
|
||||
else if (phi > SuPolyU_.lu)
|
||||
{
|
||||
// Evaluate the upper polynomial
|
||||
return polyPhi(phi, MaPolyU_);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("laminarFlameSpeedModels::SCOPE::Ma(scalar phi)")
|
||||
<< "phi = " << phi
|
||||
<< " cannot be handled by SCOPE function with the "
|
||||
"given coefficients"
|
||||
<< exit(FatalError);
|
||||
|
||||
return scalar(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
|
||||
(
|
||||
scalar p,
|
||||
scalar Tu,
|
||||
scalar phi
|
||||
) const
|
||||
{
|
||||
static const scalar Tref = 300.0;
|
||||
static const scalar pRef = 1.013e5;
|
||||
|
||||
return SuRef(phi)*pow((Tu/Tref), Texp_)*pow((p/pRef), pexp_);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
|
||||
(
|
||||
const volScalarField& p,
|
||||
const volScalarField& Tu,
|
||||
scalar phi
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tSu0
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su0",
|
||||
p.time().timeName(),
|
||||
p.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
p.mesh(),
|
||||
dimensionedScalar("Su0", dimVelocity, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& Su0 = tSu0();
|
||||
|
||||
forAll(Su0, celli)
|
||||
{
|
||||
Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi);
|
||||
}
|
||||
|
||||
forAll(Su0.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& Su0p = Su0.boundaryField()[patchi];
|
||||
const scalarField& pp = p.boundaryField()[patchi];
|
||||
const scalarField& Tup = Tu.boundaryField()[patchi];
|
||||
|
||||
forAll(Su0p, facei)
|
||||
{
|
||||
Su0p[facei] = Su0pTphi(pp[facei], Tup[facei], phi);
|
||||
}
|
||||
}
|
||||
|
||||
return tSu0;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
|
||||
(
|
||||
const volScalarField& p,
|
||||
const volScalarField& Tu,
|
||||
const volScalarField& phi
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tSu0
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su0",
|
||||
p.time().timeName(),
|
||||
p.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
p.mesh(),
|
||||
dimensionedScalar("Su0", dimVelocity, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& Su0 = tSu0();
|
||||
|
||||
forAll(Su0, celli)
|
||||
{
|
||||
Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi[celli]);
|
||||
}
|
||||
|
||||
forAll(Su0.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& Su0p = Su0.boundaryField()[patchi];
|
||||
const scalarField& pp = p.boundaryField()[patchi];
|
||||
const scalarField& Tup = Tu.boundaryField()[patchi];
|
||||
const scalarField& phip = phi.boundaryField()[patchi];
|
||||
|
||||
forAll(Su0p, facei)
|
||||
{
|
||||
Su0p[facei] =
|
||||
Su0pTphi
|
||||
(
|
||||
pp[facei],
|
||||
Tup[facei],
|
||||
phip[facei]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return tSu0;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Ma
|
||||
(
|
||||
const volScalarField& phi
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tMa
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Ma",
|
||||
phi.time().timeName(),
|
||||
phi.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
phi.mesh(),
|
||||
dimensionedScalar("Ma", dimless, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& ma = tMa();
|
||||
|
||||
forAll(ma, celli)
|
||||
{
|
||||
ma[celli] = Ma(phi[celli]);
|
||||
}
|
||||
|
||||
forAll(ma.boundaryField(), patchi)
|
||||
{
|
||||
scalarField& map = ma.boundaryField()[patchi];
|
||||
const scalarField& phip = phi.boundaryField()[patchi];
|
||||
|
||||
forAll(map, facei)
|
||||
{
|
||||
map[facei] = Ma(phip[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
return tMa;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminarFlameSpeedModels::SCOPE::Ma() const
|
||||
{
|
||||
if (psiuReactionThermo_.composition().contains("ft"))
|
||||
{
|
||||
const volScalarField& ft = psiuReactionThermo_.composition().Y("ft");
|
||||
|
||||
return Ma
|
||||
(
|
||||
dimensionedScalar
|
||||
(
|
||||
psiuReactionThermo_.lookup("stoichiometricAirFuelMassRatio")
|
||||
)*ft/(scalar(1) - ft)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
const fvMesh& mesh = psiuReactionThermo_.p().mesh();
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Ma",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Ma", dimless, Ma(equivalenceRatio_))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminarFlameSpeedModels::SCOPE::operator()() const
|
||||
{
|
||||
if (psiuReactionThermo_.composition().contains("ft"))
|
||||
{
|
||||
const volScalarField& ft = psiuReactionThermo_.composition().Y("ft");
|
||||
|
||||
return Su0pTphi
|
||||
(
|
||||
psiuReactionThermo_.p(),
|
||||
psiuReactionThermo_.Tu(),
|
||||
dimensionedScalar
|
||||
(
|
||||
psiuReactionThermo_.lookup("stoichiometricAirFuelMassRatio")
|
||||
)*ft/(scalar(1) - ft)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Su0pTphi
|
||||
(
|
||||
psiuReactionThermo_.p(),
|
||||
psiuReactionThermo_.Tu(),
|
||||
equivalenceRatio_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,220 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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/>.
|
||||
|
||||
Class
|
||||
Foam::laminarFlameSpeedModels::SCOPE
|
||||
|
||||
Description
|
||||
Laminar flame speed obtained from the SCOPE correlation.
|
||||
|
||||
Seven parameters are specified in terms of polynomial functions of
|
||||
stoichiometry. Two polynomials are fitted, covering different parts of the
|
||||
flammable range. If the mixture is outside the fitted range, linear
|
||||
interpolation is used between the extreme of the polynomio and the upper or
|
||||
lower flammable limit with the Markstein number constant.
|
||||
|
||||
Variations of pressure and temperature from the reference values are taken
|
||||
into account through \f$ pexp \f$ and \f$ texp \f$
|
||||
|
||||
The laminar burning velocity fitting polynomial is:
|
||||
|
||||
\f$ Su = a_{0}(1+a_{1}x+K+..a_{i}x^{i}..+a_{6}x^{6}) (p/p_{ref})^{pexp}
|
||||
(T/T_{ref})^{texp} \f$
|
||||
|
||||
where:
|
||||
|
||||
\f$ a_{i} \f$ are the polinomial coefficients.
|
||||
|
||||
\f$ pexp \f$ and \f$ texp \f$ are the pressure and temperature factors
|
||||
respectively.
|
||||
|
||||
\f$ x \f$ is the equivalence ratio.
|
||||
|
||||
\f$ T_{ref} \f$ and \f$ p_{ref} \f$ are the temperature and pressure
|
||||
references for the laminar burning velocity.
|
||||
|
||||
|
||||
SourceFiles
|
||||
SCOPELaminarFlameSpeed.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SCOPE_H
|
||||
#define SCOPE_H
|
||||
|
||||
#include "laminarFlameSpeed.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace laminarFlameSpeedModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SCOPE Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class SCOPE
|
||||
:
|
||||
public laminarFlameSpeed
|
||||
{
|
||||
// Private Data
|
||||
|
||||
class polynomial
|
||||
:
|
||||
public FixedList<scalar, 7>
|
||||
{
|
||||
public:
|
||||
|
||||
//- Lower limit
|
||||
scalar ll;
|
||||
|
||||
//- Upper polynomial limit
|
||||
scalar ul;
|
||||
|
||||
//- Value at lower limit
|
||||
scalar llv;
|
||||
|
||||
//- Value at upper limit
|
||||
scalar ulv;
|
||||
|
||||
//- Changeover point from lower to upper polynomial
|
||||
scalar lu;
|
||||
|
||||
//- Construct from dictionary
|
||||
polynomial(const dictionary& polyDict);
|
||||
};
|
||||
|
||||
|
||||
dictionary coeffsDict_;
|
||||
|
||||
//- Lower flamability limit
|
||||
scalar LFL_;
|
||||
|
||||
//- Upper flamability limit
|
||||
scalar UFL_;
|
||||
|
||||
//- Lower Su polynomial
|
||||
polynomial SuPolyL_;
|
||||
|
||||
//- Upper Su polynomial
|
||||
polynomial SuPolyU_;
|
||||
|
||||
//- Temperature correction exponent
|
||||
scalar Texp_;
|
||||
|
||||
//- Pressure correction exponent
|
||||
scalar pexp_;
|
||||
|
||||
//- Lower Ma polynomial
|
||||
polynomial MaPolyL_;
|
||||
|
||||
//- Upper Ma polynomial
|
||||
polynomial MaPolyU_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Polynomial evaluated from the given equivalence ratio
|
||||
// and polynomial coefficients
|
||||
static inline scalar polyPhi(scalar phi, const polynomial& a);
|
||||
|
||||
//- Laminar flame speed evaluated from the given equivalence ratio
|
||||
// at the reference temperature and pressure
|
||||
inline scalar SuRef(scalar phi) const;
|
||||
|
||||
//- Markstein evaluated from the given equivalence ratio
|
||||
inline scalar Ma(scalar phi) const;
|
||||
|
||||
//- Laminar flame speed evaluated from the given equivalence ratio
|
||||
// corrected for temperature and pressure dependence
|
||||
inline scalar Su0pTphi(scalar p, scalar Tu, scalar phi) const;
|
||||
|
||||
//- Laminar flame speed evaluated from the given uniform
|
||||
// equivalence ratio corrected for temperature and pressure dependence
|
||||
tmp<volScalarField> Su0pTphi
|
||||
(
|
||||
const volScalarField& p,
|
||||
const volScalarField& Tu,
|
||||
scalar phi
|
||||
) const;
|
||||
|
||||
//- Laminar flame speed evaluated from the given equivalence ratio
|
||||
// distribution corrected for temperature and pressure dependence
|
||||
tmp<volScalarField> Su0pTphi
|
||||
(
|
||||
const volScalarField& p,
|
||||
const volScalarField& Tu,
|
||||
const volScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Return the Markstein number
|
||||
// evaluated from the given equivalence ratio
|
||||
tmp<volScalarField> Ma(const volScalarField& phi) const;
|
||||
|
||||
//- Construct as copy (not implemented)
|
||||
SCOPE(const SCOPE&);
|
||||
|
||||
void operator=(const SCOPE&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("SCOPE");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and psiuReactionThermo
|
||||
SCOPE
|
||||
(
|
||||
const dictionary&,
|
||||
const psiuReactionThermo&
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~SCOPE();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the Markstein number
|
||||
tmp<volScalarField> Ma() const;
|
||||
|
||||
//- Return the laminar flame speed [m/s]
|
||||
tmp<volScalarField> operator()() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End laminarFlameSpeedModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
76
applications/solvers/combustion/PDRFoam/pEqn.H
Normal file
76
applications/solvers/combustion/PDRFoam/pEqn.H
Normal file
@ -0,0 +1,76 @@
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = invA & UEqn.H();
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
(fvc::interpolate(rho*HbyA) & mesh.Sf())
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
|
||||
)/fvc::interpolate(rho)
|
||||
);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
betav*fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rho*invA, p)
|
||||
);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi == pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(
|
||||
(fvc::interpolate(rho*HbyA) & mesh.Sf())
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
betav*fvm::ddt(psi, p)
|
||||
+ fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rho*invA, p)
|
||||
);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "continuityErrs.H"
|
||||
|
||||
U = HbyA - (invA & (betav*fvc::grad(p)));
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
if (thermo.dpdt())
|
||||
{
|
||||
dpdt = fvc::ddt(p);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
Info<< "Reading combustion properties\n" << endl;
|
||||
|
||||
IOdictionary combustionProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"combustionProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
ignition ign(combustionProperties, runTime, mesh);
|
||||
36
applications/solvers/combustion/PDRFoam/rhoEqn.H
Normal file
36
applications/solvers/combustion/PDRFoam/rhoEqn.H
Normal file
@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
Global
|
||||
rhoEqn
|
||||
|
||||
Description
|
||||
Solve the continuity for density.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
solve(betav*fvm::ddt(rho) + fvc::div(phi));
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
51
applications/solvers/combustion/PDRFoam/setDeltaT.H
Normal file
51
applications/solvers/combustion/PDRFoam/setDeltaT.H
Normal file
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
Global
|
||||
setDeltaT
|
||||
|
||||
Description
|
||||
Reset the timestep to maintain a constant maximum courant Number.
|
||||
Reduction of time-step is imediate but increase is damped to avoid
|
||||
unstable oscillations.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL);
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
31
applications/solvers/combustion/XiFoam/EaEqn.H
Normal file
31
applications/solvers/combustion/XiFoam/EaEqn.H
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
volScalarField& hea = thermo.he();
|
||||
|
||||
fvScalarMatrix EaEqn
|
||||
(
|
||||
fvm::ddt(rho, hea) + mvConvection->fvmDiv(phi, hea)
|
||||
+ fvc::ddt(rho, K) + fvc::div(phi, K)
|
||||
+ (
|
||||
hea.name() == "ea"
|
||||
? fvc::div
|
||||
(
|
||||
fvc::absolute(phi/fvc::interpolate(rho), U),
|
||||
p,
|
||||
"div(phiv,p)"
|
||||
)
|
||||
: -dpdt
|
||||
)
|
||||
- fvm::laplacian(turbulence->alphaEff(), hea)
|
||||
+ fvOptions(rho, hea)
|
||||
);
|
||||
|
||||
EaEqn.relax();
|
||||
|
||||
fvOptions.constrain(EaEqn);
|
||||
|
||||
EaEqn.solve();
|
||||
|
||||
fvOptions.correct(hea);
|
||||
|
||||
thermo.correct();
|
||||
}
|
||||
36
applications/solvers/combustion/XiFoam/EauEqn.H
Normal file
36
applications/solvers/combustion/XiFoam/EauEqn.H
Normal file
@ -0,0 +1,36 @@
|
||||
if (ign.ignited())
|
||||
{
|
||||
volScalarField& heau = thermo.heu();
|
||||
|
||||
fvScalarMatrix heauEqn
|
||||
(
|
||||
fvm::ddt(rho, heau) + mvConvection->fvmDiv(phi, heau)
|
||||
+ (fvc::ddt(rho, K) + fvc::div(phi, K))*rho/thermo.rhou()
|
||||
+ (
|
||||
heau.name() == "eau"
|
||||
? fvc::div
|
||||
(
|
||||
fvc::absolute(phi/fvc::interpolate(rho), U),
|
||||
p,
|
||||
"div(phiv,p)"
|
||||
)*rho/thermo.rhou()
|
||||
: -dpdt*rho/thermo.rhou()
|
||||
)
|
||||
- fvm::laplacian(turbulence->alphaEff(), heau)
|
||||
|
||||
// These terms cannot be used in partially-premixed combustion due to
|
||||
// the resultant inconsistency between ft and heau transport.
|
||||
// A possible solution would be to solve for ftu as well as ft.
|
||||
//- fvm::div(muEff*fvc::grad(b)/(b + 0.001), heau)
|
||||
//+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), heau)
|
||||
|
||||
==
|
||||
fvOptions(rho, heau)
|
||||
);
|
||||
|
||||
fvOptions.constrain(heauEqn);
|
||||
|
||||
heauEqn.solve();
|
||||
|
||||
fvOptions.correct(heau);
|
||||
}
|
||||
3
applications/solvers/combustion/XiFoam/Make/files
Normal file
3
applications/solvers/combustion/XiFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
XiFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/XiFoam
|
||||
25
applications/solvers/combustion/XiFoam/Make/options
Normal file
25
applications/solvers/combustion/XiFoam/Make/options
Normal file
@ -0,0 +1,25 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude\
|
||||
-I$(LIB_SRC)/engine/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lsampling \
|
||||
-lmeshTools \
|
||||
-lengine \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lreactionThermophysicalModels \
|
||||
-lspecie \
|
||||
-llaminarFlameSpeedModels
|
||||
21
applications/solvers/combustion/XiFoam/UEqn.H
Normal file
21
applications/solvers/combustion/XiFoam/UEqn.H
Normal file
@ -0,0 +1,21 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
==
|
||||
rho*g
|
||||
+ fvOptions(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
fvOptions.constrain(UEqn);
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
137
applications/solvers/combustion/XiFoam/XiFoam.C
Normal file
137
applications/solvers/combustion/XiFoam/XiFoam.C
Normal file
@ -0,0 +1,137 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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
|
||||
XiFoam
|
||||
|
||||
Description
|
||||
Solver for compressible premixed/partially-premixed combustion with
|
||||
turbulence modelling.
|
||||
|
||||
Combusting RANS code using the b-Xi two-equation model.
|
||||
Xi may be obtained by either the solution of the Xi transport
|
||||
equation or from an algebraic exression. Both approaches are
|
||||
based on Gulder's flame speed correlation which has been shown
|
||||
to be appropriate by comparison with the results from the
|
||||
spectral model.
|
||||
|
||||
Strain effects are encorporated directly into the Xi equation
|
||||
but not in the algebraic approximation. Further work need to be
|
||||
done on this issue, particularly regarding the enhanced removal rate
|
||||
caused by flame compression. Analysis using results of the spectral
|
||||
model will be required.
|
||||
|
||||
For cases involving very lean Propane flames or other flames which are
|
||||
very strain-sensitive, a transport equation for the laminar flame
|
||||
speed is present. This equation is derived using heuristic arguments
|
||||
involving the strain time scale and the strain-rate at extinction.
|
||||
the transport velocity is the same as that for the Xi equation.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "psiuReactionThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "laminarFlameSpeed.H"
|
||||
#include "ignition.H"
|
||||
#include "Switch.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvIOoptionList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readCombustionProperties.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "UEqn.H"
|
||||
|
||||
#include "ftEqn.H"
|
||||
#include "bEqn.H"
|
||||
#include "EauEqn.H"
|
||||
#include "EaEqn.H"
|
||||
|
||||
if (!ign.ignited())
|
||||
{
|
||||
thermo.heu() == thermo.he();
|
||||
}
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
279
applications/solvers/combustion/XiFoam/bEqn.H
Normal file
279
applications/solvers/combustion/XiFoam/bEqn.H
Normal file
@ -0,0 +1,279 @@
|
||||
if (ign.ignited())
|
||||
{
|
||||
// progress variable
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
volScalarField c(scalar(1) - b);
|
||||
|
||||
// Unburnt gas density
|
||||
// ~~~~~~~~~~~~~~~~~~~
|
||||
volScalarField rhou(thermo.rhou());
|
||||
|
||||
// Calculate flame normal etc.
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
volVectorField n(fvc::grad(b));
|
||||
|
||||
volScalarField mgb(mag(n));
|
||||
|
||||
dimensionedScalar dMgb = 1.0e-3*
|
||||
(b*c*mgb)().weightedAverage(mesh.V())
|
||||
/((b*c)().weightedAverage(mesh.V()) + SMALL)
|
||||
+ dimensionedScalar("ddMgb", mgb.dimensions(), SMALL);
|
||||
|
||||
mgb += dMgb;
|
||||
|
||||
surfaceVectorField SfHat(mesh.Sf()/mesh.magSf());
|
||||
surfaceVectorField nfVec(fvc::interpolate(n));
|
||||
nfVec += SfHat*(fvc::snGrad(b) - (SfHat & nfVec));
|
||||
nfVec /= (mag(nfVec) + dMgb);
|
||||
surfaceScalarField nf((mesh.Sf() & nfVec));
|
||||
n /= mgb;
|
||||
|
||||
|
||||
#include "StCorr.H"
|
||||
|
||||
// Calculate turbulent flame speed flux
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
surfaceScalarField phiSt("phiSt", fvc::interpolate(rhou*StCorr*Su*Xi)*nf);
|
||||
|
||||
scalar StCoNum = max
|
||||
(
|
||||
mesh.surfaceInterpolation::deltaCoeffs()
|
||||
*mag(phiSt)/(fvc::interpolate(rho)*mesh.magSf())
|
||||
).value()*runTime.deltaTValue();
|
||||
|
||||
Info<< "Max St-Courant Number = " << StCoNum << endl;
|
||||
|
||||
// Create b equation
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
fvScalarMatrix bEqn
|
||||
(
|
||||
fvm::ddt(rho, b)
|
||||
+ mvConvection->fvmDiv(phi, b)
|
||||
+ fvm::div(phiSt, b)
|
||||
- fvm::Sp(fvc::div(phiSt), b)
|
||||
- fvm::laplacian(turbulence->alphaEff(), b)
|
||||
==
|
||||
fvOptions(rho, b)
|
||||
);
|
||||
|
||||
|
||||
// Add ignition cell contribution to b-equation
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#include "ignite.H"
|
||||
|
||||
|
||||
// Solve for b
|
||||
// ~~~~~~~~~~~
|
||||
bEqn.relax();
|
||||
|
||||
fvOptions.constrain(bEqn);
|
||||
|
||||
bEqn.solve();
|
||||
|
||||
fvOptions.correct(b);
|
||||
|
||||
Info<< "min(b) = " << min(b).value() << endl;
|
||||
|
||||
|
||||
// Calculate coefficients for Gulder's flame speed correlation
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
volScalarField up(uPrimeCoef*sqrt((2.0/3.0)*turbulence->k()));
|
||||
//volScalarField up(sqrt(mag(diag(n * n) & diag(turbulence->r()))));
|
||||
|
||||
volScalarField epsilon(pow(uPrimeCoef, 3)*turbulence->epsilon());
|
||||
|
||||
volScalarField tauEta(sqrt(thermo.muu()/(rhou*epsilon)));
|
||||
|
||||
volScalarField Reta
|
||||
(
|
||||
up
|
||||
/ (
|
||||
sqrt(epsilon*tauEta)
|
||||
+ dimensionedScalar("1e-8", up.dimensions(), 1e-8)
|
||||
)
|
||||
);
|
||||
|
||||
//volScalarField l = 0.337*k*sqrt(k)/epsilon;
|
||||
//Reta *= max((l - dimensionedScalar("dl", dimLength, 1.5e-3))/l, 0.0);
|
||||
|
||||
// Calculate Xi flux
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
surfaceScalarField phiXi
|
||||
(
|
||||
phiSt
|
||||
- fvc::interpolate(fvc::laplacian(turbulence->alphaEff(), b)/mgb)*nf
|
||||
+ fvc::interpolate(rho)*fvc::interpolate(Su*(1.0/Xi - Xi))*nf
|
||||
);
|
||||
|
||||
|
||||
// Calculate mean and turbulent strain rates
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
volVectorField Ut(U + Su*Xi*n);
|
||||
volScalarField sigmat((n & n)*fvc::div(Ut) - (n & fvc::grad(Ut) & n));
|
||||
|
||||
volScalarField sigmas
|
||||
(
|
||||
((n & n)*fvc::div(U) - (n & fvc::grad(U) & n))/Xi
|
||||
+ (
|
||||
(n & n)*fvc::div(Su*n)
|
||||
- (n & fvc::grad(Su*n) & n)
|
||||
)*(Xi + scalar(1))/(2*Xi)
|
||||
);
|
||||
|
||||
|
||||
// Calculate the unstrained laminar flame speed
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
volScalarField Su0(unstrainedLaminarFlameSpeed()());
|
||||
|
||||
|
||||
// Calculate the laminar flame speed in equilibrium with the applied strain
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
volScalarField SuInf(Su0*max(scalar(1) - sigmas/sigmaExt, scalar(0.01)));
|
||||
|
||||
if (SuModel == "unstrained")
|
||||
{
|
||||
Su == Su0;
|
||||
}
|
||||
else if (SuModel == "equilibrium")
|
||||
{
|
||||
Su == SuInf;
|
||||
}
|
||||
else if (SuModel == "transport")
|
||||
{
|
||||
// Solve for the strained laminar flame speed
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
volScalarField Rc
|
||||
(
|
||||
(sigmas*SuInf*(Su0 - SuInf) + sqr(SuMin)*sigmaExt)
|
||||
/(sqr(Su0 - SuInf) + sqr(SuMin))
|
||||
);
|
||||
|
||||
fvScalarMatrix SuEqn
|
||||
(
|
||||
fvm::ddt(rho, Su)
|
||||
+ fvm::div(phi + phiXi, Su, "div(phiXi,Su)")
|
||||
- fvm::Sp(fvc::div(phiXi), Su)
|
||||
==
|
||||
- fvm::SuSp(-rho*Rc*Su0/Su, Su)
|
||||
- fvm::SuSp(rho*(sigmas + Rc), Su)
|
||||
+ fvOptions(rho, Su)
|
||||
);
|
||||
|
||||
SuEqn.relax();
|
||||
|
||||
fvOptions.constrain(SuEqn);
|
||||
|
||||
SuEqn.solve();
|
||||
|
||||
fvOptions.correct(Su);
|
||||
|
||||
// Limit the maximum Su
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
Su.min(SuMax);
|
||||
Su.max(SuMin);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< args.executable() << " : Unknown Su model " << SuModel
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// Calculate Xi according to the selected flame wrinkling model
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (XiModel == "fixed")
|
||||
{
|
||||
// Do nothing, Xi is fixed!
|
||||
}
|
||||
else if (XiModel == "algebraic")
|
||||
{
|
||||
// Simple algebraic model for Xi based on Gulders correlation
|
||||
// with a linear correction function to give a plausible profile for Xi
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Xi == scalar(1) +
|
||||
(scalar(1) + (2*XiShapeCoef)*(scalar(0.5) - b))
|
||||
*XiCoef*sqrt(up/(Su + SuMin))*Reta;
|
||||
}
|
||||
else if (XiModel == "transport")
|
||||
{
|
||||
// Calculate Xi transport coefficients based on Gulders correlation
|
||||
// and DNS data for the rate of generation
|
||||
// with a linear correction function to give a plausible profile for Xi
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
volScalarField XiEqStar
|
||||
(
|
||||
scalar(1.001) + XiCoef*sqrt(up/(Su + SuMin))*Reta
|
||||
);
|
||||
|
||||
volScalarField XiEq
|
||||
(
|
||||
scalar(1.001)
|
||||
+ (
|
||||
scalar(1)
|
||||
+ (2*XiShapeCoef)
|
||||
*(scalar(0.5) - min(max(b, scalar(0)), scalar(1)))
|
||||
)*(XiEqStar - scalar(1.001))
|
||||
);
|
||||
|
||||
volScalarField Gstar(0.28/tauEta);
|
||||
volScalarField R(Gstar*XiEqStar/(XiEqStar - scalar(1)));
|
||||
volScalarField G(R*(XiEq - scalar(1.001))/XiEq);
|
||||
|
||||
//R *= (Gstar + 2*mag(dev(symm(fvc::grad(U)))))/Gstar;
|
||||
|
||||
// Solve for the flame wrinkling
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fvScalarMatrix XiEqn
|
||||
(
|
||||
fvm::ddt(rho, Xi)
|
||||
+ fvm::div(phi + phiXi, Xi, "div(phiXi,Xi)")
|
||||
- fvm::Sp(fvc::div(phiXi), Xi)
|
||||
==
|
||||
rho*R
|
||||
- fvm::Sp(rho*(R - G), Xi)
|
||||
- fvm::Sp
|
||||
(
|
||||
rho*max
|
||||
(
|
||||
sigmat - sigmas,
|
||||
dimensionedScalar("0", sigmat.dimensions(), 0)
|
||||
),
|
||||
Xi
|
||||
)
|
||||
+ fvOptions(rho, Xi)
|
||||
);
|
||||
|
||||
XiEqn.relax();
|
||||
|
||||
fvOptions.constrain(XiEqn);
|
||||
|
||||
XiEqn.solve();
|
||||
|
||||
fvOptions.correct(Xi);
|
||||
|
||||
// Correct boundedness of Xi
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Xi.max(1.0);
|
||||
Info<< "max(Xi) = " << max(Xi).value() << endl;
|
||||
Info<< "max(XiEq) = " << max(XiEq).value() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< args.executable() << " : Unknown Xi model " << XiModel
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
Info<< "Combustion progress = "
|
||||
<< 100*(scalar(1) - b)().weightedAverage(mesh.V()).value() << "%"
|
||||
<< endl;
|
||||
|
||||
St = Xi*Su;
|
||||
}
|
||||
140
applications/solvers/combustion/XiFoam/createFields.H
Normal file
140
applications/solvers/combustion/XiFoam/createFields.H
Normal file
@ -0,0 +1,140 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<psiuReactionThermo> pThermo
|
||||
(
|
||||
psiuReactionThermo::New(mesh)
|
||||
);
|
||||
psiuReactionThermo& thermo = pThermo();
|
||||
thermo.validate(args.executable(), "ha", "ea");
|
||||
|
||||
basicMultiComponentMixture& composition = thermo.composition();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.rho()
|
||||
);
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
const volScalarField& psi = thermo.psi();
|
||||
|
||||
volScalarField& b = composition.Y("b");
|
||||
Info<< "min(b) = " << min(b).value() << endl;
|
||||
|
||||
|
||||
Info<< "\nReading 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::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dpdt",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
|
||||
);
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
Info<< "Creating field Xi\n" << endl;
|
||||
volScalarField Xi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Xi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Creating the unstrained laminar flame speed\n" << endl;
|
||||
autoPtr<laminarFlameSpeed> unstrainedLaminarFlameSpeed
|
||||
(
|
||||
laminarFlameSpeed::New(thermo)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading strained laminar flame speed field Su\n" << endl;
|
||||
volScalarField Su
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
dimensionedScalar SuMin = 0.01*Su.average();
|
||||
dimensionedScalar SuMax = 4*Su.average();
|
||||
|
||||
Info<< "Calculating turbulent flame speed field St\n" << endl;
|
||||
volScalarField St
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"St",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Xi*Su
|
||||
);
|
||||
|
||||
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
|
||||
|
||||
if (composition.contains("ft"))
|
||||
{
|
||||
fields.add(composition.Y("ft"));
|
||||
}
|
||||
|
||||
fields.add(b);
|
||||
fields.add(thermo.he());
|
||||
fields.add(thermo.heu());
|
||||
30
applications/solvers/combustion/XiFoam/ftEqn.H
Normal file
30
applications/solvers/combustion/XiFoam/ftEqn.H
Normal file
@ -0,0 +1,30 @@
|
||||
tmp<fv::convectionScheme<scalar> > mvConvection
|
||||
(
|
||||
fv::convectionScheme<scalar>::New
|
||||
(
|
||||
mesh,
|
||||
fields,
|
||||
phi,
|
||||
mesh.divScheme("div(phi,ft_b_ha_hau)")
|
||||
)
|
||||
);
|
||||
|
||||
if (composition.contains("ft"))
|
||||
{
|
||||
volScalarField& ft = composition.Y("ft");
|
||||
|
||||
fvScalarMatrix ftEqn
|
||||
(
|
||||
fvm::ddt(rho, ft)
|
||||
+ mvConvection->fvmDiv(phi, ft)
|
||||
- fvm::laplacian(turbulence->alphaEff(), ft)
|
||||
==
|
||||
fvOptions(rho, ft)
|
||||
);
|
||||
|
||||
fvOptions.constrain(ftEqn);
|
||||
|
||||
ftEqn.solve();
|
||||
|
||||
fvOptions.correct(ft);
|
||||
}
|
||||
90
applications/solvers/combustion/XiFoam/pEqn.H
Normal file
90
applications/solvers/combustion/XiFoam/pEqn.H
Normal file
@ -0,0 +1,90 @@
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
(fvc::interpolate(rho*HbyA) & mesh.Sf())
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
|
||||
)/fvc::interpolate(rho)
|
||||
);
|
||||
|
||||
fvOptions.makeRelative(fvc::interpolate(psi), phid);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rhorAUf, p)
|
||||
==
|
||||
fvOptions(psi, p, rho.name())
|
||||
);
|
||||
|
||||
fvOptions.constrain(pEqn);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi == pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(
|
||||
(fvc::interpolate(rho*HbyA) & mesh.Sf())
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.makeRelative(phiHbyA);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rhorAUf, p)
|
||||
==
|
||||
fvOptions(psi, p, rho.name())
|
||||
);
|
||||
|
||||
fvOptions.constrain(pEqn);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
U = HbyA - rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
if (thermo.dpdt())
|
||||
{
|
||||
dpdt = fvc::ddt(p);
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
Info<< "Reading combustion properties\n" << endl;
|
||||
|
||||
IOdictionary combustionProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"combustionProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
word SuModel
|
||||
(
|
||||
combustionProperties.lookup("SuModel")
|
||||
);
|
||||
|
||||
dimensionedScalar sigmaExt
|
||||
(
|
||||
combustionProperties.lookup("sigmaExt")
|
||||
);
|
||||
|
||||
word XiModel
|
||||
(
|
||||
combustionProperties.lookup("XiModel")
|
||||
);
|
||||
|
||||
dimensionedScalar XiCoef
|
||||
(
|
||||
combustionProperties.lookup("XiCoef")
|
||||
);
|
||||
|
||||
dimensionedScalar XiShapeCoef
|
||||
(
|
||||
combustionProperties.lookup("XiShapeCoef")
|
||||
);
|
||||
|
||||
dimensionedScalar uPrimeCoef
|
||||
(
|
||||
combustionProperties.lookup("uPrimeCoef")
|
||||
);
|
||||
|
||||
ignition ign(combustionProperties, runTime, mesh);
|
||||
3
applications/solvers/combustion/chemFoam/Make/files
Normal file
3
applications/solvers/combustion/chemFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
chemFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/chemFoam
|
||||
22
applications/solvers/combustion/chemFoam/Make/options
Normal file
22
applications/solvers/combustion/chemFoam/Make/options
Normal file
@ -0,0 +1,22 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude\
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lreactionThermophysicalModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lchemistryModel \
|
||||
-lODE \
|
||||
-lthermophysicalFunctions \
|
||||
-lspecie
|
||||
12
applications/solvers/combustion/chemFoam/YEqn.H
Normal file
12
applications/solvers/combustion/chemFoam/YEqn.H
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
forAll(Y, specieI)
|
||||
{
|
||||
volScalarField& Yi = Y[specieI];
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, Yi) - chemistry.RR(specieI),
|
||||
mesh.solver("Yi")
|
||||
);
|
||||
}
|
||||
}
|
||||
90
applications/solvers/combustion/chemFoam/chemFoam.C
Normal file
90
applications/solvers/combustion/chemFoam/chemFoam.C
Normal file
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 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
|
||||
chemFoam
|
||||
|
||||
Description
|
||||
Solver for chemistry problems
|
||||
- designed for use on single cell cases to provide comparison against
|
||||
other chemistry solvers
|
||||
- single cell mesh created on-the-fly
|
||||
- fields created on the fly from the initial conditions
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "psiReactionThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "psiChemistryModel.H"
|
||||
#include "chemistrySolver.H"
|
||||
#include "OFstream.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "basicMultiComponentMixture.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createSingleCellMesh.H"
|
||||
#include "createFields.H"
|
||||
#include "readInitialConditions.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "solveChemistry.H"
|
||||
#include "YEqn.H"
|
||||
#include "hEqn.H"
|
||||
#include "pEqn.H"
|
||||
|
||||
#include "output.H"
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info << "Number of steps = " << runTime.timeIndex() << endl;
|
||||
Info << "End" << nl << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
57
applications/solvers/combustion/chemFoam/createBaseFields.H
Normal file
57
applications/solvers/combustion/chemFoam/createBaseFields.H
Normal file
@ -0,0 +1,57 @@
|
||||
// write base thermo fields - not registered since will be re-read by
|
||||
// thermo package
|
||||
|
||||
Info<< "Creating base fields for time " << runTime.timeName() << endl;
|
||||
{
|
||||
volScalarField Ydefault
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Ydefault",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Ydefault", dimless, 1)
|
||||
);
|
||||
|
||||
Ydefault.write();
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("p", dimPressure, p0)
|
||||
);
|
||||
|
||||
p.write();
|
||||
|
||||
volScalarField T
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("T", dimTemperature, T0)
|
||||
);
|
||||
|
||||
T.write();
|
||||
}
|
||||
|
||||
105
applications/solvers/combustion/chemFoam/createFields.H
Normal file
105
applications/solvers/combustion/chemFoam/createFields.H
Normal file
@ -0,0 +1,105 @@
|
||||
if (mesh.nCells() != 1)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Solver only applicable to single cell cases"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Info<< "Reading initial conditions.\n" << endl;
|
||||
IOdictionary initialConditions
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"initialConditions",
|
||||
runTime.constant(),
|
||||
runTime,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
scalar p0 = readScalar(initialConditions.lookup("p"));
|
||||
scalar T0 = readScalar(initialConditions.lookup("T"));
|
||||
|
||||
#include "createBaseFields.H"
|
||||
|
||||
Info<< nl << "Reading thermophysicalProperties" << endl;
|
||||
autoPtr<psiChemistryModel> pChemistry(psiChemistryModel::New(mesh));
|
||||
|
||||
psiChemistryModel& chemistry = pChemistry();
|
||||
scalar dtChem = refCast<const psiChemistryModel>(chemistry).deltaTChem()[0];
|
||||
|
||||
psiReactionThermo& thermo = chemistry.thermo();
|
||||
thermo.validate(args.executable(), "h");
|
||||
|
||||
basicMultiComponentMixture& composition = thermo.composition();
|
||||
PtrList<volScalarField>& Y = composition.Y();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.rho()
|
||||
);
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
|
||||
volScalarField Rspecific
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Rspecific",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"zero",
|
||||
dimensionSet(dimEnergy/dimMass/dimTemperature),
|
||||
0.0
|
||||
)
|
||||
);
|
||||
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector("zero", dimVelocity, vector::zero),
|
||||
p.boundaryField().types()
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
Info << "Creating turbulence model.\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
OFstream post(args.path()/"chemFoam.out");
|
||||
post<< "# Time" << token::TAB << "Temperature [K]" << token::TAB
|
||||
<< "Pressure [Pa]" << endl;
|
||||
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
Info<< "Constructing single cell mesh" << nl << endl;
|
||||
|
||||
labelList owner(6, label(0));
|
||||
labelList neighbour(0);
|
||||
|
||||
pointField points(8);
|
||||
points[0] = vector(0, 0, 0);
|
||||
points[1] = vector(1, 0, 0);
|
||||
points[2] = vector(1, 1, 0);
|
||||
points[3] = vector(0, 1, 0);
|
||||
points[4] = vector(0, 0, 1);
|
||||
points[5] = vector(1, 0, 1);
|
||||
points[6] = vector(1, 1, 1);
|
||||
points[7] = vector(0, 1, 1);
|
||||
|
||||
const cellModel& hexa = *(cellModeller::lookup("hex"));
|
||||
faceList faces = hexa.modelFaces();
|
||||
|
||||
fvMesh mesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fvMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
xferMove<Field<vector> >(points),
|
||||
faces.xfer(),
|
||||
owner.xfer(),
|
||||
neighbour.xfer()
|
||||
);
|
||||
|
||||
List<polyPatch*> patches(1);
|
||||
|
||||
patches[0] = new emptyPolyPatch
|
||||
(
|
||||
"boundary",
|
||||
6,
|
||||
0,
|
||||
0,
|
||||
mesh.boundaryMesh(),
|
||||
emptyPolyPatch::typeName
|
||||
);
|
||||
|
||||
mesh.addFvPatches(patches);
|
||||
14
applications/solvers/combustion/chemFoam/hEqn.H
Normal file
14
applications/solvers/combustion/chemFoam/hEqn.H
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
volScalarField& h = thermo.he();
|
||||
|
||||
if (constProp == "volume")
|
||||
{
|
||||
h[0] = u0 + p[0]/rho[0] + integratedHeat;
|
||||
}
|
||||
else
|
||||
{
|
||||
h[0] = h0 + integratedHeat;
|
||||
}
|
||||
|
||||
thermo.correct();
|
||||
}
|
||||
11
applications/solvers/combustion/chemFoam/output.H
Normal file
11
applications/solvers/combustion/chemFoam/output.H
Normal file
@ -0,0 +1,11 @@
|
||||
runTime.write();
|
||||
|
||||
Info<< "Sh = " << Sh
|
||||
<< ", T = " << thermo.T()[0]
|
||||
<< ", p = " << thermo.p()[0]
|
||||
<< ", " << Y[0].name() << " = " << Y[0][0]
|
||||
<< endl;
|
||||
|
||||
post<< runTime.value() << token::TAB << thermo.T()[0] << token::TAB
|
||||
<< thermo.p()[0] << endl;
|
||||
|
||||
16
applications/solvers/combustion/chemFoam/pEqn.H
Normal file
16
applications/solvers/combustion/chemFoam/pEqn.H
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
rho = thermo.rho();
|
||||
if (constProp == "volume")
|
||||
{
|
||||
scalar invW = 0.0;
|
||||
forAll(Y, i)
|
||||
{
|
||||
invW += Y[i][0]/specieData[i].W();
|
||||
}
|
||||
|
||||
Rspecific[0] = 1000.0*constant::physicoChemical::R.value()*invW;
|
||||
|
||||
p[0] = rho0*Rspecific[0]*thermo.T()[0];
|
||||
rho[0] = rho0;
|
||||
}
|
||||
}
|
||||
8
applications/solvers/combustion/chemFoam/readControls.H
Normal file
8
applications/solvers/combustion/chemFoam/readControls.H
Normal file
@ -0,0 +1,8 @@
|
||||
if (runTime.controlDict().lookupOrDefault("suppressSolverInfo", false))
|
||||
{
|
||||
lduMatrix::debug = 0;
|
||||
}
|
||||
|
||||
Switch adjustTimeStep(runTime.controlDict().lookup("adjustTimeStep"));
|
||||
|
||||
scalar maxDeltaT(readScalar(runTime.controlDict().lookup("maxDeltaT")));
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user