Creation of OpenFOAM-dev repository 15/04/2008

This commit is contained in:
OpenFOAM-admin
2008-04-15 18:56:58 +01:00
commit 3170c7c0c9
9896 changed files with 4016171 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// postChannel tool definition
description "Periodic channel flow statistics; works only for meshes with i-j-k style cell numbering; j numbering can accommodate multiple blocks";
postChannelDict
{
type dictionary;
description "postChannel control dictionary";
dictionaryPath "constant";
entries
{
arguments
{
type rootCaseArguments;
}
include "$FOAMX_CONFIG/entries/label/Nx.cfg";
Ny
{
type list;
description "Ny - number of cells in EACH BLOCK of mesh in y direction ";
elementType label;
}
include "$FOAMX_CONFIG/entries/label/Nz.cfg";
}
}
// ************************************************************************* //

View File

@ -0,0 +1,4 @@
postChannel.C
channelIndex.C
EXE = $(FOAM_APPBIN)/postChannel

View File

@ -0,0 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsampling \

View File

@ -0,0 +1,73 @@
/*
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",
Times[i].name(),
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",
Times[i].name(),
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",
Times[i].name(),
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",
Times[i].name(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, 0, 0)
);
txy = Txy - (Umeanx*Umeany);
txy.write();
*/

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "channelIndex.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
channelIndex::channelIndex(const fvMesh& m)
:
indexingDict_
(
IOobject
(
"postChannelDict",
m.time().constant(),
m,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
nx_(readLabel(indexingDict_.lookup("Nx"))),
ny_(indexingDict_.lookup("Ny")),
nz_(readLabel(indexingDict_.lookup("Nz"))),
symmetric_
(
readBool(indexingDict_.lookup("symmetric"))
),
cumNy_(ny_.size()),
nLayers_(ny_[0])
{
// initialise the layers
cumNy_[0] = ny_[0];
for (label j=1; j<ny_.size(); j++)
{
nLayers_ += ny_[j];
cumNy_[j] = ny_[j]+cumNy_[j-1];
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
channelIndex::~channelIndex()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalarField channelIndex::collapse
(
const volScalarField& vsf,
const bool asymmetric
) const
{
scalarField cs(nLayers(), 0.0);
forAll(cs, j)
{
// sweep over all cells in this layer
for (label i=0; i<nx(); i++)
{
for (label k=0; k<nz(); k++)
{
cs[j] += vsf[operator()(i,j,k)];
}
}
// and divide by the number of cells in the layer
cs[j] /= scalar(nx()*nz());
}
if (symmetric_)
{
label nlb2 = nLayers()/2;
if (asymmetric)
{
for (label j=0; j<nlb2; j++)
{
cs[j] = 0.5*(cs[j] - cs[nLayers() - j - 1]);
}
}
else
{
for (label j=0; j<nlb2; j++)
{
cs[j] = 0.5*(cs[j] + cs[nLayers() - j - 1]);
}
}
cs.setSize(nlb2);
}
return cs;
}
scalarField channelIndex::y
(
const volVectorField& cellCentres
) const
{
if (symmetric_)
{
scalarField Y(nLayers()/2);
for (label j=0; j<nLayers()/2; j++)
{
Y[j] = cellCentres[operator()(0, j, 0)].y();
}
return Y;
}
else
{
scalarField Y(nLayers());
for (label j=0; j<nLayers(); j++)
{
Y[j] = cellCentres[operator()(0, j, 0)].y();
}
return Y;
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
label channelIndex::operator()
(
const label Jx,
const label Jy,
const label Jz
) const
{
label index(0);
// count up `full' layers in the mesh
label j(0);
label tmpJy(Jy);
while(Jy >= cumNy_[j])
{
index += nx_*ny_[j]*nz_;
tmpJy -= ny_[j];
j++;
}
index += Jx + nx_*tmpJy + nx_*ny_[j]*Jz;
return index;
}
// ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::channelIndex
Description
does indexing for a standard (Christer-style) channel.
Assumes that the blocks are aranged in the y direction.
SourceFiles
channelIndex.C
channelIndexIO.C
\*---------------------------------------------------------------------------*/
#ifndef channelIndex_H
#define channelIndex_H
#include "fvCFD.H"
/*---------------------------------------------------------------------------*\
Class channelIndex Declaration
\*---------------------------------------------------------------------------*/
class channelIndex
{
// Private data
IOdictionary indexingDict_;
const label nx_;
const labelList ny_;
const label nz_;
const bool symmetric_;
labelList cumNy_;
label nLayers_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
channelIndex(const channelIndex&);
void operator=(const channelIndex&);
public:
// Constructors
channelIndex(const fvMesh& m);
// Destructor
~channelIndex();
// Member Functions
// Access
//- return number of layers
label nLayers() const
{
return nLayers_;
}
//- number of cells in X direction
label nx() const
{
return nx_;
}
//- number of cells in Z direction
label nz() const
{
return nz_;
}
//- collapse a field to a line
scalarField collapse
(
const volScalarField& vsf,
const bool asymmetric=false
) const;
//- return the field of Y locations from the cell centres
scalarField y
(
const volVectorField& cellCentres
) const;
// Member Operators
label operator()(const label, const label, const label) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
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));
scalarField y = channelIndexing.y(mesh.C());
makeGraph(y, UmeanXvalues, "Uf", R.path(), gFormat);
makeGraph(y, urmsValues, "u", R.path(), gFormat);
makeGraph(y, vrmsValues, "v", R.path(), gFormat);
makeGraph(y, wrmsValues, "w", R.path(), gFormat);
makeGraph(y, RxyValues, "uv", R.path(), gFormat);
makeGraph(y, kValues, "k", R.path(), gFormat);
makeGraph(y, pPrime2MeanValues, "pPrime2Mean", R.path(), gFormat);
makeGraph(y, epsilonValues, "epsilon", R.path(), gFormat);
/*
makeGraph(y, nuMeanValues, "nu", R.path(), gFormat);
makeGraph(y, nuPrimeValues, "nuPrime", R.path(), gFormat);
makeGraph(y, gammaDotMeanValues, "gammaDot", R.path(), gFormat);
makeGraph(y, gammaDotPrimeValues, "gammaDotPrime", R.path(), gFormat);
*/

View File

@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
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 "fvCFD.H"
#include "channelIndex.H"
#include "makeGraph.H"
#include "OSspecific.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createMesh.H"
# include "readTransportProperties.H"
const word& gFormat = runTime.graphFormat();
// Setup channel indexing for averaging over channel down to a line
channelIndex channelIndexing(mesh);
// For each time step read all fields
for (label i=startTime; i<endTime; i++)
{
runTime.setTime(Times[i], i);
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<< "end" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class dictionary;
object postChannelDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Nx 40;
Ny
(
50
);
Nz 30;
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
IOobject UmeanHeader
(
"Umean",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
);
if (!UmeanHeader.headerOk())
{
continue;
}
volVectorField Umean
(
UmeanHeader,
mesh
);
volSymmTensorField R
(
IOobject
(
"R",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
),
mesh
);
volScalarField Rxx(R.component(symmTensor::XX));
volScalarField Ryy(R.component(symmTensor::YY));
volScalarField Rzz(R.component(symmTensor::ZZ));
volScalarField Rxy(R.component(symmTensor::XY));
volScalarField pPrime2Mean
(
IOobject
(
"pPrime2Mean",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
),
mesh
);
volScalarField epsilonMean
(
IOobject
(
"epsilonMean",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
),
mesh
);
/*
volScalarField nuMean
(
IOobject
(
"nuMean",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
),
mesh
);
volScalarField gammaDotMean
(
IOobject
(
"gammaDotMean",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
),
mesh
);
volScalarField nuPrime2
(
IOobject
(
"nuPrime",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
),
mesh
);
volScalarField nuPrime = sqrt(mag(nuPrime2 - sqr(nuMean)));
volScalarField gammaDotPrime2
(
IOobject
(
"gammaDotPrime",
runTime.times()[i].name(),
mesh,
IOobject::MUST_READ
),
mesh
);
volScalarField gammaDotPrime = sqrt(mag(gammaDotPrime2 -sqr(gammaDotMean)));
*/

View File

@ -0,0 +1,13 @@
Info<< nl << "Reading transportProperties" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);