Merge remote-tracking branch 'origin/feature/pressureBasedTurbo' into nextRelease
This commit is contained in:
commit
84b040d238
179 changed files with 216715 additions and 1 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
steadyCompressibleFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/steadyCompressibleFoam
|
|
@ -0,0 +1,13 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lspecie \
|
||||||
|
-lcompressibleRASModels \
|
||||||
|
-llduSolvers
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Solve the momentum equation
|
||||||
|
U.storePrevIter();
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, U)
|
||||||
|
+ fvm::div(phi, U)
|
||||||
|
+ turbulence->divDevRhoReff(U)
|
||||||
|
);
|
||||||
|
|
||||||
|
UEqn.relax();
|
||||||
|
|
||||||
|
eqnResidual = solve
|
||||||
|
(
|
||||||
|
UEqn == -fvc::grad(p)
|
||||||
|
).initialResidual();
|
||||||
|
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
|
@ -0,0 +1,9 @@
|
||||||
|
// check convergence
|
||||||
|
|
||||||
|
if (maxResidual < convergenceCriterion)
|
||||||
|
{
|
||||||
|
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
|
||||||
|
runTime.writeAndEnd();
|
||||||
|
Info<< "latestTime = " << runTime.timeName() << endl;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
Info<< "Reading thermophysical properties\n" << endl;
|
||||||
|
|
||||||
|
autoPtr<basicPsiThermo> pThermo
|
||||||
|
(
|
||||||
|
basicPsiThermo::New(mesh)
|
||||||
|
);
|
||||||
|
basicPsiThermo& thermo = pThermo();
|
||||||
|
|
||||||
|
volScalarField& p = thermo.p();
|
||||||
|
volScalarField& h = thermo.h();
|
||||||
|
const volScalarField& T = thermo.T();
|
||||||
|
const volScalarField& psi = thermo.psi();
|
||||||
|
|
||||||
|
volScalarField rho
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
thermo.rho()
|
||||||
|
);
|
||||||
|
rho.oldTime();
|
||||||
|
|
||||||
|
Info<< "\nReading field U\n" << endl;
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
# include "compressibleCreatePhi.H"
|
||||||
|
|
||||||
|
Info<< "Creating turbulence model\n" << endl;
|
||||||
|
autoPtr<compressible::RASModel> turbulence
|
||||||
|
(
|
||||||
|
compressible::RASModel::New
|
||||||
|
(
|
||||||
|
rho,
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
thermo
|
||||||
|
)
|
||||||
|
);
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
|
||||||
|
Global
|
||||||
|
continuityErrs
|
||||||
|
|
||||||
|
Description
|
||||||
|
Calculates and prints the continuity errors.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
{
|
||||||
|
volScalarField divErr = fvc::ddt(psi, p);
|
||||||
|
|
||||||
|
scalar sumLocalDivErr =
|
||||||
|
mag(divErr)().weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
|
scalar globalDivErr =
|
||||||
|
divErr.weightedAverage(mesh.V()).value();
|
||||||
|
|
||||||
|
Info<< "time step divFlux errors: "
|
||||||
|
<< "maximum = " << max(divErr.internalField())
|
||||||
|
<< ", sum local = " << sumLocalDivErr
|
||||||
|
<< ", global = " << globalDivErr
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
// Solve the enthalpy equation
|
||||||
|
T.storePrevIter();
|
||||||
|
|
||||||
|
surfaceScalarField faceU = phi/fvc::interpolate(rho);
|
||||||
|
|
||||||
|
fvScalarMatrix hEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, h)
|
||||||
|
+ fvm::div(phi, h)
|
||||||
|
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||||
|
==
|
||||||
|
// ddt(p) term removed: steady-state. HJ, 27/Apr/2010
|
||||||
|
fvc::div(faceU, p, "div(U,p)")
|
||||||
|
- p*fvc::div(faceU)
|
||||||
|
// Viscous heating: note sign (devRhoReff has a minus in it)
|
||||||
|
- (turbulence->devRhoReff() && fvc::grad(U))
|
||||||
|
);
|
||||||
|
|
||||||
|
hEqn.relax();
|
||||||
|
|
||||||
|
eqnResidual = hEqn.solve().initialResidual();
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
||||||
|
|
||||||
|
// Bound the enthalpy using TMin and TMax
|
||||||
|
volScalarField Cp = thermo.Cp();
|
||||||
|
|
||||||
|
h = Foam::min(h, TMax*Cp);
|
||||||
|
h = Foam::max(h, TMin*Cp);
|
||||||
|
h.correctBoundaryConditions();
|
||||||
|
|
||||||
|
thermo.correct();
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
// initialize values for convergence checks
|
||||||
|
|
||||||
|
scalar eqnResidual = 1, maxResidual = 0;
|
||||||
|
scalar convergenceCriterion = 0;
|
||||||
|
|
||||||
|
pimple.readIfPresent("convergence", convergenceCriterion);
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
{
|
||||||
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
for (int corr = 0; corr < nCorr; corr++)
|
||||||
|
{
|
||||||
|
U = rUA*UEqn.H();
|
||||||
|
|
||||||
|
// Execute ddtPhiCorr before recalculating flux
|
||||||
|
// HJ, 27/Apr/2010
|
||||||
|
surfaceScalarField phid
|
||||||
|
(
|
||||||
|
"phid",
|
||||||
|
fvc::interpolate(psi)*
|
||||||
|
(
|
||||||
|
(fvc::interpolate(U) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Calculate phi for boundary conditions
|
||||||
|
phi = fvc::interpolate(rho*U) & mesh.Sf();
|
||||||
|
|
||||||
|
p.storePrevIter();
|
||||||
|
|
||||||
|
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(psi, p)
|
||||||
|
+ fvm::div(phid, p)
|
||||||
|
- fvm::laplacian(rho*rUA, p)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Retain the residual from the first pressure solution
|
||||||
|
eqnResidual = pEqn.solve().initialResidual();
|
||||||
|
|
||||||
|
if (corr == 0 && nonOrth == 0)
|
||||||
|
{
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the flux
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi = pEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# include "compressibleContinuityErrs.H"
|
||||||
|
|
||||||
|
// Relax the pressure
|
||||||
|
p.relax();
|
||||||
|
|
||||||
|
U -= rUA*fvc::grad(p);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bound the pressure
|
||||||
|
if (min(p) < pMin || max(p) > pMax)
|
||||||
|
{
|
||||||
|
p.max(pMin);
|
||||||
|
p.min(pMax);
|
||||||
|
p.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bound the velocity
|
||||||
|
volScalarField magU = mag(U);
|
||||||
|
|
||||||
|
if (max(magU) > UMax)
|
||||||
|
{
|
||||||
|
volScalarField Ulimiter = pos(magU - UMax)*UMax/(magU + smallU)
|
||||||
|
+ neg(magU - UMax);
|
||||||
|
Ulimiter.max(scalar(0));
|
||||||
|
Ulimiter.min(scalar(1));
|
||||||
|
|
||||||
|
U *= Ulimiter;
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Read field bounds
|
||||||
|
dictionary fieldBounds = mesh.solutionDict().subDict("fieldBounds");
|
||||||
|
|
||||||
|
// Pressure bounds
|
||||||
|
dimensionedScalar pMin("pMin", p.dimensions(), 0);
|
||||||
|
dimensionedScalar pMax("pMax", p.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(p.name()) >> pMin.value() >> pMax.value();
|
||||||
|
|
||||||
|
// Temperature bounds
|
||||||
|
dimensionedScalar TMin("TMin", T.dimensions(), 0);
|
||||||
|
dimensionedScalar TMax("TMax", T.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(T.name()) >> TMin.value() >> TMax.value();
|
||||||
|
|
||||||
|
// Velocity bound
|
||||||
|
dimensionedScalar UMax("UMax", U.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(U.name()) >> UMax.value();
|
||||||
|
dimensionedScalar smallU("smallU", dimVelocity, 1e-10);
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
// Calculate density from pressure
|
||||||
|
rho.storePrevIter();
|
||||||
|
rho = thermo.rho();
|
||||||
|
|
||||||
|
// Bound rho
|
||||||
|
volScalarField R = thermo.Cp() - thermo.Cv();
|
||||||
|
|
||||||
|
volScalarField rhoMin = pMin/(R*TMax);
|
||||||
|
volScalarField rhoMax = pMax/(R*TMin);
|
||||||
|
|
||||||
|
rho = Foam::min(rho, rhoMax);
|
||||||
|
rho = Foam::max(rho, rhoMin);
|
||||||
|
rho.relax();
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
steadyCompressibleFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Steady-state solver for compressible, turbulent flow.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "basicPsiThermo.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createMesh.H"
|
||||||
|
# include "createFields.H"
|
||||||
|
# include "readPIMPLEControls.H"
|
||||||
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
for (runTime++; !runTime.end(); runTime++)
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
# include "readPIMPLEControls.H"
|
||||||
|
# include "readFieldBounds.H"
|
||||||
|
|
||||||
|
# include "initConvergenceCheck.H"
|
||||||
|
|
||||||
|
# include "UEqn.H"
|
||||||
|
# include "hEqn.H"
|
||||||
|
# include "pEqn.H"
|
||||||
|
|
||||||
|
# include "rhoFromP.H"
|
||||||
|
|
||||||
|
// Correct turbulence
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
|
||||||
|
# include "convergenceCheck.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
steadyCompressibleMRFFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/steadyCompressibleMRFFoam
|
|
@ -0,0 +1,13 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lspecie \
|
||||||
|
-lcompressibleRASModels \
|
||||||
|
-llduSolvers
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Solve the momentum equation
|
||||||
|
U.storePrevIter();
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, U)
|
||||||
|
+ fvm::div(phi, U)
|
||||||
|
+ turbulence->divDevRhoReff(U)
|
||||||
|
);
|
||||||
|
|
||||||
|
// MRF: add Coriolis force
|
||||||
|
mrfZones.addCoriolis(rho, UEqn);
|
||||||
|
|
||||||
|
UEqn.relax();
|
||||||
|
|
||||||
|
eqnResidual = solve
|
||||||
|
(
|
||||||
|
UEqn == -fvc::grad(p)
|
||||||
|
).initialResidual();
|
||||||
|
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
|
@ -0,0 +1,9 @@
|
||||||
|
// check convergence
|
||||||
|
|
||||||
|
if (maxResidual < convergenceCriterion)
|
||||||
|
{
|
||||||
|
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
|
||||||
|
runTime.writeAndEnd();
|
||||||
|
Info<< "latestTime = " << runTime.timeName() << endl;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
Info<< "Reading thermophysical properties\n" << endl;
|
||||||
|
|
||||||
|
autoPtr<basicPsiThermo> pThermo
|
||||||
|
(
|
||||||
|
basicPsiThermo::New(mesh)
|
||||||
|
);
|
||||||
|
basicPsiThermo& thermo = pThermo();
|
||||||
|
|
||||||
|
volScalarField& p = thermo.p();
|
||||||
|
volScalarField& h = thermo.h();
|
||||||
|
const volScalarField& T = thermo.T();
|
||||||
|
const volScalarField& psi = thermo.psi();
|
||||||
|
|
||||||
|
volScalarField rho
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
thermo.rho()
|
||||||
|
);
|
||||||
|
rho.oldTime();
|
||||||
|
|
||||||
|
Info<< "\nReading field U\n" << endl;
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
# include "compressibleCreatePhi.H"
|
||||||
|
|
||||||
|
Info<< "Creating turbulence model\n" << endl;
|
||||||
|
autoPtr<compressible::RASModel> turbulence
|
||||||
|
(
|
||||||
|
compressible::RASModel::New
|
||||||
|
(
|
||||||
|
rho,
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
thermo
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create MRF zones
|
||||||
|
MRFZones mrfZones(mesh);
|
||||||
|
mrfZones.correctBoundaryVelocity(U);
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
// Solve the enthalpy equation
|
||||||
|
T.storePrevIter();
|
||||||
|
|
||||||
|
surfaceScalarField faceU = phi/fvc::interpolate(rho);
|
||||||
|
|
||||||
|
fvScalarMatrix hEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, h)
|
||||||
|
+ fvm::div(phi, h)
|
||||||
|
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||||
|
==
|
||||||
|
// Note: potential issue with reconstructed relative velocity.
|
||||||
|
// HJ, 12/Dec/2009
|
||||||
|
// fvc::div(faceU, p, "div(U,p)")
|
||||||
|
fvc::div(faceU + mrfZones.fluxCorrection(), p,"div(U,p)")
|
||||||
|
- p*fvc::div(faceU)
|
||||||
|
// Viscous heating: note sign (devRhoReff has a minus in it)
|
||||||
|
- (turbulence->devRhoReff() && fvc::grad(U))
|
||||||
|
);
|
||||||
|
|
||||||
|
hEqn.relax();
|
||||||
|
|
||||||
|
eqnResidual = hEqn.solve().initialResidual();
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
||||||
|
|
||||||
|
// Bound the enthalpy using TMin and TMax
|
||||||
|
volScalarField Cp = thermo.Cp();
|
||||||
|
|
||||||
|
h = Foam::min(h, TMax*Cp);
|
||||||
|
h = Foam::max(h, TMin*Cp);
|
||||||
|
h.correctBoundaryConditions();
|
||||||
|
|
||||||
|
thermo.correct();
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
// initialize values for convergence checks
|
||||||
|
|
||||||
|
scalar eqnResidual = 1, maxResidual = 0;
|
||||||
|
scalar convergenceCriterion = 0;
|
||||||
|
|
||||||
|
pimple.readIfPresent("convergence", convergenceCriterion);
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
{
|
||||||
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
for (int corr = 0; corr < nCorr; corr++)
|
||||||
|
{
|
||||||
|
U = rUA*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField psif = fvc::interpolate(psi);
|
||||||
|
surfaceScalarField rhof = fvc::interpolate(rho);
|
||||||
|
|
||||||
|
// Execute ddtPhiCorr before recalculating flux
|
||||||
|
// HJ, 27/Apr/2010
|
||||||
|
surfaceScalarField phid
|
||||||
|
(
|
||||||
|
"phid",
|
||||||
|
psif*(fvc::interpolate(U) & mesh.Sf())
|
||||||
|
);
|
||||||
|
|
||||||
|
// Make flux relative within the MRF zone
|
||||||
|
mrfZones.relativeFlux(psif, phid);
|
||||||
|
|
||||||
|
// Calculate phi for boundary conditions
|
||||||
|
phi = fvc::interpolate(rho*U) & mesh.Sf();
|
||||||
|
|
||||||
|
// Make flux relative within the MRF zone
|
||||||
|
mrfZones.relativeFlux(rhof, phi);
|
||||||
|
|
||||||
|
p.storePrevIter();
|
||||||
|
|
||||||
|
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(psi, p)
|
||||||
|
+ fvm::div(phid, p)
|
||||||
|
- fvm::laplacian(rho*rUA, p)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Retain the residual from the first pressure solution
|
||||||
|
eqnResidual = pEqn.solve().initialResidual();
|
||||||
|
|
||||||
|
if (corr == 0 && nonOrth == 0)
|
||||||
|
{
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the flux
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi = pEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# include "compressibleContinuityErrs.H"
|
||||||
|
|
||||||
|
// Explicitly relax the pressure for momentum corrector
|
||||||
|
p.relax();
|
||||||
|
|
||||||
|
U -= rUA*fvc::grad(p);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bound the pressure
|
||||||
|
if (min(p) < pMin || max(p) > pMax)
|
||||||
|
{
|
||||||
|
p.max(pMin);
|
||||||
|
p.min(pMax);
|
||||||
|
p.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bound the velocity
|
||||||
|
volScalarField magU = mag(U);
|
||||||
|
|
||||||
|
if (max(magU) > UMax)
|
||||||
|
{
|
||||||
|
volScalarField Ulimiter = pos(magU - UMax)*UMax/(magU + smallU)
|
||||||
|
+ neg(magU - UMax);
|
||||||
|
Ulimiter.max(scalar(0));
|
||||||
|
Ulimiter.min(scalar(1));
|
||||||
|
|
||||||
|
U *= Ulimiter;
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Read field bounds
|
||||||
|
dictionary fieldBounds = mesh.solutionDict().subDict("fieldBounds");
|
||||||
|
|
||||||
|
// Pressure bounds
|
||||||
|
dimensionedScalar pMin("pMin", p.dimensions(), 0);
|
||||||
|
dimensionedScalar pMax("pMax", p.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(p.name()) >> pMin.value() >> pMax.value();
|
||||||
|
|
||||||
|
// Temperature bounds
|
||||||
|
dimensionedScalar TMin("TMin", T.dimensions(), 0);
|
||||||
|
dimensionedScalar TMax("TMax", T.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(T.name()) >> TMin.value() >> TMax.value();
|
||||||
|
|
||||||
|
// Velocity bound
|
||||||
|
dimensionedScalar UMax("UMax", U.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(U.name()) >> UMax.value();
|
||||||
|
dimensionedScalar smallU("smallU", dimVelocity, 1e-10);
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
// Calculate density from pressure
|
||||||
|
rho.storePrevIter();
|
||||||
|
rho = thermo.rho();
|
||||||
|
|
||||||
|
// Bound rho
|
||||||
|
volScalarField R = thermo.Cp() - thermo.Cv();
|
||||||
|
|
||||||
|
volScalarField rhoMin = pMin/(R*TMax);
|
||||||
|
volScalarField rhoMax = pMax/(R*TMin);
|
||||||
|
|
||||||
|
rho = Foam::min(rho, rhoMax);
|
||||||
|
rho = Foam::max(rho, rhoMin);
|
||||||
|
rho.relax();
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
steadyCompressibleFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Steady-state solver for compressible, turbulent flow, with support for
|
||||||
|
multiple rotating reference frames.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "basicPsiThermo.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "MRFZones.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createMesh.H"
|
||||||
|
# include "createFields.H"
|
||||||
|
# include "readPIMPLEControls.H"
|
||||||
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
for (runTime++; !runTime.end(); runTime++)
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
# include "readPIMPLEControls.H"
|
||||||
|
# include "readFieldBounds.H"
|
||||||
|
|
||||||
|
# include "initConvergenceCheck.H"
|
||||||
|
|
||||||
|
# include "UEqn.H"
|
||||||
|
# include "hEqn.H"
|
||||||
|
# include "pEqn.H"
|
||||||
|
|
||||||
|
# include "rhoFromP.H"
|
||||||
|
|
||||||
|
// Correct turbulence
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
|
||||||
|
# include "convergenceCheck.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
steadyCompressibleSRFFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/steadyCompressibleSRFFoam
|
|
@ -0,0 +1,13 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lspecie \
|
||||||
|
-lcompressibleRASModels \
|
||||||
|
-llduSolvers
|
|
@ -0,0 +1,19 @@
|
||||||
|
// Solve the momentum equation
|
||||||
|
Urel.storePrevIter();
|
||||||
|
|
||||||
|
fvVectorMatrix UrelEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, Urel)
|
||||||
|
+ fvm::div(phi, Urel)
|
||||||
|
+ turbulence->divDevRhoReff(Urel)
|
||||||
|
+ rho*SRF->Su()
|
||||||
|
);
|
||||||
|
|
||||||
|
UrelEqn.relax();
|
||||||
|
|
||||||
|
eqnResidual = solve
|
||||||
|
(
|
||||||
|
UrelEqn == -fvc::grad(p)
|
||||||
|
).initialResidual();
|
||||||
|
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
|
@ -0,0 +1,9 @@
|
||||||
|
// check convergence
|
||||||
|
|
||||||
|
if (maxResidual < convergenceCriterion)
|
||||||
|
{
|
||||||
|
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
|
||||||
|
runTime.writeAndEnd();
|
||||||
|
Info<< "latestTime = " << runTime.timeName() << endl;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
Info<< "Reading thermophysical properties\n" << endl;
|
||||||
|
|
||||||
|
autoPtr<basicPsiThermo> pThermo
|
||||||
|
(
|
||||||
|
basicPsiThermo::New(mesh)
|
||||||
|
);
|
||||||
|
basicPsiThermo& thermo = pThermo();
|
||||||
|
|
||||||
|
volScalarField& p = thermo.p();
|
||||||
|
volScalarField& h = thermo.h();
|
||||||
|
const volScalarField& T = thermo.T();
|
||||||
|
const volScalarField& psi = thermo.psi();
|
||||||
|
|
||||||
|
volScalarField rho
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
thermo.rho()
|
||||||
|
);
|
||||||
|
rho.oldTime();
|
||||||
|
|
||||||
|
Info<< "\nReading field Urel\n" << endl;
|
||||||
|
volVectorField Urel
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Urel",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading/calculating face flux field phi\n" << endl;
|
||||||
|
|
||||||
|
surfaceScalarField phi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phi",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
linearInterpolate(rho*Urel) & mesh.Sf()
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating turbulence model\n" << endl;
|
||||||
|
autoPtr<compressible::RASModel> turbulence
|
||||||
|
(
|
||||||
|
compressible::RASModel::New
|
||||||
|
(
|
||||||
|
rho,
|
||||||
|
Urel,
|
||||||
|
phi,
|
||||||
|
thermo
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating SRF model\n" << endl;
|
||||||
|
autoPtr<SRF::SRFModel> SRF
|
||||||
|
(
|
||||||
|
SRF::SRFModel::New(Urel)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create absolute velocity field
|
||||||
|
volVectorField Uabs
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Uabs",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
Urel + SRF->U()
|
||||||
|
);
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
// Solve the enthalpy equation
|
||||||
|
T.storePrevIter();
|
||||||
|
|
||||||
|
surfaceScalarField faceU = phi/fvc::interpolate(rho);
|
||||||
|
|
||||||
|
fvScalarMatrix hEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, h)
|
||||||
|
+ fvm::div(phi, h)
|
||||||
|
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||||
|
==
|
||||||
|
// ddt(p) term removed: steady-state. HJ, 27/Apr/2010
|
||||||
|
fvc::div(faceU, p, "div(U,p)")
|
||||||
|
- p*fvc::div(faceU)
|
||||||
|
// Viscous heating: note sign (devRhoReff has a minus in it)
|
||||||
|
- (turbulence->devRhoReff() && fvc::grad(Urel))
|
||||||
|
);
|
||||||
|
|
||||||
|
hEqn.relax();
|
||||||
|
|
||||||
|
eqnResidual = hEqn.solve().initialResidual();
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
||||||
|
|
||||||
|
// Bound the enthalpy using TMin and TMax
|
||||||
|
volScalarField Cp = thermo.Cp();
|
||||||
|
|
||||||
|
h = Foam::min(h, TMax*Cp);
|
||||||
|
h = Foam::max(h, TMin*Cp);
|
||||||
|
h.correctBoundaryConditions();
|
||||||
|
|
||||||
|
thermo.correct();
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
// initialize values for convergence checks
|
||||||
|
|
||||||
|
scalar eqnResidual = 1, maxResidual = 0;
|
||||||
|
scalar convergenceCriterion = 0;
|
||||||
|
|
||||||
|
pimple.readIfPresent("convergence", convergenceCriterion);
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
{
|
||||||
|
volScalarField rUrelA = 1.0/UrelEqn.A();
|
||||||
|
|
||||||
|
for (int corr = 0; corr < nCorr; corr++)
|
||||||
|
{
|
||||||
|
Urel = rUrelA*UrelEqn.H();
|
||||||
|
|
||||||
|
// Execute ddtPhiCorr before recalculating flux
|
||||||
|
// HJ, 27/Apr/2010
|
||||||
|
surfaceScalarField phid
|
||||||
|
(
|
||||||
|
"phid",
|
||||||
|
fvc::interpolate(thermo.psi())*
|
||||||
|
(
|
||||||
|
(fvc::interpolate(Urel) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rUrelA, rho, Urel, phi)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Calculate phi for boundary conditions
|
||||||
|
phi = fvc::interpolate(rho*Urel) & mesh.Sf();
|
||||||
|
|
||||||
|
p.storePrevIter();
|
||||||
|
|
||||||
|
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(psi, p)
|
||||||
|
+ fvm::div(phid, p)
|
||||||
|
- fvm::laplacian(rho*rUrelA, p)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Retain the residual from the first pressure solution
|
||||||
|
eqnResidual = pEqn.solve().initialResidual();
|
||||||
|
|
||||||
|
if (corr == 0 && nonOrth == 0)
|
||||||
|
{
|
||||||
|
maxResidual = max(eqnResidual, maxResidual);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the flux
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi = pEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# include "compressibleContinuityErrs.H"
|
||||||
|
|
||||||
|
|
||||||
|
// Explicitly relax the pressure for momentum corrector
|
||||||
|
p.relax();
|
||||||
|
|
||||||
|
Urel -= rUrelA*fvc::grad(p);
|
||||||
|
Urel.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bound the pressure
|
||||||
|
if (min(p) < pMin || max(p) > pMax)
|
||||||
|
{
|
||||||
|
p.max(pMin);
|
||||||
|
p.min(pMax);
|
||||||
|
p.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bound the velocity
|
||||||
|
volScalarField magUrel = mag(Urel);
|
||||||
|
|
||||||
|
if (max(magUrel) > UrelMax)
|
||||||
|
{
|
||||||
|
volScalarField Urellimiter =
|
||||||
|
pos(magUrel - UrelMax)*UrelMax/(magUrel + smallUrel)
|
||||||
|
+ neg(magUrel - UrelMax);
|
||||||
|
Urellimiter.max(scalar(0));
|
||||||
|
Urellimiter.min(scalar(1));
|
||||||
|
|
||||||
|
Urel *= Urellimiter;
|
||||||
|
Urel.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
dictionary fieldBounds = mesh.solutionDict().subDict("fieldBounds");
|
||||||
|
|
||||||
|
// Pressure bounds
|
||||||
|
dimensionedScalar pMin("pMin", p.dimensions(), 0);
|
||||||
|
dimensionedScalar pMax("pMax", p.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(p.name()) >> pMin.value() >> pMax.value();
|
||||||
|
|
||||||
|
// Temperature bounds
|
||||||
|
dimensionedScalar TMin("TMin", T.dimensions(), 0);
|
||||||
|
dimensionedScalar TMax("TMax", T.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(T.name()) >> TMin.value() >> TMax.value();
|
||||||
|
|
||||||
|
// Velocity bound
|
||||||
|
dimensionedScalar UrelMax("UrelMax", Urel.dimensions(), 0);
|
||||||
|
|
||||||
|
fieldBounds.lookup(Urel.name()) >> UrelMax.value();
|
||||||
|
dimensionedScalar smallUrel("smallUrel", dimVelocity, 1e-10);
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
// Calculate density from pressure
|
||||||
|
rho.storePrevIter();
|
||||||
|
rho = thermo.rho();
|
||||||
|
|
||||||
|
// Bound rho
|
||||||
|
volScalarField R = thermo.Cp() - thermo.Cv();
|
||||||
|
|
||||||
|
volScalarField rhoMin = pMin/(R*TMax);
|
||||||
|
volScalarField rhoMax = pMax/(R*TMin);
|
||||||
|
|
||||||
|
rho = Foam::min(rho, rhoMax);
|
||||||
|
rho = Foam::max(rho, rhoMin);
|
||||||
|
rho.relax();
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
steadyCompressibleFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Steady-state solver for compressible, turbulent flow, with solution
|
||||||
|
performed using rotating frame of reference.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "basicPsiThermo.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "SRFModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createMesh.H"
|
||||||
|
# include "createFields.H"
|
||||||
|
# include "readPIMPLEControls.H"
|
||||||
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
for (runTime++; !runTime.end(); runTime++)
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
# include "readPIMPLEControls.H"
|
||||||
|
# include "readFieldBounds.H"
|
||||||
|
|
||||||
|
# include "initConvergenceCheck.H"
|
||||||
|
|
||||||
|
# include "UEqn.H"
|
||||||
|
# include "hEqn.H"
|
||||||
|
# include "pEqn.H"
|
||||||
|
|
||||||
|
# include "rhoFromP.H"
|
||||||
|
|
||||||
|
// Correct turbulence
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
Uabs = Urel + SRF->U();
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
|
||||||
|
# include "convergenceCheck.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
convertPhi.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/convertPhi
|
|
@ -0,0 +1,5 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume
|
166
applications/utilities/preProcessing/convertPhi/convertPhi.C
Normal file
166
applications/utilities/preProcessing/convertPhi/convertPhi.C
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
|
||||||
|
Description
|
||||||
|
COnvert volumetric to mass flux
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "fvCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::validOptions.insert("rhoRef", "scalar");
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
|
||||||
|
if (!args.options().found("rhoRef"))
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "Missing reference density"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
FatalError.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dimensionedScalar rhoRef
|
||||||
|
(
|
||||||
|
"rhoRef",
|
||||||
|
dimDensity,
|
||||||
|
readScalar(IStringStream(args.options()["rhoRef"])())
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reference density = " << rhoRef.value() << endl;
|
||||||
|
|
||||||
|
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createMesh.H"
|
||||||
|
|
||||||
|
Info<< "Time = " << runTime.value() << endl;
|
||||||
|
|
||||||
|
Info<< " Reading p" << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
if (p.dimensions() == dimPressure)
|
||||||
|
{
|
||||||
|
Info<< "Pressure " << p.name() << " is a dynamic pressure. "
|
||||||
|
<< "Nothing to do"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
else if (p.dimensions() == dimPressure/dimDensity)
|
||||||
|
{
|
||||||
|
volScalarField rhoP
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho" + p.name(),
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
rhoRef*p
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Correcting kinematic pressure " << p.name()
|
||||||
|
<< " into dynamic pressure " << rhoP.name()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
rhoP.write();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Cannot recognise dimensions of pressure field " << p.name()
|
||||||
|
<< ": " << p.dimensions() << ". Ignoring" << endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " Reading phi" << endl;
|
||||||
|
surfaceScalarField phi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phi",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimMass/dimTime)
|
||||||
|
{
|
||||||
|
Info<< "Flux " << phi.name() << " is a mass flux. Nothing to do"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
else if (phi.dimensions() == dimVolume/dimTime)
|
||||||
|
{
|
||||||
|
surfaceScalarField rhoPhi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho" + phi.name(),
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
rhoRef*phi
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Correcting volume flux " << phi.name()
|
||||||
|
<< " into mass flux " << rhoPhi.name()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
rhoPhi.write();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Cannot recognise dimensions of flux field " << phi.name()
|
||||||
|
<< ": " << phi.dimensions() << ". Ignoring" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -169,6 +169,10 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
|
||||||
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
|
||||||
|
$(derivedFvPatchFields)/pulseFixedValue/pulseFixedValueFvPatchFields.C
|
||||||
|
$(derivedFvPatchFields)/waveTransmissiveInlet/waveTransmissiveInletFvPatchFields.C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fvsPatchFields = fields/fvsPatchFields
|
fvsPatchFields = fields/fvsPatchFields
|
||||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||||
|
@ -302,6 +306,7 @@ $(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C
|
||||||
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C
|
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C
|
||||||
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C
|
$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C
|
||||||
$(ddtSchemes)/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C
|
$(ddtSchemes)/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C
|
||||||
|
$(ddtSchemes)/steadyInertialDdtScheme/steadyInertialDdtSchemes.C
|
||||||
|
|
||||||
d2dt2Schemes = finiteVolume/d2dt2Schemes
|
d2dt2Schemes = finiteVolume/d2dt2Schemes
|
||||||
$(d2dt2Schemes)/d2dt2Scheme/d2dt2Schemes.C
|
$(d2dt2Schemes)/d2dt2Scheme/d2dt2Schemes.C
|
||||||
|
@ -378,6 +383,10 @@ $(SRF)/SRFModel/SRFModel/SRFModel.C
|
||||||
$(SRF)/SRFModel/SRFModel/newSRFModel.C
|
$(SRF)/SRFModel/SRFModel/newSRFModel.C
|
||||||
$(SRF)/SRFModel/rpm/rpm.C
|
$(SRF)/SRFModel/rpm/rpm.C
|
||||||
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
|
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
|
||||||
|
$(SRF)/derivedFvPatchFields/SRFSurfaceNormalVelocityFvPatchVectorField/SRFSurfaceNormalVelocityFvPatchVectorField.C
|
||||||
|
$(SRF)/derivedFvPatchFields/SRFTotalTemperature/SRFTotalTemperatureFvPatchScalarField.C
|
||||||
|
$(SRF)/derivedFvPatchFields/SRFFlowRateInletVelocity/SRFFlowRateInletVelocityFvPatchVectorField.C
|
||||||
|
$(SRF)/derivedFvPatchFields/SRFTotalPressure/SRFTotalPressureFvPatchScalarField.C
|
||||||
|
|
||||||
fieldSources = $(general)/fieldSources
|
fieldSources = $(general)/fieldSources
|
||||||
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||||
|
|
|
@ -0,0 +1,238 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "SRFFlowRateInletVelocityFvPatchVectorField.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "SRFModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::SRFFlowRateInletVelocityFvPatchVectorField::
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
|
flowRate_(0),
|
||||||
|
phiName_("phi"),
|
||||||
|
rhoName_("rho"),
|
||||||
|
relative_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::SRFFlowRateInletVelocityFvPatchVectorField::
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||||
|
flowRate_(readScalar(dict.lookup("flowRate"))),
|
||||||
|
phiName_("phi"),
|
||||||
|
rhoName_("rho"),
|
||||||
|
relative_(dict.lookup("relative"))
|
||||||
|
{
|
||||||
|
if (dict.found("phi"))
|
||||||
|
{
|
||||||
|
dict.lookup("phi") >> phiName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("rho"))
|
||||||
|
{
|
||||||
|
dict.lookup("rho") >> rhoName_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::SRFFlowRateInletVelocityFvPatchVectorField::
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||||
|
flowRate_(ptf.flowRate_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_),
|
||||||
|
relative_(ptf.relative_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::SRFFlowRateInletVelocityFvPatchVectorField::
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFFlowRateInletVelocityFvPatchVectorField& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<vector>(ptf),
|
||||||
|
flowRate_(ptf.flowRate_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_),
|
||||||
|
relative_(ptf.relative_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::SRFFlowRateInletVelocityFvPatchVectorField::
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<vector>(ptf, iF),
|
||||||
|
flowRate_(ptf.flowRate_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_),
|
||||||
|
relative_(ptf.relative_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::SRFFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar avgU = -flowRate_/gSum(patch().magSf());
|
||||||
|
|
||||||
|
vectorField n = patch().nf();
|
||||||
|
|
||||||
|
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>
|
||||||
|
(
|
||||||
|
phiName_
|
||||||
|
);
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
// Volumetric flow-rate
|
||||||
|
|
||||||
|
// If relative, include the effect of the SRF
|
||||||
|
if (relative_)
|
||||||
|
{
|
||||||
|
// Get reference to the SRF model
|
||||||
|
const SRF::SRFModel& srf =
|
||||||
|
db().lookupObject<SRF::SRFModel>("SRFProperties");
|
||||||
|
|
||||||
|
// Determine patch velocity due to SRF
|
||||||
|
const vectorField SRFSurfaceNormalVelocity =
|
||||||
|
srf.velocity(patch().Cf());
|
||||||
|
|
||||||
|
operator==(n*avgU - SRFSurfaceNormalVelocity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
operator==(n*avgU);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
// Mass flow-rate
|
||||||
|
|
||||||
|
const fvPatchScalarField& rhop =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
|
// If relative, include the effect of the SRF
|
||||||
|
if (relative_)
|
||||||
|
{
|
||||||
|
// Get reference to the SRF model
|
||||||
|
const SRF::SRFModel& srf =
|
||||||
|
db().lookupObject<SRF::SRFModel>("SRFProperties");
|
||||||
|
|
||||||
|
// Determine patch velocity due to SRF
|
||||||
|
const vectorField SRFSurfaceNormalVelocity =
|
||||||
|
srf.velocity(patch().Cf());
|
||||||
|
|
||||||
|
operator==(n*avgU/rhop - SRFSurfaceNormalVelocity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
operator==(n*avgU/rhop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"SRFFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
|
||||||
|
) << "dimensions of " << phiName_ << " are incorrect" << nl
|
||||||
|
<< " on patch " << this->patch().name()
|
||||||
|
<< " of field " << this->dimensionedInternalField().name()
|
||||||
|
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||||
|
<< nl << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchField<vector>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::SRFFlowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<vector>::write(os);
|
||||||
|
|
||||||
|
os.writeKeyword("flowRate") << flowRate_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
if (phiName_ != "phi")
|
||||||
|
{
|
||||||
|
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rhoName_ != "rho")
|
||||||
|
{
|
||||||
|
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchVectorField,
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Describes a volumetric/mass flow normal vector boundary condition by its
|
||||||
|
magnitude as an integral over its area.
|
||||||
|
|
||||||
|
Corrected for presence of rotating reference frames.
|
||||||
|
HJ, 8/Mar/2010
|
||||||
|
|
||||||
|
The basis of the patch (volumetric or mass) is determined by the
|
||||||
|
dimensions of the flux, phi.
|
||||||
|
The current density is used to correct the velocity when applying the
|
||||||
|
mass basis.
|
||||||
|
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
@verbatim
|
||||||
|
inlet
|
||||||
|
{
|
||||||
|
type SRFFlowRateInletVelocity;
|
||||||
|
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
||||||
|
relative true; // Relative velocity correction
|
||||||
|
value uniform (0 0 0); // placeholder
|
||||||
|
}
|
||||||
|
@endverbatim
|
||||||
|
|
||||||
|
Note
|
||||||
|
- The value is positive inwards
|
||||||
|
- May not work correctly for transonic inlets
|
||||||
|
- Strange behaviour with potentialFoam since the U equation is not solved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef SRFFlowRateInletVelocityFvPatchVectorField_H
|
||||||
|
#define SRFFlowRateInletVelocityFvPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class SRFFlowRateInletVelocityFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchVectorField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Inlet integral flow rate
|
||||||
|
scalar flowRate_;
|
||||||
|
|
||||||
|
//- Name of the flux transporting the field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of the density field used to normalize the mass flux
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Is the supplied inlet value relative to the SRF
|
||||||
|
Switch relative_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("SRFFlowRateInletVelocity");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
// onto a new patch
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFFlowRateInletVelocityFvPatchVectorField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFFlowRateInletVelocityFvPatchVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchVectorField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new SRFFlowRateInletVelocityFvPatchVectorField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
SRFFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFFlowRateInletVelocityFvPatchVectorField&,
|
||||||
|
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 SRFFlowRateInletVelocityFvPatchVectorField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the flux
|
||||||
|
scalar flowRate() const
|
||||||
|
{
|
||||||
|
return flowRate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the flux to allow adjustment
|
||||||
|
scalar& flowRate()
|
||||||
|
{
|
||||||
|
return flowRate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,188 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "SRFSurfaceNormalVelocityFvPatchVectorField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "SRFModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField::
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
|
relative_(0),
|
||||||
|
refValue_(p.size(), 0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField::
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFSurfaceNormalVelocityFvPatchVectorField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||||
|
relative_(ptf.relative_),
|
||||||
|
refValue_(ptf.refValue_, mapper)
|
||||||
|
{
|
||||||
|
fvPatchVectorField::operator=(refValue_*patch().nf());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField::
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
|
relative_(dict.lookup("relative")),
|
||||||
|
refValue_("refValue", dict, p.size())
|
||||||
|
{
|
||||||
|
fvPatchVectorField::operator=(refValue_*patch().nf());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField::
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFSurfaceNormalVelocityFvPatchVectorField& srfvpvf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(srfvpvf),
|
||||||
|
relative_(srfvpvf.relative_),
|
||||||
|
refValue_(srfvpvf.refValue_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField::
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFSurfaceNormalVelocityFvPatchVectorField& srfvpvf,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(srfvpvf, iF),
|
||||||
|
relative_(srfvpvf.relative_),
|
||||||
|
refValue_(srfvpvf.refValue_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void SRFSurfaceNormalVelocityFvPatchVectorField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vectorField::autoMap(m);
|
||||||
|
refValue_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFSurfaceNormalVelocityFvPatchVectorField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchVectorField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchVectorField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const SRFSurfaceNormalVelocityFvPatchVectorField& tiptf =
|
||||||
|
refCast<const SRFSurfaceNormalVelocityFvPatchVectorField>(ptf);
|
||||||
|
|
||||||
|
refValue_.rmap(tiptf.refValue_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFSurfaceNormalVelocityFvPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If relative, include the effect of the SRF
|
||||||
|
if (relative_)
|
||||||
|
{
|
||||||
|
// Get reference to the SRF model
|
||||||
|
const SRF::SRFModel& srf =
|
||||||
|
db().lookupObject<SRF::SRFModel>("SRFProperties");
|
||||||
|
|
||||||
|
// Determine patch velocity due to SRF
|
||||||
|
const vectorField SRFSurfaceNormalVelocity =
|
||||||
|
srf.velocity(patch().Cf());
|
||||||
|
|
||||||
|
operator==(-SRFSurfaceNormalVelocity + refValue_*patch().nf());
|
||||||
|
}
|
||||||
|
// If absolute, simply supply the inlet value as a fixed value
|
||||||
|
else
|
||||||
|
{
|
||||||
|
operator==(refValue_*patch().nf());
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchVectorField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFSurfaceNormalVelocityFvPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchVectorField::write(os);
|
||||||
|
os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
|
||||||
|
refValue_.writeEntry("refValue", os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchVectorField,
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,184 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Velocity patch, specifying surface-normal velocity to be used with the
|
||||||
|
SRF model. Surface normal vector boundary condition is set by its
|
||||||
|
magnitude.
|
||||||
|
Note: The value is positive for outward-pointing vectors
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef SRFSurfaceNormalVelocityFvPatchVectorField_H
|
||||||
|
#define SRFSurfaceNormalVelocityFvPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class SRFSurfaceNormalVelocityFvPatchVectorField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchVectorField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Is the supplied inlet value relative to the SRF
|
||||||
|
Switch relative_;
|
||||||
|
|
||||||
|
//- Surface-normal velocity value
|
||||||
|
scalarField refValue_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("SRFSurfaceNormalVelocity");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// SRFSurfaceNormalVelocityFvPatchVectorField onto a new patch
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFSurfaceNormalVelocityFvPatchVectorField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFSurfaceNormalVelocityFvPatchVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchVectorField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new SRFSurfaceNormalVelocityFvPatchVectorField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
SRFSurfaceNormalVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const SRFSurfaceNormalVelocityFvPatchVectorField&,
|
||||||
|
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 SRFSurfaceNormalVelocityFvPatchVectorField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return const access to the relative flag
|
||||||
|
const Switch& relative() const
|
||||||
|
{
|
||||||
|
return relative_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 fvPatchVectorField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,279 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "SRFTotalPressureFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "SRFModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
SRFTotalPressureFvPatchScalarField::SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
UName_("undefined"),
|
||||||
|
phiName_("undefined"),
|
||||||
|
rhoName_("undefined"),
|
||||||
|
psiName_("undefined"),
|
||||||
|
gamma_(0.0),
|
||||||
|
relative_(0),
|
||||||
|
p0_(p.size(), 0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalPressureFvPatchScalarField::SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
UName_(dict.lookup("U")),
|
||||||
|
phiName_(dict.lookup("phi")),
|
||||||
|
rhoName_(dict.lookup("rho")),
|
||||||
|
psiName_(dict.lookup("psi")),
|
||||||
|
gamma_(readScalar(dict.lookup("gamma"))),
|
||||||
|
relative_(dict.lookup("relative")),
|
||||||
|
p0_("p0", dict, p.size())
|
||||||
|
{
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=
|
||||||
|
(
|
||||||
|
scalarField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=(p0_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalPressureFvPatchScalarField::SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalPressureFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
UName_(ptf.UName_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_),
|
||||||
|
psiName_(ptf.psiName_),
|
||||||
|
gamma_(ptf.gamma_),
|
||||||
|
relative_(ptf.relative_),
|
||||||
|
p0_(ptf.p0_, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalPressureFvPatchScalarField::SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalPressureFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf),
|
||||||
|
UName_(tppsf.UName_),
|
||||||
|
phiName_(tppsf.phiName_),
|
||||||
|
rhoName_(tppsf.rhoName_),
|
||||||
|
psiName_(tppsf.psiName_),
|
||||||
|
gamma_(tppsf.gamma_),
|
||||||
|
relative_(tppsf.relative_),
|
||||||
|
p0_(tppsf.p0_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalPressureFvPatchScalarField::SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalPressureFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF),
|
||||||
|
UName_(tppsf.UName_),
|
||||||
|
phiName_(tppsf.phiName_),
|
||||||
|
rhoName_(tppsf.rhoName_),
|
||||||
|
psiName_(tppsf.psiName_),
|
||||||
|
gamma_(tppsf.gamma_),
|
||||||
|
relative_(tppsf.relative_),
|
||||||
|
p0_(tppsf.p0_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void SRFTotalPressureFvPatchScalarField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::autoMap(m);
|
||||||
|
p0_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFTotalPressureFvPatchScalarField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchScalarField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const SRFTotalPressureFvPatchScalarField& tiptf =
|
||||||
|
refCast<const SRFTotalPressureFvPatchScalarField>(ptf);
|
||||||
|
|
||||||
|
p0_.rmap(tiptf.p0_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFTotalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvsPatchField<scalar>& phip =
|
||||||
|
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||||
|
|
||||||
|
if (psiName_ == "none" && rhoName_ == "none")
|
||||||
|
{
|
||||||
|
operator==(p0_ - 0.5*(1.0 - pos(phip))*magSqr(Up));
|
||||||
|
}
|
||||||
|
else if (rhoName_ == "none")
|
||||||
|
{
|
||||||
|
const fvPatchField<scalar>& psip =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||||
|
|
||||||
|
if (gamma_ > 1.0)
|
||||||
|
{
|
||||||
|
scalar gM1ByG = (gamma_ - 1.0)/gamma_;
|
||||||
|
|
||||||
|
operator==
|
||||||
|
(
|
||||||
|
p0_
|
||||||
|
/pow
|
||||||
|
(
|
||||||
|
(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)),
|
||||||
|
1.0/gM1ByG
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
operator==(p0_/(1.0 + 0.5*psip*(1.0 - pos(phip))*magSqr(Up)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (psiName_ == "none")
|
||||||
|
{
|
||||||
|
const fvPatchField<scalar>& rho =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
|
operator==(p0_ - 0.5*rho*(1.0 - pos(phip))*magSqr(Up));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"SRFTotalPressureFvPatchScalarField::updateCoeffs()"
|
||||||
|
) << " rho or psi set inconsitently, rho = " << rhoName_
|
||||||
|
<< ", psi = " << psiName_ << '.' << nl
|
||||||
|
<< " Set either rho or psi or neither depending on the "
|
||||||
|
"definition of total pressure." << nl
|
||||||
|
<< " Set the unused variables to 'none'."
|
||||||
|
<< "\n on patch " << this->patch().name()
|
||||||
|
<< " of field " << this->dimensionedInternalField().name()
|
||||||
|
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFTotalPressureFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
const vectorField& U =
|
||||||
|
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||||
|
|
||||||
|
// If relative, include the effect of the SRF
|
||||||
|
if (relative_)
|
||||||
|
{
|
||||||
|
// Get reference to the SRF model
|
||||||
|
const SRF::SRFModel& srf =
|
||||||
|
db().lookupObject<SRF::SRFModel>("SRFProperties");
|
||||||
|
|
||||||
|
// Determine patch velocity due to SRF
|
||||||
|
const vectorField SRFSurfaceNormalVelocity =
|
||||||
|
srf.velocity(patch().Cf());
|
||||||
|
|
||||||
|
updateCoeffs(U - SRFSurfaceNormalVelocity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateCoeffs(U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFTotalPressureFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl;
|
||||||
|
os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
|
||||||
|
p0_.writeEntry("p0", os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField(fvPatchScalarField, SRFTotalPressureFvPatchScalarField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,234 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::SRFTotalPressureFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Total pressure boundary condition for a rotating reference frame
|
||||||
|
simulations. Rotating component is taken into account when calculating
|
||||||
|
the boundary value
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
SRFTotalPressureFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef SRFTotalPressureFvPatchScalarField_H
|
||||||
|
#define SRFTotalPressureFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class SRFTotalPressureFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class SRFTotalPressureFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of the velocity field
|
||||||
|
word UName_;
|
||||||
|
|
||||||
|
//- Name of the flux transporting the field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of the density field used to normalise the mass flux
|
||||||
|
// if neccessary
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Name of the compressibility field used to calculate the wave speed
|
||||||
|
word psiName_;
|
||||||
|
|
||||||
|
//- Heat capacity ratio
|
||||||
|
scalar gamma_;
|
||||||
|
|
||||||
|
//- Is the supplied inlet value relative to the SRF
|
||||||
|
Switch relative_;
|
||||||
|
|
||||||
|
//- Total pressure
|
||||||
|
scalarField p0_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("SRFTotalPressure");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given SRFTotalPressureFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalPressureFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalPressureFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new SRFTotalPressureFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
SRFTotalPressureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalPressureFvPatchScalarField&,
|
||||||
|
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 SRFTotalPressureFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the name of the velocity field
|
||||||
|
const word& UName() const
|
||||||
|
{
|
||||||
|
return UName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the name of the velocity field
|
||||||
|
// to allow adjustment
|
||||||
|
word& UName()
|
||||||
|
{
|
||||||
|
return UName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the heat capacity ratio
|
||||||
|
scalar gamma() const
|
||||||
|
{
|
||||||
|
return gamma_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the heat capacity ratio to allow adjustment
|
||||||
|
scalar& gamma()
|
||||||
|
{
|
||||||
|
return gamma_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the total pressure
|
||||||
|
const scalarField& p0() const
|
||||||
|
{
|
||||||
|
return p0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the total pressure to allow adjustment
|
||||||
|
scalarField& p0()
|
||||||
|
{
|
||||||
|
return p0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 fvPatchScalarField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
// using the given patch velocity field
|
||||||
|
virtual void updateCoeffs(const vectorField& Up);
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,230 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "SRFTotalTemperatureFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "SRFModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
SRFTotalTemperatureFvPatchScalarField::SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
UName_("Undefined"),
|
||||||
|
phiName_("Undefined"),
|
||||||
|
psiName_("Undefined"),
|
||||||
|
gamma_(0.0),
|
||||||
|
relative_(0),
|
||||||
|
T0_(p.size(), 0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalTemperatureFvPatchScalarField::SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
UName_(dict.lookup("U")),
|
||||||
|
phiName_(dict.lookup("phi")),
|
||||||
|
psiName_(dict.lookup("psi")),
|
||||||
|
gamma_(readScalar(dict.lookup("gamma"))),
|
||||||
|
relative_(dict.lookup("relative")),
|
||||||
|
T0_("T0", dict, p.size())
|
||||||
|
{
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=
|
||||||
|
(
|
||||||
|
scalarField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=(T0_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalTemperatureFvPatchScalarField::SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalTemperatureFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
UName_(ptf.UName_),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
psiName_(ptf.psiName_),
|
||||||
|
gamma_(ptf.gamma_),
|
||||||
|
relative_(ptf.relative_),
|
||||||
|
T0_(ptf.T0_, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalTemperatureFvPatchScalarField::SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalTemperatureFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf),
|
||||||
|
UName_(tppsf.UName_),
|
||||||
|
phiName_(tppsf.phiName_),
|
||||||
|
psiName_(tppsf.psiName_),
|
||||||
|
gamma_(tppsf.gamma_),
|
||||||
|
relative_(tppsf.relative_),
|
||||||
|
T0_(tppsf.T0_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
SRFTotalTemperatureFvPatchScalarField::SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalTemperatureFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF),
|
||||||
|
UName_(tppsf.UName_),
|
||||||
|
phiName_(tppsf.phiName_),
|
||||||
|
psiName_(tppsf.psiName_),
|
||||||
|
gamma_(tppsf.gamma_),
|
||||||
|
relative_(tppsf.relative_),
|
||||||
|
T0_(tppsf.T0_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void SRFTotalTemperatureFvPatchScalarField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::autoMap(m);
|
||||||
|
T0_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFTotalTemperatureFvPatchScalarField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchScalarField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const SRFTotalTemperatureFvPatchScalarField& tiptf =
|
||||||
|
refCast<const SRFTotalTemperatureFvPatchScalarField>(ptf);
|
||||||
|
|
||||||
|
T0_.rmap(tiptf.T0_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFTotalTemperatureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fvsPatchScalarField& phip =
|
||||||
|
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||||
|
|
||||||
|
const fvPatchScalarField& psip =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||||
|
|
||||||
|
scalar gM1ByG = (gamma_ - 1.0)/gamma_;
|
||||||
|
|
||||||
|
operator==
|
||||||
|
(
|
||||||
|
T0_/(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up))
|
||||||
|
);
|
||||||
|
|
||||||
|
fixedValueFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SRFTotalTemperatureFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
const fvPatchVectorField& U =
|
||||||
|
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||||
|
|
||||||
|
// If relative, include the effect of the SRF
|
||||||
|
if (relative_)
|
||||||
|
{
|
||||||
|
// Get reference to the SRF model
|
||||||
|
const SRF::SRFModel& srf =
|
||||||
|
db().lookupObject<SRF::SRFModel>("SRFProperties");
|
||||||
|
|
||||||
|
// Determine patch velocity due to SRF
|
||||||
|
const vectorField SRFSurfaceNormalVelocity =
|
||||||
|
srf.velocity(patch().Cf());
|
||||||
|
|
||||||
|
updateCoeffs(U - SRFSurfaceNormalVelocity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateCoeffs(U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SRFTotalTemperatureFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl;
|
||||||
|
os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
|
||||||
|
T0_.writeEntry("T0", os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField(fvPatchScalarField, SRFTotalTemperatureFvPatchScalarField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,211 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::SRFTotalTemperatureFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Total temperature boundary condition for a rotating reference frame
|
||||||
|
simulations. Rotating component is taken into account when calculating
|
||||||
|
the boundary value
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
SRFTotalTemperatureFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef SRFTotalTemperatureFvPatchScalarField_H
|
||||||
|
#define SRFTotalTemperatureFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class SRFTotalTemperatureFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class SRFTotalTemperatureFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of the velocity field
|
||||||
|
word UName_;
|
||||||
|
|
||||||
|
//- Name of the flux transporting the field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of the compressibility field used to calculate the wave speed
|
||||||
|
word psiName_;
|
||||||
|
|
||||||
|
//- Heat capacity ratio
|
||||||
|
scalar gamma_;
|
||||||
|
|
||||||
|
//- Is the supplied inlet value relative to the SRF
|
||||||
|
Switch relative_;
|
||||||
|
|
||||||
|
//- Total temperature
|
||||||
|
scalarField T0_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("SRFTotalTemperature");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given SRFTotalTemperatureFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalTemperatureFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalTemperatureFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new SRFTotalTemperatureFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
SRFTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const SRFTotalTemperatureFvPatchScalarField&,
|
||||||
|
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 SRFTotalTemperatureFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the name of the velocity field
|
||||||
|
const word& UName() const
|
||||||
|
{
|
||||||
|
return UName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the total pressure
|
||||||
|
const scalarField& T0() const
|
||||||
|
{
|
||||||
|
return T0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the total pressure to allow adjustment
|
||||||
|
scalarField& T0()
|
||||||
|
{
|
||||||
|
return T0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 fvPatchScalarField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
// using the given patch velocity field
|
||||||
|
virtual void updateCoeffs(const vectorField& Up);
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,206 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "pulseFixedValueFvPatchField.H"
|
||||||
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
scalar pulseFixedValueFvPatchField<Type>::currentScale() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
1.0
|
||||||
|
+ amplitude_*
|
||||||
|
pos(1 - 2*this->db().time().value()*frequency_)*
|
||||||
|
sin(2*mathematicalConstant::pi*frequency_*this->db().time().value());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
pulseFixedValueFvPatchField<Type>::pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
refValue_(p.size()),
|
||||||
|
amplitude_(0.0),
|
||||||
|
frequency_(0.0),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
pulseFixedValueFvPatchField<Type>::pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const pulseFixedValueFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
refValue_(ptf.refValue_, mapper),
|
||||||
|
amplitude_(ptf.amplitude_),
|
||||||
|
frequency_(ptf.frequency_),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
pulseFixedValueFvPatchField<Type>::pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
refValue_("refValue", dict, p.size()),
|
||||||
|
amplitude_(readScalar(dict.lookup("amplitude"))),
|
||||||
|
frequency_(readScalar(dict.lookup("frequency"))),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<Type>::operator==
|
||||||
|
(
|
||||||
|
Field<Type>("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<Type>::operator==(refValue_*currentScale());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
pulseFixedValueFvPatchField<Type>::pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const pulseFixedValueFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf),
|
||||||
|
refValue_(ptf.refValue_),
|
||||||
|
amplitude_(ptf.amplitude_),
|
||||||
|
frequency_(ptf.frequency_),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
pulseFixedValueFvPatchField<Type>::pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const pulseFixedValueFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf, iF),
|
||||||
|
refValue_(ptf.refValue_),
|
||||||
|
amplitude_(ptf.amplitude_),
|
||||||
|
frequency_(ptf.frequency_),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void pulseFixedValueFvPatchField<Type>::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<Type>::autoMap(m);
|
||||||
|
refValue_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void pulseFixedValueFvPatchField<Type>::rmap
|
||||||
|
(
|
||||||
|
const fvPatchField<Type>& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<Type>::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const pulseFixedValueFvPatchField<Type>& tiptf =
|
||||||
|
refCast<const pulseFixedValueFvPatchField<Type> >(ptf);
|
||||||
|
|
||||||
|
refValue_.rmap(tiptf.refValue_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void pulseFixedValueFvPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curTimeIndex_ != this->db().time().timeIndex())
|
||||||
|
{
|
||||||
|
Field<Type>& patchField = *this;
|
||||||
|
|
||||||
|
patchField = refValue_*currentScale();
|
||||||
|
|
||||||
|
curTimeIndex_ = this->db().time().timeIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void pulseFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
refValue_.writeEntry("refValue", os);
|
||||||
|
os.writeKeyword("amplitude")
|
||||||
|
<< amplitude_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("frequency")
|
||||||
|
<< frequency_ << token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,225 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::pulseFixedValueFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::pulseFixedValueFvPatchField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
pulseFixedValueFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef pulseFixedValueFvPatchField_H
|
||||||
|
#define pulseFixedValueFvPatchField_H
|
||||||
|
|
||||||
|
#include "Random.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class pulseFixedValueFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class pulseFixedValueFvPatchField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference value
|
||||||
|
Field<Type> refValue_;
|
||||||
|
|
||||||
|
//- Amplitude
|
||||||
|
scalar amplitude_;
|
||||||
|
|
||||||
|
//- Frequency
|
||||||
|
scalar frequency_;
|
||||||
|
|
||||||
|
//- Current time index
|
||||||
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Return current scale
|
||||||
|
scalar currentScale() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("pulseFixedValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given pulseFixedValueFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const pulseFixedValueFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const pulseFixedValueFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new pulseFixedValueFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
pulseFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const pulseFixedValueFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new pulseFixedValueFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the ref value
|
||||||
|
const Field<Type>& refValue() const
|
||||||
|
{
|
||||||
|
return refValue_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the ref value to allow adjustment
|
||||||
|
Field<Type>& refValue()
|
||||||
|
{
|
||||||
|
return refValue_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return amplitude
|
||||||
|
scalar amplitude() const
|
||||||
|
{
|
||||||
|
return amplitude_;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar& amplitude()
|
||||||
|
{
|
||||||
|
return amplitude_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return frequency
|
||||||
|
scalar frequency() const
|
||||||
|
{
|
||||||
|
return frequency_;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar& frequency()
|
||||||
|
{
|
||||||
|
return frequency_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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<Type>&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "pulseFixedValueFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "pulseFixedValueFvPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(pulseFixedValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 pulseFixedValueFvPatchFields_H
|
||||||
|
#define pulseFixedValueFvPatchFields_H
|
||||||
|
|
||||||
|
#include "pulseFixedValueFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(pulseFixedValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 pulseFixedValueFvPatchFieldsFwd_H
|
||||||
|
#define pulseFixedValueFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class pulseFixedValueFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(pulseFixedValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,202 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "waveTransmissiveInletFvPatchField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
waveTransmissiveInletFvPatchField<Type>::waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(p, iF),
|
||||||
|
psiName_("Undefined"),
|
||||||
|
UName_("Undefined"),
|
||||||
|
gamma_(0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
waveTransmissiveInletFvPatchField<Type>::waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(p, iF, dict),
|
||||||
|
psiName_(dict.lookup("psi")),
|
||||||
|
UName_(dict.lookup("U")),
|
||||||
|
gamma_(readScalar(dict.lookup("gamma")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
waveTransmissiveInletFvPatchField<Type>::waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const waveTransmissiveInletFvPatchField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
psiName_(ptf.psiName_),
|
||||||
|
UName_(ptf.UName_),
|
||||||
|
gamma_(ptf.gamma_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
waveTransmissiveInletFvPatchField<Type>::waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const waveTransmissiveInletFvPatchField& ptpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(ptpsf),
|
||||||
|
psiName_(ptpsf.psiName_),
|
||||||
|
UName_(ptpsf.UName_),
|
||||||
|
gamma_(ptpsf.gamma_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
waveTransmissiveInletFvPatchField<Type>::waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const waveTransmissiveInletFvPatchField& ptpsf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(ptpsf, iF),
|
||||||
|
psiName_(ptpsf.psiName_),
|
||||||
|
UName_(ptpsf.UName_),
|
||||||
|
gamma_(ptpsf.gamma_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<scalarField>
|
||||||
|
waveTransmissiveInletFvPatchField<Type>::advectionSpeed() const
|
||||||
|
{
|
||||||
|
// Lookup the velocity and compressibility of the patch
|
||||||
|
const fvPatchField<scalar>& psip = this->patch().lookupPatchField
|
||||||
|
(
|
||||||
|
psiName_,
|
||||||
|
reinterpret_cast<const volScalarField*>(NULL),
|
||||||
|
reinterpret_cast<const scalar*>(NULL)
|
||||||
|
);
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
this->db().objectRegistry::lookupObject<surfaceScalarField>
|
||||||
|
(this->phiName_);
|
||||||
|
|
||||||
|
fvsPatchField<scalar> phip = this->patch().lookupPatchField
|
||||||
|
(
|
||||||
|
this->phiName_,
|
||||||
|
reinterpret_cast<const surfaceScalarField*>(NULL),
|
||||||
|
reinterpret_cast<const scalar*>(NULL)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
const fvPatchScalarField& rhop = this->patch().lookupPatchField
|
||||||
|
(
|
||||||
|
this->rhoName_,
|
||||||
|
reinterpret_cast<const volScalarField*>(NULL),
|
||||||
|
reinterpret_cast<const scalar*>(NULL)
|
||||||
|
);
|
||||||
|
|
||||||
|
phip /= rhop;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the speed of the field wave w
|
||||||
|
// by subtracting the speed of sound (sqrt(gamma_/psi)) from the
|
||||||
|
// component of the velocity normal to the boundary
|
||||||
|
// Note: at the inlet, the flux has got a negative sign
|
||||||
|
// Bug fix: wrong speed. HJ, 26/Apr/2010
|
||||||
|
return sqrt(gamma_/psip) + phip/this->patch().magSf();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<scalarField>
|
||||||
|
waveTransmissiveInletFvPatchField<Type>::supercritical() const
|
||||||
|
{
|
||||||
|
// Lookup the velocity and compressibility of the patch
|
||||||
|
const fvPatchField<scalar>& psip = this->patch().lookupPatchField
|
||||||
|
(
|
||||||
|
psiName_,
|
||||||
|
reinterpret_cast<const volScalarField*>(NULL),
|
||||||
|
reinterpret_cast<const scalar*>(NULL)
|
||||||
|
);
|
||||||
|
|
||||||
|
const fvPatchVectorField& U =
|
||||||
|
this->patch().lookupPatchField
|
||||||
|
(
|
||||||
|
UName_,
|
||||||
|
reinterpret_cast<const volVectorField*>(NULL),
|
||||||
|
reinterpret_cast<const vector*>(NULL)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Calculate the speed of the field wave w
|
||||||
|
// by summing the component of the velocity normal to the boundary
|
||||||
|
// and the speed of sound (sqrt(gamma_/psi)).
|
||||||
|
return pos
|
||||||
|
(
|
||||||
|
mag(U.patchInternalField() & this->patch().Sf())/this->patch().magSf()
|
||||||
|
- sqrt(gamma_/psip)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void waveTransmissiveInletFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
advectiveFvPatchField<Type>::write(os);
|
||||||
|
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,187 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::waveTransmissiveInletFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wave transmissive boundary condition for inlet boundary.
|
||||||
|
Advective velocity is set to u - c. Useful for pressure inlet.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
waveTransmissiveInletFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef waveTransmissiveInletFvPatchField_H
|
||||||
|
#define waveTransmissiveInletFvPatchField_H
|
||||||
|
|
||||||
|
#include "advectiveFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class waveTransmissiveInletFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class waveTransmissiveInletFvPatchField
|
||||||
|
:
|
||||||
|
public advectiveFvPatchField<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of the compressibility field used to calculate the wave speed
|
||||||
|
word psiName_;
|
||||||
|
|
||||||
|
//- Name of velocity field used to calculate supercritical condition
|
||||||
|
word UName_;
|
||||||
|
|
||||||
|
//- Heat capacity ratio
|
||||||
|
scalar gamma_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("waveTransmissiveInlet");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given waveTransmissiveInletFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const waveTransmissiveInletFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const waveTransmissiveInletFvPatchField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new waveTransmissiveInletFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
waveTransmissiveInletFvPatchField
|
||||||
|
(
|
||||||
|
const waveTransmissiveInletFvPatchField&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new waveTransmissiveInletFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the heat capacity ratio
|
||||||
|
scalar gamma() const
|
||||||
|
{
|
||||||
|
return gamma_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the heat capacity ratio to allow adjustment
|
||||||
|
scalar& gamma()
|
||||||
|
{
|
||||||
|
return gamma_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Calculate and return the advection speed at the boundary
|
||||||
|
virtual tmp<scalarField> advectionSpeed() const;
|
||||||
|
|
||||||
|
//- Calculate and return the supercritical switch at the boundary
|
||||||
|
// Supercritical = 1 converts the outlet to zeroGradient
|
||||||
|
// Supercritical = 0 no correction
|
||||||
|
virtual tmp<scalarField> supercritical() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "waveTransmissiveInletFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "waveTransmissiveInletFvPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(waveTransmissiveInlet);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 waveTransmissiveInletFvPatchFields_H
|
||||||
|
#define waveTransmissiveInletFvPatchFields_H
|
||||||
|
|
||||||
|
#include "waveTransmissiveInletFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(waveTransmissiveInlet)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 waveTransmissiveInletFvPatchFieldsFwd_H
|
||||||
|
#define waveTransmissiveInletFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class waveTransmissiveInletFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(waveTransmissiveInlet)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,692 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "steadyInertialDdtScheme.H"
|
||||||
|
#include "surfaceInterpolate.H"
|
||||||
|
#include "fvMatrices.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<volScalarField> steadyInertialDdtScheme<Type>::CorDeltaT() const
|
||||||
|
{
|
||||||
|
// Collect face delta t and pick the smallest for the cell
|
||||||
|
surfaceScalarField cofrDeltaT = CofrDeltaT();
|
||||||
|
|
||||||
|
tmp<volScalarField> tcorDeltaT
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"CorDeltaT",
|
||||||
|
cofrDeltaT.instance(),
|
||||||
|
mesh()
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("CorDeltaT", cofrDeltaT.dimensions(), 0.0),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField& corDeltaT = tcorDeltaT();
|
||||||
|
|
||||||
|
const unallocLabelList& owner = mesh().owner();
|
||||||
|
const unallocLabelList& neighbour = mesh().neighbour();
|
||||||
|
|
||||||
|
forAll(owner, faceI)
|
||||||
|
{
|
||||||
|
corDeltaT[owner[faceI]] =
|
||||||
|
max(corDeltaT[owner[faceI]], cofrDeltaT[faceI]);
|
||||||
|
|
||||||
|
corDeltaT[neighbour[faceI]] =
|
||||||
|
max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(corDeltaT.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
const fvsPatchScalarField& pcofrDeltaT =
|
||||||
|
cofrDeltaT.boundaryField()[patchi];
|
||||||
|
|
||||||
|
const fvPatch& p = pcofrDeltaT.patch();
|
||||||
|
const unallocLabelList& faceCells = p.patch().faceCells();
|
||||||
|
|
||||||
|
forAll(pcofrDeltaT, patchFacei)
|
||||||
|
{
|
||||||
|
corDeltaT[faceCells[patchFacei]] = max
|
||||||
|
(
|
||||||
|
corDeltaT[faceCells[patchFacei]],
|
||||||
|
pcofrDeltaT[patchFacei]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
corDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
|
return tcorDeltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<surfaceScalarField> steadyInertialDdtScheme<Type>::CofrDeltaT() const
|
||||||
|
{
|
||||||
|
const objectRegistry& registry = this->mesh();
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
registry.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
|
||||||
|
{
|
||||||
|
// Calculate face velocity
|
||||||
|
surfaceScalarField magFaceU = mag(phi)/mesh().magSf();
|
||||||
|
|
||||||
|
// Calculate face Co number from local face velocity stabilised to
|
||||||
|
// avoid U = 0 case. Min velocity is assumed to be 1/1000 of the max
|
||||||
|
// velocity. HJ, 8/Mar/2010
|
||||||
|
dimensionedScalar faceUlimit =
|
||||||
|
Foam::max
|
||||||
|
(
|
||||||
|
0.001*max(magFaceU), // Field max will do global reduction
|
||||||
|
dimensionedScalar("one", dimVelocity, 1.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
return max(magFaceU, faceUlimit)*
|
||||||
|
mesh().surfaceInterpolation::deltaCoeffs()/maxCo_;
|
||||||
|
}
|
||||||
|
else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
|
||||||
|
{
|
||||||
|
const volScalarField& rho =
|
||||||
|
registry.lookupObject<volScalarField>(rhoName_);
|
||||||
|
|
||||||
|
surfaceScalarField magFaceU =
|
||||||
|
mag(phi)/(fvc::interpolate(rho)*mesh().magSf());
|
||||||
|
|
||||||
|
// Calculate face Co number from local face velocity stabilised to
|
||||||
|
// avoid U = 0 case. Min velocity is assumed to be 1/1000 of the max
|
||||||
|
// velocity. HJ, 8/Mar/2010
|
||||||
|
dimensionedScalar faceUlimit = 0.001*max(magFaceU);
|
||||||
|
|
||||||
|
return max(magFaceU, faceUlimit)*
|
||||||
|
mesh().surfaceInterpolation::deltaCoeffs()/maxCo_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn("steaddyInertialDdtScheme<Type>::CofrDeltaT() const")
|
||||||
|
<< "Incorrect dimensions of phi: " << phi.dimensions()
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
return tmp<surfaceScalarField>(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
steadyInertialDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const dimensioned<Type>& dt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
volScalarField rDeltaT = CorDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt("+dt.name()+')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > tdtdt
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<Type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
dt.dimensions()/dimTime,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
tdtdt().internalField() =
|
||||||
|
rDeltaT.internalField()*dt.value()*(1.0 - mesh().V0()/mesh().V());
|
||||||
|
|
||||||
|
return tdtdt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<Type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
dt.dimensions()/dimTime,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
),
|
||||||
|
calculatedFvPatchField<Type>::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
steadyInertialDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
volScalarField rDeltaT = CorDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt("+vf.name()+')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
rDeltaT.dimensions()*vf.dimensions(),
|
||||||
|
rDeltaT.internalField()*
|
||||||
|
(
|
||||||
|
vf.internalField()
|
||||||
|
- vf.oldTime().internalField()*mesh().V0()/mesh().V()
|
||||||
|
),
|
||||||
|
rDeltaT.boundaryField()*
|
||||||
|
(
|
||||||
|
vf.boundaryField() - vf.oldTime().boundaryField()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
rDeltaT*(vf - vf.oldTime())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
steadyInertialDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
volScalarField rDeltaT = CorDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt("+rho.name()+','+vf.name()+')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(),
|
||||||
|
rDeltaT.internalField()*rho.value()*
|
||||||
|
(
|
||||||
|
vf.internalField()
|
||||||
|
- vf.oldTime().internalField()*mesh().V0()/mesh().V()
|
||||||
|
),
|
||||||
|
rDeltaT.boundaryField()*rho.value()*
|
||||||
|
(
|
||||||
|
vf.boundaryField() - vf.oldTime().boundaryField()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
rDeltaT*rho*(vf - vf.oldTime())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
steadyInertialDdtScheme<Type>::fvcDdt
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
volScalarField rDeltaT = CorDeltaT();
|
||||||
|
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddt("+rho.name()+','+vf.name()+')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(),
|
||||||
|
rDeltaT.internalField()*
|
||||||
|
(
|
||||||
|
rho.internalField()*vf.internalField()
|
||||||
|
- rho.oldTime().internalField()
|
||||||
|
*vf.oldTime().internalField()*mesh().V0()/mesh().V()
|
||||||
|
),
|
||||||
|
rDeltaT.boundaryField()*
|
||||||
|
(
|
||||||
|
rho.boundaryField()*vf.boundaryField()
|
||||||
|
- rho.oldTime().boundaryField()
|
||||||
|
*vf.oldTime().boundaryField()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
rDeltaT*(rho*vf - rho.oldTime()*vf.oldTime())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvMatrix<Type> >
|
||||||
|
steadyInertialDdtScheme<Type>::fvmDdt
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<fvMatrix<Type> > tfvm
|
||||||
|
(
|
||||||
|
new fvMatrix<Type>
|
||||||
|
(
|
||||||
|
vf,
|
||||||
|
vf.dimensions()*dimVol/dimTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
|
scalarField rDeltaT = CorDeltaT()().internalField();
|
||||||
|
|
||||||
|
fvm.diag() = rDeltaT*mesh().V();
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvMatrix<Type> >
|
||||||
|
steadyInertialDdtScheme<Type>::fvmDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar& rho,
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<fvMatrix<Type> > tfvm
|
||||||
|
(
|
||||||
|
new fvMatrix<Type>
|
||||||
|
(
|
||||||
|
vf,
|
||||||
|
rho.dimensions()*vf.dimensions()*dimVol/dimTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
|
scalarField rDeltaT = CorDeltaT()().internalField();
|
||||||
|
|
||||||
|
fvm.diag() = rDeltaT*rho.value()*mesh().V();
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.value()*vf.oldTime().internalField()*mesh().V0();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.value()*vf.oldTime().internalField()*mesh().V();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvMatrix<Type> >
|
||||||
|
steadyInertialDdtScheme<Type>::fvmDdt
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<fvMatrix<Type> > tfvm
|
||||||
|
(
|
||||||
|
new fvMatrix<Type>
|
||||||
|
(
|
||||||
|
vf,
|
||||||
|
rho.dimensions()*vf.dimensions()*dimVol/dimTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
fvMatrix<Type>& fvm = tfvm();
|
||||||
|
|
||||||
|
scalarField rDeltaT = CorDeltaT()().internalField();
|
||||||
|
|
||||||
|
fvm.diag() = rDeltaT*rho.internalField()*mesh().V();
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.oldTime().internalField()
|
||||||
|
*vf.oldTime().internalField()*mesh().V0();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvm.source() = rDeltaT
|
||||||
|
*rho.oldTime().internalField()
|
||||||
|
*vf.oldTime().internalField()*mesh().V();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<typename steadyInertialDdtScheme<Type>::fluxFieldType>
|
||||||
|
steadyInertialDdtScheme<Type>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddtPhiCorr(" + rA.name() + ',' + U.name() + ',' + phi.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<typename flux<Type>::type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
rA.dimensions()*phi.dimensions()/dimTime,
|
||||||
|
pTraits<typename flux<Type>::type>::zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
volScalarField rDeltaT = CorDeltaT();
|
||||||
|
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff(U.oldTime(), phi.oldTime())*
|
||||||
|
(
|
||||||
|
fvc::interpolate(rDeltaT*rA)*phi.oldTime()
|
||||||
|
- (fvc::interpolate(rDeltaT*rA*U.oldTime()) & mesh().Sf())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<typename steadyInertialDdtScheme<Type>::fluxFieldType>
|
||||||
|
steadyInertialDdtScheme<Type>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobject ddtIOobject
|
||||||
|
(
|
||||||
|
"ddtPhiCorr("
|
||||||
|
+ rA.name() + ',' + rho.name() + ',' + U.name() + ',' + phi.name() + ')',
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mesh().moving())
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
mesh(),
|
||||||
|
dimensioned<typename flux<Type>::type>
|
||||||
|
(
|
||||||
|
"0",
|
||||||
|
rA.dimensions()*rho.dimensions()*phi.dimensions()/dimTime,
|
||||||
|
pTraits<typename flux<Type>::type>::zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
volScalarField rDeltaT = CorDeltaT();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
U.dimensions() == dimVelocity
|
||||||
|
&& phi.dimensions() == dimVelocity*dimArea
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff(U.oldTime(), phi.oldTime())
|
||||||
|
*(
|
||||||
|
fvc::interpolate(rDeltaT*rA*rho.oldTime())*
|
||||||
|
phi.oldTime()
|
||||||
|
- (fvc::interpolate(rDeltaT*rA*rho.oldTime()*U.oldTime())
|
||||||
|
& mesh().Sf())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
U.dimensions() == dimVelocity
|
||||||
|
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff
|
||||||
|
(
|
||||||
|
U.oldTime(),
|
||||||
|
phi.oldTime()/fvc::interpolate(rho.oldTime())
|
||||||
|
)
|
||||||
|
*(
|
||||||
|
fvc::interpolate(rDeltaT*rA*rho.oldTime())
|
||||||
|
*phi.oldTime()/fvc::interpolate(rho.oldTime())
|
||||||
|
- (
|
||||||
|
fvc::interpolate
|
||||||
|
(
|
||||||
|
rDeltaT*rA*rho.oldTime()*U.oldTime()
|
||||||
|
) & mesh().Sf()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
U.dimensions() == dimDensity*dimVelocity
|
||||||
|
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<fluxFieldType>
|
||||||
|
(
|
||||||
|
new fluxFieldType
|
||||||
|
(
|
||||||
|
ddtIOobject,
|
||||||
|
fvcDdtPhiCoeff(rho.oldTime(), U.oldTime(), phi.oldTime())
|
||||||
|
*(
|
||||||
|
fvc::interpolate(rDeltaT*rA)*phi.oldTime()
|
||||||
|
- (
|
||||||
|
fvc::interpolate(rDeltaT*rA*U.oldTime())&mesh().Sf()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"steadyInertialDdtScheme<Type>::fvcDdtPhiCorr"
|
||||||
|
) << "dimensions of phi are not correct"
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
return fluxFieldType::null();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<surfaceScalarField> steadyInertialDdtScheme<Type>::meshPhi
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tmp<surfaceScalarField>
|
||||||
|
(
|
||||||
|
new surfaceScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"meshPhi",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("0", dimVolume/dimTime, 0.0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fv
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,222 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::fv::steadyInertialDdtScheme
|
||||||
|
|
||||||
|
Description
|
||||||
|
Stabilised local time-step first-order Euler implicit/explicit ddt.
|
||||||
|
The time-step is adjusted locally so that an advective equations remains
|
||||||
|
diagonally dominant.
|
||||||
|
|
||||||
|
This scheme should only be used for steady-state computations
|
||||||
|
using transient codes where local time-stepping is preferably to
|
||||||
|
under-relaxation for transport consistency reasons.
|
||||||
|
|
||||||
|
See also CoEulerDdtScheme.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
steadyInertialDdtScheme.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef steadyInertialDdtScheme_H
|
||||||
|
#define steadyInertialDdtScheme_H
|
||||||
|
|
||||||
|
#include "ddtScheme.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class steadyInertialDdtScheme Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class steadyInertialDdtScheme
|
||||||
|
:
|
||||||
|
public fv::ddtScheme<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Name of the flux field used to calculate the local time-step
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of the density field used to obtain the volumetric flux
|
||||||
|
// from the mass flux if required
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Maximum local Courant number
|
||||||
|
scalar maxCo_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
steadyInertialDdtScheme(const steadyInertialDdtScheme&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const steadyInertialDdtScheme&);
|
||||||
|
|
||||||
|
//- Return the reciprocal of the Courant-number limited time-step
|
||||||
|
tmp<volScalarField> CorDeltaT() const;
|
||||||
|
|
||||||
|
//- Return the reciprocal of the face-Courant-number limited time-step
|
||||||
|
tmp<surfaceScalarField> CofrDeltaT() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("steadyInertial");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh and Istream
|
||||||
|
steadyInertialDdtScheme(const fvMesh& mesh, Istream& is)
|
||||||
|
:
|
||||||
|
ddtScheme<Type>(mesh, is),
|
||||||
|
phiName_(is),
|
||||||
|
rhoName_(is),
|
||||||
|
maxCo_(readScalar(is))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return mesh reference
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return fv::ddtScheme<Type>::mesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const dimensioned<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar&,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt
|
||||||
|
(
|
||||||
|
const volScalarField&,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fvMatrix<Type> > fvmDdt
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fvMatrix<Type> > fvmDdt
|
||||||
|
(
|
||||||
|
const dimensionedScalar&,
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fvMatrix<Type> > fvmDdt
|
||||||
|
(
|
||||||
|
const volScalarField&,
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;
|
||||||
|
|
||||||
|
tmp<fluxFieldType> fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<fluxFieldType> fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& rho,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& U,
|
||||||
|
const fluxFieldType& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<surfaceScalarField> meshPhi
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
tmp<surfaceScalarField> steadyInertialDdtScheme<scalar>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
tmp<surfaceScalarField> steadyInertialDdtScheme<scalar>::fvcDdtPhiCorr
|
||||||
|
(
|
||||||
|
const volScalarField& rA,
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volScalarField& U,
|
||||||
|
const surfaceScalarField& phi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fv
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "steadyInertialDdtScheme.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "steadyInertialDdtScheme.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fv
|
||||||
|
{
|
||||||
|
makeFvDdtScheme(steadyInertialDdtScheme)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,148 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "MachNumber.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "basicThermo.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(MachNumber, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
MachNumber,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::MachNumber::MachNumber
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& t,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
functionObject(name),
|
||||||
|
time_(t),
|
||||||
|
regionName_(polyMesh::defaultRegion),
|
||||||
|
UName_(dict.lookup("UName"))
|
||||||
|
{
|
||||||
|
if (dict.found("region"))
|
||||||
|
{
|
||||||
|
dict.lookup("region") >> regionName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Creating MachNumber for field "
|
||||||
|
<< UName_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::MachNumber::start()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::MachNumber::execute()
|
||||||
|
{
|
||||||
|
const fvMesh& mesh =
|
||||||
|
time_.lookupObject<fvMesh>(regionName_);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
mesh.foundObject<volVectorField>(UName_)
|
||||||
|
&& mesh.foundObject<basicThermo>("thermophysicalProperties")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const volVectorField& U = mesh.lookupObject<volVectorField>(UName_);
|
||||||
|
|
||||||
|
const basicThermo& thermo =
|
||||||
|
mesh.lookupObject<basicThermo>("thermophysicalProperties");
|
||||||
|
|
||||||
|
volScalarField Cp = thermo.Cp();
|
||||||
|
volScalarField Cv = thermo.Cv();
|
||||||
|
|
||||||
|
volScalarField Ma
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Ma" + UName_,
|
||||||
|
U.instance(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mag(U)/(sqrt((Cp/Cv)*(Cp - Cv)*thermo.T()))
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Mach number min = " << Foam::min(Ma.internalField())
|
||||||
|
<< " max = " << Foam::max(Ma.internalField()) << endl;
|
||||||
|
|
||||||
|
if (mesh.time().outputTime())
|
||||||
|
{
|
||||||
|
Info << "Writing Mach number field" << endl;
|
||||||
|
Ma.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Field " << UName_ << " or thermo not found. Skipping."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::MachNumber::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
UName_ = word(dict.lookup("UName"));
|
||||||
|
|
||||||
|
if (dict.found("region"))
|
||||||
|
{
|
||||||
|
dict.lookup("region") >> regionName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
MachNumber
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject calculates the Mach number
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
MachNumber.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef MachNumber_H
|
||||||
|
#define MachNumber_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class MachNumber Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class MachNumber
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to main object registry
|
||||||
|
const Time& time_;
|
||||||
|
|
||||||
|
//- Region name
|
||||||
|
word regionName_;
|
||||||
|
|
||||||
|
//- Velocity field name
|
||||||
|
word UName_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
MachNumber
|
||||||
|
(
|
||||||
|
const MachNumber&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const MachNumber&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("MachNumber");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
MachNumber
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- start is called at the start of the time-loop
|
||||||
|
virtual bool start();
|
||||||
|
|
||||||
|
//- execute is called at each ++ or += of the time-loop
|
||||||
|
virtual bool execute();
|
||||||
|
|
||||||
|
//- Read and set the function object if its data has changed
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -4,4 +4,8 @@ staticPressure/staticPressureFunctionObject.C
|
||||||
dsmcFields/dsmcFields.C
|
dsmcFields/dsmcFields.C
|
||||||
dsmcFields/dsmcFieldsFunctionObject.C
|
dsmcFields/dsmcFieldsFunctionObject.C
|
||||||
|
|
||||||
|
MachNumber/MachNumber.C
|
||||||
|
|
||||||
|
divFlux/divFlux.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
||||||
|
|
|
@ -2,6 +2,8 @@ EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
|
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
|
@ -10,4 +12,6 @@ LIB_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lsampling \
|
-lsampling \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-ldsmc
|
-ldsmc \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lspecie
|
||||||
|
|
142
src/postProcessing/functionObjects/utilities/divFlux/divFlux.C
Normal file
142
src/postProcessing/functionObjects/utilities/divFlux/divFlux.C
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "divFlux.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(divFlux, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
divFlux,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::divFlux::divFlux
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& t,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
functionObject(name),
|
||||||
|
time_(t),
|
||||||
|
regionName_(polyMesh::defaultRegion),
|
||||||
|
phiName_(dict.lookup("phiName"))
|
||||||
|
{
|
||||||
|
if (dict.found("region"))
|
||||||
|
{
|
||||||
|
dict.lookup("region") >> regionName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Creating divFlux for field "
|
||||||
|
<< phiName_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::divFlux::start()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::divFlux::execute()
|
||||||
|
{
|
||||||
|
const fvMesh& mesh =
|
||||||
|
time_.lookupObject<fvMesh>(regionName_);
|
||||||
|
|
||||||
|
if (mesh.foundObject<surfaceScalarField>(phiName_))
|
||||||
|
{
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
mesh.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
|
volScalarField divFlux
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"divFlux",
|
||||||
|
phi.instance(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mag(fvc::div(phi))
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Flux divergence min = " << Foam::min(divFlux.internalField())
|
||||||
|
<< " max = " << Foam::max(divFlux.internalField())
|
||||||
|
<< " average: " << divFlux.weightedAverage(mesh.V()).value()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
if (mesh.time().outputTime())
|
||||||
|
{
|
||||||
|
Info << "Writing divFlux field" << endl;
|
||||||
|
divFlux.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Field " << phiName_ << " not found. Skipping."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::divFlux::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
phiName_ = word(dict.lookup("phiName"));
|
||||||
|
|
||||||
|
if (dict.found("region"))
|
||||||
|
{
|
||||||
|
dict.lookup("region") >> regionName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
121
src/postProcessing/functionObjects/utilities/divFlux/divFlux.H
Normal file
121
src/postProcessing/functionObjects/utilities/divFlux/divFlux.H
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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
|
||||||
|
divFlux
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject calculates the divergence of flux field
|
||||||
|
|
||||||
|
Author
|
||||||
|
Hrvoje Jasak, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
divFlux.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef divFlux_H
|
||||||
|
#define divFlux_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class divFlux Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class divFlux
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to main object registry
|
||||||
|
const Time& time_;
|
||||||
|
|
||||||
|
//- Region name
|
||||||
|
word regionName_;
|
||||||
|
|
||||||
|
//- Flux field name
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
divFlux
|
||||||
|
(
|
||||||
|
const divFlux&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const divFlux&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("divFlux");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
divFlux
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- start is called at the start of the time-loop
|
||||||
|
virtual bool start();
|
||||||
|
|
||||||
|
//- execute is called at each ++ or += of the time-loop
|
||||||
|
virtual bool execute();
|
||||||
|
|
||||||
|
//- Read and set the function object if its data has changed
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -24,4 +24,7 @@ derivedFvPatchFields/mixedInternalEnergy/mixedInternalEnergyFvPatchScalarField.C
|
||||||
|
|
||||||
derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
|
derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
|
||||||
|
|
||||||
|
derivedFvPatchFields/temperatureDirectedInletOutletVelocity/temperatureDirectedInletOutletVelocityFvPatchVectorField.C
|
||||||
|
derivedFvPatchFields/isentropicTotalTemperature/isentropicTotalTemperatureFvPatchScalarField.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libbasicThermophysicalModels
|
LIB = $(FOAM_LIBBIN)/libbasicThermophysicalModels
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "isentropicTotalTemperatureFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
#include "basicThermo.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField::isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
pName_("Undefined"),
|
||||||
|
T0_(p.size(), 0.0),
|
||||||
|
p0_(p.size(), 0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField::isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const isentropicTotalTemperatureFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
pName_(ptf.pName_),
|
||||||
|
T0_(ptf.T0_, mapper),
|
||||||
|
p0_(ptf.p0_, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField::isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
pName_(dict.lookup("p")),
|
||||||
|
T0_("T0", dict, p.size()),
|
||||||
|
p0_("p0", dict, p.size())
|
||||||
|
{
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=
|
||||||
|
(
|
||||||
|
scalarField("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::operator=(T0_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField::isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const isentropicTotalTemperatureFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf),
|
||||||
|
pName_(tppsf.pName_),
|
||||||
|
T0_(tppsf.T0_),
|
||||||
|
p0_(tppsf.p0_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField::isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const isentropicTotalTemperatureFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF),
|
||||||
|
pName_(tppsf.pName_),
|
||||||
|
T0_(tppsf.T0_),
|
||||||
|
p0_(tppsf.p0_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void isentropicTotalTemperatureFvPatchScalarField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::autoMap(m);
|
||||||
|
T0_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void isentropicTotalTemperatureFvPatchScalarField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchScalarField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const isentropicTotalTemperatureFvPatchScalarField& tiptf =
|
||||||
|
refCast<const isentropicTotalTemperatureFvPatchScalarField>(ptf);
|
||||||
|
|
||||||
|
T0_.rmap(tiptf.T0_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void isentropicTotalTemperatureFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fvPatchField<scalar>& p =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(pName_);
|
||||||
|
|
||||||
|
const basicThermo& thermo =
|
||||||
|
db().lookupObject<basicThermo>("thermophysicalProperties");
|
||||||
|
|
||||||
|
volScalarField gamma = thermo.Cp()/thermo.Cv();
|
||||||
|
|
||||||
|
const fvPatchField<scalar>& gammap =
|
||||||
|
patch().patchField<volScalarField, scalar>(gamma);
|
||||||
|
|
||||||
|
scalarField gM1ByG = (gammap - 1.0)/gammap;
|
||||||
|
|
||||||
|
operator==(T0_*pow(p/p0_,gM1ByG));
|
||||||
|
|
||||||
|
fixedValueFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
void isentropicTotalTemperatureFvPatchScalarField::updateCoeffs(const vectorField& Up)
|
||||||
|
{
|
||||||
|
updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void isentropicTotalTemperatureFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl;
|
||||||
|
T0_.writeEntry("T0", os);
|
||||||
|
p0_.writeEntry("p0", os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField(fvPatchScalarField, isentropicTotalTemperatureFvPatchScalarField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,189 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef isentropicTotalTemperatureFvPatchScalarField_H
|
||||||
|
#define isentropicTotalTemperatureFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class isentropicTotalTemperatureFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of the static pressure field
|
||||||
|
word pName_;
|
||||||
|
|
||||||
|
//- Total temperature field
|
||||||
|
scalarField T0_;
|
||||||
|
|
||||||
|
//- Total pressure field
|
||||||
|
scalarField p0_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("isentropicTotalTemperature");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const isentropicTotalTemperatureFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const isentropicTotalTemperatureFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new isentropicTotalTemperatureFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
isentropicTotalTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const isentropicTotalTemperatureFvPatchScalarField&,
|
||||||
|
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 isentropicTotalTemperatureFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the total pressure
|
||||||
|
const scalarField& T0() const
|
||||||
|
{
|
||||||
|
return T0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the total pressure to allow adjustment
|
||||||
|
scalarField& T0()
|
||||||
|
{
|
||||||
|
return T0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 fvPatchScalarField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
// using the given patch velocity field
|
||||||
|
virtual void updateCoeffs(const vectorField& Up);
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,284 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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 "temperatureDirectedInletOutletVelocityFvPatchVectorField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
#include "basicThermo.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField::
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchVectorField(p, iF),
|
||||||
|
phiName_("phi"),
|
||||||
|
TName_("T"),
|
||||||
|
T0_(p.size(), 0.0),
|
||||||
|
inletDir_(p.size()),
|
||||||
|
cylindricalCCS_(0),
|
||||||
|
omega_(vector::zero)
|
||||||
|
{
|
||||||
|
refValue() = *this;
|
||||||
|
refGrad() = vector::zero;
|
||||||
|
valueFraction() = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField::
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const temperatureDirectedInletOutletVelocityFvPatchVectorField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchVectorField(ptf, p, iF, mapper),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
TName_(ptf.TName_),
|
||||||
|
T0_(ptf.T0_, mapper),
|
||||||
|
inletDir_(ptf.inletDir_, mapper),
|
||||||
|
cylindricalCCS_(ptf.cylindricalCCS_),
|
||||||
|
omega_(ptf.omega_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField::
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchVectorField(p, iF),
|
||||||
|
phiName_("phi"),
|
||||||
|
TName_("T"),
|
||||||
|
T0_("T0", dict, p.size()),
|
||||||
|
inletDir_("inletDirection", dict, p.size()),
|
||||||
|
cylindricalCCS_(dict.lookup("cylindricalCCS")),
|
||||||
|
omega_(dict.lookup("omega"))
|
||||||
|
{
|
||||||
|
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
||||||
|
|
||||||
|
if (dict.found("phi"))
|
||||||
|
{
|
||||||
|
dict.lookup("phi") >> phiName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
refValue() = *this;
|
||||||
|
refGrad() = vector::zero;
|
||||||
|
valueFraction() = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField::
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const temperatureDirectedInletOutletVelocityFvPatchVectorField& pivpvf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchVectorField(pivpvf),
|
||||||
|
phiName_(pivpvf.phiName_),
|
||||||
|
TName_(pivpvf.TName_),
|
||||||
|
T0_(pivpvf.T0_),
|
||||||
|
inletDir_(pivpvf.inletDir_),
|
||||||
|
cylindricalCCS_(pivpvf.cylindricalCCS_),
|
||||||
|
omega_(pivpvf.omega_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField::
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const temperatureDirectedInletOutletVelocityFvPatchVectorField& pivpvf,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchVectorField(pivpvf, iF),
|
||||||
|
phiName_(pivpvf.phiName_),
|
||||||
|
TName_(pivpvf.TName_),
|
||||||
|
T0_(pivpvf.T0_),
|
||||||
|
inletDir_(pivpvf.inletDir_),
|
||||||
|
cylindricalCCS_(pivpvf.cylindricalCCS_),
|
||||||
|
omega_(pivpvf.omega_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void temperatureDirectedInletOutletVelocityFvPatchVectorField::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
mixedFvPatchVectorField::autoMap(m);
|
||||||
|
|
||||||
|
inletDir_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void temperatureDirectedInletOutletVelocityFvPatchVectorField::rmap
|
||||||
|
(
|
||||||
|
const fvPatchVectorField& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
mixedFvPatchVectorField::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const temperatureDirectedInletOutletVelocityFvPatchVectorField& tiptf =
|
||||||
|
refCast<const temperatureDirectedInletOutletVelocityFvPatchVectorField>(ptf);
|
||||||
|
|
||||||
|
inletDir_.rmap(tiptf.inletDir_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void temperatureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vectorField& C = patch().Cf();
|
||||||
|
vectorField rotationVelocity = omega_ ^ C;
|
||||||
|
vectorField inletDirCCS = inletDir_/mag(inletDir_);
|
||||||
|
vectorField inletDir(inletDirCCS);
|
||||||
|
|
||||||
|
if (cylindricalCCS_)
|
||||||
|
{
|
||||||
|
scalar radius;
|
||||||
|
forAll(C, facei)
|
||||||
|
{
|
||||||
|
radius = sqrt(sqr(C[facei].x())+ sqr(C[facei].y()));
|
||||||
|
inletDir[facei].z() = inletDirCCS[facei].z();
|
||||||
|
|
||||||
|
if (radius > 0.0)
|
||||||
|
{
|
||||||
|
inletDir[facei].x() =
|
||||||
|
(C[facei].x()*inletDirCCS[facei].x()
|
||||||
|
- C[facei].y()*inletDirCCS[facei].y())/radius;
|
||||||
|
|
||||||
|
inletDir[facei].y() =
|
||||||
|
(C[facei].y()*inletDirCCS[facei].x()
|
||||||
|
+ C[facei].x()*inletDirCCS[facei].y())/radius;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inletDir[facei].x() = 0.0;
|
||||||
|
inletDir[facei].y() = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
|
const fvsPatchField<scalar>& phip =
|
||||||
|
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
vectorField n = patch().nf();
|
||||||
|
scalarField ndmagS = (n & inletDir_)*patch().magSf();
|
||||||
|
|
||||||
|
refValue() = inletDir*phip/ndmagS - rotationVelocity;
|
||||||
|
}
|
||||||
|
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
const fvPatchField<scalar>& Tp =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(TName_);
|
||||||
|
|
||||||
|
const basicThermo& thermo =
|
||||||
|
db().lookupObject<basicThermo>("thermophysicalProperties");
|
||||||
|
|
||||||
|
volScalarField Cp = thermo.Cp();
|
||||||
|
|
||||||
|
const fvPatchField<scalar>& Cpp =
|
||||||
|
patch().patchField<volScalarField, scalar>(Cp);
|
||||||
|
|
||||||
|
refValue() =
|
||||||
|
inletDir*sqrt(2.0*Cpp*max(T0_-Tp,VSMALL)) - rotationVelocity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"temperatureDirectedInletOutletVelocityFvPatchVectorField::"
|
||||||
|
"updateCoeffs()"
|
||||||
|
) << "dimensions of phi are not correct"
|
||||||
|
<< "\n on patch " << this->patch().name()
|
||||||
|
<< " of field " << this->dimensionedInternalField().name()
|
||||||
|
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
valueFraction() = 1.0 - pos(phip);
|
||||||
|
|
||||||
|
mixedFvPatchVectorField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchVectorField::write(os);
|
||||||
|
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
|
||||||
|
T0_.writeEntry("T0", os);
|
||||||
|
inletDir_.writeEntry("inletDirection", os);
|
||||||
|
os.writeKeyword("cylindricalCCS") << cylindricalCCS_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchVectorField,
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,195 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright held by original author
|
||||||
|
\\/ 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::temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef temperatureDirectedInletOutletVelocityFvPatchVectorField_H
|
||||||
|
#define temperatureDirectedInletOutletVelocityFvPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class temperatureDirectedInletOutletVelocityFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
:
|
||||||
|
public mixedFvPatchVectorField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of flux field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of static Temperature field
|
||||||
|
word TName_;
|
||||||
|
|
||||||
|
//- Total Temperature field
|
||||||
|
scalarField T0_;
|
||||||
|
|
||||||
|
//- Inlet direction
|
||||||
|
vectorField inletDir_;
|
||||||
|
|
||||||
|
//- Is the supplied inlet value in cartesian or cylindrical coordinates?
|
||||||
|
Switch cylindricalCCS_;
|
||||||
|
|
||||||
|
//- Angular velocity of the frame
|
||||||
|
vector omega_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("temperatureDirectedInletOutletVelocity");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
// onto a new patch
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const temperatureDirectedInletOutletVelocityFvPatchVectorField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const temperatureDirectedInletOutletVelocityFvPatchVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchVectorField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const temperatureDirectedInletOutletVelocityFvPatchVectorField&,
|
||||||
|
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 temperatureDirectedInletOutletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the name of phi
|
||||||
|
const word& phiName() const
|
||||||
|
{
|
||||||
|
return phiName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 fvPatchVectorField&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
61
tutorials/compressible/steadyCompressibleFoam/2bump/0/T
Normal file
61
tutorials/compressible/steadyCompressibleFoam/2bump/0/T
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object T;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 1 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 300;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTL2
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
|
||||||
|
// type waveTransmissive;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet false;
|
||||||
|
// correctSupercritical true;
|
||||||
|
// lInf 0.0;
|
||||||
|
// fieldInf 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type symmetryPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP5
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
65
tutorials/compressible/steadyCompressibleFoam/2bump/0/U
Normal file
65
tutorials/compressible/steadyCompressibleFoam/2bump/0/U
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volVectorField;
|
||||||
|
object U;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform (572 0 0);
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (572 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTL2
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue uniform (0 0 0);
|
||||||
|
|
||||||
|
// type waveTransmissive;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet true;
|
||||||
|
// correctSupercritical true;
|
||||||
|
// lInf 0;
|
||||||
|
// fieldInf (0 0 0);
|
||||||
|
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type symmetryPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP5
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
61
tutorials/compressible/steadyCompressibleFoam/2bump/0/p
Normal file
61
tutorials/compressible/steadyCompressibleFoam/2bump/0/p
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 101325;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 101325;
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTL2
|
||||||
|
{
|
||||||
|
// type zeroGradient;
|
||||||
|
type waveTransmissive;
|
||||||
|
phi phi;
|
||||||
|
rho rho;
|
||||||
|
psi psi;
|
||||||
|
U U;
|
||||||
|
gamma 1.4;
|
||||||
|
inletOutlet false;
|
||||||
|
correctSupercritical true;
|
||||||
|
lInf 0;
|
||||||
|
fieldInf 101325;
|
||||||
|
value uniform 101325;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type symmetryPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP5
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
7
tutorials/compressible/steadyCompressibleFoam/2bump/Allclean
Executable file
7
tutorials/compressible/steadyCompressibleFoam/2bump/Allclean
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Source tutorial clean functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||||
|
|
||||||
|
cleanTimeDirectories
|
||||||
|
\rm -rf VTK
|
7
tutorials/compressible/steadyCompressibleFoam/2bump/Allrun
Executable file
7
tutorials/compressible/steadyCompressibleFoam/2bump/Allrun
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Source tutorial run functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
|
application="steadyCompressibleFoam"
|
||||||
|
|
||||||
|
runApplication $application
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object RASProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
RASModel laminar;
|
||||||
|
|
||||||
|
turbulence on;
|
||||||
|
|
||||||
|
printCoeffs on;
|
||||||
|
|
||||||
|
laminarCoeffs
|
||||||
|
{}
|
||||||
|
|
||||||
|
wallFunctionCoeffs
|
||||||
|
{
|
||||||
|
kappa 0.4187;
|
||||||
|
E 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class polyBoundaryMesh;
|
||||||
|
object boundary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
5
|
||||||
|
(
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
nFaces 60;
|
||||||
|
startFace 26715;
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTL2
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
nFaces 60;
|
||||||
|
startFace 26775;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type symmetryPlane;
|
||||||
|
nFaces 225;
|
||||||
|
startFace 26835;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
nFaces 225;
|
||||||
|
startFace 27060;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP5
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
nFaces 27000;
|
||||||
|
startFace 27285;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,22 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object thermophysicalProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
|
||||||
|
|
||||||
|
// mixture air 1 28.9 1007 0 1.84e-05 0.7;
|
||||||
|
mixture air 1 28.9 1007 0 0.0 0.7;
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
startFrom startTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 2000;
|
||||||
|
|
||||||
|
deltaT 1;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
|
||||||
|
writeInterval 50;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression uncompressed;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
graphFormat raw;
|
||||||
|
|
||||||
|
runTimeModifiable yes;
|
||||||
|
|
||||||
|
functions
|
||||||
|
(
|
||||||
|
flux
|
||||||
|
{
|
||||||
|
type divFlux;
|
||||||
|
phiName phi;
|
||||||
|
|
||||||
|
functionObjectLibs ("libutilityFunctionObjects.so");
|
||||||
|
}
|
||||||
|
|
||||||
|
Mach
|
||||||
|
{
|
||||||
|
type MachNumber;
|
||||||
|
UName U;
|
||||||
|
|
||||||
|
functionObjectLibs ("libutilityFunctionObjects.so");
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxU
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name U;
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxP
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name p;
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxRho
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name rho;
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxT
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name T;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSchemes;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
default none;
|
||||||
|
|
||||||
|
ddt(rho,U) steadyState;
|
||||||
|
ddt(rho,h) steadyState;
|
||||||
|
// ddt(rho,h) steadyInertial phi rho 1;
|
||||||
|
ddt(psi,p) steadyInertial phi rho 1;
|
||||||
|
|
||||||
|
U steadyState;
|
||||||
|
T steadyState;
|
||||||
|
p steadyState;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
default none;
|
||||||
|
// div(phi,U) Gauss upwind;
|
||||||
|
// div(phi,h) Gauss upwind;
|
||||||
|
// div(phid,p) Gauss upwind;
|
||||||
|
|
||||||
|
div(phi,U) Gauss vanLeerDC;
|
||||||
|
div(phi,h) Gauss vanLeerDC;
|
||||||
|
div(phid,p) Gauss vanLeer;
|
||||||
|
|
||||||
|
div(U,p) Gauss linear;
|
||||||
|
|
||||||
|
div(phi,k) Gauss upwind;
|
||||||
|
div(phi,epsilon) Gauss upwind;
|
||||||
|
div((muEff*dev2(grad(U).T()))) Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
laplacianSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolationSchemes
|
||||||
|
{
|
||||||
|
default linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
snGradSchemes
|
||||||
|
{
|
||||||
|
default corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
fluxRequired
|
||||||
|
{
|
||||||
|
default no;
|
||||||
|
p;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSolution;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
solvers
|
||||||
|
{
|
||||||
|
p
|
||||||
|
{
|
||||||
|
solver BiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
|
||||||
|
minIter 0;
|
||||||
|
maxIter 1000;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0.01;
|
||||||
|
};
|
||||||
|
U
|
||||||
|
{
|
||||||
|
solver BiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
|
||||||
|
minIter 0;
|
||||||
|
maxIter 1000;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0.01;
|
||||||
|
};
|
||||||
|
h
|
||||||
|
{
|
||||||
|
solver BiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
|
||||||
|
minIter 0;
|
||||||
|
maxIter 1000;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0.01;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
PIMPLE
|
||||||
|
{
|
||||||
|
nOuterCorrectors 1;
|
||||||
|
nCorrectors 2;
|
||||||
|
nNonOrthogonalCorrectors 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationFactors
|
||||||
|
{
|
||||||
|
// Note: under-relaxation factors used in wave-transmissive schemes
|
||||||
|
U 0.5;
|
||||||
|
p 0.2;
|
||||||
|
h 0.5;
|
||||||
|
rho 0.5;
|
||||||
|
T 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldBounds
|
||||||
|
{
|
||||||
|
// No bounding
|
||||||
|
// p 0 1e7;
|
||||||
|
// T 0 10000;
|
||||||
|
// U 1e6;
|
||||||
|
|
||||||
|
// With bounding
|
||||||
|
p 50 1e6;
|
||||||
|
T 20 3000;
|
||||||
|
U 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object T;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 1 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 300;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value $internalField;
|
||||||
|
|
||||||
|
// type waveTransmissiveInlet;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet false;
|
||||||
|
// correctSupercritical false;
|
||||||
|
// lInf 0.01;//HJ
|
||||||
|
// fieldInf 300;
|
||||||
|
// value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRES2
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
|
||||||
|
// type waveTransmissive;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet true;
|
||||||
|
// correctSupercritical false;
|
||||||
|
// lInf 0.0;
|
||||||
|
// fieldInf 300;
|
||||||
|
// value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP5
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP6
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volVectorField;
|
||||||
|
object U;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform (234 0 0);
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (234 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PRES2
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue uniform (0 0 0);
|
||||||
|
|
||||||
|
// type waveTransmissive;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet true;
|
||||||
|
// correctSupercritical false;
|
||||||
|
// lInf 0;
|
||||||
|
// fieldInf (0 0 0);
|
||||||
|
// value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP5
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP6
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 101325;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
|
||||||
|
// type waveTransmissiveInlet;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet false;
|
||||||
|
// correctSupercritical false;
|
||||||
|
// lInf 0.0;
|
||||||
|
// fieldInf 101325;
|
||||||
|
// value uniform 101325;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRES2
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 101325;
|
||||||
|
|
||||||
|
// type waveTransmissive;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet false;
|
||||||
|
// correctSupercritical true;
|
||||||
|
// lInf 0.1;
|
||||||
|
// fieldInf 101325;
|
||||||
|
// value uniform 101325;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP5
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMP6
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
7
tutorials/compressible/steadyCompressibleFoam/bumpBlockMesh/Allclean
Executable file
7
tutorials/compressible/steadyCompressibleFoam/bumpBlockMesh/Allclean
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Source tutorial clean functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||||
|
|
||||||
|
cleanCase
|
||||||
|
\rm -rf VTK
|
8
tutorials/compressible/steadyCompressibleFoam/bumpBlockMesh/Allrun
Executable file
8
tutorials/compressible/steadyCompressibleFoam/bumpBlockMesh/Allrun
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Source tutorial run functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
|
application="steadyCompressibleFoam"
|
||||||
|
|
||||||
|
runApplication blockMesh
|
||||||
|
runApplication $application
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object RASProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
RASModel laminar;
|
||||||
|
|
||||||
|
turbulence on;
|
||||||
|
|
||||||
|
printCoeffs on;
|
||||||
|
|
||||||
|
laminarCoeffs
|
||||||
|
{}
|
||||||
|
|
||||||
|
wallFunctionCoeffs
|
||||||
|
{
|
||||||
|
kappa 0.4187;
|
||||||
|
E 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object blockMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
convertToMeters 1;
|
||||||
|
|
||||||
|
vertices
|
||||||
|
(
|
||||||
|
(-1.5 0 -0.1)
|
||||||
|
(-0.5 0 -0.1)
|
||||||
|
( 0.5 0 -0.1)
|
||||||
|
( 1.5 0 -0.1)
|
||||||
|
|
||||||
|
(-1.5 1 -0.1)
|
||||||
|
(-0.5 1 -0.1)
|
||||||
|
( 0.5 1 -0.1)
|
||||||
|
( 1.5 1 -0.1)
|
||||||
|
|
||||||
|
(-1.5 0 0.1)
|
||||||
|
(-0.5 0 0.1)
|
||||||
|
( 0.5 0 0.1)
|
||||||
|
( 1.5 0 0.1)
|
||||||
|
|
||||||
|
(-1.5 1 0.1)
|
||||||
|
(-0.5 1 0.1)
|
||||||
|
( 0.5 1 0.1)
|
||||||
|
( 1.5 1 0.1)
|
||||||
|
);
|
||||||
|
|
||||||
|
blocks
|
||||||
|
(
|
||||||
|
hex (0 1 5 4 8 9 13 12) (160 160 1) simpleGrading (1 1 1)
|
||||||
|
hex (1 2 6 5 9 10 14 13) (160 160 1) simpleGrading (1 1 1)
|
||||||
|
hex (2 3 7 6 10 11 15 14) (160 160 1) simpleGrading (1 1 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
edges
|
||||||
|
(
|
||||||
|
arc 1 2 (0 0.1 -0.1)
|
||||||
|
arc 9 10 (0 0.1 0.1)
|
||||||
|
);
|
||||||
|
|
||||||
|
patches
|
||||||
|
(
|
||||||
|
patch INLE1
|
||||||
|
(
|
||||||
|
(0 8 12 4)
|
||||||
|
)
|
||||||
|
|
||||||
|
patch PRES2
|
||||||
|
(
|
||||||
|
(3 7 15 11)
|
||||||
|
)
|
||||||
|
|
||||||
|
wall WALL3
|
||||||
|
(
|
||||||
|
(4 12 13 5)
|
||||||
|
(5 13 14 6)
|
||||||
|
(6 14 15 7)
|
||||||
|
)
|
||||||
|
|
||||||
|
wall WALL4
|
||||||
|
(
|
||||||
|
(0 1 9 8)
|
||||||
|
(1 2 10 9)
|
||||||
|
(2 3 11 10)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
mergePatchPairs
|
||||||
|
(
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class polyBoundaryMesh;
|
||||||
|
location "constant/polyMesh";
|
||||||
|
object boundary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
5
|
||||||
|
(
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
nFaces 160;
|
||||||
|
startFace 152960;
|
||||||
|
}
|
||||||
|
PRES2
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
nFaces 160;
|
||||||
|
startFace 153120;
|
||||||
|
}
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
nFaces 480;
|
||||||
|
startFace 153280;
|
||||||
|
}
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
nFaces 480;
|
||||||
|
startFace 153760;
|
||||||
|
}
|
||||||
|
defaultFaces
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
nFaces 153600;
|
||||||
|
startFace 154240;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object thermophysicalProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
|
||||||
|
|
||||||
|
// name, nMoles, mol weight, CP, Hf, mu, Pr;
|
||||||
|
mixture air 1 28.9 1007 0 0 0.7;
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
startFrom startTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 2000;
|
||||||
|
|
||||||
|
deltaT 1;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
|
||||||
|
writeInterval 50;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression uncompressed;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
graphFormat raw;
|
||||||
|
|
||||||
|
runTimeModifiable yes;
|
||||||
|
|
||||||
|
functions
|
||||||
|
(
|
||||||
|
flux
|
||||||
|
{
|
||||||
|
type divFlux;
|
||||||
|
phiName phi;
|
||||||
|
|
||||||
|
functionObjectLibs ("libutilityFunctionObjects.so");
|
||||||
|
}
|
||||||
|
|
||||||
|
Mach
|
||||||
|
{
|
||||||
|
type MachNumber;
|
||||||
|
UName U;
|
||||||
|
|
||||||
|
functionObjectLibs ("libutilityFunctionObjects.so");
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxU
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name U;
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxP
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name p;
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxRho
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name rho;
|
||||||
|
}
|
||||||
|
|
||||||
|
minMaxT
|
||||||
|
{
|
||||||
|
type minMaxField;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
name T;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSchemes;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
default none;
|
||||||
|
|
||||||
|
// ddt(rho,U) steadyInertial phi rho 1;
|
||||||
|
ddt(rho,U) steadyState;
|
||||||
|
// ddt(rho,h) steadyState;
|
||||||
|
ddt(rho,h) steadyInertial phi rho 1;
|
||||||
|
ddt(psi,p) steadyInertial phi rho 1;
|
||||||
|
|
||||||
|
U steadyState;
|
||||||
|
T steadyState;
|
||||||
|
p steadyState;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
default none;
|
||||||
|
|
||||||
|
div(phi,U) Gauss upwind;
|
||||||
|
// div(phi,U) Gauss linearUpwind faceLimited Gauss linear 1.0;
|
||||||
|
// div(phi,U) Gauss blended 0.9;
|
||||||
|
// div(phi,U) Gauss vanLeerDC;
|
||||||
|
// div(phi,U) Gauss SuperBeeDC;
|
||||||
|
// div(phi,U) Gauss GammaVDC 0.5;
|
||||||
|
|
||||||
|
// div(phi,h) Gauss upwind;
|
||||||
|
// div(phi,h) Gauss GammaDC 0.5;
|
||||||
|
div(phi,h) Gauss vanLeerDC;
|
||||||
|
|
||||||
|
// div(phid,p) Gauss upwind;
|
||||||
|
div(phid,p) Gauss vanLeerDC;
|
||||||
|
|
||||||
|
div(phi,k) Gauss upwind;
|
||||||
|
div(phi,epsilon) Gauss upwind;
|
||||||
|
div((muEff*dev2(grad(U).T()))) Gauss linear;
|
||||||
|
|
||||||
|
div(U,p) Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
laplacianSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolationSchemes
|
||||||
|
{
|
||||||
|
default linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
snGradSchemes
|
||||||
|
{
|
||||||
|
default corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
fluxRequired
|
||||||
|
{
|
||||||
|
default no;
|
||||||
|
p;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSolution;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
solvers
|
||||||
|
{
|
||||||
|
p
|
||||||
|
{
|
||||||
|
solver BiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
|
||||||
|
minIter 0;
|
||||||
|
maxIter 1000;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0.0;
|
||||||
|
};
|
||||||
|
U
|
||||||
|
{
|
||||||
|
solver BiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
|
||||||
|
minIter 0;
|
||||||
|
maxIter 1000;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0.0;
|
||||||
|
};
|
||||||
|
h
|
||||||
|
{
|
||||||
|
solver BiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
|
||||||
|
minIter 0;
|
||||||
|
maxIter 1000;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0.0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
PIMPLE
|
||||||
|
{
|
||||||
|
nOuterCorrectors 1;
|
||||||
|
nCorrectors 3;
|
||||||
|
nNonOrthogonalCorrectors 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationFactors
|
||||||
|
{
|
||||||
|
// Note: under-relaxation factors used in wave-transmissive schemes
|
||||||
|
U 0.4;
|
||||||
|
p 0.2;
|
||||||
|
h 0.5;
|
||||||
|
rho 0.5;
|
||||||
|
T 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldBounds
|
||||||
|
{
|
||||||
|
// With bounding
|
||||||
|
p 50 1e6;
|
||||||
|
T 20 3000;
|
||||||
|
U 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
74
tutorials/compressible/steadyCompressibleFoam/bumpFine05/0/T
Normal file
74
tutorials/compressible/steadyCompressibleFoam/bumpFine05/0/T
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object T;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 1 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 300;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value $internalField;
|
||||||
|
|
||||||
|
// type waveTransmissiveInlet;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet false;
|
||||||
|
// correctSupercritical false;
|
||||||
|
// lInf 0.01;//HJ
|
||||||
|
// fieldInf 300;
|
||||||
|
// value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRES2
|
||||||
|
{
|
||||||
|
// type zeroGradient;
|
||||||
|
|
||||||
|
type waveTransmissive;
|
||||||
|
phi phi;
|
||||||
|
rho rho;
|
||||||
|
psi psi;
|
||||||
|
U U;
|
||||||
|
gamma 1.4;
|
||||||
|
inletOutlet true;
|
||||||
|
correctSupercritical false;
|
||||||
|
lInf 0.5;
|
||||||
|
fieldInf 300;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultFaces
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
65
tutorials/compressible/steadyCompressibleFoam/bumpFine05/0/U
Normal file
65
tutorials/compressible/steadyCompressibleFoam/bumpFine05/0/U
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volVectorField;
|
||||||
|
object U;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform (173 0 0);
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (173 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PRES2
|
||||||
|
{
|
||||||
|
// type inletOutlet;
|
||||||
|
// inletValue uniform (0 0 0);
|
||||||
|
|
||||||
|
type waveTransmissive;
|
||||||
|
phi phi;
|
||||||
|
rho rho;
|
||||||
|
psi psi;
|
||||||
|
U U;
|
||||||
|
gamma 1.4;
|
||||||
|
inletOutlet true;
|
||||||
|
correctSupercritical false;
|
||||||
|
lInf 0.5;
|
||||||
|
fieldInf (0 0 0);
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultFaces
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
74
tutorials/compressible/steadyCompressibleFoam/bumpFine05/0/p
Normal file
74
tutorials/compressible/steadyCompressibleFoam/bumpFine05/0/p
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 3.0 |
|
||||||
|
| \\ / A nd | Web: http://www.extend-project.de |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object p;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 101325;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
INLE1
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
|
||||||
|
// type waveTransmissiveInlet;
|
||||||
|
// phi phi;
|
||||||
|
// rho rho;
|
||||||
|
// psi psi;
|
||||||
|
// U U;
|
||||||
|
// gamma 1.4;
|
||||||
|
// inletOutlet false;
|
||||||
|
// correctSupercritical false;
|
||||||
|
// lInf 0.0;
|
||||||
|
// fieldInf 101325;
|
||||||
|
// value uniform 101325;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRES2
|
||||||
|
{
|
||||||
|
// type fixedValue;
|
||||||
|
// value uniform 101325;
|
||||||
|
|
||||||
|
type waveTransmissive;
|
||||||
|
phi phi;
|
||||||
|
rho rho;
|
||||||
|
psi psi;
|
||||||
|
U U;
|
||||||
|
gamma 1.4;
|
||||||
|
inletOutlet false;
|
||||||
|
correctSupercritical true;
|
||||||
|
lInf 0.5;
|
||||||
|
fieldInf 101325;
|
||||||
|
value uniform 101325;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL3
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
WALL4
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultFaces
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue