functionObjects: layerAverage: Replacment for postChannel
This function generates plots of fields averaged over the layers in the
mesh. It is a generalised replacement for the postChannel utility, which
has been removed. An example of this function's usage is as follows:
layerAverage1
{
type layerAverage;
libs ("libfieldFunctionObjects.so");
writeControl writeTime;
setFormat raw;
// Patches and/or zones from which layers extrude
patches (bottom);
zones (quarterPlane threeQuartersPlane);
// Spatial component against which to plot
component y;
// Is the geometry symmetric around the centre layer?
symmetric true;
// Fields to average and plot
fields (pMean pPrime2Mean UMean UPrime2Mean k);
}
This commit is contained in:
@ -1,4 +0,0 @@
|
||||
postChannel.C
|
||||
channelIndex.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/postChannel
|
||||
@ -1,10 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields \
|
||||
-lsampling
|
||||
@ -1,73 +0,0 @@
|
||||
/*
|
||||
volTensorField gradU(fvc::grad(U));
|
||||
volSymmTensorField D(symm(fvc::grad(U)));
|
||||
volTensorField Dprim(symm(fvc::grad(U - UMean)));
|
||||
|
||||
volScalarField prod(-((U - UMean)*(U - UMean)) && D);
|
||||
*/
|
||||
|
||||
/*
|
||||
volScalarField txx
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"txx",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 1, -1, 0, 0)
|
||||
);
|
||||
txx =sqrt(Txx - (UMeanx*UMeanx));
|
||||
txx.write();
|
||||
|
||||
volScalarField tyy
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tyy",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 1, -1, 0, 0)
|
||||
);
|
||||
tyy = sqrt(Tyy - (UMeany*UMeany));
|
||||
tyy.write();
|
||||
|
||||
volScalarField tzz
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tzz",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 1, -1, 0, 0)
|
||||
);
|
||||
tzz = sqrt(Tzz - (UMeanz*UMeanz));
|
||||
tzz.write();
|
||||
|
||||
volScalarField txy
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"txy",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionSet(0, 2, -2, 0, 0)
|
||||
);
|
||||
txy = Txy - (UMeanx*UMeany);
|
||||
txy.write();
|
||||
*/
|
||||
@ -1,293 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 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 "channelIndex.H"
|
||||
#include "boolList.H"
|
||||
#include "syncTools.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
#include "Time.H"
|
||||
#include "SortableList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::vector::components,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"x",
|
||||
"y",
|
||||
"z"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::vector::components, 3>
|
||||
Foam::channelIndex::vectorComponentsNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Determines face blocking
|
||||
void Foam::channelIndex::walkOppositeFaces
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& startFaces,
|
||||
boolList& blockedFace
|
||||
)
|
||||
{
|
||||
const cellList& cells = mesh.cells();
|
||||
const faceList& faces = mesh.faces();
|
||||
label nBnd = mesh.nFaces() - mesh.nInternalFaces();
|
||||
|
||||
DynamicList<label> frontFaces(startFaces);
|
||||
forAll(frontFaces, i)
|
||||
{
|
||||
label facei = frontFaces[i];
|
||||
blockedFace[facei] = true;
|
||||
}
|
||||
|
||||
while (returnReduce(frontFaces.size(), sumOp<label>()) > 0)
|
||||
{
|
||||
// Transfer across.
|
||||
boolList isFrontBndFace(nBnd, false);
|
||||
forAll(frontFaces, i)
|
||||
{
|
||||
label facei = frontFaces[i];
|
||||
|
||||
if (!mesh.isInternalFace(facei))
|
||||
{
|
||||
isFrontBndFace[facei-mesh.nInternalFaces()] = true;
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, isFrontBndFace);
|
||||
|
||||
// Add
|
||||
forAll(isFrontBndFace, i)
|
||||
{
|
||||
label facei = mesh.nInternalFaces()+i;
|
||||
if (isFrontBndFace[i] && !blockedFace[facei])
|
||||
{
|
||||
blockedFace[facei] = true;
|
||||
frontFaces.append(facei);
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer across cells
|
||||
DynamicList<label> newFrontFaces(frontFaces.size());
|
||||
|
||||
forAll(frontFaces, i)
|
||||
{
|
||||
label facei = frontFaces[i];
|
||||
|
||||
{
|
||||
const cell& ownCell = cells[mesh.faceOwner()[facei]];
|
||||
|
||||
label oppositeFacei = ownCell.opposingFaceLabel(facei, faces);
|
||||
|
||||
if (oppositeFacei == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face:" << facei << " owner cell:" << ownCell
|
||||
<< " is not a hex?" << abort(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!blockedFace[oppositeFacei])
|
||||
{
|
||||
blockedFace[oppositeFacei] = true;
|
||||
newFrontFaces.append(oppositeFacei);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh.isInternalFace(facei))
|
||||
{
|
||||
const cell& neiCell = mesh.cells()[mesh.faceNeighbour()[facei]];
|
||||
|
||||
label oppositeFacei = neiCell.opposingFaceLabel(facei, faces);
|
||||
|
||||
if (oppositeFacei == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face:" << facei << " neighbour cell:" << neiCell
|
||||
<< " is not a hex?" << abort(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!blockedFace[oppositeFacei])
|
||||
{
|
||||
blockedFace[oppositeFacei] = true;
|
||||
newFrontFaces.append(oppositeFacei);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frontFaces.transfer(newFrontFaces);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calculate regions.
|
||||
void Foam::channelIndex::calcLayeredRegions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& startFaces
|
||||
)
|
||||
{
|
||||
boolList blockedFace(mesh.nFaces(), false);
|
||||
walkOppositeFaces
|
||||
(
|
||||
mesh,
|
||||
startFaces,
|
||||
blockedFace
|
||||
);
|
||||
|
||||
|
||||
if (false)
|
||||
{
|
||||
OFstream str(mesh.time().path()/"blockedFaces.obj");
|
||||
label vertI = 0;
|
||||
forAll(blockedFace, facei)
|
||||
{
|
||||
if (blockedFace[facei])
|
||||
{
|
||||
const face& f = mesh.faces()[facei];
|
||||
forAll(f, fp)
|
||||
{
|
||||
meshTools::writeOBJ(str, mesh.points()[f[fp]]);
|
||||
}
|
||||
str<< 'f';
|
||||
forAll(f, fp)
|
||||
{
|
||||
str << ' ' << vertI+fp+1;
|
||||
}
|
||||
str << nl;
|
||||
vertI += f.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Do analysis for connected regions
|
||||
cellRegion_.reset(new regionSplit(mesh, blockedFace));
|
||||
|
||||
Info<< "Detected " << cellRegion_().nRegions() << " layers." << nl << endl;
|
||||
|
||||
// Sum number of entries per region
|
||||
regionCount_ = regionSum(scalarField(mesh.nCells(), 1.0));
|
||||
|
||||
// Average cell centres to determine ordering.
|
||||
pointField regionCc
|
||||
(
|
||||
regionSum(mesh.cellCentres())
|
||||
/ regionCount_
|
||||
);
|
||||
|
||||
SortableList<scalar> sortComponent(regionCc.component(dir_));
|
||||
|
||||
sortMap_ = sortComponent.indices();
|
||||
|
||||
y_ = sortComponent;
|
||||
|
||||
if (symmetric_)
|
||||
{
|
||||
y_.setSize(cellRegion_().nRegions()/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::channelIndex::channelIndex
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
symmetric_(readBool(dict.lookup("symmetric"))),
|
||||
dir_(vectorComponentsNames_.read(dict.lookup("component")))
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
const wordList patchNames(dict.lookup("patches"));
|
||||
|
||||
label nFaces = 0;
|
||||
|
||||
forAll(patchNames, i)
|
||||
{
|
||||
const label patchi = patches.findPatchID(patchNames[i]);
|
||||
|
||||
if (patchi == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal patch " << patchNames[i]
|
||||
<< ". Valid patches are " << patches.name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
nFaces += patches[patchi].size();
|
||||
}
|
||||
|
||||
labelList startFaces(nFaces);
|
||||
nFaces = 0;
|
||||
|
||||
forAll(patchNames, i)
|
||||
{
|
||||
const polyPatch& pp = patches[patchNames[i]];
|
||||
|
||||
forAll(pp, j)
|
||||
{
|
||||
startFaces[nFaces++] = pp.start()+j;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate regions.
|
||||
calcLayeredRegions(mesh, startFaces);
|
||||
}
|
||||
|
||||
|
||||
Foam::channelIndex::channelIndex
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& startFaces,
|
||||
const bool symmetric,
|
||||
const direction dir
|
||||
)
|
||||
:
|
||||
symmetric_(symmetric),
|
||||
dir_(dir)
|
||||
{
|
||||
// Calculate regions.
|
||||
calcLayeredRegions(mesh, startFaces);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,160 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 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::channelIndex
|
||||
|
||||
Description
|
||||
Does averaging of fields over layers of cells. Assumes layered mesh.
|
||||
|
||||
SourceFiles
|
||||
channelIndex.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef channelIndex_H
|
||||
#define channelIndex_H
|
||||
|
||||
#include "regionSplit.H"
|
||||
#include "direction.H"
|
||||
#include "scalarField.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class channelIndex Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class channelIndex
|
||||
{
|
||||
|
||||
// Private Data
|
||||
|
||||
static const NamedEnum<vector::components, 3> vectorComponentsNames_;
|
||||
|
||||
//- Is mesh symmetric
|
||||
const bool symmetric_;
|
||||
|
||||
//- Direction to sort
|
||||
const direction dir_;
|
||||
|
||||
//- Per cell the global region
|
||||
autoPtr<regionSplit> cellRegion_;
|
||||
|
||||
//- Per global region the number of cells (scalarField so we can use
|
||||
// field algebra)
|
||||
scalarField regionCount_;
|
||||
|
||||
//- From sorted region back to unsorted global region
|
||||
labelList sortMap_;
|
||||
|
||||
//- Sorted component of cell centres
|
||||
scalarField y_;
|
||||
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void walkOppositeFaces
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& startFaces,
|
||||
boolList& blockedFace
|
||||
);
|
||||
|
||||
void calcLayeredRegions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& startFaces
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
channelIndex(const polyMesh&, const dictionary&);
|
||||
|
||||
//- Construct from supplied starting faces
|
||||
channelIndex
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& startFaces,
|
||||
const bool symmetric,
|
||||
const direction dir
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
channelIndex(const channelIndex&) = delete;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Sum field per region
|
||||
template<class T>
|
||||
Field<T> regionSum(const Field<T>& cellField) const;
|
||||
|
||||
//- Collapse a field to a line
|
||||
template<class T>
|
||||
Field<T> collapse
|
||||
(
|
||||
const Field<T>& vsf,
|
||||
const bool asymmetric=false
|
||||
) const;
|
||||
|
||||
//- Return the field of Y locations from the cell centres
|
||||
const scalarField& y() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const channelIndex&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "channelIndexTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,102 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 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 "channelIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
|
||||
{
|
||||
Field<T> regionField(cellRegion_().nRegions(), Zero);
|
||||
|
||||
forAll(cellRegion_(), celli)
|
||||
{
|
||||
regionField[cellRegion_()[celli]] += cellField[celli];
|
||||
}
|
||||
|
||||
// Global sum
|
||||
Pstream::listCombineGather(regionField, plusEqOp<T>());
|
||||
Pstream::listCombineScatter(regionField);
|
||||
|
||||
return regionField;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::Field<T> Foam::channelIndex::collapse
|
||||
(
|
||||
const Field<T>& cellField,
|
||||
const bool asymmetric
|
||||
) const
|
||||
{
|
||||
// Average and order
|
||||
const Field<T> summedField(regionSum(cellField));
|
||||
|
||||
Field<T> regionField
|
||||
(
|
||||
summedField
|
||||
/ regionCount_,
|
||||
sortMap_
|
||||
);
|
||||
|
||||
// Symmetry?
|
||||
if (symmetric_)
|
||||
{
|
||||
label nlb2 = cellRegion_().nRegions()/2;
|
||||
|
||||
if (asymmetric)
|
||||
{
|
||||
for (label j=0; j<nlb2; j++)
|
||||
{
|
||||
regionField[j] =
|
||||
0.5
|
||||
* (
|
||||
regionField[j]
|
||||
- regionField[cellRegion_().nRegions() - j - 1]
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (label j=0; j<nlb2; j++)
|
||||
{
|
||||
regionField[j] =
|
||||
0.5
|
||||
* (
|
||||
regionField[j]
|
||||
+ regionField[cellRegion_().nRegions() - j - 1]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
regionField.setSize(nlb2);
|
||||
}
|
||||
|
||||
return regionField;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,69 +0,0 @@
|
||||
scalarField UMeanXvalues
|
||||
(
|
||||
channelIndexing.collapse(UMean.component(vector::X)())
|
||||
);
|
||||
|
||||
scalarField UMeanYvalues
|
||||
(
|
||||
channelIndexing.collapse(UMean.component(vector::Y)())
|
||||
);
|
||||
|
||||
scalarField UMeanZvalues
|
||||
(
|
||||
channelIndexing.collapse(UMean.component(vector::Z)())
|
||||
);
|
||||
|
||||
scalarField RxxValues(channelIndexing.collapse(Rxx));
|
||||
scalarField RyyValues(channelIndexing.collapse(Ryy));
|
||||
scalarField RzzValues(channelIndexing.collapse(Rzz));
|
||||
scalarField RxyValues(channelIndexing.collapse(Rxy, true));
|
||||
|
||||
scalarField pPrime2MeanValues(channelIndexing.collapse(pPrime2Mean));
|
||||
|
||||
/*
|
||||
scalarField epsilonValues(channelIndexing.collapse(epsilonMean));
|
||||
|
||||
scalarField nuMeanValues(channelIndexing.collapse(nuMean));
|
||||
scalarField nuPrimeValues(channelIndexing.collapse(nuPrime));
|
||||
|
||||
scalarField gammaDotMeanValues(channelIndexing.collapse(gammaDotMean));
|
||||
scalarField gammaDotPrimeValues(channelIndexing.collapse(gammaDotPrime));
|
||||
*/
|
||||
|
||||
scalarField urmsValues(sqrt(mag(RxxValues)));
|
||||
scalarField vrmsValues(sqrt(mag(RyyValues)));
|
||||
scalarField wrmsValues(sqrt(mag(RzzValues)));
|
||||
|
||||
scalarField kValues
|
||||
(
|
||||
0.5*(sqr(urmsValues) + sqr(vrmsValues) + sqr(wrmsValues))
|
||||
);
|
||||
|
||||
setWriter::New(runTime.graphFormat())->write
|
||||
(
|
||||
runTime.globalPath()
|
||||
/functionObjects::writeFile::outputPrefix
|
||||
/args.executable()
|
||||
/runTime.timeName(),
|
||||
|
||||
args.executable(),
|
||||
|
||||
coordSet(true, "y", channelIndexing.y()),
|
||||
|
||||
"Uf", UMeanXvalues,
|
||||
|
||||
"u", urmsValues,
|
||||
"v", vrmsValues,
|
||||
"w", wrmsValues,
|
||||
"uv", RxyValues,
|
||||
|
||||
"k", kValues,
|
||||
|
||||
"pPrime2Mean", pPrime2MeanValues
|
||||
|
||||
// "epsilon", epsilonValues,
|
||||
// "nu", nuMeanValues,
|
||||
// "nuPrime", nuPrimeValues,
|
||||
// "gammaDot", gammaDotMeanValues,
|
||||
// "gammaDotPrime", gammaDotPrimeValues
|
||||
);
|
||||
@ -1,97 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
postChannel
|
||||
|
||||
Description
|
||||
Post-processes data from channel flow calculations.
|
||||
|
||||
For each time: calculate: txx, txy,tyy, txy,
|
||||
eps, prod, vorticity, enstrophy and helicity. Assuming that the mesh
|
||||
is periodic in the x and z directions, collapse Umeanx, Umeany, txx,
|
||||
txy and tyy to a line and print them as standard output.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "volFields.H"
|
||||
#include "channelIndex.H"
|
||||
#include "setWriter.H"
|
||||
#include "writeFile.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
timeSelector::addOptions();
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
#include "createMeshNoChangers.H"
|
||||
#include "readPhysicalProperties.H"
|
||||
|
||||
// Setup channel indexing for averaging over channel down to a line
|
||||
|
||||
IOdictionary channelDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"postChannelDict",
|
||||
mesh.time().system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
channelIndex channelIndexing(mesh, channelDict);
|
||||
|
||||
|
||||
// For each time step read all fields
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
Info<< "Collapsing fields for time " << runTime.timeName() << endl;
|
||||
|
||||
#include "readFields.H"
|
||||
#include "calculateFields.H"
|
||||
|
||||
// Average fields over channel down to a line
|
||||
#include "collapse.H"
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,112 +0,0 @@
|
||||
typeIOobject<volVectorField> UMeanHeader
|
||||
(
|
||||
"UMean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
if (!UMeanHeader.headerOk())
|
||||
{
|
||||
Info<< " No UMean field" << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
volVectorField UMean
|
||||
(
|
||||
UMeanHeader,
|
||||
mesh
|
||||
);
|
||||
|
||||
volSymmTensorField UPrime2Mean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"UPrime2Mean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
volScalarField Rxx(UPrime2Mean.component(symmTensor::XX));
|
||||
volScalarField Ryy(UPrime2Mean.component(symmTensor::YY));
|
||||
volScalarField Rzz(UPrime2Mean.component(symmTensor::ZZ));
|
||||
volScalarField Rxy(UPrime2Mean.component(symmTensor::XY));
|
||||
|
||||
volScalarField pPrime2Mean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pPrime2Mean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
/*
|
||||
volScalarField epsilonMean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"epsilonMean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField nuMean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nuMean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField gammaDotMean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gammaDotMean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField nuPrime2
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nuPrime",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
volScalarField nuPrime = sqrt(mag(nuPrime2 - sqr(nuMean)));
|
||||
|
||||
|
||||
volScalarField gammaDotPrime2
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gammaDotPrime",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
mesh
|
||||
);
|
||||
volScalarField gammaDotPrime = sqrt(mag(gammaDotPrime2 -sqr(gammaDotMean)));
|
||||
*/
|
||||
@ -1,13 +0,0 @@
|
||||
Info<< nl << "Reading physicalProperties" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"physicalProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user