Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2011-04-15 16:09:42 +01:00
15 changed files with 443 additions and 207 deletions

View File

@ -62,6 +62,7 @@ class regExp
//- Precompiled regular expression //- Precompiled regular expression
mutable regex_t* preg_; mutable regex_t* preg_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
@ -72,6 +73,8 @@ class regExp
public: public:
// Static Member Functions
//- Is character a regular expression meta-character? //- Is character a regular expression meta-character?
// any character: '.' \n // any character: '.' \n
// quantifiers: '*', '+', '?' \n // quantifiers: '*', '+', '?' \n
@ -102,66 +105,69 @@ public:
//- Construct from std::string (or string), optionally ignoring case //- Construct from std::string (or string), optionally ignoring case
regExp(const std::string&, const bool ignoreCase=false); regExp(const std::string&, const bool ignoreCase=false);
//- Destructor //- Destructor
~regExp(); ~regExp();
// Member functions // Member functions
//- Access // Access
//- Return true if a precompiled expression does not exist //- Return true if a precompiled expression does not exist
inline bool empty() const inline bool empty() const
{ {
return !preg_; return !preg_;
} }
//- Does a precompiled expression exist? //- Does a precompiled expression exist?
inline bool exists() const inline bool exists() const
{ {
return preg_ ? true : false; return preg_ ? true : false;
} }
//- Return the number of (groups) //- Return the number of (groups)
inline int ngroups() const inline int ngroups() const
{ {
return preg_ ? preg_->re_nsub : 0; return preg_ ? preg_->re_nsub : 0;
} }
//- Editing // Editing
//- Compile pattern into a regular expression, optionally ignoring case //- Compile pattern into a regular expression, optionally ignoring
void set(const char*, const bool ignoreCase=false) const; // case
void set(const char*, const bool ignoreCase=false) const;
//- Compile pattern into a regular expression, optionally ignoring case //- Compile pattern into a regular expression, optionally ignoring
void set(const std::string&, const bool ignoreCase=false) const; // case
void set(const std::string&, const bool ignoreCase=false) const;
//- Release precompiled expression. //- Release precompiled expression.
// Returns true if precompiled expression existed before clear // Returns true if precompiled expression existed before clear
bool clear() const; bool clear() const;
//- Searching // Searching
//- Find position within string. //- Find position within string.
// Returns the index where it begins or string::npos if not found // Returns the index where it begins or string::npos if not found
std::string::size_type find(const std::string& str) const; std::string::size_type find(const std::string& str) const;
//- Return true if it matches the entire string //- Return true if it matches the entire string
// The begin-of-line (^) and end-of-line ($) anchors are implicit // The begin-of-line (^) and end-of-line ($) anchors are implicit
bool match(const std::string&) const; bool match(const std::string&) const;
//- Return true if it matches and sets the sub-groups matched //- Return true if it matches and sets the sub-groups matched
// The begin-of-line (^) and end-of-line ($) anchors are implicit // The begin-of-line (^) and end-of-line ($) anchors are implicit
bool match(const string&, List<string>& groups) const; bool match(const string&, List<string>& groups) const;
//- Return true if the regex was found within string //- Return true if the regex was found within string
bool search(const std::string& str) const bool search(const std::string& str) const
{ {
return std::string::npos != find(str); return std::string::npos != find(str);
} }
// Member Operators // Member Operators
@ -173,7 +179,6 @@ public:
//- Assign and compile pattern from string //- Assign and compile pattern from string
// Always case sensitive // Always case sensitive
void operator=(const std::string&); void operator=(const std::string&);
}; };

View File

@ -46,7 +46,6 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
const entry& codeEntry = dict.lookupEntry("code", false, false); const entry& codeEntry = dict.lookupEntry("code", false, false);
code_ = stringOps::trim(codeEntry.stream()); code_ = stringOps::trim(codeEntry.stream());
stringOps::inplaceExpand(code_, dict); stringOps::inplaceExpand(code_, dict);
addLineDirective(code_, codeEntry.startLineNumber(), dict.name());
} }
// note: removes any leading/trailing whitespace // note: removes any leading/trailing whitespace
@ -64,7 +63,6 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
{ {
include_ = stringOps::trim(includePtr->stream()); include_ = stringOps::trim(includePtr->stream());
stringOps::inplaceExpand(include_, dict); stringOps::inplaceExpand(include_, dict);
addLineDirective(include_, includePtr->startLineNumber(), dict.name());
} }
// optional // optional
@ -92,6 +90,28 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
OSHA1stream os; OSHA1stream os;
os << include_ << options_ << libs_ << localCode_ << code_; os << include_ << options_ << libs_ << localCode_ << code_;
sha1_ = os.digest(); sha1_ = os.digest();
// Add line number after calculating sha1 since includes processorDDD
// in path which differs between processors.
{
const entry& codeEntry = dict.lookupEntry("code", false, false);
addLineDirective(code_, codeEntry.startLineNumber(), dict.name());
}
if (includePtr)
{
addLineDirective(include_, includePtr->startLineNumber(), dict.name());
}
if (optionsPtr)
{
addLineDirective(options_, optionsPtr->startLineNumber(), dict.name());
}
if (libsPtr)
{
addLineDirective(libs_, libsPtr->startLineNumber(), dict.name());
}
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -96,7 +96,8 @@ void Foam::plane::calcPntAndVec
" const point&,\n" " const point&,\n"
" const point&\n" " const point&\n"
")\n" ")\n"
) << "Bad points." << abort(FatalError); ) << "Bad points:" << point1 << ' ' << point2 << ' ' << point3
<< abort(FatalError);
} }
unitVector_ = line12 ^ line23; unitVector_ = line12 ^ line23;
@ -112,7 +113,8 @@ void Foam::plane::calcPntAndVec
" const point&,\n" " const point&,\n"
" const point&\n" " const point&\n"
")\n" ")\n"
) << "Plane normal defined with zero length" ) << "Plane normal defined with zero length" << nl
<< "Bad points:" << point1 << ' ' << point2 << ' ' << point3
<< abort(FatalError); << abort(FatalError);
} }
@ -137,7 +139,7 @@ Foam::plane::plane(const vector& normalVector)
else else
{ {
FatalErrorIn("plane::plane(const vector&)") FatalErrorIn("plane::plane(const vector&)")
<< "plane normal has zero length" << "plane normal has zero length. basePoint:" << basePoint_
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -158,7 +160,7 @@ Foam::plane::plane(const point& basePoint, const vector& normalVector)
else else
{ {
FatalErrorIn("plane::plane(const point&, const vector&)") FatalErrorIn("plane::plane(const point&, const vector&)")
<< "plane normal has zero length" << "plane normal has zero length. basePoint:" << basePoint_
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -228,8 +230,7 @@ Foam::plane::plane(const dictionary& dict)
( (
"plane::plane(const dictionary&)", "plane::plane(const dictionary&)",
dict dict
) ) << "Invalid plane type: " << planeType
<< "Invalid plane type: " << planeType
<< abort(FatalIOError); << abort(FatalIOError);
} }
} }
@ -250,7 +251,7 @@ Foam::plane::plane(Istream& is)
else else
{ {
FatalErrorIn("plane::plane(Istream& is)") FatalErrorIn("plane::plane(Istream& is)")
<< "plane normal has zero length" << "plane normal has zero length. basePoint:" << basePoint_
<< abort(FatalError); << abort(FatalError);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,6 +52,7 @@ SourceFiles
#include "word.H" #include "word.H"
#include "regExp.H" #include "regExp.H"
#include "keyType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +61,6 @@ namespace Foam
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
class wordRe; class wordRe;
class Istream; class Istream;
class Ostream; class Ostream;
@ -110,6 +110,7 @@ public:
//- Test string for regular expression meta characters //- Test string for regular expression meta characters
static inline bool isPattern(const string&); static inline bool isPattern(const string&);
// Constructors // Constructors
//- Construct null //- Construct null
@ -118,71 +119,83 @@ public:
//- Construct as copy //- Construct as copy
inline wordRe(const wordRe&); inline wordRe(const wordRe&);
//- Construct from keyType
inline wordRe(const keyType&, const compOption=LITERAL);
//- Construct as copy of word //- Construct as copy of word
inline wordRe(const word&); inline wordRe(const word&);
//- Construct as copy of character array //- Construct as copy of character array
// Optionally specify how it should be treated. // Optionally specify how it should be treated.
inline wordRe(const char*, const compOption=LITERAL); inline wordRe(const char*, const compOption = LITERAL);
//- Construct as copy of string. //- Construct as copy of string.
// Optionally specify how it should be treated. // Optionally specify how it should be treated.
inline wordRe(const string&, const compOption=LITERAL); inline wordRe(const string&, const compOption = LITERAL);
//- Construct as copy of std::string //- Construct as copy of std::string
// Optionally specify how it should be treated. // Optionally specify how it should be treated.
inline wordRe(const std::string&, const compOption=LITERAL); inline wordRe(const std::string&, const compOption = LITERAL);
//- Construct from Istream //- Construct from Istream
// Words are treated as literals, strings with an auto-test // Words are treated as literals, strings with an auto-test
wordRe(Istream&); wordRe(Istream&);
// Member functions // Member functions
//- Access // Access
//- Should be treated as a match rather than a literal string? //- Should be treated as a match rather than a literal string?
inline bool isPattern() const; inline bool isPattern() const;
//- Infrastructure
//- Compile the regular expression // Infrastructure
inline bool compile() const;
//- Possibly compile the regular expression, with greater control //- Compile the regular expression
inline bool compile(const compOption) const; inline bool compile() const;
//- Recompile an existing regular expression //- Possibly compile the regular expression, with greater control
inline bool recompile() const; inline bool compile(const compOption) const;
//- Frees precompiled regular expression, making wordRe a literal. //- Recompile an existing regular expression
// Optionally strips invalid word characters inline bool recompile() const;
inline void uncompile(const bool doStripInvalid=false) const;
//- Editing //- Frees precompiled regular expression, making wordRe a literal.
// Optionally strips invalid word characters
inline void uncompile(const bool doStripInvalid = false) const;
//- Copy string, auto-test for regular expression or other options
inline void set(const std::string&, const compOption=DETECT);
//- Copy string, auto-test for regular expression or other options // Editing
inline void set(const char*, const compOption=DETECT);
//- Clear string and precompiled regular expression //- Copy string, auto-test for regular expression or other options
inline void clear(); inline void set(const std::string&, const compOption = DETECT);
//- Searching //- Copy string, auto-test for regular expression or other options
inline void set(const char*, const compOption = DETECT);
//- Smart match as regular expression or as a string //- Clear string and precompiled regular expression
// Optionally force a literal match only inline void clear();
inline bool match(const std::string&, bool literalMatch=false) const;
//- Miscellaneous
//- Return a string with quoted meta-characters // Searching
inline string quotemeta() const;
//- Output some basic info //- Smart match as regular expression or as a string
Ostream& info(Ostream&) const; // Optionally force a literal match only
inline bool match
(
const std::string&,
bool literalMatch = false
) const;
// Miscellaneous
//- Return a string with quoted meta-characters
inline string quotemeta() const;
//- Output some basic info
Ostream& info(Ostream&) const;
// Member operators // Member operators
@ -196,6 +209,10 @@ public:
//- Copy word, never a regular expression //- Copy word, never a regular expression
inline const wordRe& operator=(const word&); inline const wordRe& operator=(const word&);
//- Copy keyType, auto-test for regular expression
// Always case sensitive
inline const wordRe& operator=(const keyType&);
//- Copy string, auto-test for regular expression //- Copy string, auto-test for regular expression
// Always case sensitive // Always case sensitive
inline const wordRe& operator=(const string&); inline const wordRe& operator=(const string&);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,6 +65,18 @@ inline Foam::wordRe::wordRe(const word& str)
{} {}
inline Foam::wordRe::wordRe(const keyType& str, const compOption opt)
:
word(str, false),
re_()
{
if (str.isPattern())
{
compile(opt);
}
}
inline Foam::wordRe::wordRe(const char* str, const compOption opt) inline Foam::wordRe::wordRe(const char* str, const compOption opt)
: :
word(str, false), word(str, false),
@ -236,6 +248,17 @@ inline const Foam::wordRe& Foam::wordRe::operator=(const word& str)
} }
inline const Foam::wordRe& Foam::wordRe::operator=(const keyType& str)
{
string::operator=(str);
if (str.isPattern())
{
compile();
}
return *this;
}
inline const Foam::wordRe& Foam::wordRe::operator=(const string& str) inline const Foam::wordRe& Foam::wordRe::operator=(const string& str)
{ {
string::operator=(str); string::operator=(str);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -109,6 +109,12 @@ bool Foam::combineFaces::validFace
return false; return false;
} }
bool isNonManifold = bigFace.checkPointManifold(false, NULL);
if (isNonManifold)
{
return false;
}
// Check for convexness // Check for convexness
face f(getOutsideFace(bigFace)); face f(getOutsideFace(bigFace));
@ -984,6 +990,7 @@ void Foam::combineFaces::setUnrefinement
zoneFlip // face flip in zone zoneFlip // face flip in zone
) )
); );
restoredFaces.insert(masterFaceI, masterFaceI);
// Add the previously removed faces // Add the previously removed faces
for (label i = 1; i < faces.size(); i++) for (label i = 1; i < faces.size(); i++)
@ -991,7 +998,7 @@ void Foam::combineFaces::setUnrefinement
//Pout<< "Restoring removed face with vertices " << faces[i] //Pout<< "Restoring removed face with vertices " << faces[i]
// << endl; // << endl;
meshMod.setAction label faceI = meshMod.setAction
( (
polyAddFace polyAddFace
( (
@ -1007,6 +1014,7 @@ void Foam::combineFaces::setUnrefinement
zoneFlip // zoneFlip zoneFlip // zoneFlip
) )
); );
restoredFaces.insert(faceI, masterFaceI);
} }
// Clear out restored set // Clear out restored set

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -302,6 +302,35 @@ void Foam::polyTopoChange::getMergeSets
} }
bool Foam::polyTopoChange::hasValidPoints(const face& f) const
{
forAll(f, fp)
{
if (f[fp] < 0 || f[fp] >= points_.size())
{
return false;
}
}
return true;
}
Foam::pointField Foam::polyTopoChange::facePoints(const face& f) const
{
pointField points(f.size());
forAll(f, fp)
{
if (f[fp] < 0 && f[fp] >= points_.size())
{
FatalErrorIn("polyTopoChange::facePoints(const face&) const")
<< "Problem." << abort(FatalError);
}
points[fp] = points_[f[fp]];
}
return points;
}
void Foam::polyTopoChange::checkFace void Foam::polyTopoChange::checkFace
( (
const face& f, const face& f,
@ -329,7 +358,14 @@ void Foam::polyTopoChange::checkFace
<< "f:" << f << "f:" << f
<< " faceI(-1 if added face):" << faceI << " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei << " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError); << " patchI:" << patchI << nl;
if (hasValidPoints(f))
{
FatalError
<< "points (removed points marked with "
<< vector::max << ") " << facePoints(f);
}
FatalError << abort(FatalError);
} }
} }
else else
@ -344,7 +380,14 @@ void Foam::polyTopoChange::checkFace
<< "f:" << f << "f:" << f
<< " faceI(-1 if added face):" << faceI << " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei << " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError); << " patchI:" << patchI << nl;
if (hasValidPoints(f))
{
FatalError
<< "points (removed points marked with "
<< vector::max << ") : " << facePoints(f);
}
FatalError << abort(FatalError);
} }
if (nei <= own) if (nei <= own)
@ -358,7 +401,14 @@ void Foam::polyTopoChange::checkFace
<< "f:" << f << "f:" << f
<< " faceI(-1 if added face):" << faceI << " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei << " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError); << " patchI:" << patchI << nl;
if (hasValidPoints(f))
{
FatalError
<< "points (removed points marked with "
<< vector::max << ") : " << facePoints(f);
}
FatalError << abort(FatalError);
} }
} }
@ -373,7 +423,14 @@ void Foam::polyTopoChange::checkFace
<< "f:" << f << "f:" << f
<< " faceI(-1 if added face):" << faceI << " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei << " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError); << " patchI:" << patchI << nl;
if (hasValidPoints(f))
{
FatalError
<< "points (removed points marked with "
<< vector::max << ") : " << facePoints(f);
}
FatalError << abort(FatalError);
} }
if (faceI >= 0 && faceI < faces_.size() && faceRemoved(faceI)) if (faceI >= 0 && faceI < faces_.size() && faceRemoved(faceI))
{ {
@ -386,7 +443,14 @@ void Foam::polyTopoChange::checkFace
<< "f:" << f << "f:" << f
<< " faceI(-1 if added face):" << faceI << " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei << " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError); << " patchI:" << patchI << nl;
if (hasValidPoints(f))
{
FatalError
<< "points (removed points marked with "
<< vector::max << ") : " << facePoints(f);
}
FatalError << abort(FatalError);
} }
forAll(f, fp) forAll(f, fp)
{ {
@ -401,7 +465,14 @@ void Foam::polyTopoChange::checkFace
<< "f:" << f << "f:" << f
<< " faceI(-1 if added face):" << faceI << " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei << " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError); << " patchI:" << patchI << nl;
if (hasValidPoints(f))
{
FatalError
<< "points (removed points marked with "
<< vector::max << ") : " << facePoints(f);
}
FatalError << abort(FatalError);
} }
} }
} }
@ -729,8 +800,16 @@ void Foam::polyTopoChange::getFaceOrder
<< " neighbour " << faceNeighbour_[faceI] << " neighbour " << faceNeighbour_[faceI]
<< " region " << region_[faceI] << endl << " region " << region_[faceI] << endl
<< "This is usually caused by not specifying a patch for" << "This is usually caused by not specifying a patch for"
<< " a boundary face." << " a boundary face." << nl
<< abort(FatalError); << "Switch on the polyTopoChange::debug flag to catch"
<< " this error earlier." << nl;
if (hasValidPoints(faces_[faceI]))
{
FatalError
<< "points (removed points marked with "
<< vector::max << ") " << facePoints(faces_[faceI]);
}
FatalError << abort(FatalError);
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -239,6 +239,12 @@ class polyTopoChange
List<objectMap>& cellsFromCells List<objectMap>& cellsFromCells
); );
//- Are all face vertices valid
bool hasValidPoints(const face&) const;
//- Return face points
pointField facePoints(const face& f) const;
//- Check inputs to modFace or addFace //- Check inputs to modFace or addFace
void checkFace void checkFace
( (

View File

@ -2615,9 +2615,12 @@ void Foam::autoLayerDriver::addLayers
extrudeStatus extrudeStatus
); );
Info<< "Extruding " << countExtrusion(pp, extrudeStatus) label nExtruded = countExtrusion(pp, extrudeStatus);
<< " out of " << returnReduce(pp().size(), sumOp<label>()) label nTotFaces = returnReduce(pp().size(), sumOp<label>());
<< " faces. Removed extrusion at " << nTotChanged << " faces." Info<< "Extruding " << nExtruded
<< " out of " << nTotFaces
<< " faces (" << 100.0*nExtruded/nTotFaces << "%)."
<< " Removed extrusion at " << nTotChanged << " faces."
<< endl; << endl;
if (nTotChanged == 0) if (nTotChanged == 0)

View File

@ -277,7 +277,11 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
} }
} }
// Get all sets of faces that can be merged // Get all sets of faces that can be merged. Since only faces on the same
// patch get merged there is no risk of e.g. patchID faces getting merged
// with original patches (or even processor patches). There is a risk
// though of original patchfaces getting merged if they make a small
// angle. Would be pretty weird starting mesh though.
labelListList allFaceSets labelListList allFaceSets
( (
faceCombiner.getMergeSets faceCombiner.getMergeSets
@ -352,27 +356,20 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
// Get the kept faces that need to be recalculated. // Get the kept faces that need to be recalculated.
// Merging two boundary faces might shift the cell centre // Merging two boundary faces might shift the cell centre
// (unless the faces are absolutely planar) // (unless the faces are absolutely planar)
labelHashSet retestFaces(6*allFaceSets.size()); labelHashSet retestFaces(2*allFaceSets.size());
forAll(allFaceSets, setI) forAll(allFaceSets, setI)
{ {
label oldMasterI = allFaceSets[setI][0]; label oldMasterI = allFaceSets[setI][0];
retestFaces.insert(map().reverseFaceMap()[oldMasterI]);
label faceI = map().reverseFaceMap()[oldMasterI];
// faceI is always uncoupled boundary face
const cell& cFaces = mesh_.cells()[mesh_.faceOwner()[faceI]];
forAll(cFaces, i)
{
retestFaces.insert(cFaces[i]);
}
} }
updateMesh(map, retestFaces.toc()); updateMesh(map, growFaceCellFace(retestFaces));
if (debug) if (debug)
{ {
// Check sync // Check sync
Pout<< "Checking sync after initial merging " << nFaceSets
<< " faces." << endl;
checkData(); checkData();
Pout<< "Writing initial merged-faces mesh to time " Pout<< "Writing initial merged-faces mesh to time "
@ -555,26 +552,18 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
// Get the kept faces that need to be recalculated. // Get the kept faces that need to be recalculated.
// Merging two boundary faces might shift the cell centre // Merging two boundary faces might shift the cell centre
// (unless the faces are absolutely planar) // (unless the faces are absolutely planar)
labelHashSet retestFaces(6*restoredFaces.size()); labelHashSet retestFaces(2*restoredFaces.size());
forAll(restoredFaces, setI) forAllConstIter(Map<label>, restoredFaces, iter)
{ {
label faceI = restoredFaces[setI]; retestFaces.insert(iter.key());
// faceI is always uncoupled boundary face
const cell& cFaces = mesh_.cells()[mesh_.faceOwner()[faceI]];
forAll(cFaces, i)
{
retestFaces.insert(cFaces[i]);
}
} }
// Experimental:restore all points/face/cells in maps // Experimental:restore all points/face/cells in maps
updateMesh updateMesh
( (
map, map,
retestFaces.toc(), growFaceCellFace(retestFaces),
restoredPoints, restoredPoints,
restoredFaces, restoredFaces,
restoredCells restoredCells
@ -583,6 +572,8 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
if (debug) if (debug)
{ {
// Check sync // Check sync
Pout<< "Checking sync after restoring " << retestFaces.size()
<< " faces." << endl;
checkData(); checkData();
Pout<< "Writing merged-faces mesh to time " Pout<< "Writing merged-faces mesh to time "
@ -635,7 +626,26 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemovePoints
mesh_.setInstance(timeName()); mesh_.setInstance(timeName());
pointRemover.updateMesh(map); pointRemover.updateMesh(map);
updateMesh(map, labelList(0));
// Retest all affected faces and all the cells using them
labelHashSet retestFaces(pointRemover.savedFaceLabels().size());
forAll(pointRemover.savedFaceLabels(), i)
{
label faceI = pointRemover.savedFaceLabels()[i];
if (faceI >= 0)
{
retestFaces.insert(faceI);
}
}
updateMesh(map, growFaceCellFace(retestFaces));
if (debug)
{
// Check sync
Pout<< "Checking sync after removing points." << endl;
checkData();
}
return map; return map;
} }
@ -689,7 +699,25 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRestorePoints
mesh_.setInstance(timeName()); mesh_.setInstance(timeName());
pointRemover.updateMesh(map); pointRemover.updateMesh(map);
updateMesh(map, labelList(0));
labelHashSet retestFaces(2*facesToRestore.size());
forAll(facesToRestore, i)
{
label faceI = map().reverseFaceMap()[facesToRestore[i]];
if (faceI >= 0)
{
retestFaces.insert(faceI);
}
}
updateMesh(map, growFaceCellFace(retestFaces));
if (debug)
{
// Check sync
Pout<< "Checking sync after restoring points on "
<< facesToRestore.size() << " faces." << endl;
checkData();
}
return map; return map;
} }

View File

@ -65,7 +65,7 @@ License
The current default mapping strategy in Scotch can be seen by using the The current default mapping strategy in Scotch can be seen by using the
"-vs" option of program gmap. It is, to date: "-vs" option of program gmap. It is, to date:
b r
{ {
job=t, job=t,
map=t, map=t,
@ -76,11 +76,17 @@ License
{ {
asc=b asc=b
{ {
bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, bnd=
org=f{move=80,pass=-1,bal=0.005}, (
d{pass=40,dif=1,rem=1}
|
)
f{move=80,pass=-1,bal=0.002491},
org=f{move=80,pass=-1,bal=0.002491},
width=3 width=3
}, },
low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, low=h{pass=10}
f{move=80,pass=-1,bal=0.002491},
type=h, type=h,
vert=80, vert=80,
rat=0.8 rat=0.8
@ -89,11 +95,17 @@ License
{ {
asc=b asc=b
{ {
bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, bnd=
org=f{move=80,pass=-1,bal=0.005}, (
d{pass=40,dif=1,rem=1}
|
)
f{move=80,pass=-1,bal=0.002491},
org=f{move=80,pass=-1,bal=0.002491},
width=3 width=3
}, },
low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, low=h{pass=10}
f{move=80,pass=-1,bal=0.002491},
type=h, type=h,
vert=80, vert=80,
rat=0.8 rat=0.8
@ -102,6 +114,9 @@ License
} }
Note: instead of gmap run gpart <nProcs> -vs <grfFile>
where <grfFile> can be obtained by running with 'writeGraph=true'
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "scotchDecomp.H" #include "scotchDecomp.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -328,7 +328,7 @@ kOmegaSSTSAS::kOmegaSSTSAS
bound(k_, kMin_); bound(k_, kMin_);
bound(omega_, omegaMin_); bound(omega_, omegaMin_);
updateSubGridScaleFields(magSqr(2.0*symm(fvc::grad(U)))); updateSubGridScaleFields(2.0*magSqr(symm(fvc::grad(U))));
printCoeffs(); printCoeffs();
} }
@ -345,7 +345,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
y_.correct(); y_.correct();
} }
volScalarField S2(magSqr(2.0*symm(gradU()))); volScalarField S2(2.0*magSqr(symm(gradU())));
gradU.clear(); gradU.clear();
volVectorField gradK(fvc::grad(k_)); volVectorField gradK(fvc::grad(k_));

View File

@ -28,6 +28,12 @@ Description
kOmegaSSTSAS LES turbulence model for incompressible flows kOmegaSSTSAS LES turbulence model for incompressible flows
References: References:
Evaluation of the SST-SAS model: Channel flow, asymmetric diffuser and axi-
symmetric hill
European Conference on Computational Fluid Dynamics
ECCOMAS CFD 2006
Lars Davison
A Scale-Adaptive Simulation Model using Two-Equation Models A Scale-Adaptive Simulation Model using Two-Equation Models
AIAA 2005-1095 AIAA 2005-1095
F. R. Menter and Y. Egorov F. R. Menter and Y. Egorov

View File

@ -167,76 +167,101 @@ blocks
hex (29 13 12 28 73 61 60 72) (5 5 7) simpleGrading (1 1 2.985984) hex (29 13 12 28 73 61 60 72) (5 5 7) simpleGrading (1 1 2.985984)
); );
patches boundary
( (
patch outer outer
( {
(91 90 86 87) type patch;
(90 89 85 86) faces
(89 88 84 85) (
(87 86 82 83) (91 90 86 87)
(86 85 81 82) (90 89 85 86)
(85 84 80 81) (89 88 84 85)
(83 82 78 79) (87 86 82 83)
(82 81 77 78) (86 85 81 82)
(81 80 76 77) (85 84 80 81)
(48 64 68 52) (83 82 78 79)
(64 76 80 68) (82 81 77 78)
(52 68 70 56) (81 80 76 77)
(68 80 84 70) (48 64 68 52)
(56 70 72 60) (64 76 80 68)
(70 84 88 72) (52 68 70 56)
(91 87 71 75) (68 80 84 70)
(87 83 69 71) (56 70 72 60)
(83 79 67 69) (70 84 88 72)
(75 71 59 63) (91 87 71 75)
(71 69 55 59) (87 83 69 71)
(69 67 51 55) (83 79 67 69)
(48 49 65 64) (75 71 59 63)
(49 50 66 65) (71 69 55 59)
(50 51 67 66) (69 67 51 55)
(64 65 77 76) (48 49 65 64)
(65 66 78 77) (49 50 66 65)
(66 67 79 78) (50 51 67 66)
(91 75 74 90) (64 65 77 76)
(75 63 62 74) (65 66 78 77)
(90 74 73 89) (66 67 79 78)
(74 62 61 73) (91 75 74 90)
(89 73 72 88) (75 63 62 74)
(73 61 60 72) (90 74 73 89)
) (74 62 61 73)
wall ground (89 73 72 88)
( (73 61 60 72)
(0 4 5 1) );
(1 5 6 2) }
(2 6 7 3)
(4 8 9 5)
(5 9 10 6)
(6 10 11 7)
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
(4 0 48 52)
(8 4 52 56)
(12 8 56 60)
(11 15 63 59)
(7 11 59 55)
(3 7 55 51)
(0 1 49 48)
(1 2 50 49)
(2 3 51 50)
(15 14 62 63)
(14 13 61 62)
(13 12 60 61)
)
wall blockedFaces
()
wall baffleWall
()
cycic baffleCyclic_half0
()
cycic baffleCyclic_half1
()
ground
{
type wall;
faces
(
(0 4 5 1)
(1 5 6 2)
(2 6 7 3)
(4 8 9 5)
(5 9 10 6)
(6 10 11 7)
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
(4 0 48 52)
(8 4 52 56)
(12 8 56 60)
(11 15 63 59)
(7 11 59 55)
(3 7 55 51)
(0 1 49 48)
(1 2 50 49)
(2 3 51 50)
(15 14 62 63)
(14 13 61 62)
(13 12 60 61)
);
}
blockedFaces
{
type wall;
faces ();
}
baffleWall
{
type wall;
faces ();
}
baffleCyclic_half0
{
type cyclic;
neighbourPatch baffleCyclic_half1;
faces ();
}
baffleCyclic_half1
{
type cyclic;
neighbourPatch baffleCyclic_half0;
faces ();
}
); );

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions # Source tutorial run functions