Completed transformation of post-processing utilities into functionObjects
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
streamFunction.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/streamFunction
|
||||
@ -1,8 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lgenericPatchFields \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
@ -1,491 +0,0 @@
|
||||
/*---------------------------------------------------------------------------* \
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
streamFunction
|
||||
|
||||
Description
|
||||
Calculates and writes the stream function of velocity field U at each
|
||||
time.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "pointFields.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "symmetryPlanePolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
label nD = mesh.nGeometricD();
|
||||
|
||||
if (nD != 2)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Case is not 2D, stream-function cannot be computed"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Vector<label> slabNormal((Vector<label>::one - mesh.geometricD())/2);
|
||||
const direction slabDir
|
||||
(
|
||||
slabNormal
|
||||
& Vector<label>(Vector<label>::X, Vector<label>::Y, Vector<label>::Z)
|
||||
);
|
||||
|
||||
scalar thickness = vector(slabNormal) & mesh.bounds().span();
|
||||
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< nl << "Time: " << runTime.timeName() << endl;
|
||||
|
||||
IOobject phiHeader
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (phiHeader.headerOk())
|
||||
{
|
||||
mesh.readUpdate();
|
||||
|
||||
Info<< nl << "Reading field phi" << endl;
|
||||
|
||||
surfaceScalarField phi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
pointScalarField streamFunction
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"streamFunction",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
pMesh,
|
||||
dimensionedScalar("zero", phi.dimensions(), 0.0)
|
||||
);
|
||||
|
||||
labelList visitedPoint(mesh.nPoints());
|
||||
forAll(visitedPoint, pointi)
|
||||
{
|
||||
visitedPoint[pointi] = 0;
|
||||
}
|
||||
label nVisited = 0;
|
||||
label nVisitedOld = 0;
|
||||
|
||||
const faceUList& faces = mesh.faces();
|
||||
const pointField& points = mesh.points();
|
||||
|
||||
label nInternalFaces = mesh.nInternalFaces();
|
||||
|
||||
vectorField unitAreas(mesh.faceAreas());
|
||||
unitAreas /= mag(unitAreas);
|
||||
|
||||
const polyPatchList& patches = mesh.boundaryMesh();
|
||||
|
||||
bool finished = true;
|
||||
|
||||
// Find the boundary face with zero flux. set the stream function
|
||||
// to zero on that face
|
||||
bool found = false;
|
||||
|
||||
do
|
||||
{
|
||||
found = false;
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const primitivePatch& bouFaces = patches[patchi];
|
||||
|
||||
if (!isType<emptyPolyPatch>(patches[patchi]))
|
||||
{
|
||||
forAll(bouFaces, facei)
|
||||
{
|
||||
if
|
||||
(
|
||||
magSqr(phi.boundaryField()[patchi][facei])
|
||||
< SMALL
|
||||
)
|
||||
{
|
||||
const labelList& zeroPoints = bouFaces[facei];
|
||||
|
||||
// Zero flux face found
|
||||
found = true;
|
||||
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
if (visitedPoint[zeroPoints[pointi]] == 1)
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
Info<< "Zero face: patch: " << patchi
|
||||
<< " face: " << facei << endl;
|
||||
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
streamFunction[zeroPoints[pointi]] = 0;
|
||||
visitedPoint[zeroPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
Info<< "zero flux boundary face not found. "
|
||||
<< "Using cell as a reference."
|
||||
<< endl;
|
||||
|
||||
const cellList& c = mesh.cells();
|
||||
|
||||
forAll(c, cI)
|
||||
{
|
||||
labelList zeroPoints = c[cI].labels(mesh.faces());
|
||||
|
||||
bool found = true;
|
||||
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
if (visitedPoint[zeroPoints[pointi]] == 1)
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
streamFunction[zeroPoints[pointi]] = 0.0;
|
||||
visitedPoint[zeroPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find initialisation face or a cell."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through all faces. If one of the points on
|
||||
// the face has the streamfunction value different
|
||||
// from -1, all points with -1 ont that face have the
|
||||
// streamfunction value equal to the face flux in
|
||||
// that point plus the value in the visited point
|
||||
do
|
||||
{
|
||||
finished = true;
|
||||
|
||||
for
|
||||
(
|
||||
label facei = nInternalFaces;
|
||||
facei<faces.size();
|
||||
facei++
|
||||
)
|
||||
{
|
||||
const labelList& curBPoints = faces[facei];
|
||||
bool bPointFound = false;
|
||||
|
||||
scalar currentBStream = 0.0;
|
||||
vector currentBStreamPoint(0, 0, 0);
|
||||
|
||||
forAll(curBPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curBPoints[pointi]] == 1)
|
||||
{
|
||||
// The point has been visited
|
||||
currentBStream =
|
||||
streamFunction[curBPoints[pointi]];
|
||||
currentBStreamPoint =
|
||||
points[curBPoints[pointi]];
|
||||
|
||||
bPointFound = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bPointFound)
|
||||
{
|
||||
// Sort out other points on the face
|
||||
forAll(curBPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curBPoints[pointi]] == 0)
|
||||
{
|
||||
label patchNo =
|
||||
mesh.boundaryMesh().whichPatch(facei);
|
||||
|
||||
if
|
||||
(
|
||||
!isType<emptyPolyPatch>
|
||||
(patches[patchNo])
|
||||
&& !isType<symmetryPlanePolyPatch>
|
||||
(patches[patchNo])
|
||||
&& !isType<symmetryPolyPatch>
|
||||
(patches[patchNo])
|
||||
&& !isType<wedgePolyPatch>
|
||||
(patches[patchNo])
|
||||
)
|
||||
{
|
||||
label faceNo =
|
||||
mesh.boundaryMesh()[patchNo]
|
||||
.whichFace(facei);
|
||||
|
||||
vector edgeHat =
|
||||
points[curBPoints[pointi]]
|
||||
- currentBStreamPoint;
|
||||
edgeHat.replace(slabDir, 0);
|
||||
edgeHat /= mag(edgeHat);
|
||||
|
||||
vector nHat = unitAreas[facei];
|
||||
|
||||
if (edgeHat.y() > VSMALL)
|
||||
{
|
||||
visitedPoint[curBPoints[pointi]] =
|
||||
1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curBPoints[pointi]]
|
||||
=
|
||||
currentBStream
|
||||
+ phi.boundaryField()
|
||||
[patchNo][faceNo]
|
||||
*sign(nHat.x());
|
||||
}
|
||||
else if (edgeHat.y() < -VSMALL)
|
||||
{
|
||||
visitedPoint[curBPoints[pointi]] =
|
||||
1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curBPoints[pointi]]
|
||||
=
|
||||
currentBStream
|
||||
- phi.boundaryField()
|
||||
[patchNo][faceNo]
|
||||
*sign(nHat.x());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (edgeHat.x() > VSMALL)
|
||||
{
|
||||
visitedPoint
|
||||
[curBPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction
|
||||
[curBPoints[pointi]] =
|
||||
currentBStream
|
||||
+ phi.boundaryField()
|
||||
[patchNo][faceNo]
|
||||
*sign(nHat.y());
|
||||
}
|
||||
else if (edgeHat.x() < -VSMALL)
|
||||
{
|
||||
visitedPoint
|
||||
[curBPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction
|
||||
[curBPoints[pointi]] =
|
||||
currentBStream
|
||||
- phi.boundaryField()
|
||||
[patchNo][faceNo]
|
||||
*sign(nHat.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finished = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (label facei=0; facei<nInternalFaces; facei++)
|
||||
{
|
||||
// Get the list of point labels for the face
|
||||
const labelList& curPoints = faces[facei];
|
||||
|
||||
bool pointFound = false;
|
||||
|
||||
scalar currentStream = 0.0;
|
||||
point currentStreamPoint(0, 0, 0);
|
||||
|
||||
forAll(curPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curPoints[pointi]] == 1)
|
||||
{
|
||||
// The point has been visited
|
||||
currentStream =
|
||||
streamFunction[curPoints[pointi]];
|
||||
currentStreamPoint =
|
||||
points[curPoints[pointi]];
|
||||
pointFound = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pointFound)
|
||||
{
|
||||
// Sort out other points on the face
|
||||
forAll(curPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curPoints[pointi]] == 0)
|
||||
{
|
||||
vector edgeHat =
|
||||
points[curPoints[pointi]]
|
||||
- currentStreamPoint;
|
||||
|
||||
edgeHat.replace(slabDir, 0);
|
||||
edgeHat /= mag(edgeHat);
|
||||
|
||||
vector nHat = unitAreas[facei];
|
||||
|
||||
if (edgeHat.y() > VSMALL)
|
||||
{
|
||||
visitedPoint[curPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curPoints[pointi]] =
|
||||
currentStream
|
||||
+ phi[facei]*sign(nHat.x());
|
||||
}
|
||||
else if (edgeHat.y() < -VSMALL)
|
||||
{
|
||||
visitedPoint[curPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curPoints[pointi]] =
|
||||
currentStream
|
||||
- phi[facei]*sign(nHat.x());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finished = false;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< ".";
|
||||
|
||||
if (nVisited == nVisitedOld)
|
||||
{
|
||||
// Find new seed. This must be a
|
||||
// multiply connected domain
|
||||
Info<< nl << "Exhausted a seed. Looking for new seed "
|
||||
<< "(this is correct for multiply connected "
|
||||
<< "domains).";
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
nVisitedOld = nVisited;
|
||||
}
|
||||
} while (!finished);
|
||||
|
||||
Info<< endl;
|
||||
} while (!finished);
|
||||
|
||||
// Normalise the stream-function by the 2D mesh thickness
|
||||
streamFunction /= thickness;
|
||||
streamFunction.boundaryFieldRef() = 0.0;
|
||||
streamFunction.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Flux field does not exist."
|
||||
<< " Stream function not calculated" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +0,0 @@
|
||||
wallHeatFlux.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/wallHeatFlux
|
||||
@ -1,23 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lturbulenceModels \
|
||||
-lcompressibleTurbulenceModels \
|
||||
-lreactionThermophysicalModels \
|
||||
-lgenericPatchFields \
|
||||
-lspecie \
|
||||
-lcompressibleTransportModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lsolidThermo \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lmeshTools
|
||||
@ -1,72 +0,0 @@
|
||||
autoPtr<basicThermo> thermo
|
||||
(
|
||||
basicThermo::New(mesh)
|
||||
);
|
||||
|
||||
const volScalarField& h = thermo->he();
|
||||
|
||||
// Register copy of thermo density
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
thermo->rho()
|
||||
);
|
||||
|
||||
// Construct turbulence model (if fluid)
|
||||
autoPtr<volVectorField> UPtr;
|
||||
autoPtr<surfaceScalarField> phiPtr;
|
||||
autoPtr<compressible::turbulenceModel> turbulence;
|
||||
|
||||
if (isA<fluidThermo>(thermo()))
|
||||
{
|
||||
UPtr.reset
|
||||
(
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
const volVectorField& U = UPtr();
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
// Copy phi to autoPtr. Rename to make sure copy is now registered as 'phi'.
|
||||
phi.rename("phiFluid");
|
||||
phiPtr.reset(new surfaceScalarField("phi", phi));
|
||||
|
||||
turbulence = compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phiPtr(),
|
||||
refCast<const fluidThermo>(thermo())
|
||||
);
|
||||
}
|
||||
|
||||
// Read radiative heat-flux if available
|
||||
volScalarField Qr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qr",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0)
|
||||
);
|
||||
@ -1,157 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
wallHeatFlux
|
||||
|
||||
Description
|
||||
Calculates and writes the heat flux for all patches as the boundary field
|
||||
of a volScalarField and also prints the integrated flux for all wall
|
||||
patches.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "solidThermo.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
mesh.readUpdate();
|
||||
|
||||
#include "createFields.H"
|
||||
|
||||
surfaceScalarField heatFlux
|
||||
(
|
||||
fvc::interpolate
|
||||
(
|
||||
(
|
||||
turbulence.valid()
|
||||
? turbulence->alphaEff()()
|
||||
: thermo->alpha()
|
||||
)
|
||||
)*fvc::snGrad(h)
|
||||
);
|
||||
|
||||
const surfaceScalarField::Boundary& patchHeatFlux =
|
||||
heatFlux.boundaryField();
|
||||
|
||||
const volScalarField::Boundary& patchRadHeatFlux =
|
||||
Qr.boundaryField();
|
||||
|
||||
const surfaceScalarField::Boundary& magSf =
|
||||
mesh.magSf().boundaryField();
|
||||
|
||||
Info<< "\nWall heat fluxes [W]" << endl;
|
||||
forAll(patchHeatFlux, patchi)
|
||||
{
|
||||
if (isA<wallFvPatch>(mesh.boundary()[patchi]))
|
||||
{
|
||||
scalar convFlux = gSum(magSf[patchi]*patchHeatFlux[patchi]);
|
||||
scalar radFlux = -gSum(magSf[patchi]*patchRadHeatFlux[patchi]);
|
||||
|
||||
Info<< mesh.boundary()[patchi].name() << endl
|
||||
<< " convective: " << convFlux << endl
|
||||
<< " radiative: " << radFlux << endl
|
||||
<< " total: " << convFlux + radFlux << endl;
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
volScalarField wallHeatFlux
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wallHeatFlux",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("wallHeatFlux", heatFlux.dimensions(), 0.0)
|
||||
);
|
||||
|
||||
volScalarField::Boundary& wallHeatFluxBf =
|
||||
wallHeatFlux.boundaryFieldRef();
|
||||
|
||||
forAll(wallHeatFluxBf, patchi)
|
||||
{
|
||||
wallHeatFluxBf[patchi] = patchHeatFlux[patchi];
|
||||
}
|
||||
|
||||
wallHeatFlux.write();
|
||||
|
||||
// Write the total heat-flux including the radiative contribution
|
||||
// if available
|
||||
if (Qr.headerOk())
|
||||
{
|
||||
volScalarField totalWallHeatFlux
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"totalWallHeatFlux",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"totalWallHeatFlux",
|
||||
heatFlux.dimensions(),
|
||||
0.0
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField::Boundary& totalWallHeatFluxBf =
|
||||
totalWallHeatFlux.boundaryFieldRef();
|
||||
|
||||
forAll(totalWallHeatFluxBf, patchi)
|
||||
{
|
||||
totalWallHeatFluxBf[patchi] =
|
||||
patchHeatFlux[patchi] - patchRadHeatFlux[patchi];
|
||||
}
|
||||
|
||||
totalWallHeatFlux.write();
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
1
bin/streamFunction
Symbolic link
1
bin/streamFunction
Symbolic link
@ -0,0 +1 @@
|
||||
supercededByPostProcess
|
||||
1
bin/wallHeatFlux
Symbolic link
1
bin/wallHeatFlux
Symbolic link
@ -0,0 +1 @@
|
||||
supercededByPostProcessOption
|
||||
22
etc/caseDicts/postProcessing/fields/streamFunction
Normal file
22
etc/caseDicts/postProcessing/fields/streamFunction
Normal file
@ -0,0 +1,22 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Web: www.OpenFOAM.org
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Description
|
||||
Writes the steam-function pointScalarField calculated from the specified
|
||||
flux surfaceScalarField.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type streamFunction;
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
|
||||
field phi;
|
||||
|
||||
executeControl writeTime;
|
||||
writeControl writeTime;
|
||||
|
||||
// ************************************************************************* //
|
||||
20
etc/caseDicts/postProcessing/fields/wallHeatFlux
Normal file
20
etc/caseDicts/postProcessing/fields/wallHeatFlux
Normal file
@ -0,0 +1,20 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Web: www.OpenFOAM.org
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Description
|
||||
Calculates the heat-flux at wall patches, outputting the data as a
|
||||
volScalarField.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type wallHeatFlux;
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
|
||||
executeControl writeTime;
|
||||
writeControl writeTime;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and outputs the Courant number as a
|
||||
volScalarField. The field is stored on the mesh database so that it can
|
||||
be retrieved and used for other applications.
|
||||
Calculates and outputs the Courant number as a volScalarField. The field is
|
||||
stored on the mesh database so that it can be retrieved and used for other
|
||||
applications.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and outputs the second largest eigenvalue
|
||||
of the sum of the square of the symmetrical and anti-symmetrical parts of
|
||||
the velocity gradient tensor.
|
||||
Calculates and outputs the second largest eigenvalue of the sum of the
|
||||
square of the symmetrical and anti-symmetrical parts of the velocity
|
||||
gradient tensor.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -28,8 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and writes the Mach number as a
|
||||
volScalarField.
|
||||
Calculates and writes the Mach number as a volScalarField.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -53,10 +53,12 @@ MachNo/MachNo.C
|
||||
turbulenceFields/turbulenceFields.C
|
||||
yPlus/yPlus.C
|
||||
wallShearStress/wallShearStress.C
|
||||
wallHeatFlux/wallHeatFlux.C
|
||||
|
||||
writeCellCentres/writeCellCentres.C
|
||||
writeCellVolumes/writeCellVolumes.C
|
||||
|
||||
XiReactionRate/XiReactionRate.C
|
||||
streamFunction/streamFunction.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||
|
||||
@ -28,8 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and outputs the Peclet number as a
|
||||
surfaceScalarField.
|
||||
Calculates and outputs the Peclet number as a surfaceScalarField.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and outputs the second invariant of the
|
||||
velocity gradient tensor [1/s^2].
|
||||
Calculates and outputs the second invariant of the velocity gradient tensor
|
||||
[1/s^2].
|
||||
|
||||
\f[
|
||||
Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U))))
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object writes the turbulent flame-speed and reaction-rate
|
||||
volScalarFields for the Xi-based combustion models.
|
||||
Writes the turbulent flame-speed and reaction-rate volScalarFields for the
|
||||
Xi-based combustion models.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and outputs the blendingFactor as used by
|
||||
the bended convection schemes. The output is a volume field (cells) whose
|
||||
value is calculated via the maximum blending factor for any cell face.
|
||||
Calculates and outputs the blendingFactor as used by the bended convection
|
||||
schemes. The output is a volume field (cells) whose value is calculated via
|
||||
the maximum blending factor for any cell face.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the components of a field.
|
||||
Calculates the components of a field.
|
||||
|
||||
The operation can be applied to any volume or surface fields generating a
|
||||
volume or surface scalar fields for each component.
|
||||
|
||||
@ -28,9 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the divergence of a field. The operation is
|
||||
limited to surfaceScalarFields and volVectorFields, and the output is a
|
||||
volScalarField.
|
||||
Calculates the divergence of a field. The operation is limited to
|
||||
surfaceScalarFields and volVectorFields, and the output is a volScalarField.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the enstrophy of the velocity.
|
||||
Calculates the enstrophy of the velocity.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -28,10 +28,12 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates average quantities for a user-specified
|
||||
selection of volumetric and surface fields. Fields are entered as a list
|
||||
of sub-dictionaries, which indicate the type of averages to perform, and
|
||||
can be updated during the calculation. The current options include:
|
||||
Calculates average quantities for a user-specified selection of volumetric
|
||||
and surface fields.
|
||||
|
||||
Fields are entered as a list of sub-dictionaries, which indicate the type of
|
||||
averages to perform, and can be updated during the calculation. The current
|
||||
options include:
|
||||
- \c mean: arithmetic mean:
|
||||
\f[
|
||||
\overline{x} = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N x_i
|
||||
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object transforms a user-specified selection of fields from
|
||||
global Cartesian co-ordinates to a local co-ordinate system. The fields
|
||||
are run-time modifiable.
|
||||
Transforms a user-specified selection of fields from global Cartesian
|
||||
co-ordinates to a local co-ordinate system. The fields are run-time
|
||||
modifiable.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,11 +28,12 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the value and location of scalar minimim
|
||||
and maximum for a list of user-specified fields. For variables with a rank
|
||||
greater than zero, either the min/max of a component value or the magnitude
|
||||
is reported. When operating in parallel, the processor owning the value
|
||||
is also given.
|
||||
Calculates the value and location of scalar minimim and maximum for a list
|
||||
of user-specified fields.
|
||||
|
||||
For variables with a rank greater than zero, either the min/max of a
|
||||
component value or the magnitude is reported. When operating in parallel,
|
||||
the processor owning the value is also given.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,8 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object provides a differencing option between two 'field
|
||||
value' function objects.
|
||||
Provides a differencing option between two 'field value' function objects.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,10 +28,11 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object provides a 'face regionType' variant of the fieldValues
|
||||
function object. Given a list of user-specified fields and a selection
|
||||
of mesh (or general surface) faces, a number of operations can be
|
||||
performed, such as sums, averages and integrations.
|
||||
Provides a 'face regionType' variant of the fieldValues function object.
|
||||
|
||||
Given a list of user-specified fields and a selection of mesh (or general
|
||||
surface) faces, a number of operations can be performed, such as sums,
|
||||
averages and integrations.
|
||||
|
||||
For example, to calculate the volumetric or mass flux across a patch,
|
||||
apply the 'sum' operator to the flux field (typically \c phi)
|
||||
|
||||
@ -28,10 +28,11 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object provides a 'cell region' variant of the fieldValues
|
||||
function object. Given a list of user-specified fields and a selection
|
||||
of mesh cells, a number of operations can be performed, such as sums,
|
||||
averages and integrations.
|
||||
Provides a 'cell region' variant of the fieldValues function object.
|
||||
|
||||
Given a list of user-specified fields and a selection of mesh cells, a
|
||||
number of operations can be performed, such as sums, averages and
|
||||
integrations.
|
||||
|
||||
|
||||
Example of function object specification:
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and writes the flowType of a velocity field.
|
||||
Calculates and writes the flowType of a velocity field.
|
||||
|
||||
The flow type parameter is obtained according to the following equation:
|
||||
\verbatim
|
||||
|
||||
@ -28,9 +28,10 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the gradient of a field. The operation is
|
||||
limited to scalar and vector volume or surface fields, and the output is a
|
||||
volume vector or tensor field.
|
||||
Calculates the gradient of a field.
|
||||
|
||||
The operation is limited to scalar and vector volume or surface fields, and
|
||||
the output is a volume vector or tensor field.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the magnitude of a field.
|
||||
Calculates the magnitude of a field.
|
||||
|
||||
The operation can be applied to any volume or surface fields generating a
|
||||
volume or surface scalar field.
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the magnitude of the sqr of a field.
|
||||
Calculates the magnitude of the sqr of a field.
|
||||
|
||||
The operation can be applied to any volume or surface field generating a
|
||||
volume or surface scalar field.
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object samples near-patch volume fields
|
||||
Samples near-patch volume fields.
|
||||
|
||||
Fields are stored
|
||||
- every time step the field is updated with new values
|
||||
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object includes tools to manipulate the pressure into
|
||||
different forms. These currently include:
|
||||
Includes tools to manipulate the pressure into different forms.
|
||||
|
||||
These currently include:
|
||||
- static pressure
|
||||
\f[
|
||||
p = \rho p_k
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object writes a scalar field whose value is the local
|
||||
processor ID. The output field name is 'processorID'.
|
||||
Writes a scalar field whose value is the local processor ID. The output
|
||||
field name is 'processorID'.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,8 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object adds a random component to a field,
|
||||
with a specified perturbation magnitude.
|
||||
Adds a random component to a field, with a specified perturbation magnitude.
|
||||
|
||||
The operation can be applied to any volume field.
|
||||
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object reads fields from the time directories and adds them to
|
||||
the mesh database for further post-processing.
|
||||
Reads fields from the time directories and adds them to the mesh database
|
||||
for further post-processing.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object creates a size distribution via interrogating a
|
||||
continuous phase fraction field.
|
||||
Creates a size distribution via interrogating a continuous phase fraction
|
||||
field.
|
||||
|
||||
Looks up a phase-fraction (alpha) field and splits the mesh into regions
|
||||
based on where the field is below the threshold value. These
|
||||
|
||||
463
src/functionObjects/field/streamFunction/streamFunction.C
Normal file
463
src/functionObjects/field/streamFunction/streamFunction.C
Normal file
@ -0,0 +1,463 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "streamFunction.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "pointFields.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "symmetryPlanePolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(streamFunction, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
streamFunction,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointScalarField> Foam::functionObjects::streamFunction::calc
|
||||
(
|
||||
const surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
Log << " functionObjects::" << type() << " " << name()
|
||||
<< " calculating steam-function" << endl;
|
||||
|
||||
Vector<label> slabNormal((Vector<label>::one - mesh_.geometricD())/2);
|
||||
const direction slabDir
|
||||
(
|
||||
slabNormal
|
||||
& Vector<label>(Vector<label>::X, Vector<label>::Y, Vector<label>::Z)
|
||||
);
|
||||
|
||||
scalar thickness = vector(slabNormal) & mesh_.bounds().span();
|
||||
|
||||
const pointMesh& pMesh = pointMesh::New(mesh_);
|
||||
|
||||
tmp<pointScalarField> tstreamFunction
|
||||
(
|
||||
new pointScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"streamFunction",
|
||||
time_.timeName(),
|
||||
mesh_
|
||||
),
|
||||
pMesh,
|
||||
dimensionedScalar("zero", phi.dimensions(), 0.0)
|
||||
)
|
||||
);
|
||||
pointScalarField& streamFunction = tstreamFunction.ref();
|
||||
|
||||
labelList visitedPoint(mesh_.nPoints());
|
||||
forAll(visitedPoint, pointi)
|
||||
{
|
||||
visitedPoint[pointi] = 0;
|
||||
}
|
||||
label nVisited = 0;
|
||||
label nVisitedOld = 0;
|
||||
|
||||
const faceUList& faces = mesh_.faces();
|
||||
const pointField& points = mesh_.points();
|
||||
|
||||
label nInternalFaces = mesh_.nInternalFaces();
|
||||
|
||||
vectorField unitAreas(mesh_.faceAreas());
|
||||
unitAreas /= mag(unitAreas);
|
||||
|
||||
const polyPatchList& patches = mesh_.boundaryMesh();
|
||||
|
||||
bool finished = true;
|
||||
|
||||
// Find the boundary face with zero flux. set the stream function
|
||||
// to zero on that face
|
||||
bool found = false;
|
||||
|
||||
do
|
||||
{
|
||||
found = false;
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const primitivePatch& bouFaces = patches[patchi];
|
||||
|
||||
if (!isType<emptyPolyPatch>(patches[patchi]))
|
||||
{
|
||||
forAll(bouFaces, facei)
|
||||
{
|
||||
if
|
||||
(
|
||||
magSqr(phi.boundaryField()[patchi][facei]) < SMALL
|
||||
)
|
||||
{
|
||||
const labelList& zeroPoints = bouFaces[facei];
|
||||
|
||||
// Zero flux face found
|
||||
found = true;
|
||||
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
if (visitedPoint[zeroPoints[pointi]] == 1)
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
Log << " Zero face: patch: " << patchi
|
||||
<< " face: " << facei << endl;
|
||||
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
streamFunction[zeroPoints[pointi]] = 0;
|
||||
visitedPoint[zeroPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
Log << " Zero flux boundary face not found. "
|
||||
<< "Using cell as a reference."
|
||||
<< endl;
|
||||
|
||||
const cellList& c = mesh_.cells();
|
||||
|
||||
forAll(c, cI)
|
||||
{
|
||||
labelList zeroPoints = c[cI].labels(mesh_.faces());
|
||||
|
||||
bool found = true;
|
||||
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
if (visitedPoint[zeroPoints[pointi]] == 1)
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
forAll(zeroPoints, pointi)
|
||||
{
|
||||
streamFunction[zeroPoints[pointi]] = 0.0;
|
||||
visitedPoint[zeroPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find initialisation face or a cell."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through all faces. If one of the points on
|
||||
// the face has the streamfunction value different
|
||||
// from -1, all points with -1 ont that face have the
|
||||
// streamfunction value equal to the face flux in
|
||||
// that point plus the value in the visited point
|
||||
do
|
||||
{
|
||||
finished = true;
|
||||
|
||||
for (label facei = nInternalFaces; facei<faces.size(); facei++)
|
||||
{
|
||||
const labelList& curBPoints = faces[facei];
|
||||
bool bPointFound = false;
|
||||
|
||||
scalar currentBStream = 0.0;
|
||||
vector currentBStreamPoint(0, 0, 0);
|
||||
|
||||
forAll(curBPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curBPoints[pointi]] == 1)
|
||||
{
|
||||
// The point has been visited
|
||||
currentBStream = streamFunction[curBPoints[pointi]];
|
||||
currentBStreamPoint = points[curBPoints[pointi]];
|
||||
|
||||
bPointFound = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bPointFound)
|
||||
{
|
||||
// Sort out other points on the face
|
||||
forAll(curBPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curBPoints[pointi]] == 0)
|
||||
{
|
||||
label patchNo =
|
||||
mesh_.boundaryMesh().whichPatch(facei);
|
||||
|
||||
if
|
||||
(
|
||||
!isType<emptyPolyPatch>(patches[patchNo])
|
||||
&& !isType<symmetryPlanePolyPatch>
|
||||
(patches[patchNo])
|
||||
&& !isType<symmetryPolyPatch>(patches[patchNo])
|
||||
&& !isType<wedgePolyPatch>(patches[patchNo])
|
||||
)
|
||||
{
|
||||
label faceNo =
|
||||
mesh_.boundaryMesh()[patchNo]
|
||||
.whichFace(facei);
|
||||
|
||||
vector edgeHat =
|
||||
points[curBPoints[pointi]]
|
||||
- currentBStreamPoint;
|
||||
edgeHat.replace(slabDir, 0);
|
||||
edgeHat /= mag(edgeHat);
|
||||
|
||||
vector nHat = unitAreas[facei];
|
||||
|
||||
if (edgeHat.y() > VSMALL)
|
||||
{
|
||||
visitedPoint[curBPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curBPoints[pointi]] =
|
||||
currentBStream
|
||||
+ phi.boundaryField()[patchNo][faceNo]
|
||||
*sign(nHat.x());
|
||||
}
|
||||
else if (edgeHat.y() < -VSMALL)
|
||||
{
|
||||
visitedPoint[curBPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curBPoints[pointi]] =
|
||||
currentBStream
|
||||
- phi.boundaryField()[patchNo][faceNo]
|
||||
*sign(nHat.x());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (edgeHat.x() > VSMALL)
|
||||
{
|
||||
visitedPoint[curBPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curBPoints[pointi]] =
|
||||
currentBStream
|
||||
+ phi.boundaryField()[patchNo][faceNo]
|
||||
*sign(nHat.y());
|
||||
}
|
||||
else if (edgeHat.x() < -VSMALL)
|
||||
{
|
||||
visitedPoint[curBPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curBPoints[pointi]] =
|
||||
currentBStream
|
||||
- phi.boundaryField()[patchNo][faceNo]
|
||||
*sign(nHat.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finished = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (label facei=0; facei<nInternalFaces; facei++)
|
||||
{
|
||||
// Get the list of point labels for the face
|
||||
const labelList& curPoints = faces[facei];
|
||||
|
||||
bool pointFound = false;
|
||||
|
||||
scalar currentStream = 0.0;
|
||||
point currentStreamPoint(0, 0, 0);
|
||||
|
||||
forAll(curPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curPoints[pointi]] == 1)
|
||||
{
|
||||
// The point has been visited
|
||||
currentStream = streamFunction[curPoints[pointi]];
|
||||
currentStreamPoint = points[curPoints[pointi]];
|
||||
pointFound = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pointFound)
|
||||
{
|
||||
// Sort out other points on the face
|
||||
forAll(curPoints, pointi)
|
||||
{
|
||||
// Check if the point has been visited
|
||||
if (visitedPoint[curPoints[pointi]] == 0)
|
||||
{
|
||||
vector edgeHat =
|
||||
points[curPoints[pointi]] - currentStreamPoint;
|
||||
|
||||
edgeHat.replace(slabDir, 0);
|
||||
edgeHat /= mag(edgeHat);
|
||||
|
||||
vector nHat = unitAreas[facei];
|
||||
|
||||
if (edgeHat.y() > VSMALL)
|
||||
{
|
||||
visitedPoint[curPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curPoints[pointi]] =
|
||||
currentStream
|
||||
+ phi[facei]*sign(nHat.x());
|
||||
}
|
||||
else if (edgeHat.y() < -VSMALL)
|
||||
{
|
||||
visitedPoint[curPoints[pointi]] = 1;
|
||||
nVisited++;
|
||||
|
||||
streamFunction[curPoints[pointi]] =
|
||||
currentStream
|
||||
- phi[facei]*sign(nHat.x());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finished = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (nVisited == nVisitedOld)
|
||||
{
|
||||
// Find new seed. This must be a
|
||||
// multiply connected domain
|
||||
Log << " Exhausted a seed, looking for new seed "
|
||||
<< "(this is correct for multiply connected domains).";
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
nVisitedOld = nVisited;
|
||||
}
|
||||
} while (!finished);
|
||||
} while (!finished);
|
||||
|
||||
// Normalise the stream-function by the 2D mesh thickness
|
||||
streamFunction /= thickness;
|
||||
streamFunction.boundaryFieldRef() = 0.0;
|
||||
|
||||
return tstreamFunction;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::streamFunction::calc()
|
||||
{
|
||||
if (foundObject<surfaceScalarField>(fieldName_))
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh_.lookupObject<surfaceScalarField>(fieldName_);
|
||||
|
||||
return store(resultName_, calc(phi));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::streamFunction::streamFunction
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fieldExpression(name, runTime, dict, "phi")
|
||||
{
|
||||
setResultName("streamFunction", "phi");
|
||||
|
||||
label nD = mesh_.nGeometricD();
|
||||
|
||||
if (nD != 2)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Case is not 2D, stream-function cannot be computed"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::streamFunction::~streamFunction()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
105
src/functionObjects/field/streamFunction/streamFunction.H
Normal file
105
src/functionObjects/field/streamFunction/streamFunction.H
Normal file
@ -0,0 +1,105 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::streamFunction
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and outputs the stream-function as a
|
||||
pointScalarField.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
streamFunction.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_streamFunction_H
|
||||
#define functionObjects_streamFunction_H
|
||||
|
||||
#include "fieldExpression.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "pointFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class streamFunction Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class streamFunction
|
||||
:
|
||||
public fieldExpression
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
tmp<pointScalarField> calc(const surfaceScalarField& phi) const;
|
||||
|
||||
//- Calculate the stream-function and return true if successful
|
||||
virtual bool calc();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("streamFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
streamFunction
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~streamFunction();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,9 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object generates streamline data by sampling a set of
|
||||
user-specified fields along a particle track, transported by a
|
||||
user-specified velocity field.
|
||||
Generates streamline data by sampling a set of user-specified fields along a
|
||||
particle track, transported by a user-specified velocity field.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -27,8 +27,7 @@ Class
|
||||
Group grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object linearly interpolates volume fields to generate
|
||||
surface fields
|
||||
Linearly interpolates volume fields to generate surface fields.
|
||||
|
||||
Fields are stored
|
||||
- every time step the field is updated with new values
|
||||
|
||||
@ -28,8 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object stores turbulence fields on the mesh database for
|
||||
further manipulation.
|
||||
Stores turbulence fields on the mesh database for further manipulation.
|
||||
|
||||
Fields are stored as copies of the original, with the prefix
|
||||
"tubulenceModel:", e.g.:
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the vorticity, the curl of the velocity.
|
||||
Calculates the vorticity, the curl of the velocity.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object generates streamline data by sampling a set of
|
||||
user-specified fields along a particle track, transported by a
|
||||
user-specified velocity field, constrained to a patch.
|
||||
Generates streamline data by sampling a set of user-specified fields along a
|
||||
particle track, transported by a user-specified velocity field, constrained
|
||||
to a patch.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
286
src/functionObjects/field/wallHeatFlux/wallHeatFlux.C
Normal file
286
src/functionObjects/field/wallHeatFlux/wallHeatFlux.C
Normal file
@ -0,0 +1,286 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "wallHeatFlux.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "fvcSnGrad.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(wallHeatFlux, 0);
|
||||
addToRunTimeSelectionTable(functionObject, wallHeatFlux, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::wallHeatFlux::writeFileHeader(const label i)
|
||||
{
|
||||
// Add headers to output data
|
||||
writeHeader(file(), "Wall heat-flux");
|
||||
writeCommented(file(), "Time");
|
||||
writeTabbed(file(), "patch");
|
||||
writeTabbed(file(), "min");
|
||||
writeTabbed(file(), "max");
|
||||
writeTabbed(file(), "integral");
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::wallHeatFlux::calcHeatFlux
|
||||
(
|
||||
const compressible::turbulenceModel& model,
|
||||
volScalarField& wallHeatFlux
|
||||
)
|
||||
{
|
||||
surfaceScalarField heatFlux
|
||||
(
|
||||
fvc::interpolate(model.alphaEff())*fvc::snGrad(model.transport().he())
|
||||
);
|
||||
|
||||
volScalarField::Boundary& wallHeatFluxBf =
|
||||
wallHeatFlux.boundaryFieldRef();
|
||||
|
||||
const surfaceScalarField::Boundary& heatFluxBf =
|
||||
heatFlux.boundaryField();
|
||||
|
||||
forAll(wallHeatFluxBf, patchi)
|
||||
{
|
||||
wallHeatFluxBf[patchi] = heatFluxBf[patchi];
|
||||
}
|
||||
|
||||
if (foundObject<volScalarField>("Qr"))
|
||||
{
|
||||
const volScalarField& Qr = lookupObject<volScalarField>("Qr");
|
||||
|
||||
const volScalarField::Boundary& radHeatFluxBf =
|
||||
Qr.boundaryField();
|
||||
|
||||
forAll(wallHeatFluxBf, patchi)
|
||||
{
|
||||
wallHeatFluxBf[patchi] += radHeatFluxBf[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::wallHeatFlux::wallHeatFlux
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
writeFiles(name, runTime, dict, name),
|
||||
patchSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volScalarField* wallHeatFluxPtr
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
type(),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/pow3(dimTime), 0)
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(wallHeatFluxPtr);
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::wallHeatFlux::~wallHeatFlux()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
|
||||
{
|
||||
writeFiles::read(dict);
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
patchSet_ =
|
||||
mesh.boundaryMesh().patchSet
|
||||
(
|
||||
wordReList(dict.lookupOrDefault("patches", wordReList()))
|
||||
);
|
||||
|
||||
Info<< type() << " " << name() << ":" << nl;
|
||||
|
||||
if (patchSet_.empty())
|
||||
{
|
||||
forAll(pbm, patchi)
|
||||
{
|
||||
if (isA<wallPolyPatch>(pbm[patchi]))
|
||||
{
|
||||
patchSet_.insert(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " processing all wall patches" << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " processing wall patches: " << nl;
|
||||
labelHashSet filteredPatchSet;
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
label patchi = iter.key();
|
||||
if (isA<wallPolyPatch>(pbm[patchi]))
|
||||
{
|
||||
filteredPatchSet.insert(patchi);
|
||||
Info<< " " << pbm[patchi].name() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Requested wall heat-flux on non-wall boundary "
|
||||
<< "type patch: " << pbm[patchi].name() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
patchSet_ = filteredPatchSet;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::wallHeatFlux::execute()
|
||||
{
|
||||
volScalarField& wallHeatFlux = const_cast<volScalarField&>
|
||||
(
|
||||
lookupObject<volScalarField>(type())
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
foundObject<compressible::turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
)
|
||||
)
|
||||
{
|
||||
const compressible::turbulenceModel& turbModel =
|
||||
lookupObject<compressible::turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
calcHeatFlux(turbModel, wallHeatFlux);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to find compressible turbulence model in the "
|
||||
<< "database" << exit(FatalError);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::wallHeatFlux::write()
|
||||
{
|
||||
writeFiles::write();
|
||||
|
||||
const volScalarField& wallHeatFlux =
|
||||
obr_.lookupObject<volScalarField>(type());
|
||||
|
||||
Log << type() << " " << name() << " write:" << nl
|
||||
<< " writing field " << wallHeatFlux.name() << endl;
|
||||
|
||||
wallHeatFlux.write();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const fvPatchList& patches = mesh.boundary();
|
||||
|
||||
const surfaceScalarField::Boundary& magSf =
|
||||
mesh.magSf().boundaryField();
|
||||
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
label patchi = iter.key();
|
||||
const fvPatch& pp = patches[patchi];
|
||||
|
||||
const scalarField& hfp =
|
||||
wallHeatFlux.boundaryField()[patchi];
|
||||
|
||||
const scalar minHfp = gMin(hfp);
|
||||
const scalar maxHfp = gMax(hfp);
|
||||
const scalar integralHfp = gSum(magSf[patchi]*hfp);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << mesh.time().value()
|
||||
<< token::TAB << pp.name()
|
||||
<< token::TAB << minHfp
|
||||
<< token::TAB << maxHfp
|
||||
<< token::TAB << integralHfp
|
||||
<< endl;
|
||||
}
|
||||
|
||||
Log << " min/max(" << pp.name() << ") = "
|
||||
<< minHfp << ", " << maxHfp << ", " << integralHfp << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
169
src/functionObjects/field/wallHeatFlux/wallHeatFlux.H
Normal file
169
src/functionObjects/field/wallHeatFlux/wallHeatFlux.H
Normal file
@ -0,0 +1,169 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::wallHeatFlux
|
||||
|
||||
Group
|
||||
grpForcesFunctionObjects
|
||||
|
||||
Description
|
||||
Calculates and write the heat-flux at wall patches as the
|
||||
volScalarField field 'wallHeatFlux'.
|
||||
|
||||
All wall patches are included by default; to restrict the calculation to
|
||||
certain patches, use the optional 'patches' entry.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
wallHeatFlux1
|
||||
{
|
||||
type wallHeatFlux;
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
...
|
||||
patches (".*Wall");
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: wallHeatFlux | yes |
|
||||
patches | list of patches to process | no | all wall patches
|
||||
\endtable
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::writeFiles
|
||||
Foam::functionObjects::pressureTools
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
wallHeatFlux.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_wallHeatFlux_H
|
||||
#define functionObjects_wallHeatFlux_H
|
||||
|
||||
#include "writeFiles.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "HashSet.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wallHeatFlux Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wallHeatFlux
|
||||
:
|
||||
public writeFiles
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Optional list of patches to process
|
||||
labelHashSet patchSet_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Calculate the heat-flux
|
||||
void calcHeatFlux
|
||||
(
|
||||
const compressible::turbulenceModel& turbModel,
|
||||
volScalarField& wallHeatFlux
|
||||
);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
wallHeatFlux(const wallHeatFlux&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const wallHeatFlux&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("wallHeatFlux");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
wallHeatFlux
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~wallHeatFlux();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the wallHeatFlux data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Calculate the wall heat-flux
|
||||
virtual bool execute();
|
||||
|
||||
//- Write the wall heat-flux
|
||||
virtual bool write();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,9 +28,8 @@ Group
|
||||
grpForcesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object evaluates and outputs the shear stress at wall
|
||||
patches. The result is written as a volVectorField to time directories as
|
||||
field 'wallShearStress'
|
||||
Calculates and write the shear-stress at wall patches as
|
||||
the volVectorField field 'wallShearStress'.
|
||||
|
||||
\f[
|
||||
Stress = R \dot n
|
||||
@ -42,9 +41,9 @@ Description
|
||||
n | patch normal vector (into the domain)
|
||||
\endvartable
|
||||
|
||||
The shear stress (symmetrical) tensor field is retrieved from the
|
||||
turbulence model. All wall patches are included by default; to restrict
|
||||
the calculation to certain patches, use the optional 'patches' entry.
|
||||
The shear-stress symmetric tensor field is retrieved from the turbulence
|
||||
model. All wall patches are included by default; to restrict the
|
||||
calculation to certain patches, use the optional 'patches' entry.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
@ -114,7 +113,7 @@ protected:
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Calculate the shear stress
|
||||
//- Calculate the shear-stress
|
||||
void calcShearStress
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object writes the cell-centres volVectorField and the
|
||||
three component fields as volScalarFields.
|
||||
Writes the cell-centres volVectorField and the three component fields as
|
||||
volScalarFields.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object writes the cell-volumes volScalarField.
|
||||
Writes the cell-volumes volScalarField.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpForcesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object extends the Foam::forces function object by providing
|
||||
lift, drag and moment coefficients. The data can optionally be output into
|
||||
bins, defined in a given direction.
|
||||
Extends the forces functionObject by providing lift, drag and moment
|
||||
coefficients. The data can optionally be output into bins, defined in a
|
||||
given direction.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpForcesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates the forces and moments by integrating the
|
||||
pressure and skin-friction forces over a given list of patches.
|
||||
Calculates the forces and moments by integrating the pressure and
|
||||
skin-friction forces over a given list of patches.
|
||||
|
||||
Member function forces::write() calculates the forces/moments and
|
||||
writes the forces/moments into the file \<timeDir\>/forces.dat and bin
|
||||
|
||||
@ -28,8 +28,9 @@ Group
|
||||
grpLagrangianFunctionObjects
|
||||
|
||||
Description
|
||||
This function object outputs Lagrangian cloud information to a file. The
|
||||
current outputs include:
|
||||
Outputs Lagrangian cloud information to a file.
|
||||
|
||||
The current outputs include:
|
||||
- total current number of parcels
|
||||
- total current mass of parcels
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpSolversFunctionObjects
|
||||
|
||||
Description
|
||||
This function object evolves a passive scalar transport equation.
|
||||
Evolves a passive scalar transport equation.
|
||||
|
||||
- To specify the field name set the 'field' entry
|
||||
- To employ the same numerical schemes as another field set
|
||||
|
||||
@ -28,8 +28,7 @@ Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object provides a general interface to enable dynamic code
|
||||
compilation.
|
||||
Provides a general interface to enable dynamic code compilation.
|
||||
|
||||
The entries are
|
||||
codeInclude : include files
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object removes registered objects if present in the database
|
||||
Removes registered objects if present in the database.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object writes out the initial residual for specified fields.
|
||||
Writes out the initial residual for specified fields.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
|
||||
@ -28,9 +28,9 @@ Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object executes system calls, entered in the form of a
|
||||
string lists. Calls can be made at the following points in the
|
||||
calculation:
|
||||
Executes system calls, entered in the form of a string lists.
|
||||
|
||||
Calls can be made at the following points in the calculation:
|
||||
- every time step
|
||||
- every output time
|
||||
- end of the calculation
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object writes dictionaries on start-up, and on change
|
||||
Writes dictionaries on start-up and on change.
|
||||
|
||||
SourceFiles
|
||||
writeDictionary.C
|
||||
|
||||
@ -28,8 +28,8 @@ Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object allows specification of different writing frequency
|
||||
of objects registered to the database.
|
||||
Allows specification of different writing frequency of objects registered to
|
||||
the database.
|
||||
|
||||
It has similar functionality as the main time database through the
|
||||
writeControl setting:
|
||||
|
||||
Reference in New Issue
Block a user