Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2009-03-04 12:20:51 +01:00
25 changed files with 637 additions and 278 deletions

4
.gitignore vendored
View File

@ -55,7 +55,7 @@ doc/[Dd]oxygen/man
# ignore .timeStamp in the main directory # ignore .timeStamp in the main directory
/.timeStamp /.timeStamp
# ignore .ebrowse in the main directory # ignore .tags in the main directory
/.ebrowse /.tags
# end-of-file # end-of-file

View File

@ -8,5 +8,4 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lincompressibleRASModels \ -lincompressibleRASModels \
-lincompressibleTransportModels \ -lincompressibleTransportModels \
-lfiniteVolume \ -lfiniteVolume
-lmeshTools

View File

@ -27,26 +27,27 @@
# foamEbrowse # foamEbrowse
# #
# Description # Description
# Build the Ebrowse database for all the .C and .H files # Build the Ebrowse database for all the .H and .C files
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
headersFile=${TMPDIR:-/tmp}/headersFile.$$
sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$ sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$
if [ $# -ne 0 ]; then if [ $# -ne 0 ]; then
echo "Usage : ${0##*/}" echo "Usage : ${0##*/}"
echo "" echo ""
echo "Build the Ebrowse dadbase for all the .C and .H files" echo "Build the Ebrowse dadbase for all the .H and .C files"
echo "" echo ""
exit 1 exit 1
fi fi
# Clean up on termination and on Ctrl-C # Clean up on termination and on Ctrl-C
trap 'rm -f $headersFile $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT trap 'rm -f $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT
cd $WM_PROJECT_DIR cd $WM_PROJECT_DIR
find -H . -name "*.H" | fgrep -v lnInclude > $headersFile mkdir .tags 2>/dev/null
find -H . -name "*.C" | fgrep -v lnInclude > $sourcesFile cd .tags
ebrowse --files=$headersFile --files=$sourcesFile --output-file=.ebrowse
find -H .. \( -name "*.[HC]" -not -name "lnInclude" -not -name "Doxygen" \) -print > $sourcesFile
ebrowse --files=$sourcesFile --output-file=ebrowse
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

56
bin/foamTags Executable file
View File

@ -0,0 +1,56 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 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
#
# Script
# foamTags
#
# Description
# Build the tags files for all the .C and .H files
#
#------------------------------------------------------------------------------
if [ $# -ne 0 ]; then
echo "Usage : ${0##*/}"
echo ""
echo "Build the tags files for all the .C and .H files"
echo ""
exit 1
fi
cd $WM_PROJECT_DIR
mkdir .tags 2>/dev/null
find -H . \( -name "*.[HC]" -not -name "lnInclude" -not -name "Doxygen" \) | \
etags --declarations -l c++ -o .tags/etags -
find -H . \( -name "*.[HC]" -not -name "lnInclude" -not -name "Doxygen" \) | \
etags -l c++ -o .tags/etagsDef -
find -H . \( -name "*.H" -not -name "lnInclude" -not -name "Doxygen" \) | \
etags --declarations -l c++ -o .tags/etagsDec -
gtags -i --gtagsconf bin/tools/gtagsrc .tags
foamEbrowse
#------------------------------------------------------------------------------

63
bin/tools/gtagsrc Normal file
View File

@ -0,0 +1,63 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 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
#
# Canfiguration file
# gtagsrc
#
# Description
# Configuration file for gtags(1).
#
#------------------------------------------------------------------------------
default:\
:tc=gtags:tc=htags:
#------------------------------------------------------------------------------
# Configuration for gtags(1)
# See gtags(1).
#------------------------------------------------------------------------------
common:\
:skip=GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,.ebrowse,.etags,.etagsDef,.etagsDec,y.tab.c,y.tab.h,.notfunction,cscope.out,cscope.po.out,cscope.in.out,.gdbinit,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,.svn/,.git/,.cvsrc,.cvsignore,.gitignore,.cvspass,.cvswrappers,.deps/,autom4te.cache/,.snprj/:\
:langmap=c\:.c.h,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.cpp.cxx.hxx.hpp.C.H,php\:.php.php3.phtml:
gtags:\
:tc=common:\
:GTAGS=gtags-parser %s:\
:GRTAGS=gtags-parser -r %s:\
:GSYMS=gtags-parser -s %s:\
:skip=lnInclude/,tutorials/,wmake/,doc/,lib/,etc/:
#
#------------------------------------------------------------------------------
# Configuration for htags(1)
#------------------------------------------------------------------------------
htags:\
:body_begin=<body text='#191970' bgcolor='#f5f5dc' vlink='gray'>:body_end=</body>:\
:table_begin=<table>:table_end=</table>:\
:title_begin=<h1><font color='#cc0000'>:title_end=</font></h1>:\
:comment_begin=<i><font color='green'>:comment_end=</font></i>:\
:sharp_begin=<font color='darkred'>:sharp_end=</font>:\
:brace_begin=<font color='red'>:brace_end=</font>:\
:warned_line_begin=<span style='background-color\:yellow'>:warned_line_end=</span>:\
:reserved_begin=<b>:reserved_end=</b>:script_alias=/cgi-bin/:\
:ncol#4:tabs#8:normal_suffix=html:gzipped_suffix=ghtml:\
:definition_header=no:
#------------------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ set -x
# update OpenFOAM version strings if required # update OpenFOAM version strings if required
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
wmakeLnInclude -f OpenFOAM wmakeLnInclude -f OpenFOAM -sf
wmakeLnInclude -f OSspecific/$WM_OS wmakeLnInclude -f OSspecific/$WM_OS -sf
Pstream/Allwmake Pstream/Allwmake
wmake libo OSspecific/$WM_OS wmake libo OSspecific/$WM_OS

View File

@ -29,6 +29,10 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "PackedList.H"
#include "syncTools.H"
#include "faceSet.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -39,12 +43,15 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
dict_(is), dict_(is),
cellZoneID_(mesh_.cellZones().findZoneID(name_)), cellZoneID_(mesh_.cellZones().findZoneID(name_)),
faceZoneID_(mesh_.faceZones().findZoneID(name_)), faceZoneID_(mesh_.faceZones().findZoneID(name_)),
outsideFaces_(0),
patchNames_(dict_.lookup("patches")), patchNames_(dict_.lookup("patches")),
origin_(dict_.lookup("origin")), origin_(dict_.lookup("origin")),
axis_(dict_.lookup("axis")), axis_(dict_.lookup("axis")),
omega_(dict_.lookup("omega")), omega_(dict_.lookup("omega")),
Omega_("Omega", omega_*axis_) Omega_("Omega", omega_*axis_)
{ {
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
axis_ = axis_/mag(axis_); axis_ = axis_/mag(axis_);
Omega_ = omega_*axis_; Omega_ = omega_*axis_;
@ -65,18 +72,71 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
if (!faceZoneFound) if (!faceZoneFound)
{ {
FatalErrorIn // Determine faces in cell zone
( // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Foam::MRFZone::MRFZone(const fvMesh& , const dictionary&)" // (does not construct cells)
) << "cannot find MRF faceZone " << name_
<< exit(FatalError); const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
// Cells in zone
PackedBoolList zoneCell(mesh_.nCells());
if (cellZoneID_ != -1)
{
const labelList& cellLabels = mesh_.cellZones()[cellZoneID_];
forAll(cellLabels, i)
{
zoneCell[cellLabels[i]] = 1u;
} }
}
// Faces in zone
PackedBoolList zoneFacesSet(mesh_.nFaces());
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
{
if
(
zoneCell.get(own[faceI]) == 1u
|| zoneCell.get(nei[faceI]) == 1u
)
{
zoneFacesSet[faceI] = 1u;
}
}
syncTools::syncFaceList(mesh_, zoneFacesSet, orEqOp<unsigned int>());
// Transfer to labelList
label n = zoneFacesSet.count();
outsideFaces_.setSize(n);
n = 0;
forAll(zoneFacesSet, faceI)
{
if (zoneFacesSet.get(faceI) == 1u)
{
outsideFaces_[n++] = faceI;
}
}
Info<< nl
<< "MRFZone " << name_ << " : did not find a faceZone; using "
<< returnReduce(outsideFaces_.size(), sumOp<label>())
<< " faces internal to cellZone instead." << endl;
// Flag use of outsideFaces
faceZoneID_ = -2;
}
patchLabels_.setSize(patchNames_.size()); patchLabels_.setSize(patchNames_.size());
forAll(patchNames_, i) forAll(patchNames_, i)
{ {
patchLabels_[i] = mesh_.boundaryMesh().findPatchID(patchNames_[i]); patchLabels_[i] = patches.findPatchID(patchNames_[i]);
if (patchLabels_[i] == -1) if (patchLabels_[i] == -1)
{ {
@ -125,7 +185,13 @@ void Foam::MRFZone::relativeFlux(surfaceScalarField& phi) const
const vector& origin = origin_.value(); const vector& origin = origin_.value();
const vector& Omega = Omega_.value(); const vector& Omega = Omega_.value();
const labelList& faces = mesh_.faceZones()[faceZoneID_]; // Use either zone faces or outsideFaces_
const labelList& faces =
(
faceZoneID_ == -2
? outsideFaces_
: mesh_.faceZones()[faceZoneID_]
);
forAll(faces, i) forAll(faces, i)
{ {

View File

@ -26,7 +26,7 @@ Class
Foam::MRFZone Foam::MRFZone
Description Description
MRF zone definition based on both cell and face zones and parameters MRF zone definition based on cell zone and optional face zone and parameters
obtained from a control dictionary constructed from the given stream. obtained from a control dictionary constructed from the given stream.
The rotation of the MRF region is defined by an origin and axis of The rotation of the MRF region is defined by an origin and axis of
@ -68,18 +68,26 @@ class MRFZone
const fvMesh& mesh_; const fvMesh& mesh_;
word name_; const word name_;
dictionary dict_; const dictionary dict_;
label cellZoneID_; label cellZoneID_;
//- label of face zone with faces on outside of cell zone.
// If -2 determines outside faces itself
label faceZoneID_; label faceZoneID_;
wordList patchNames_;
//- outside faces (only if faceZoneID = -2)
labelList outsideFaces_;
const wordList patchNames_;
labelList patchLabels_; labelList patchLabels_;
dimensionedVector origin_; const dimensionedVector origin_;
dimensionedVector axis_; dimensionedVector axis_;
dimensionedScalar omega_; const dimensionedScalar omega_;
dimensionedVector Omega_; dimensionedVector Omega_;

View File

@ -51,6 +51,12 @@ namespace Foam
// Forward declaration of classes // Forward declaration of classes
class polyPatch; class polyPatch;
class polyMesh; class polyMesh;
class wallPoint;
// Forward declaration of friend functions and operators
Ostream& operator<<(Ostream&, const wallPoint&);
Istream& operator>>(Istream&, wallPoint&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class wallPoint Declaration Class wallPoint Declaration
@ -78,12 +84,15 @@ class wallPoint
const scalar tol const scalar tol
); );
public: public:
// Static data members // Static data members
//- initial point far away. //- initial point far away.
static point greatPoint; static point greatPoint;
// Constructors // Constructors
//- Construct null //- Construct null
@ -102,6 +111,7 @@ public:
const wallPoint& const wallPoint&
); );
// Member Functions // Member Functions
// Access // Access
@ -184,11 +194,11 @@ public:
const scalar tol const scalar tol
); );
// Member Operators // Member Operators
// Needed for List IO // Needed for List IO
inline bool operator==(const wallPoint&) const; inline bool operator==(const wallPoint&) const;
inline bool operator!=(const wallPoint&) const; inline bool operator!=(const wallPoint&) const;

View File

@ -76,10 +76,8 @@ bool Foam::distributedTriSurfaceMesh::read()
// Distribution type // Distribution type
distType_ = distributionTypeNames_.read(dict_.lookup("distributionType")); distType_ = distributionTypeNames_.read(dict_.lookup("distributionType"));
if (dict_.found("mergeDistance")) // Merge distance
{ mergeDist_ = readScalar(dict_.lookup("mergeDistance"));
dict_.lookup("mergeDistance") >> mergeDist_;
}
return true; return true;
} }
@ -1341,12 +1339,44 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
dict_(io, dict) dict_(io, dict)
{ {
read(); read();
if (debug)
{
Info<< "Constructed from triSurface:" << endl;
writeStats(Info);
labelList nTris(Pstream::nProcs());
nTris[Pstream::myProcNo()] = triSurface::size();
Pstream::gatherList(nTris);
Pstream::scatterList(nTris);
Info<< endl<< "\tproc\ttris\tbb" << endl;
forAll(nTris, procI)
{
Info<< '\t' << procI << '\t' << nTris[procI]
<< '\t' << procBb_[procI] << endl;
}
Info<< endl;
}
} }
Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io) Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
: :
triSurfaceMesh(io), //triSurfaceMesh(io),
triSurfaceMesh
(
IOobject
(
io.name(),
io.time().findInstance(io.local(), word::null),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
io.registerObject()
)
),
dict_ dict_
( (
IOobject IOobject
@ -1362,6 +1392,26 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
) )
{ {
read(); read();
if (debug)
{
Info<< "Read distributedTriSurface from " << io.objectPath()
<< ':' << endl;
writeStats(Info);
labelList nTris(Pstream::nProcs());
nTris[Pstream::myProcNo()] = triSurface::size();
Pstream::gatherList(nTris);
Pstream::scatterList(nTris);
Info<< endl<< "\tproc\ttris\tbb" << endl;
forAll(nTris, procI)
{
Info<< '\t' << procI << '\t' << nTris[procI]
<< '\t' << procBb_[procI] << endl;
}
Info<< endl;
}
} }
@ -1371,7 +1421,21 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
const dictionary& dict const dictionary& dict
) )
: :
triSurfaceMesh(io, dict), //triSurfaceMesh(io, dict),
triSurfaceMesh
(
IOobject
(
io.name(),
io.time().findInstance(io.local(), word::null),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
io.registerObject()
),
dict
),
dict_ dict_
( (
IOobject IOobject
@ -1387,6 +1451,26 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
) )
{ {
read(); read();
if (debug)
{
Info<< "Read distributedTriSurface from " << io.objectPath()
<< " and dictionary:" << endl;
writeStats(Info);
labelList nTris(Pstream::nProcs());
nTris[Pstream::myProcNo()] = triSurface::size();
Pstream::gatherList(nTris);
Pstream::scatterList(nTris);
Info<< endl<< "\tproc\ttris\tbb" << endl;
forAll(nTris, procI)
{
Info<< '\t' << procI << '\t' << nTris[procI]
<< '\t' << procBb_[procI] << endl;
}
Info<< endl;
}
} }
@ -2389,6 +2473,8 @@ void Foam::distributedTriSurfaceMesh::writeStats(Ostream& os) const
boundBox bb; boundBox bb;
label nPoints; label nPoints;
calcBounds(bb, nPoints); calcBounds(bb, nPoints);
reduce(bb.min(), minOp<point>());
reduce(bb.max(), maxOp<point>());
os << "Triangles : " << returnReduce(triSurface::size(), sumOp<label>()) os << "Triangles : " << returnReduce(triSurface::size(), sumOp<label>())
<< endl << endl

View File

@ -91,15 +91,14 @@ public:
private: private:
// Private member data
//- Merging distance //- Merging distance
scalar mergeDist_; scalar mergeDist_;
//- Decomposition used when independently decomposing surface. //- Decomposition used when independently decomposing surface.
autoPtr<decompositionMethod> decomposer_; autoPtr<decompositionMethod> decomposer_;
// Private member data
//- Bounding box settings //- Bounding box settings
IOdictionary dict_; IOdictionary dict_;
@ -317,10 +316,11 @@ public:
const dictionary& dict const dictionary& dict
); );
//- Construct read //- Construct read. Does findInstance to find io.local().
distributedTriSurfaceMesh(const IOobject& io); distributedTriSurfaceMesh(const IOobject& io);
//- Construct from dictionary (used by searchableSurface) //- Construct from dictionary (used by searchableSurface).
// Does read. Does findInstance to find io.local().
distributedTriSurfaceMesh distributedTriSurfaceMesh
( (
const IOobject& io, const IOobject& io,

View File

@ -52,8 +52,15 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest
scalar magN = mag(n); scalar magN = mag(n);
if (nearestDistSqr > sqr(magN-radius_)) if (nearestDistSqr > sqr(magN-radius_))
{
if (magN < ROOTVSMALL)
{
info.rawPoint() = centre_ + vector(1,0,0)/magN*radius_;
}
else
{ {
info.rawPoint() = centre_ + n/magN*radius_; info.rawPoint() = centre_ + n/magN*radius_;
}
info.setHit(); info.setHit();
info.setIndex(0); info.setIndex(0);
} }

View File

@ -59,47 +59,48 @@ void Foam::searchableSurfaceCollection::findNearest
List<pointIndexHit> hitInfo(samples.size()); List<pointIndexHit> hitInfo(samples.size());
const scalarField localMinDistSqr(samples.size(), GREAT);
forAll(subGeom_, surfI) forAll(subGeom_, surfI)
{ {
// Transform then divide // Transform then divide
tmp<pointField> localSamples = cmptDivide tmp<pointField> localSamples = cmptDivide
( (
transform_[surfI].localPosition transform_[surfI].localPosition(samples),
(
samples
),
scale_[surfI] scale_[surfI]
); );
subGeom_[surfI].findNearest(localSamples, minDistSqr, hitInfo); subGeom_[surfI].findNearest(localSamples, localMinDistSqr, hitInfo);
forAll(hitInfo, pointI) forAll(hitInfo, pointI)
{ {
if (hitInfo[pointI].hit()) if (hitInfo[pointI].hit())
{ {
minDistSqr[pointI] = magSqr
(
hitInfo[pointI].hitPoint()
- localSamples()[pointI]
);
// Rework back into global coordinate sys. Multiply then // Rework back into global coordinate sys. Multiply then
// transform // transform
nearestInfo[pointI] = hitInfo[pointI]; point globalPt = transform_[surfI].globalPosition
nearestInfo[pointI].rawPoint() =
transform_[surfI].globalPosition
( (
cmptMultiply cmptMultiply
( (
nearestInfo[pointI].rawPoint(), hitInfo[pointI].rawPoint(),
scale_[surfI] scale_[surfI]
) )
); );
scalar distSqr = magSqr(globalPt - samples[pointI]);
if (distSqr < minDistSqr[pointI])
{
minDistSqr[pointI] = distSqr;
nearestInfo[pointI].setPoint(globalPt);
nearestInfo[pointI].setHit();
nearestInfo[pointI].setIndex(hitInfo[pointI].index());
nearestSurf[pointI] = surfI; nearestSurf[pointI] = surfI;
} }
} }
} }
} }
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -228,19 +228,19 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io) Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
: :
// Find instance for triSurfaceMesh // Find instance for triSurfaceMesh
searchableSurface searchableSurface(io),
( //(
IOobject // IOobject
( // (
io.name(), // io.name(),
io.time().findInstance(io.local(), word::null), // io.time().findInstance(io.local(), word::null),
io.local(), // io.local(),
io.db(), // io.db(),
io.readOpt(), // io.readOpt(),
io.writeOpt(), // io.writeOpt(),
io.registerObject() // io.registerObject()
) // )
), //),
// Reused found instance in objectRegistry // Reused found instance in objectRegistry
objectRegistry objectRegistry
( (
@ -273,19 +273,19 @@ Foam::triSurfaceMesh::triSurfaceMesh
const dictionary& dict const dictionary& dict
) )
: :
searchableSurface searchableSurface(io),
( //(
IOobject // IOobject
( // (
io.name(), // io.name(),
io.time().findInstance(io.local(), word::null), // io.time().findInstance(io.local(), word::null),
io.local(), // io.local(),
io.db(), // io.db(),
io.readOpt(), // io.readOpt(),
io.writeOpt(), // io.writeOpt(),
io.registerObject() // io.registerObject()
) // )
), //),
// Reused found instance in objectRegistry // Reused found instance in objectRegistry
objectRegistry objectRegistry
( (

View File

@ -113,11 +113,10 @@ public:
//- Construct from triSurface //- Construct from triSurface
triSurfaceMesh(const IOobject&, const triSurface&); triSurfaceMesh(const IOobject&, const triSurface&);
//- Construct read. Does timeInstance search. //- Construct read.
triSurfaceMesh(const IOobject& io); triSurfaceMesh(const IOobject& io);
//- Construct from IO and dictionary (used by searchableSurface). //- Construct from IO and dictionary (used by searchableSurface).
// Does timeInstance search.
// Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m) // Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m)
triSurfaceMesh triSurfaceMesh
( (

View File

@ -199,46 +199,13 @@ void Foam::isoSurface::calcCutTypes
} }
} }
} }
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
label faceI = pp.start(); label faceI = pp.start();
if (isA<emptyPolyPatch>(pp))
{
// Still needs special treatment?
forAll(pp, i)
{
bool ownLower = (cVals[own[faceI]] < iso_);
scalar nbrValue;
point nbrPoint;
getNeighbour
(
boundaryRegion,
cVals,
own[faceI],
faceI,
nbrValue,
nbrPoint
);
bool neiLower = (nbrValue < iso_);
const face f = mesh_.faces()[faceI];
if (isEdgeOfFaceCut(pVals, f, ownLower, neiLower))
{
faceCutType_[faceI] = CUT;
}
faceI++;
}
}
else
{
forAll(pp, i) forAll(pp, i)
{ {
bool ownLower = (cVals[own[faceI]] < iso_); bool ownLower = (cVals[own[faceI]] < iso_);
@ -275,7 +242,6 @@ void Foam::isoSurface::calcCutTypes
faceI++; faceI++;
} }
} }
}
@ -1589,26 +1555,6 @@ Foam::isoSurface::isoSurface
const polyBoundaryMesh& patches = mesh_.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Check
forAll(patches, patchI)
{
if (isA<emptyPolyPatch>(patches[patchI]))
{
FatalErrorIn
(
"isoSurface::isoSurface\n"
"(\n"
" const volScalarField& cVals,\n"
" const scalarField& pVals,\n"
" const scalar iso,\n"
" const bool regularise,\n"
" const scalar mergeTol\n"
")\n"
) << "Iso surfaces not supported on case with empty patches."
<< exit(FatalError);
}
}
// Pre-calculate patch-per-face to avoid whichPatch call. // Pre-calculate patch-per-face to avoid whichPatch call.
labelList boundaryRegion(mesh_.nFaces()-mesh_.nInternalFaces()); labelList boundaryRegion(mesh_.nFaces()-mesh_.nInternalFaces());
@ -1724,7 +1670,7 @@ Foam::isoSurface::isoSurface
// Generate field to interpolate. This is identical to the mesh.C() // Generate field to interpolate. This is identical to the mesh.C()
// except on separated coupled patches. // except on separated coupled patches and on empty patches.
slicedVolVectorField meshC slicedVolVectorField meshC
( (
IOobject IOobject
@ -1746,10 +1692,12 @@ Foam::isoSurface::isoSurface
const polyBoundaryMesh& patches = mesh_.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI];
if if
( (
patches[patchI].coupled() pp.coupled()
&& refCast<const coupledPolyPatch>(patches[patchI]).separated() && refCast<const coupledPolyPatch>(pp).separated()
) )
{ {
fvPatchVectorField& pfld = const_cast<fvPatchVectorField&> fvPatchVectorField& pfld = const_cast<fvPatchVectorField&>
@ -1758,9 +1706,32 @@ Foam::isoSurface::isoSurface
); );
pfld.operator== pfld.operator==
( (
patches[patchI].patchSlice(mesh_.faceCentres()) pp.patchSlice(mesh_.faceCentres())
); );
} }
else if (isA<emptyPolyPatch>(pp))
{
typedef slicedVolVectorField::GeometricBoundaryField bType;
bType& bfld = const_cast<bType&>(meshC.boundaryField());
// Clear old value. Cannot resize it since slice.
bfld.set(patchI, NULL);
// Set new value we can change
bfld.set
(
patchI,
new calculatedFvPatchField<vector>
(
mesh_.boundary()[patchI],
meshC
)
);
// Change to face centres
bfld[patchI] = pp.patchSlice(mesh_.faceCentres());
}
} }
} }
@ -1885,6 +1856,14 @@ Foam::isoSurface::isoSurface
orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest); orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
//} //}
if (debug)
{
fileName stlFile = mesh_.time().path() + ".stl";
Pout<< "Dumping surface to " << stlFile << endl;
triSurface::write(stlFile);
}
} }

View File

@ -31,9 +31,6 @@ Description
G.M. Treece, R.W. Prager and A.H. Gee. G.M. Treece, R.W. Prager and A.H. Gee.
Note: Note:
- not possible on patches of type 'empty'. There are no values on
'empty' patch fields so even the api would have to change
(no volScalarField as argument). Too messy.
- in parallel the regularisation (coarsening) always takes place - in parallel the regularisation (coarsening) always takes place
and slightly different surfaces will be created compared to non-parallel. and slightly different surfaces will be created compared to non-parallel.
The surface will still be continuous though! The surface will still be continuous though!
@ -43,6 +40,7 @@ Description
- uses geometric merge with fraction of bounding box as distance. - uses geometric merge with fraction of bounding box as distance.
- triangles can be between two cell centres so constant sampling - triangles can be between two cell centres so constant sampling
does not make sense. does not make sense.
- on empty patches behaves like zero gradient.
- does not do 2D correctly, creates non-flat iso surface. - does not do 2D correctly, creates non-flat iso surface.
SourceFiles SourceFiles

View File

@ -514,9 +514,53 @@ void Foam::isoSurface::generateTriPoints
} }
else if (isA<emptyPolyPatch>(pp)) else if (isA<emptyPolyPatch>(pp))
{ {
// Assume zero-gradient. But what about coordinates? // Check if field is there (when generating geometry the
// empty patches have been rewritten to be the face centres),
// otherwise use zero-gradient.
label faceI = pp.start(); label faceI = pp.start();
const fvPatchScalarField& fvp = cVals.boundaryField()[patchI];
// Owner value of cVals
scalarField internalVals;
if (fvp.size() == 0)
{
internalVals.setSize(pp.size());
forAll(pp, i)
{
internalVals[i] = cVals[own[pp.start()+i]];
}
}
const scalarField& bVals =
(
fvp.size() > 0
? static_cast<const scalarField&>(fvp)
: internalVals
);
const fvPatchField<Type>& pc = cCoords.boundaryField()[patchI];
// Owner value of cCoords
Field<Type> internalCoords;
if (pc.size() == 0)
{
internalCoords.setSize(pp.size());
forAll(pp, i)
{
internalCoords[i] = cCoords[own[pp.start()+i]];
}
}
const Field<Type>& bCoords =
(
pc.size() > 0
? static_cast<const Field<Type>&>(pc)
: internalCoords
);
forAll(pp, i) forAll(pp, i)
{ {
if (faceCutType_[faceI] != NOTCUT) if (faceCutType_[faceI] != NOTCUT)
@ -534,8 +578,8 @@ void Foam::isoSurface::generateTriPoints
snappedPoint, snappedPoint,
faceI, faceI,
cVals[own[faceI]], bVals[i],
cCoords.boundaryField()[patchI][i], bCoords[i],
false, // fc not snapped false, // fc not snapped
pTraits<Type>::zero, pTraits<Type>::zero,

View File

@ -2,7 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
set -x set -x
wmakeLnInclude -f ../incompressible/LES wmakeLnInclude -f ../incompressible/LES -sf
wmake libso LESfilters wmake libso LESfilters
wmake libso LESdeltas wmake libso LESdeltas

View File

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "incompressible/RASModel/RASModel.H" #include "RASModel.H"
#include "MRFZones.H" #include "MRFZones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,7 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/RAS \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
-I$(LIB_SRC)/transportModels -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lincompressibleRASModels \ -lincompressibleRASModels \

View File

@ -3,8 +3,9 @@
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
blockMesh blockMesh
cellSet cellSet
cp system/faceSetDict_rotorFaces system/faceSetDict #- MRF determines its own faceZone if not supplied
faceSet #cp system/faceSetDict_rotorFaces system/faceSetDict
cp system/faceSetDict_noBoundaryFaces system/faceSetDict #faceSet
faceSet #cp system/faceSetDict_noBoundaryFaces system/faceSetDict
#faceSet
setsToZones -noFlipMap setsToZones -noFlipMap

View File

@ -2,7 +2,7 @@
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
@ -10,9 +10,9 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "system"; object autoHexMeshDict;
object snappyHexMeshDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Which of the steps to run // Which of the steps to run
@ -29,27 +29,78 @@ addLayers true;
// - to 'snap' the mesh boundary to the surface // - to 'snap' the mesh boundary to the surface
geometry geometry
{ {
fridgeA
{
type searchableBox;
min ( 2 2 0 );
max ( 3 3 2 );
}
fridgeB
{
type searchableBox;
min ( 3.5 3 0 );
max ( 4.3 3.8 1.8 );
}
igloo igloo
{ {
type searchableSphere; type searchableSphere;
centre (3 3 0); centre (3 3 0);
radius 4; radius 4;
} }
box1
{
type searchableBox;
min (0 0 0);
max (1 1 1);
} }
fridgeFreezer
{
type searchableSurfaceCollection;
freezer
{
surface box1;
scale (1 1 1);
transform
{
type cartesian;
origin (0 0 0);
e1 (1 0 0);
e3 (0 0 1);
}
}
fridge
{
surface box1;
scale (1 1 1.1);
transform
{
type cartesian;
origin (0 0 1);
e1 (1 0 0);
e3 (0 0 1);
}
}
}
twoFridgeFreezers
{
type searchableSurfaceCollection;
seal
{
surface fridgeFreezer;
scale (1.0 1.0 1.0);
transform
{
type cartesian;
origin (2 2 0);
e1 (1 0 0);
e3 (0 0 1);
}
}
herring
{
surface fridgeFreezer;
scale (1.0 1.0 1.0);
transform
{
type cartesian;
origin (3.5 3 0);
e1 (1 0 0);
e3 (0 0 1);
}
}
}
};
@ -76,7 +127,7 @@ castellatedMeshControls
// few cells. This setting will cause refinement to stop if <= minimumRefine // few cells. This setting will cause refinement to stop if <= minimumRefine
// are selected for refinement. Note: it will at least do one iteration // are selected for refinement. Note: it will at least do one iteration
// (unless the number of cells to refine is 0) // (unless the number of cells to refine is 0)
minRefinementCells 0; minRefinementCells 100;
// Number of buffer layers between different levels. // Number of buffer layers between different levels.
// 1 means normal 2:1 refinement restriction, larger means slower // 1 means normal 2:1 refinement restriction, larger means slower
@ -93,8 +144,8 @@ castellatedMeshControls
features features
( (
// { // {
// file "someLine.eMesh"; // file "fridgeA.eMesh";
// level 2; // level 3;
// } // }
); );
@ -108,27 +159,35 @@ castellatedMeshControls
// The second level is the maximum level. Cells that 'see' multiple // The second level is the maximum level. Cells that 'see' multiple
// intersections where the intersections make an // intersections where the intersections make an
// angle > resolveFeatureAngle get refined up to the maximum level. // angle > resolveFeatureAngle get refined up to the maximum level.
refinementSurfaces refinementSurfaces
{ {
fridgeA twoFridgeFreezers
{ {
// Surface-wise min and max refinement level // Surface-wise min and max refinement level
level (2 2); level (2 2);
regions
{
// Region-wise override
"cook.*"
{
level (3 3);
}
}
} }
fridgeB "iglo.*"
{
level ( 2 2 );
}
igloo
{ {
// Surface-wise min and max refinement level
level (1 1); level (1 1);
} }
} }
// Resolve sharp angles on fridges
resolveFeatureAngle 60; resolveFeatureAngle 60;
// Region-wise refinement // Region-wise refinement
// ~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~
@ -170,7 +229,7 @@ snapControls
//- Relative distance for points to be attracted by surface feature point //- Relative distance for points to be attracted by surface feature point
// or edge. True distance is this factor times local // or edge. True distance is this factor times local
// maximum edge length. // maximum edge length.
tolerance 4; tolerance 4.0;
//- Number of mesh displacement relaxation iterations. //- Number of mesh displacement relaxation iterations.
nSolveIter 30; nSolveIter 30;
@ -188,25 +247,18 @@ addLayersControls
// Per final patch (so not geometry!) the layer information // Per final patch (so not geometry!) the layer information
layers layers
{ {
fridgeA_region0 "two.*"
{ {
nSurfaceLayers 1; nSurfaceLayers 3;
} }
"igloo_.*"
fridgeB_region0
{
nSurfaceLayers 1;
}
igloo_region0
{ {
nSurfaceLayers 1; nSurfaceLayers 1;
} }
} }
// Expansion factor for layer mesh // Expansion factor for layer mesh
expansionRatio 1; expansionRatio 1.0;
//- Wanted thickness of final added cell layer. If multiple layers //- Wanted thickness of final added cell layer. If multiple layers
// is the // is the
@ -280,7 +332,6 @@ meshQualityControls
minFlatness 0.5; minFlatness 0.5;
//- Minimum pyramid volume. Is absolute volume of cell pyramid. //- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable. // Set to very negative number (e.g. -1E30) to disable.
minVol 1e-13; minVol 1e-13;
@ -314,7 +365,6 @@ meshQualityControls
} }
// Advanced // Advanced
// Flags for optional output // Flags for optional output
@ -327,7 +377,6 @@ debug 0;
// Merge tolerance. Is fraction of overall bounding box of initial mesh. // Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this. // Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-06; mergeTolerance 1E-6;
// ************************************************************************* // // ************************************************************************* //

View File

@ -145,16 +145,6 @@ find -L . -type l -exec rm \{\} \;
find .. $findOpt \ find .. $findOpt \
\( -name lnInclude -o -name Make -o -name config -o -name noLink \) -prune \ \( -name lnInclude -o -name Make -o -name config -o -name noLink \) -prune \
-o \( -name '*.[CHh]' -o -name '*.[ch]xx' -o -name '*.[ch]pp' -o -name '*.type' \) \ -o \( -name '*.[CHh]' -o -name '*.[ch]xx' -o -name '*.[ch]pp' -o -name '*.type' \) \
-a ! -name ".#*" \ -exec ln $lnOpt {} . \;
-print | \
while read src
do
link=$(readlink ${src##*/})
if [ "$link" != "$src" ]
then
rm $link 2>/dev/null
ln $lnOpt $src .
fi
done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------