mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Creation of OpenFOAM-dev repository 15/04/2008
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
rhoPimpleFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoPimpleFoam
|
||||
12
applications/solvers/compressible/rhoPimpleFoam/Make/options
Normal file
12
applications/solvers/compressible/rhoPimpleFoam/Make/options
Normal file
@ -0,0 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleTurbulenceModels
|
||||
25
applications/solvers/compressible/rhoPimpleFoam/UEqn.H
Normal file
25
applications/solvers/compressible/rhoPimpleFoam/UEqn.H
Normal file
@ -0,0 +1,25 @@
|
||||
// Solve the Momentum equation
|
||||
|
||||
tmp<fvVectorMatrix> UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
//if (oCorr != nOuterCorr-1)
|
||||
{
|
||||
UEqn().relax();
|
||||
}
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField& p = thermo->p();
|
||||
volScalarField& h = thermo->h();
|
||||
const volScalarField& psi = thermo->psi();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo->rho()
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
|
||||
dimensionedScalar pMin
|
||||
(
|
||||
mesh.solutionDict().subDict("PIMPLE").lookup("pMin")
|
||||
);
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo()
|
||||
)
|
||||
);
|
||||
|
||||
//dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
||||
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt =
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
23
applications/solvers/compressible/rhoPimpleFoam/hEqn.H
Normal file
23
applications/solvers/compressible/rhoPimpleFoam/hEqn.H
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
fvm::ddt(rho, h)
|
||||
+ fvm::div(phi, h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
DpDt
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
hEqn.relax();
|
||||
hEqn.solve(mesh.solver("hFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
hEqn.relax();
|
||||
hEqn.solve();
|
||||
}
|
||||
|
||||
thermo->correct();
|
||||
}
|
||||
112
applications/solvers/compressible/rhoPimpleFoam/pEqn.H
Normal file
112
applications/solvers/compressible/rhoPimpleFoam/pEqn.H
Normal file
@ -0,0 +1,112 @@
|
||||
rho = thermo->rho();
|
||||
|
||||
volScalarField rUA = 1.0/UEqn().A();
|
||||
U = rUA*UEqn().H();
|
||||
|
||||
if (nCorr <= 1)
|
||||
{
|
||||
UEqn.clear();
|
||||
}
|
||||
|
||||
if (transonic)
|
||||
{
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(thermo->psi())
|
||||
*(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1 && corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi == pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
phi =
|
||||
fvc::interpolate(rho)*
|
||||
(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
//+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
);
|
||||
|
||||
//bool closedVolume = adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvc::div(phi)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
if (oCorr == nOuterCorr-1 && corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi += pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
//if (oCorr != nOuterCorr-1)
|
||||
{
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
rho = thermo->rho();
|
||||
rho.relax();
|
||||
Info<< "rho max/min : " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
}
|
||||
|
||||
U -= rUA*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
|
||||
bound(p, pMin);
|
||||
|
||||
// For closed-volume cases adjust the pressure and density levels
|
||||
// to obey overall mass continuity
|
||||
/*
|
||||
if (closedVolume)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p))
|
||||
/fvc::domainIntegrate(thermo->psi());
|
||||
}
|
||||
*/
|
||||
101
applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C
Normal file
101
applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C
Normal file
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rhoSimpleFoam
|
||||
|
||||
Description
|
||||
Steady-state solver for turbulent flow of compressible fluids for
|
||||
ventilation and heat-transfer.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
# include "readTimeControls.H"
|
||||
# include "readPIMPLEControls.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
}
|
||||
|
||||
// --- PIMPLE loop
|
||||
int oCorr=0;
|
||||
do
|
||||
{
|
||||
# include "UEqn.H"
|
||||
# include "hEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
# include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
} while (++oCorr < nOuterCorr);
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
rhoPorousSimpleFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoPorousSimpleFoam
|
||||
@ -0,0 +1,13 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleTurbulenceModels
|
||||
42
applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H
Normal file
42
applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H
Normal file
@ -0,0 +1,42 @@
|
||||
// Construct the Momentum equation
|
||||
|
||||
tmp<fvVectorMatrix> UEqn
|
||||
(
|
||||
fvm::div(phi, U)
|
||||
- fvm::Sp(fvc::div(phi), U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
UEqn().relax();
|
||||
|
||||
// Include the porous media resistance and solve the momentum equation
|
||||
// either implicit in the tensorial resistance or transport using by
|
||||
// including the spherical part of the resistance in the momentum diagonal
|
||||
|
||||
tmp<volScalarField> trAU;
|
||||
tmp<volTensorField> trTU;
|
||||
|
||||
if (pressureImplicitPorosity)
|
||||
{
|
||||
tmp<volTensorField> tTU = tensor(I)*UEqn().A();
|
||||
pZones.addResistance(UEqn(), tTU());
|
||||
trTU = inv(tTU());
|
||||
trTU().rename("rAU");
|
||||
|
||||
volVectorField gradp = fvc::grad(p);
|
||||
|
||||
for (int UCorr=0; UCorr<nUCorr; UCorr++)
|
||||
{
|
||||
U = trTU() & (UEqn().H() - gradp);
|
||||
}
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
else
|
||||
{
|
||||
pZones.addResistance(UEqn());
|
||||
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
|
||||
trAU = 1.0/UEqn().A();
|
||||
trAU().rename("rAU");
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo->rho()
|
||||
);
|
||||
|
||||
volScalarField& p = thermo->p();
|
||||
volScalarField& h = thermo->h();
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
|
||||
|
||||
dimensionedScalar pMin
|
||||
(
|
||||
mesh.solutionDict().subDict("SIMPLE").lookup("pMin")
|
||||
);
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo()
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
||||
|
||||
porousZones pZones(mesh);
|
||||
Switch pressureImplicitPorosity(false);
|
||||
|
||||
int nUCorr = 0;
|
||||
if (pZones.size())
|
||||
{
|
||||
// nUCorrectors for pressureImplicitPorosity
|
||||
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
|
||||
{
|
||||
nUCorr = readInt
|
||||
(
|
||||
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
|
||||
);
|
||||
}
|
||||
|
||||
if (nUCorr > 0)
|
||||
{
|
||||
pressureImplicitPorosity = true;
|
||||
}
|
||||
}
|
||||
|
||||
17
applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H
Normal file
17
applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
fvm::div(phi, h)
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)"))
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
|
||||
hEqn.solve();
|
||||
|
||||
thermo->correct();
|
||||
}
|
||||
65
applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H
Normal file
65
applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H
Normal file
@ -0,0 +1,65 @@
|
||||
if (pressureImplicitPorosity)
|
||||
{
|
||||
U = trTU()&UEqn().H();
|
||||
}
|
||||
else
|
||||
{
|
||||
U = trAU()*UEqn().H();
|
||||
}
|
||||
|
||||
UEqn.clear();
|
||||
|
||||
phi = fvc::interpolate(rho*U) & mesh.Sf();
|
||||
bool closedVolume = adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
tmp<fvScalarMatrix> tpEqn;
|
||||
|
||||
if (pressureImplicitPorosity)
|
||||
{
|
||||
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
|
||||
}
|
||||
else
|
||||
{
|
||||
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
|
||||
}
|
||||
|
||||
tpEqn().setReference(pRefCell, pRefValue);
|
||||
tpEqn().solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= tpEqn().flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "incompressible/continuityErrs.H"
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
if (pressureImplicitPorosity)
|
||||
{
|
||||
U -= trTU()&fvc::grad(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
U -= trAU()*fvc::grad(p);
|
||||
}
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
bound(p, pMin);
|
||||
|
||||
// For closed-volume cases adjust the pressure and density levels
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p))
|
||||
/fvc::domainIntegrate(thermo->psi());
|
||||
}
|
||||
|
||||
rho = thermo->rho();
|
||||
rho.relax();
|
||||
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
|
||||
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rhoPorousSimpleFoam
|
||||
|
||||
Description
|
||||
Steady-state solver for turbulent flow of compressible fluids with
|
||||
implicit or explicit porosity treatment
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||
#include "porousZones.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readSIMPLEControls.H"
|
||||
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
|
||||
// Pressure-velocity SIMPLE corrector
|
||||
{
|
||||
# include "UEqn.H"
|
||||
# include "hEqn.H"
|
||||
# include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
rhoSimpleFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoSimpleFoam
|
||||
12
applications/solvers/compressible/rhoSimpleFoam/Make/options
Normal file
12
applications/solvers/compressible/rhoSimpleFoam/Make/options
Normal file
@ -0,0 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleTurbulenceModels
|
||||
12
applications/solvers/compressible/rhoSimpleFoam/UEqn.H
Normal file
12
applications/solvers/compressible/rhoSimpleFoam/UEqn.H
Normal file
@ -0,0 +1,12 @@
|
||||
// Solve the Momentum equation
|
||||
|
||||
tmp<fvVectorMatrix> UEqn
|
||||
(
|
||||
fvm::div(phi, U)
|
||||
- fvm::Sp(fvc::div(phi), U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
UEqn().relax();
|
||||
|
||||
solve(UEqn() == -fvc::grad(p));
|
||||
@ -0,0 +1,63 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo->rho()
|
||||
);
|
||||
|
||||
volScalarField& p = thermo->p();
|
||||
volScalarField& h = thermo->h();
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
|
||||
|
||||
dimensionedScalar pMin
|
||||
(
|
||||
mesh.solutionDict().subDict("SIMPLE").lookup("pMin")
|
||||
);
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo()
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
||||
17
applications/solvers/compressible/rhoSimpleFoam/hEqn.H
Normal file
17
applications/solvers/compressible/rhoSimpleFoam/hEqn.H
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
fvm::div(phi, h)
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)"))
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
|
||||
hEqn.solve();
|
||||
|
||||
thermo->correct();
|
||||
}
|
||||
43
applications/solvers/compressible/rhoSimpleFoam/pEqn.H
Normal file
43
applications/solvers/compressible/rhoSimpleFoam/pEqn.H
Normal file
@ -0,0 +1,43 @@
|
||||
volScalarField AU = UEqn().A();
|
||||
U = UEqn().H()/AU;
|
||||
UEqn.clear();
|
||||
phi = fvc::interpolate(rho*U) & mesh.Sf();
|
||||
bool closedVolume = adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rho/AU, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "incompressible/continuityErrs.H"
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
U -= fvc::grad(p)/AU;
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
bound(p, pMin);
|
||||
|
||||
// For closed-volume cases adjust the pressure and density levels
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p))
|
||||
/fvc::domainIntegrate(thermo->psi());
|
||||
}
|
||||
|
||||
rho = thermo->rho();
|
||||
rho.relax();
|
||||
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
|
||||
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rhoSimpleFoam
|
||||
|
||||
Description
|
||||
Steady-state solver for turbulent flow of compressible fluids for
|
||||
ventilation and heat-transfer.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readSIMPLEControls.H"
|
||||
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
|
||||
// Pressure-velocity SIMPLE corrector
|
||||
{
|
||||
# include "UEqn.H"
|
||||
# include "hEqn.H"
|
||||
# include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,68 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(p) Gauss linear;
|
||||
grad(U) Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phiv,rho) Gauss <>;
|
||||
div(phiv,rhoU) Gauss <>;
|
||||
div(phiv2,p) Gauss <>;
|
||||
div(phiv,rhoE) Gauss <>;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default none;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p BICCG 1e-15 0;
|
||||
rho BICCG 1e-15 0;
|
||||
rhoU BICCG 1e-15 0;
|
||||
rhoE BICCG 1e-15 0;
|
||||
}
|
||||
|
||||
PISO
|
||||
{
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/fvSchemes.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/ddt/transient.cfg";
|
||||
|
||||
include "../../sonicFoam/FoamX/fvSchemes/gradSchemes.cfg";
|
||||
include "fvSchemes/divSchemes.cfg";
|
||||
include "fvSchemes/laplacianSchemes.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/interpolation/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/snGrad/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/flux/p.cfg";
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
include "defaults/system/fvSchemes";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,23 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
divSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phivRho.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phivRhoU.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phiv2p.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phivRhoE.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,19 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/default.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,33 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/fvSolution.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
solvers
|
||||
{
|
||||
type dictionary;
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/pAsymm.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/rhoCD.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/rhoU.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/rhoE.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/PISO.cfg";
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
include "defaults/system/fvSolution";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
description "Compressible trans-sonic/supersonic laminar gas flow code.";
|
||||
|
||||
dictionaries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/controlDict/controlDict.cfg";
|
||||
fvSchemes;
|
||||
fvSolution;
|
||||
include "$FOAMX_CONFIG/dictionaries/thermodynamicProperties/thermodynamicPropertiesConst.cfg";
|
||||
}
|
||||
|
||||
fields
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/pDynamic.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/U.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/T.cfg";
|
||||
}
|
||||
|
||||
patchPhysicalTypes
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/patches.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/sonic/patches.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/thermal/patches.cfg";
|
||||
}
|
||||
|
||||
patchFieldsPhysicalTypes
|
||||
{
|
||||
U
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/U.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/sonic/U.cfg";
|
||||
}
|
||||
|
||||
p
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/p.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/sonic/p.cfg";
|
||||
}
|
||||
|
||||
T
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/thermal/T.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
rhoSonicFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoSonicFoam
|
||||
@ -0,0 +1,4 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = -lfiniteVolume
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
# include "rhoEqn.H"
|
||||
}
|
||||
{
|
||||
scalar sumLocalContErr = (sum(mag(rho - psi*p))/sum(rho)).value();
|
||||
scalar globalContErr = (sum(rho - psi*p)/sum(rho)).value();
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr << endl;
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
volScalarField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"psi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
1.0/(R*T)
|
||||
);
|
||||
psi.oldTime();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
psi*p,
|
||||
p.boundaryField().types()
|
||||
);
|
||||
|
||||
volVectorField rhoU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
rho*U,
|
||||
U.boundaryField().types()
|
||||
);
|
||||
|
||||
volScalarField rhoE
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoE",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
rho*Cv*T + 0.5*rho*magSqr(rhoU/rho),
|
||||
T.boundaryField().types()
|
||||
);
|
||||
@ -0,0 +1,23 @@
|
||||
Info<< "Reading thermodynamicProperties\n" << endl;
|
||||
|
||||
IOdictionary thermodynamicProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermodynamicProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar R
|
||||
(
|
||||
thermodynamicProperties.lookup("R")
|
||||
);
|
||||
|
||||
dimensionedScalar Cv
|
||||
(
|
||||
thermodynamicProperties.lookup("Cv")
|
||||
);
|
||||
130
applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C
Normal file
130
applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C
Normal file
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rhoSonicFoam
|
||||
|
||||
Description
|
||||
Density-based compressible flow solver.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readThermodynamicProperties.H"
|
||||
# include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
surfaceScalarField phiv
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiv",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fvc::interpolate(rhoU)/fvc::interpolate(rho) & mesh.Sf()
|
||||
);
|
||||
|
||||
scalar CoNum = max
|
||||
(
|
||||
mesh.surfaceInterpolation::deltaCoeffs()
|
||||
*mag(phiv)/mesh.magSf()
|
||||
).value()*runTime.deltaT().value();
|
||||
|
||||
Info<< "\nMax Courant Number = " << CoNum << endl;
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho)
|
||||
+ fvm::div(phiv, rho)
|
||||
);
|
||||
|
||||
p = rho/psi;
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rhoU)
|
||||
+ fvm::div(phiv, rhoU)
|
||||
==
|
||||
- fvc::grad(p)
|
||||
);
|
||||
|
||||
U == rhoU/rho;
|
||||
|
||||
surfaceScalarField phiv2
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiv2",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fvc::interpolate(rhoU)/fvc::interpolate(rho) & mesh.Sf()
|
||||
);
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rhoE)
|
||||
+ fvm::div(phiv, rhoE)
|
||||
==
|
||||
- fvc::div(phiv2, p)
|
||||
);
|
||||
|
||||
T = (rhoE - 0.5*rho*magSqr(rhoU/rho))/Cv/rho;
|
||||
psi = 1.0/(R*T);
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Time derivative discretisation schemes
|
||||
ddtSchemes
|
||||
{
|
||||
// Default scheme
|
||||
default Euler;
|
||||
}
|
||||
|
||||
// Gradient discretisation schemes
|
||||
gradSchemes
|
||||
{
|
||||
// Default gradient scheme
|
||||
default Gauss linear;
|
||||
grad(p) Gauss linear;
|
||||
}
|
||||
|
||||
// Convection discretisation schemes
|
||||
divSchemes
|
||||
{
|
||||
// Default scheme
|
||||
default none;
|
||||
div(phi,U) Gauss <>;
|
||||
div(phid,p) Gauss <>;
|
||||
div(phiU,p) Gauss linear;
|
||||
div(phi,h) Gauss <>;
|
||||
div(phi,k) Gauss <>;
|
||||
div(phi,epsilon) Gauss <>;
|
||||
div(phi,R) Gauss <>;
|
||||
div((rho*R)) Gauss linear;
|
||||
div(R) Gauss linear;
|
||||
div(U) Gauss linear;
|
||||
div((muEff*dev2(grad(U).T()))) Gauss linear;
|
||||
}
|
||||
|
||||
// Laplacian discretisation schemes
|
||||
laplacianSchemes
|
||||
{
|
||||
// Default scheme
|
||||
default none;
|
||||
laplacian(muEff,U) Gauss linear corrected;
|
||||
laplacian(mut,U) Gauss linear corrected;
|
||||
laplacian(DkEff,k) Gauss linear corrected;
|
||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
||||
laplacian(DREff,R) Gauss linear corrected;
|
||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
||||
laplacian(alphaEff,h) Gauss linear corrected;
|
||||
}
|
||||
|
||||
// Interpolation schemes
|
||||
interpolationSchemes
|
||||
{
|
||||
// Default scheme
|
||||
default linear;
|
||||
}
|
||||
|
||||
// Surface normal gradient schemes
|
||||
snGradSchemes
|
||||
{
|
||||
// Default scheme
|
||||
default corrected;
|
||||
}
|
||||
|
||||
// Calculation of flux
|
||||
fluxRequired
|
||||
{
|
||||
// Create storage for flux for all solved variables?
|
||||
default no;
|
||||
p;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
// Solver for the rho equation
|
||||
rho ICCG 1e-05 0;
|
||||
// Solver for the U equation
|
||||
U BICCG 1e-05 0;
|
||||
// Solver for the p equation
|
||||
p ICCG 1e-06 0;
|
||||
// Solver for the h equation
|
||||
h BICCG 1e-05 0;
|
||||
// Solver for the R equation
|
||||
R BICCG 1e-05 0;
|
||||
// Solver for the k equation
|
||||
k BICCG 1e-05 0;
|
||||
// Solver for the epsilon equation
|
||||
epsilon BICCG 1e-05 0;
|
||||
}
|
||||
|
||||
PISO
|
||||
{
|
||||
// Number of PISO correctors
|
||||
nCorrectors 2;
|
||||
// Number of non-orthogonal correctors
|
||||
nNonOrthogonalCorrectors 0;
|
||||
// momentumPredictor?
|
||||
momentumPredictor yes;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/fvSchemes.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/ddt/transient.cfg";
|
||||
|
||||
include "fvSchemes/gradSchemes.cfg";
|
||||
include "fvSchemes/divSchemes.cfg";
|
||||
include "fvSchemes/laplacianSchemes.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/interpolation/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/snGrad/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/flux/p.cfg";
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
include "defaults/system/fvSchemes";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,29 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
divSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phiU.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phidp.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phiUp.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phih.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phik.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phiEpsilon.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phiR.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/rhoR.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/R.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/U.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/muEffGradUT.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,19 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/p.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,25 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/muEffU.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/mutU.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/DkEffk.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/DepsilonEffEpsilon.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/DREffR.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/rhoAUp.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/alphaEffh.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/fvSolution.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
solvers
|
||||
{
|
||||
type dictionary;
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/rho.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/U.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/pSymm.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/h.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/R.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/k.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/epsilon.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/PISO.cfg";
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
include "defaults/system/fvSolution";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
description "Transient solver for compressible turbulent flow";
|
||||
|
||||
dictionaries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/controlDict/controlDictAdjustTimeStep.cfg";
|
||||
fvSchemes;
|
||||
fvSolution;
|
||||
include "$FOAMX_CONFIG/dictionaries/thermophysicalProperties/thermophysicalPropertiesMixture.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/turbulenceProperties/turbulenceModelsCompressible.cfg";
|
||||
}
|
||||
|
||||
fields
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/U.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/pDynamic.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/T.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/k.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/epsilon.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/Rkinematic.cfg";
|
||||
}
|
||||
|
||||
patchPhysicalTypes
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/patches.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/thermal/patches.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/wallFunctions/patches.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/wallFunctions/thermal/patches.cfg";
|
||||
}
|
||||
|
||||
patchFieldsPhysicalTypes
|
||||
{
|
||||
U
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/U.cfg";
|
||||
}
|
||||
|
||||
p
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/p.cfg";
|
||||
}
|
||||
|
||||
T
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/thermal/T.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/wallFunctions/thermal/T.cfg";
|
||||
}
|
||||
|
||||
k
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/k.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/wallFunctions/k.cfg";
|
||||
}
|
||||
|
||||
epsilon
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/epsilon.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/wallFunctions/epsilon.cfg";
|
||||
}
|
||||
|
||||
R
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/R.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/wallFunctions/R.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/solvers/compressible/rhoTurbFoam/Make/files
Normal file
3
applications/solvers/compressible/rhoTurbFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
rhoTurbFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhoTurbFoam
|
||||
12
applications/solvers/compressible/rhoTurbFoam/Make/options
Normal file
12
applications/solvers/compressible/rhoTurbFoam/Make/options
Normal file
@ -0,0 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleTurbulenceModels
|
||||
11
applications/solvers/compressible/rhoTurbFoam/UEqn.H
Normal file
11
applications/solvers/compressible/rhoTurbFoam/UEqn.H
Normal file
@ -0,0 +1,11 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
57
applications/solvers/compressible/rhoTurbFoam/createFields.H
Normal file
57
applications/solvers/compressible/rhoTurbFoam/createFields.H
Normal file
@ -0,0 +1,57 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
volScalarField& p = thermo->p();
|
||||
volScalarField& h = thermo->h();
|
||||
const volScalarField& psi = thermo->psi();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo->rho()
|
||||
);
|
||||
|
||||
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 =
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
12
applications/solvers/compressible/rhoTurbFoam/hEqn.H
Normal file
12
applications/solvers/compressible/rhoTurbFoam/hEqn.H
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, h)
|
||||
+ fvm::div(phi, h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
DpDt
|
||||
);
|
||||
|
||||
thermo->correct();
|
||||
}
|
||||
68
applications/solvers/compressible/rhoTurbFoam/pEqn.H
Normal file
68
applications/solvers/compressible/rhoTurbFoam/pEqn.H
Normal file
@ -0,0 +1,68 @@
|
||||
rho = thermo->rho();
|
||||
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
U = rUA*UEqn.H();
|
||||
|
||||
if (transonic)
|
||||
{
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(thermo->psi())
|
||||
*(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi == pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
phi =
|
||||
fvc::interpolate(rho)*
|
||||
(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvc::div(phi)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi += pEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
U -= rUA*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
96
applications/solvers/compressible/rhoTurbFoam/rhoTurbFoam.C
Normal file
96
applications/solvers/compressible/rhoTurbFoam/rhoTurbFoam.C
Normal file
@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rhoTurbFoam
|
||||
|
||||
Description
|
||||
Transient solver for compressible, turbulent flow.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicThermo.H"
|
||||
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "readPISOControls.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# include "readTimeControls.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
# include "setInitialDeltaT.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
# include "readTimeControls.H"
|
||||
# include "readPISOControls.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "rhoEqn.H"
|
||||
# include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=1; corr<=nCorr; corr++)
|
||||
{
|
||||
# include "hEqn.H"
|
||||
# include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
rho = thermo->rho();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
5
applications/solvers/compressible/rhopSonicFoam/Allwmake
Executable file
5
applications/solvers/compressible/rhopSonicFoam/Allwmake
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
wmake libso BCs
|
||||
wmake
|
||||
@ -0,0 +1,8 @@
|
||||
rho/fixedRhoFvPatchScalarField.C
|
||||
rho/gradientRhoFvPatchScalarField.C
|
||||
rhoE/fixedRhoEFvPatchScalarField.C
|
||||
rhoE/mixedRhoEFvPatchScalarField.C
|
||||
rhoU/fixedRhoUFvPatchVectorField.C
|
||||
p/inviscidWallPFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/librhopSonicFoam
|
||||
@ -0,0 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-L$(FOAM_LIBBIN)
|
||||
@ -0,0 +1,164 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "inviscidWallPFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
fluxFraction_(1)
|
||||
{}
|
||||
|
||||
|
||||
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const inviscidWallPFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||
fluxFraction_(ptf.fluxFraction_)
|
||||
{}
|
||||
|
||||
|
||||
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
fluxFraction_(readScalar(dict.lookup("fluxFraction")))
|
||||
{
|
||||
if (dict.found("gradient"))
|
||||
{
|
||||
gradient() = scalarField("gradient", dict, p.size());
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
fixedGradientFvPatchScalarField::evaluate();
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
}
|
||||
|
||||
if (fluxFraction_<0.0 || fluxFraction_ > 1.0)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"inviscidWallPFvPatchScalarField::"
|
||||
"supersonicFreeStreamFvPatchVectorField"
|
||||
"(const fvPatch&, const scalarField&, const dictionary&)",
|
||||
dict
|
||||
) << " unphysical fluxFraction specified (< 0.0 or > 1.0)"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const inviscidWallPFvPatchScalarField& wbppsf
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf),
|
||||
fluxFraction_(wbppsf.fluxFraction_)
|
||||
{}
|
||||
|
||||
|
||||
inviscidWallPFvPatchScalarField::inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const inviscidWallPFvPatchScalarField& wbppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf, iF),
|
||||
fluxFraction_(wbppsf.fluxFraction_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void inviscidWallPFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<vector>& rhoUp =
|
||||
patch().lookupPatchField<volVectorField, vector>("rhoU");
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("phi");
|
||||
|
||||
const fvsPatchField<scalar>& rAp =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("rrhoUAf");
|
||||
|
||||
gradient() = (fluxFraction_*phip - (patch().Sf() & rhoUp))/
|
||||
(rAp*patch().magSf());
|
||||
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void inviscidWallPFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedGradientFvPatchScalarField::write(os);
|
||||
os.writeKeyword("fluxFraction")
|
||||
<< fluxFraction_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, inviscidWallPFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,137 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef inviscidWallPFvPatchScalarFields_H
|
||||
#define inviscidWallPFvPatchScalarFields_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class inviscidWallPFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class inviscidWallPFvPatchScalarField
|
||||
:
|
||||
public fixedGradientFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Private data
|
||||
|
||||
scalar fluxFraction_;
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("inviscidWallP");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given inviscidWallPFvPatchScalarField onto
|
||||
// a new patch
|
||||
inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const inviscidWallPFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const inviscidWallPFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new inviscidWallPFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
inviscidWallPFvPatchScalarField
|
||||
(
|
||||
const inviscidWallPFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new inviscidWallPFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,127 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedRhoFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void fixedRhoFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& psip =
|
||||
patch().lookupPatchField<volScalarField, scalar>("psi");
|
||||
|
||||
const fvPatchField<scalar>& pp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("p");
|
||||
|
||||
operator==(psip*pp);
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void fixedRhoFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, fixedRhoFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedRhoFvPatchScalarField_H
|
||||
#define fixedRhoFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixedRhoFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixedRhoFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fixedRho");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given fixedRhoFvPatchScalarField
|
||||
// onto a new patch
|
||||
fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fixedRhoFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fixedRhoFvPatchScalarField
|
||||
(
|
||||
const fixedRhoFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fixedRhoFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "gradientRhoFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
|
||||
(
|
||||
const gradientRhoFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF)
|
||||
{
|
||||
if (dict.found("gradient"))
|
||||
{
|
||||
gradient() = scalarField("gradient", dict, p.size());
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
fixedGradientFvPatchScalarField::evaluate();
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
|
||||
(
|
||||
const gradientRhoFvPatchScalarField& wbppsf
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf)
|
||||
{}
|
||||
|
||||
|
||||
gradientRhoFvPatchScalarField::gradientRhoFvPatchScalarField
|
||||
(
|
||||
const gradientRhoFvPatchScalarField& wbppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void gradientRhoFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& psip =
|
||||
patch().lookupPatchField<volScalarField, scalar>("psi");
|
||||
|
||||
const fvPatchField<scalar>& pp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("p");
|
||||
|
||||
gradient() = psip*pp.snGrad() + psip.snGrad()*pp;
|
||||
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void gradientRhoFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedGradientFvPatchScalarField::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, gradientRhoFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef gradientRhoFvPatchScalarFields_H
|
||||
#define gradientRhoFvPatchScalarFields_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class gradientRhoFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class gradientRhoFvPatchScalarField
|
||||
:
|
||||
public fixedGradientFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("gradientRho");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
gradientRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
gradientRhoFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given gradientRhoFvPatchScalarField onto
|
||||
// a new patch
|
||||
gradientRhoFvPatchScalarField
|
||||
(
|
||||
const gradientRhoFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
gradientRhoFvPatchScalarField
|
||||
(
|
||||
const gradientRhoFvPatchScalarField&x
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new gradientRhoFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
gradientRhoFvPatchScalarField
|
||||
(
|
||||
const gradientRhoFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new gradientRhoFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,137 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedRhoEFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fixedRhoEFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fixedRhoEFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoEFvPatchScalarField::fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fixedRhoEFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void fixedRhoEFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const dictionary& thermodynamicProperties = db().lookupObject<IOdictionary>
|
||||
(
|
||||
"thermodynamicProperties"
|
||||
);
|
||||
|
||||
dimensionedScalar Cv(thermodynamicProperties.lookup("Cv"));
|
||||
|
||||
const fvPatchScalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const fvPatchVectorField& rhoUp =
|
||||
patch().lookupPatchField<volVectorField, vector>("rhoU");
|
||||
|
||||
const fvPatchScalarField& Tp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("T");
|
||||
|
||||
operator==(rhop*(Cv.value()*Tp + 0.5*magSqr(rhoUp/rhop)));
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void fixedRhoEFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, fixedRhoEFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedRhoEFvPatchScalarField_H
|
||||
#define fixedRhoEFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixedRhoEFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixedRhoEFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fixedRhoE");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given fixedRhoEFvPatchScalarField
|
||||
// onto a new patch
|
||||
fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fixedRhoEFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fixedRhoEFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fixedRhoEFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fixedRhoEFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fixedRhoEFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,195 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mixedRhoEFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF)
|
||||
{
|
||||
refValue() = 0.0;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const mixedRhoEFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF)
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
}
|
||||
|
||||
refValue() = *this;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const mixedRhoEFvPatchScalarField& ptpsf
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptpsf)
|
||||
{}
|
||||
|
||||
|
||||
mixedRhoEFvPatchScalarField::mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const mixedRhoEFvPatchScalarField& ptpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptpsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mixedRhoEFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
mixedFvPatchScalarField::autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void mixedRhoEFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchField<scalar>& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
mixedFvPatchField<scalar>::rmap(ptf, addr);
|
||||
}
|
||||
|
||||
|
||||
void mixedRhoEFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
const fvPatchField<vector>& rhoUp =
|
||||
patch().lookupPatchField<volVectorField, vector>("rhoU");
|
||||
// fvPatchField<scalar>& Tp =
|
||||
// patch().lookupPatchField<volScalarField, scalar>("T");
|
||||
|
||||
const volScalarField& T = db().lookupObject<volScalarField>("T");
|
||||
const label patchi = patch().index();
|
||||
fvPatchScalarField& Tp =
|
||||
const_cast<fvPatchScalarField&>(T.boundaryField()[patchi]);
|
||||
|
||||
Tp.evaluate();
|
||||
|
||||
const dictionary& thermodynamicProperties = db().lookupObject<IOdictionary>
|
||||
(
|
||||
"thermodynamicProperties"
|
||||
);
|
||||
|
||||
dimensionedScalar Cv(thermodynamicProperties.lookup("Cv"));
|
||||
|
||||
valueFraction() = rhop.snGrad()/
|
||||
(rhop.snGrad() - rhop*this->patch().deltaCoeffs());
|
||||
|
||||
refValue() = 0.5*rhop*magSqr(rhoUp/rhop);
|
||||
refGrad() =
|
||||
rhop*Cv.value()*Tp.snGrad()
|
||||
+ (
|
||||
refValue()
|
||||
- (0.5*rhop.patchInternalField()*
|
||||
magSqr(rhoUp.patchInternalField()/rhop.patchInternalField()))
|
||||
)*patch().deltaCoeffs();
|
||||
|
||||
mixedFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void mixedRhoEFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("valueFraction") << valueFraction()
|
||||
<< token::END_STATEMENT << endl;
|
||||
os.writeKeyword("refValue") << refValue() << token::END_STATEMENT << endl;
|
||||
os.writeKeyword("refGrad") << refGrad() << token::END_STATEMENT << endl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, mixedRhoEFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::mixedRhoEFvPatchScalarField
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
mixedRhoEFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mixedRhoEFvPatchScalarFields_H
|
||||
#define mixedRhoEFvPatchScalarFields_H
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mixedRhoEFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mixedRhoEFvPatchScalarField
|
||||
:
|
||||
public mixedFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mixedRhoE");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given mixedRhoEFvPatchScalarField
|
||||
// onto a new patch
|
||||
mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const mixedRhoEFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const mixedRhoEFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mixedRhoEFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
mixedRhoEFvPatchScalarField
|
||||
(
|
||||
const mixedRhoEFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mixedRhoEFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchField<scalar>&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,127 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedRhoUFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fixedRhoUFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fixedRhoUFvPatchVectorField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(tppsf)
|
||||
{}
|
||||
|
||||
|
||||
fixedRhoUFvPatchVectorField::fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fixedRhoUFvPatchVectorField& tppsf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(tppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void fixedRhoUFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchScalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const fvPatchVectorField& Up =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
|
||||
operator==(rhop*Up);
|
||||
|
||||
fixedValueFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void fixedRhoUFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchVectorField, fixedRhoUFvPatchVectorField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedRhoUFvPatchVectorField_H
|
||||
#define fixedRhoUFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixedRhoUFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixedRhoUFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fixedRhoU");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given fixedRhoUFvPatchVectorField
|
||||
// onto a new patch
|
||||
fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fixedRhoUFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fixedRhoUFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new fixedRhoUFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fixedRhoUFvPatchVectorField
|
||||
(
|
||||
const fixedRhoUFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new fixedRhoUFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
rhopSonicFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/rhopSonicFoam
|
||||
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-IBCs/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lrhopSonicFoam
|
||||
@ -0,0 +1,7 @@
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fixedRhoFvPatchScalarField.H"
|
||||
#include "gradientRhoFvPatchScalarField.H"
|
||||
#include "fixedRhoEFvPatchScalarField.H"
|
||||
#include "mixedRhoEFvPatchScalarField.H"
|
||||
#include "fixedRhoUFvPatchVectorField.H"
|
||||
@ -0,0 +1,54 @@
|
||||
IOobject phiHeader
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
|
||||
surfaceScalarField* phiPtr;
|
||||
|
||||
if (phiHeader.headerOk())
|
||||
{
|
||||
Info<< "Reading face flux field phi\n" << endl;
|
||||
|
||||
phiPtr = new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Calculating face flux field phi\n" << endl;
|
||||
|
||||
wordList phiTypes
|
||||
(
|
||||
rhoU.boundaryField().size(),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
phiPtr = new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rhoU) & mesh.Sf(),
|
||||
phiTypes
|
||||
);
|
||||
}
|
||||
|
||||
surfaceScalarField& phi = *phiPtr;
|
||||
129
applications/solvers/compressible/rhopSonicFoam/createFields.H
Normal file
129
applications/solvers/compressible/rhopSonicFoam/createFields.H
Normal file
@ -0,0 +1,129 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
p.oldTime();
|
||||
|
||||
Info<< "Reading field T\n" << endl;
|
||||
volScalarField T
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
T.correctBoundaryConditions();
|
||||
|
||||
volScalarField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"psi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
1.0/(R*T)
|
||||
);
|
||||
psi.oldTime();
|
||||
|
||||
# include "rhoBoundaryTypes.H"
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p*psi,
|
||||
rhoBoundaryTypes
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "rhoUboundaryTypes.H"
|
||||
volVectorField rhoU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
rho*U,
|
||||
rhoUboundaryTypes
|
||||
);
|
||||
|
||||
# include "rhoEboundaryTypes.H"
|
||||
volScalarField rhoE
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoE",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
rho*Cv*T + 0.5*rho*magSqr(rhoU/rho),
|
||||
rhoEboundaryTypes
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
phi.oldTime();
|
||||
|
||||
surfaceScalarField phiv
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiv",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
phi/linearInterpolate(rho),
|
||||
phi.boundaryField().types()
|
||||
);
|
||||
|
||||
rhoU.correctBoundaryConditions();
|
||||
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
|
||||
|
||||
volScalarField magRhoU = mag(rhoU);
|
||||
volScalarField H("H", (rhoE + p)/rho);
|
||||
|
||||
fields.add(rho);
|
||||
fields.add(magRhoU);
|
||||
fields.add(H);
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
Info<< "Reading thermodynamicProperties\n" << endl;
|
||||
|
||||
IOdictionary thermodynamicProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermodynamicProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar R
|
||||
(
|
||||
thermodynamicProperties.lookup("R")
|
||||
);
|
||||
|
||||
dimensionedScalar Cv
|
||||
(
|
||||
thermodynamicProperties.lookup("Cv")
|
||||
);
|
||||
|
||||
dimensionedScalar Cp = Cv + R;
|
||||
|
||||
dimensionedScalar gamma = Cp/Cv;
|
||||
|
||||
dimensionedScalar Pr = dimensionedScalar("Pr", dimless, 1.0);
|
||||
if (thermodynamicProperties.found("Pr"))
|
||||
{
|
||||
Pr = thermodynamicProperties.lookup("Pr");
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
surfaceScalarField::GeometricBoundaryField& phiPatches = phi.boundaryField();
|
||||
const volVectorField::GeometricBoundaryField& rhoUpatches = rhoU.boundaryField();
|
||||
const surfaceVectorField::GeometricBoundaryField& SfPatches = mesh.Sf().boundaryField();
|
||||
|
||||
forAll(phiPatches, patchI)
|
||||
{
|
||||
if (phi.boundaryField().types()[patchI] == "calculated")
|
||||
{
|
||||
calculatedFvsPatchScalarField& phiPatch =
|
||||
refCast<calculatedFvsPatchScalarField>(phiPatches[patchI]);
|
||||
|
||||
phiPatch == (rhoUpatches[patchI] & SfPatches[patchI]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
const volScalarField::GeometricBoundaryField& pbf = p.boundaryField();
|
||||
wordList rhoBoundaryTypes = pbf.types();
|
||||
|
||||
forAll(rhoBoundaryTypes, patchi)
|
||||
{
|
||||
if
|
||||
(
|
||||
rhoBoundaryTypes[patchi] == "pressureTransmissive"
|
||||
)
|
||||
{
|
||||
rhoBoundaryTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
|
||||
}
|
||||
else if (pbf[patchi].fixesValue())
|
||||
{
|
||||
rhoBoundaryTypes[patchi] = fixedRhoFvPatchScalarField::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
rhoBoundaryTypes[patchi] = gradientRhoFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
const volScalarField::GeometricBoundaryField& Tbf = T.boundaryField();
|
||||
wordList rhoEboundaryTypes = Tbf.types();
|
||||
|
||||
forAll(rhoEboundaryTypes, patchi)
|
||||
{
|
||||
if (Tbf[patchi].fixesValue())
|
||||
{
|
||||
rhoEboundaryTypes[patchi] = fixedRhoEFvPatchScalarField::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
rhoEboundaryTypes[patchi] = mixedRhoEFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
const volVectorField::GeometricBoundaryField& Ubf = U.boundaryField();
|
||||
wordList rhoUboundaryTypes = Ubf.types();
|
||||
|
||||
forAll(rhoUboundaryTypes, patchi)
|
||||
{
|
||||
if (Ubf[patchi].fixesValue())
|
||||
{
|
||||
rhoUboundaryTypes[patchi] = fixedRhoUFvPatchVectorField::typeName;
|
||||
}
|
||||
}
|
||||
193
applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C
Normal file
193
applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C
Normal file
@ -0,0 +1,193 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rhopSonicFoam
|
||||
|
||||
Description
|
||||
Pressure-density-based compressible flow solver.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "weighted.H"
|
||||
#include "gaussConvectionScheme.H"
|
||||
#include "multivariateGaussConvectionScheme.H"
|
||||
#include "MUSCL.H"
|
||||
#include "LimitedScheme.H"
|
||||
#include "boundaryTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readThermodynamicProperties.H"
|
||||
# include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
{
|
||||
Info<< "Time = " << runTime.value() << nl << endl;
|
||||
|
||||
# include "readPISOControls.H"
|
||||
scalar HbyAblend = readScalar(piso.lookup("HbyAblend"));
|
||||
|
||||
# include "readTimeControls.H"
|
||||
|
||||
scalar CoNum = max
|
||||
(
|
||||
mesh.surfaceInterpolation::deltaCoeffs()
|
||||
*mag(phiv)/mesh.magSf()
|
||||
).value()*runTime.deltaT().value();
|
||||
|
||||
Info<< "Max Courant Number = " << CoNum << endl;
|
||||
|
||||
# include "setDeltaT.H"
|
||||
|
||||
for (int outerCorr=0; outerCorr<nOuterCorr; outerCorr++)
|
||||
{
|
||||
magRhoU = mag(rhoU);
|
||||
H = (rhoE + p)/rho;
|
||||
|
||||
fv::multivariateGaussConvectionScheme<scalar> mvConvection
|
||||
(
|
||||
mesh,
|
||||
fields,
|
||||
phiv,
|
||||
mesh.divScheme("div(phiv,rhoUH)")
|
||||
);
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho)
|
||||
+ mvConvection.fvmDiv(phiv, rho)
|
||||
);
|
||||
|
||||
surfaceScalarField rhoUWeights =
|
||||
mvConvection.interpolationScheme()()(magRhoU)()
|
||||
.weights(magRhoU);
|
||||
|
||||
weighted<vector> rhoUScheme(rhoUWeights);
|
||||
|
||||
fvVectorMatrix rhoUEqn
|
||||
(
|
||||
fvm::ddt(rhoU)
|
||||
+ fv::gaussConvectionScheme<vector>(mesh, phiv, rhoUScheme)
|
||||
.fvmDiv(phiv, rhoU)
|
||||
);
|
||||
|
||||
solve(rhoUEqn == -fvc::grad(p));
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rhoE)
|
||||
+ mvConvection.fvmDiv(phiv, rhoE)
|
||||
==
|
||||
- mvConvection.fvcDiv(phiv, p)
|
||||
);
|
||||
|
||||
T = (rhoE - 0.5*rho*magSqr(rhoU/rho))/Cv/rho;
|
||||
psi = 1.0/(R*T);
|
||||
p = rho/psi;
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
volScalarField rrhoUA = 1.0/rhoUEqn.A();
|
||||
surfaceScalarField rrhoUAf("rrhoUAf", fvc::interpolate(rrhoUA));
|
||||
volVectorField HbyA = rrhoUA*rhoUEqn.H();
|
||||
|
||||
surfaceScalarField HbyAWeights =
|
||||
HbyAblend*mesh.weights()
|
||||
+ (1.0 - HbyAblend)*
|
||||
LimitedScheme
|
||||
<vector, MUSCLLimiter<NVDTVD>, limitFuncs::magSqr>
|
||||
(mesh, phi, IStringStream("HbyA")()).weights(HbyA);
|
||||
|
||||
phi =
|
||||
(
|
||||
surfaceInterpolationScheme<vector>::interpolate
|
||||
(HbyA, HbyAWeights) & mesh.Sf()
|
||||
)
|
||||
+ HbyAblend*fvc::ddtPhiCorr(rrhoUA, rho, rhoU, phi);
|
||||
|
||||
p.boundaryField().updateCoeffs();
|
||||
|
||||
surfaceScalarField phiGradp =
|
||||
rrhoUAf*mesh.magSf()*fvc::snGrad(p);
|
||||
|
||||
phi -= phiGradp;
|
||||
|
||||
# include "resetPhiPatches.H"
|
||||
|
||||
surfaceScalarField rhof =
|
||||
mvConvection.interpolationScheme()()(rho)()
|
||||
.interpolate(rho);
|
||||
|
||||
phiv = phi/rhof;
|
||||
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ mvConvection.fvcDiv(phiv, rho)
|
||||
+ fvc::div(phiGradp)
|
||||
- fvm::laplacian(rrhoUAf, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
phi += phiGradp + pEqn.flux();
|
||||
rho = psi*p;
|
||||
rhof =
|
||||
mvConvection.interpolationScheme()()(rho)()
|
||||
.interpolate(rho);
|
||||
phiv = phi/rhof;
|
||||
|
||||
rhoU = HbyA - rrhoUA*fvc::grad(p);
|
||||
rhoU.correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
U = rhoU/rho;
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,70 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(p) Gauss linear;
|
||||
grad(U) Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss <>;
|
||||
div(phid,p) Gauss <>;
|
||||
div(phi,e) Gauss <>;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default none;
|
||||
laplacian(mu,U) Gauss linear corrected;
|
||||
laplacian(mu,e) Gauss linear corrected;
|
||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p BICCG 1e-15 0;
|
||||
U BICCG 1e-15 0;
|
||||
rho ICCG 1e-15 0;
|
||||
e BICCG 1e-15 0;
|
||||
}
|
||||
|
||||
PISO
|
||||
{
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/fvSchemes.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/ddt/transient.cfg";
|
||||
|
||||
include "fvSchemes/gradSchemes.cfg";
|
||||
include "fvSchemes/divSchemes.cfg";
|
||||
include "fvSchemes/laplacianSchemes.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/interpolation/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/snGrad/defaultOnly.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/flux/p.cfg";
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
include "defaults/system/fvSchemes";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,22 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
divSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phiU.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phidp.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/div/phie.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,21 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/p.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/grad/U.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,22 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/schemes.cfg";
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/default.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/muU.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/mue.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSchemes/laplacian/rhoAUp.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,33 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/fvSolution.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
solvers
|
||||
{
|
||||
type dictionary;
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/pAsymm.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/U.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/rho.cfg";
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/solvers/e.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/fvSolution/PISO.cfg";
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
include "defaults/system/fvSolution";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,55 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
description "Compressible trans-sonic/supersonic laminar gas flow code.";
|
||||
|
||||
dictionaries
|
||||
{
|
||||
include "$FOAMX_CONFIG/dictionaries/controlDict/controlDict.cfg";
|
||||
fvSchemes;
|
||||
fvSolution;
|
||||
transportProperties;
|
||||
include "$FOAMX_CONFIG/dictionaries/thermodynamicProperties/thermodynamicPropertiesConst.cfg";
|
||||
}
|
||||
|
||||
fields
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/pDynamic.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/U.cfg";
|
||||
include "$FOAMX_CONFIG/entries/geometricFields/T.cfg";
|
||||
}
|
||||
|
||||
patchPhysicalTypes
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/patches.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/sonic/patches.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/thermal/patches.cfg";
|
||||
}
|
||||
|
||||
patchFieldsPhysicalTypes
|
||||
{
|
||||
U
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/U.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/sonic/U.cfg";
|
||||
}
|
||||
|
||||
p
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/p.cfg";
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/sonic/p.cfg";
|
||||
}
|
||||
|
||||
T
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/patchPhysicalTypes/standard/thermal/T.cfg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,16 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
include "$FOAMX_CONFIG/dictionaries/transportProperties/transportProperties.cfg";
|
||||
|
||||
entries
|
||||
{
|
||||
include "$FOAMX_CONFIG/entries/dimensionedScalar/mu.cfg";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/solvers/compressible/sonicFoam/Make/files
Normal file
3
applications/solvers/compressible/sonicFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
sonicFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/sonicFoam
|
||||
4
applications/solvers/compressible/sonicFoam/Make/options
Normal file
4
applications/solvers/compressible/sonicFoam/Make/options
Normal file
@ -0,0 +1,4 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = -lfiniteVolume
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
# include "rhoEqn.H"
|
||||
}
|
||||
{
|
||||
scalar sumLocalContErr = (sum(mag(rho - psi*p))/sum(rho)).value();
|
||||
scalar globalContErr = (sum(rho - psi*p)/sum(rho)).value();
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr << endl;
|
||||
}
|
||||
86
applications/solvers/compressible/sonicFoam/createFields.H
Normal file
86
applications/solvers/compressible/sonicFoam/createFields.H
Normal file
@ -0,0 +1,86 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field T\n" << endl;
|
||||
volScalarField T
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field e from T\n" << endl;
|
||||
volScalarField e
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"e",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Cv*T,
|
||||
T.boundaryField().types()
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"psi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
1.0/(R*T)
|
||||
);
|
||||
psi.oldTime();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
psi*p
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
@ -0,0 +1,23 @@
|
||||
Info<< "Reading thermodynamicProperties\n" << endl;
|
||||
|
||||
IOdictionary thermodynamicProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermodynamicProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar R
|
||||
(
|
||||
thermodynamicProperties.lookup("R")
|
||||
);
|
||||
|
||||
dimensionedScalar Cv
|
||||
(
|
||||
thermodynamicProperties.lookup("Cv")
|
||||
);
|
||||
@ -0,0 +1,18 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar mu
|
||||
(
|
||||
transportProperties.lookup("mu")
|
||||
);
|
||||
136
applications/solvers/compressible/sonicFoam/sonicFoam.C
Normal file
136
applications/solvers/compressible/sonicFoam/sonicFoam.C
Normal file
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
sonicFoam
|
||||
|
||||
Description
|
||||
Transient solver for trans-sonic/supersonic, laminar flow of a
|
||||
compressible gas.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readThermodynamicProperties.H"
|
||||
# include "readTransportProperties.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readPISOControls.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
|
||||
# include "rhoEqn.H"
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(mu, U)
|
||||
);
|
||||
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, e)
|
||||
+ fvm::div(phi, e)
|
||||
- fvm::laplacian(mu, e)
|
||||
==
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
+ mu*magSqr(symm(fvc::grad(U)))
|
||||
);
|
||||
|
||||
T = e/Cv;
|
||||
psi = 1.0/(R*T);
|
||||
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
U = rUA*UEqn.H();
|
||||
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rho*rUA, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
phi = pEqn.flux();
|
||||
}
|
||||
|
||||
# include "compressibleContinuityErrs.H"
|
||||
|
||||
U -= rUA*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
rho = psi*p;
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
sonicFoamAutoMotion.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/sonicFoamAutoMotion
|
||||
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-ldynamicMesh \
|
||||
-lmeshTools
|
||||
@ -0,0 +1,20 @@
|
||||
{
|
||||
# include "rhoEqn.H"
|
||||
}
|
||||
{
|
||||
scalar sumLocalContErr =
|
||||
sum
|
||||
(
|
||||
mag(rho.internalField() - (psi*p)().internalField())
|
||||
)/sum(rho.internalField());
|
||||
|
||||
scalar globalContErr =
|
||||
sum(rho.internalField() - (psi*p)().internalField())
|
||||
/sum(rho.internalField());
|
||||
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr << endl;
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field T\n" << endl;
|
||||
volScalarField T
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field e from T\n" << endl;
|
||||
volScalarField e
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"e",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Cv*T,
|
||||
T.boundaryField().types()
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
volScalarField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"psi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
1.0/(R*T)
|
||||
);
|
||||
psi.oldTime();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
psi*p
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
|
||||
|
||||
Info<< "Creating field phid\n" << endl;
|
||||
surfaceScalarField phid
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phid",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
phi/fvc::interpolate(p),
|
||||
phi.boundaryField().types()
|
||||
);
|
||||
@ -0,0 +1,23 @@
|
||||
Info<< "Reading thermodynamicProperties\n" << endl;
|
||||
|
||||
IOdictionary thermodynamicProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermodynamicProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar R
|
||||
(
|
||||
thermodynamicProperties.lookup("R")
|
||||
);
|
||||
|
||||
dimensionedScalar Cv
|
||||
(
|
||||
thermodynamicProperties.lookup("Cv")
|
||||
);
|
||||
@ -0,0 +1,18 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar mu
|
||||
(
|
||||
transportProperties.lookup("mu")
|
||||
);
|
||||
@ -0,0 +1,139 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
sonicFoamAutoMotion
|
||||
|
||||
Description
|
||||
Transient solver for trans-sonic/supersonic, laminar flow of a
|
||||
compressible gas with mesh motion..
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "motionSolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readThermodynamicProperties.H"
|
||||
# include "readTransportProperties.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
autoPtr<Foam::motionSolver> motionPtr = motionSolver::New(mesh);
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readPISOControls.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
|
||||
mesh.movePoints(motionPtr->newPoints());
|
||||
|
||||
# include "rhoEqn.H"
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(mu, U)
|
||||
);
|
||||
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, e)
|
||||
+ fvm::div(phi, e)
|
||||
- fvm::laplacian(mu, e)
|
||||
==
|
||||
- p*fvc::div(phi/fvc::interpolate(rho) + fvc::meshPhi(rho, U))
|
||||
+ mu*magSqr(symm(fvc::grad(U)))
|
||||
);
|
||||
|
||||
T = e/Cv;
|
||||
psi = 1.0/(R*T);
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
U = UEqn.H()/UEqn.A();
|
||||
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(psi)*
|
||||
(
|
||||
(fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)
|
||||
)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
+ fvm::div(phid, p)
|
||||
- fvm::laplacian(rho/UEqn.A(), p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
phi = pEqn.flux();
|
||||
}
|
||||
|
||||
# include "compressibleContinuityErrs.H"
|
||||
|
||||
U -= fvc::grad(p)/UEqn.A();
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
rho = psi*p;
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(p) Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss <>;
|
||||
div(phid,p) Gauss <>;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default none;
|
||||
laplacian(mu,U) Gauss linear corrected;
|
||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.4 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p BICCG 1e-06 0;
|
||||
U BICCG 1e-05 0;
|
||||
rho ICCG 1e-05 0;
|
||||
}
|
||||
|
||||
PISO
|
||||
{
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user