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,3 @@
#if [ "$FV_HOME" -a -r $FV_HOME ] ; then
# wmake fieldview9Reader
#fi

View File

@ -0,0 +1,5 @@
errno.c
readerDatabase.C
fieldview9Reader.C
EXE = $(FOAM_APPBIN)/fvbinFoam

View File

@ -0,0 +1,105 @@
/*
* Note: compilation options takes from ld_fv script from Fieldview9.
* Only Linux tested.
*
*/
#if defined(linux) || defined(linux64)
FV_LIBS = \
$(FV_HOME)/user/obj/linux_x86/fv.o \
-lGL -lGLU -lXmu -lXp -lXt $(XLIBS) -ldl
#elif defined(solaris) || defined(solarisGcc)
FV_LIBS = \
$(FV_HOME)/user/obj/solaris/fv.o \
-i \
-L/usr/dt/lib -R/usr/dt/lib -lMrm -lXm \
-L/opt/SUNWits/Graphics-sw/xgl-3.0/lib \
-R/opt/SUNWits/Graphics-sw/xgl-3.0/lib -lxgl \
-L/usr/openwin/lib -R/usr/openwin/lib \
-L$(FV_HOME)/user/obj/solaris \
-lGL -lGLU -lXt $(XLIBS) \
-lgen -lnsl -lsocket -lw -lintl -ldl
#elif defined(sgiN32) || defined(sgiN32Gcc)
FV_LIBS = \
$(FV_HOME)/user/obj/iris/fv.o \
$(FV_HOME)/user/obj/iris/fv2.o \
$(FV_HOME)/user/obj/iris/fv3.o \
$(FV_HOME)/user/obj/iris/netserver.o \
$(FV_HOME)/user/obj/iris/pV_Server.o \
$(FV_HOME)/user/obj/iris/dore.o \
$(FV_HOME)/user/obj/iris/libpV3ser.a \
$(FV_HOME)/user/obj/iris/libgpvm3.a \
$(FV_HOME)/user/obj/iris/libpvm3.a \
$(FV_HOME)/user/obj/iris/libBLT.a \
$(FV_HOME)/user/obj/iris/libtk8.2.a \
$(FV_HOME)/user/obj/iris/libtcl8.2.a \
-lGL -lGLU -lgl \
-lMrm -lXm -lXt $(XLIBS) -lPW \
-lftn -lc
#elif defined(sgi64) || defined(sgi64Gcc)
FV_LIBS = \
$(FV_HOME)/user/obj/iris64/fv.o \
$(FV_HOME)/user/obj/iris64/fv2.o \
$(FV_HOME)/user/obj/iris64/fv3.o \
$(FV_HOME)/user/obj/iris64/netserver.o \
$(FV_HOME)/user/obj/iris64/pV_Server.o \
$(FV_HOME)/user/obj/iris64/dore.o \
$(FV_HOME)/user/obj/iris64/libpV3ser.a \
$(FV_HOME)/user/obj/iris64/libgpvm3.a \
$(FV_HOME)/user/obj/iris64/libpvm3.a \
$(FV_HOME)/user/obj/iris64/libBLT.a \
$(FV_HOME)/user/obj/iris64/libtk8.2.a \
$(FV_HOME)/user/obj/iris64/libtcl8.2.a \
-lGL -lGLU \
-lMrm -lXm -lXt $(XLIBS) -lPW \
-lftn -lc
#elif defined(ibm) || defined(ibmGcc)
FV_LIBS = \
-bh:4 -T512 -H512 \
-bmaxdata:0x60000000 \
$(FV_HOME)/user/obj/ibm_rs/fv.o \
-L/usr/lib -L$(FV_HOME)/user/obj/ibm_rs \
-lMrm -lXm -lXt -lX11 -lxlf90 \
-lGL -lGLU -lXext \
-lm -lc -lPW -lIM -lgl
#elif defined(hpux)
FV_LIBS = \
$(FV_HOME)/user/obj/hp_700/fv.o \
-L/opt/graphics/common/lib \
-L/usr/lib/Motif1.2 \
-L/opt/graphics/OpenGL/lib \
-L$(FV_HOME)/user/obj/hp_700 \
-lGL -lGLU -lXext \
-lXwindow -lhpgfx \
-lXhp11 -lMrm -lXm -lXt -lX11 \
-lM -lc -lPW -ldld -ldce $endlib \
-Wl,+b: -Wl,+s
#endif
EXE_INC = \
-I$(FV_HOME)/uns \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/browser/lnInclude \
-I$(FOAM_SRC)/lagrangian/basic/lnInclude \
EXE_LIBS = \
$(FV_LIBS) \
-lfiniteVolume \
-lmeshTools \

View File

@ -0,0 +1,56 @@
Fieldview9 reader module
------------------------
This is a version of the fvbin executable with a built-in reader for Foam
data.
1] Limitations
--------------
- only volScalarFields and volVectorFields and only on points, not on boundary.
- handles polyhedra by decomposition (introduces cell centre)
- no surface fields, no lagrangian fields, no tetFem fields.
- does not run in parallel
2] Building
-----------
It has only been tested on Linux. Other platforms should build with a little
bit of effort. Have a look at the Fieldview link script and see which options
you need to add to Make/options to make it build.
Instructions:
0. Make sure FV_HOME is set to the root of the FieldView installation.
(i.e. $FV_HOME/user should exist)
1. Add $FV_HOME/bin to your path and make sure you can actually run fv.
2. Make the new fv executable by typing
wmake
This should create an 'fvbinFoam' executable.
3. On Linux you can directly run this executable instead of through the 'fv'
script. On other machines you might have to backup the old $FV_HOME/bin/fvbin
executable and move the fvbinFoam one into its position. Now you can use the
fv script to start it all up.
3] Running
----------
After starting it up (see step above) you should have a 'Foam Reader' under
the 'Data Files' pull-down menu. This will open a file selection box. Go to the
case directory and click on any file. The reader will recognize that the
current directory is a case directory (it has checks for a 'constant' directory)
and start reading the mesh. It will
pop-up a box with time steps and a list of variables as usual.
In case of a case with topology changes (i.e. more than one mesh) it
will ask for the time step a second time. This is due to a limitation in
Fieldview. Choose the same time as before.
In the terminal window it will print various informational messages.
A not fairly well tested feature is cellSet displaying. Instead of selecting
a case directory selecting a cellSet (in a polyMesh/sets/ directory) it
will try to subset the mesh using the selected cellSet. It is not possible
to display fields on subsetted meshes.

View File

@ -0,0 +1 @@
int errno = 0;

View File

@ -0,0 +1,344 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "readerDatabase.H"
#include "demandDrivenData.H"
#include "fvMesh.H"
#include "fvMeshSubset.H"
#include "Time.H"
#include "fileName.H"
#include "instant.H"
#include "cellSet.H"
#include "cellModeller.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const bool Foam::readerDatabase::debug_ = Foam::env("readerDatabase");
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Gets cell numbers of all polyHedra
void Foam::readerDatabase::getPolyHedra()
{
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
DynamicList<label> polys(mesh().nCells()/100 + 1);
const cellShapeList& cellShapes = mesh().cellShapes();
forAll(cellShapes, celli)
{
const cellShape& cellShape = cellShapes[celli];
const cellModel& cellModel = cellShape.model();
if
(
(cellModel != tet)
&& (cellModel != pyr)
&& (cellModel != prism)
&& (cellModel != wedge)
&& (cellModel != tetWedge)
&& (cellModel != hex)
)
{
polys.append(celli);
}
}
polys.shrink();
Info<< "Found " << polys.size() << " polyhedral cells " << endl;
polys_.transfer(polys);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
Foam::readerDatabase::readerDatabase()
:
fieldviewNames_(10),
runTimePtr_(NULL),
meshPtr_(NULL),
setName_(""),
polys_(),
volScalarNames_(),
volVectorNames_()
{
// Initialize name mapping table. See note on static in header file.
fieldviewNames_.insert("alpha", "aalpha");
fieldviewNames_.insert("Alpha", "AAlpha");
fieldviewNames_.insert("fsmach", "ffsmach");
fieldviewNames_.insert("FSMach", "FFSMach");
fieldviewNames_.insert("re", "rre");
fieldviewNames_.insert("Re", "RRe");
fieldviewNames_.insert("time", "ttime");
fieldviewNames_.insert("Time", "TTime");
fieldviewNames_.insert("pi", "ppi");
fieldviewNames_.insert("PI", "PPI");
fieldviewNames_.insert("x", "xx");
fieldviewNames_.insert("X", "XX");
fieldviewNames_.insert("y", "yy");
fieldviewNames_.insert("Y", "YY");
fieldviewNames_.insert("z", "zz");
fieldviewNames_.insert("Z", "ZZ");
fieldviewNames_.insert("rcyl", "rrcyl");
fieldviewNames_.insert("Rcyl", "RRcyl");
fieldviewNames_.insert("theta", "ttheta");
fieldviewNames_.insert("Theta", "TTheta");
fieldviewNames_.insert("rsphere", "rrsphere");
fieldviewNames_.insert("Rsphere", "RRsphere");
fieldviewNames_.insert("k", "kk");
fieldviewNames_.insert("K", "KK");
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::readerDatabase::~readerDatabase()
{
deleteDemandDrivenData(meshPtr_);
deleteDemandDrivenData(runTimePtr_);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::Time& Foam::readerDatabase::runTime() const
{
if (!runTimePtr_)
{
FatalErrorIn("readerDatabase::runTime()")
<< "No database set" << abort(FatalError);
}
return *runTimePtr_;
}
const Foam::fvMesh& Foam::readerDatabase::mesh() const
{
if (!meshPtr_)
{
FatalErrorIn("readerDatabase::runTime()")
<< "No mesh set" << abort(FatalError);
}
if (setName_.size() == 0)
{
return *meshPtr_;
}
else
{
return meshPtr_->subMesh();
}
}
const Foam::labelList& Foam::readerDatabase::polys() const
{
return polys_;
}
const Foam::wordList& Foam::readerDatabase::volScalarNames() const
{
return volScalarNames_;
}
const Foam::wordList& Foam::readerDatabase::volVectorNames() const
{
return volVectorNames_;
}
const Foam::word& Foam::readerDatabase::getFvName(const word& foamName) const
{
if (fieldviewNames_.found(foamName))
{
return fieldviewNames_[foamName];
}
else
{
return foamName;
}
}
bool Foam::readerDatabase::setRunTime
(
const fileName& rootDir,
const fileName& caseName,
const word& setName
)
{
bool newDatabase = false;
if (runTimePtr_)
{
if
(
(runTimePtr_->caseName() != caseName)
|| (runTimePtr_->rootPath() != rootDir)
|| (setName_ != setName)
)
{
if (debug_)
{
Info<< "Deleting old mesh since deleting old database" << endl;
}
deleteDemandDrivenData(meshPtr_);
if (debug_)
{
Info<< "Deleting old database for " << runTimePtr_->caseName()
<< endl;
}
deleteDemandDrivenData(runTimePtr_);
}
}
setName_ = setName;
if (!runTimePtr_)
{
if (debug_)
{
Info<< "Deleting old mesh since loading new Time" << endl;
}
deleteDemandDrivenData(meshPtr_);
if (debug_)
{
Info<< "Creating database for " << caseName << endl;
}
runTimePtr_ = new Time(Time::controlDictName, rootDir, caseName);
newDatabase = true;
}
return newDatabase;
}
void Foam::readerDatabase::loadMesh()
{
deleteDemandDrivenData(meshPtr_);
Info<< "Loading new mesh" << endl;
meshPtr_ = new fvMeshSubset
(
*runTimePtr_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (setName_.size() != 0)
{
Info<< "Subsetting mesh based on cellSet " << setName_ << endl;
fvMeshSubset& mesh = *meshPtr_;
cellSet currentSet(mesh, setName_);
mesh.setCellSubset(currentSet);
}
getPolyHedra();
}
Foam::polyMesh::readUpdateState Foam::readerDatabase::setTime
(
const instant& timeInstance,
const label timeIndex
)
{
runTime().setTime(timeInstance, timeIndex);
polyMesh::readUpdateState meshChange;
if (meshPtr_)
{
// Update loaded mesh
meshChange = meshPtr_->readUpdate();
if ((setName_.size() != 0) && (meshChange != polyMesh::UNCHANGED))
{
Info<< "Subsetting mesh based on " << setName_ << endl;
fvMeshSubset& mesh = *meshPtr_;
cellSet currentSet(mesh, setName_);
mesh.setCellSubset(currentSet);
}
if
(
(meshChange == polyMesh::TOPO_CHANGE)
|| (meshChange == polyMesh::TOPO_PATCH_CHANGE)
)
{
getPolyHedra();
}
}
else
{
// Force new mesh to be loaded for current time
loadMesh();
meshChange = polyMesh::TOPO_CHANGE;
}
return meshChange;
}
void Foam::readerDatabase::setFieldNames
(
const wordList& vsNames,
const wordList& vvNames
)
{
volScalarNames_ = vsNames;
volVectorNames_ = vvNames;
}
// ************************************************************************* //

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::readerDatabase
Description
Singleton caching Foam database and mesh and various. Used in Fv reader
to keep track of data inbetween callbacks.
SourceFiles
readerDatabase.C
\*---------------------------------------------------------------------------*/
#ifndef readerDatabase_H
#define readerDatabase_H
#include "wordList.H"
#include "Time.H"
#include "polyMesh.H"
#include "label.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
class fvMeshSubset;
class Time;
class fileName;
class instant;
/*---------------------------------------------------------------------------*\
Class readerDatabase Declaration
\*---------------------------------------------------------------------------*/
class readerDatabase
{
// Private data
//- Names for protected Fieldview keywords. Gets set at construction
// time.
// Note: Should be static but this gives problem with construction
// order since *this is static as well.
HashTable<word> fieldviewNames_;
// Private data
//- Cached database
Time* runTimePtr_;
//- Cached mesh, guaranteed uptodate with runTime.
fvMeshSubset* meshPtr_;
//- Empty string or name of current set.
word setName_;
//- Cell labels of polyHedra. Uptodate with meshPtr.
labelList polys_;
//- All volScalarFields in all time directories
wordList volScalarNames_;
//- All volVectorFields ,,
wordList volVectorNames_;
// Private Member Functions
//- Gets cell numbers of all polyHedra
void getPolyHedra();
//- Disallow default bitwise copy construct
readerDatabase(const readerDatabase&);
//- Disallow default bitwise assignment
void operator=(const readerDatabase&);
public:
// Static
//- Debug flag. Note: uses envvar instead of controlDict since
// *this is static as well. Might be initialized before controlDict
// read.
const static bool debug_;
// Constructors
//- Construct null
readerDatabase();
// Destructor
~readerDatabase();
// Member Functions
// Access
const Time& runTime() const;
const fvMesh& mesh() const;
const labelList& polys() const;
const wordList& volScalarNames() const;
const wordList& volVectorNames() const;
//- Get fieldview compatible name.
const word& getFvName(const word& foamName) const;
// Edit
//- Create database (if nessecary).
// Returns true if new Time created, false if old one reused.
// Optional fvMeshSubset using setName.
bool setRunTime
(
const fileName& rootDir,
const fileName& caseName,
const word& setName
);
//- Forcibly load mesh.
void loadMesh();
//- Set time (use this instead of database::setTime), updates
// mesh as well and returns mesh update status
polyMesh::readUpdateState setTime(const instant&, const label);
//- Set volScalarNames, volVectorNames.
void setFieldNames(const wordList&, const wordList&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //