mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -160,6 +160,7 @@ $(dictionaryEntry)/dictionaryEntry.C
|
||||
$(dictionaryEntry)/dictionaryEntryIO.C
|
||||
|
||||
functionEntries = $(dictionary)/functionEntries
|
||||
$(functionEntries)/calcEntry/calcEntry.C
|
||||
$(functionEntries)/codeStream/codeStream.C
|
||||
$(functionEntries)/functionEntry/functionEntry.C
|
||||
$(functionEntries)/includeEntry/includeEntry.C
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "calcEntry.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
#include "dictionary.H"
|
||||
#include "dynamicCode.H"
|
||||
#include "codeStream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionEntries
|
||||
{
|
||||
defineTypeNameAndDebug(calcEntry, 0);
|
||||
|
||||
addToMemberFunctionSelectionTable
|
||||
(
|
||||
functionEntry,
|
||||
calcEntry,
|
||||
execute,
|
||||
primitiveEntryIstream
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionEntries::calcEntry::execute
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& thisEntry,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
Info<< "Using #calcEntry at line " << is.lineNumber()
|
||||
<< " in file " << parentDict.name() << endl;
|
||||
|
||||
dynamicCode::checkSecurity
|
||||
(
|
||||
"functionEntries::calcEntry::execute(..)",
|
||||
parentDict
|
||||
);
|
||||
|
||||
// Read string
|
||||
string s(is);
|
||||
// Make sure we stop this entry
|
||||
//is.putBack(token(token::END_STATEMENT, is.lineNumber()));
|
||||
|
||||
// Construct codeDict for codeStream
|
||||
// must reference parent for stringOps::expand to work nicely.
|
||||
dictionary codeSubDict;
|
||||
codeSubDict.add("code", "os << (" + s + ");");
|
||||
dictionary codeDict(parentDict, codeSubDict);
|
||||
|
||||
codeStream::streamingFunctionType function = codeStream::getFunction
|
||||
(
|
||||
parentDict,
|
||||
codeDict
|
||||
);
|
||||
|
||||
// use function to write stream
|
||||
OStringStream os(is.format());
|
||||
(*function)(os, parentDict);
|
||||
|
||||
// get the entry from this stream
|
||||
IStringStream resultStream(os.str());
|
||||
thisEntry.read(parentDict, resultStream);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
111
src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H
Normal file
111
src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H
Normal file
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionEntries::calcEntry
|
||||
|
||||
Description
|
||||
Uses dynamic compilation to provide calculating functionality
|
||||
for entering dictionary entries.
|
||||
|
||||
E.g.
|
||||
|
||||
\verbatim
|
||||
a 1.0;
|
||||
b 3;
|
||||
c #calc "$a/$b";
|
||||
\endverbatim
|
||||
|
||||
Note the explicit trailing 0 ('1.0') to force a to be read (and written)
|
||||
as a floating point number.
|
||||
|
||||
Note
|
||||
Internally this is just a wrapper around codeStream functionality - the
|
||||
#calc string gets used to construct a dictionary for codeStream.
|
||||
|
||||
SourceFiles
|
||||
calcEntry.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef calcEntry_H
|
||||
#define calcEntry_H
|
||||
|
||||
#include "functionEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
class dlLibraryTable;
|
||||
|
||||
namespace functionEntries
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class calcEntry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class calcEntry
|
||||
:
|
||||
public functionEntry
|
||||
{
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
calcEntry(const calcEntry&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const calcEntry&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("calc");
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Execute the functionEntry in a sub-dict context
|
||||
static bool execute
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry&,
|
||||
Istream&
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionEntries
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -92,28 +92,13 @@ Foam::dlLibraryTable& Foam::functionEntries::codeStream::libs
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionEntries::codeStream::execute
|
||||
Foam::functionEntries::codeStream::streamingFunctionType
|
||||
Foam::functionEntries::codeStream::getFunction
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& entry,
|
||||
Istream& is
|
||||
const dictionary& codeDict
|
||||
)
|
||||
{
|
||||
Info<< "Using #codeStream at line " << is.lineNumber()
|
||||
<< " in file " << parentDict.name() << endl;
|
||||
|
||||
dynamicCode::checkSecurity
|
||||
(
|
||||
"functionEntries::codeStream::execute(..)",
|
||||
parentDict
|
||||
);
|
||||
|
||||
// get code dictionary
|
||||
// must reference parent for stringOps::expand to work nicely
|
||||
dictionary codeDict("#codeStream", parentDict, is);
|
||||
|
||||
// get code, codeInclude, codeOptions
|
||||
dynamicCodeContext context(codeDict);
|
||||
|
||||
@ -260,6 +245,34 @@ bool Foam::functionEntries::codeStream::execute
|
||||
<< " in library " << lib << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return function;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionEntries::codeStream::execute
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
primitiveEntry& entry,
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
Info<< "Using #codeStream at line " << is.lineNumber()
|
||||
<< " in file " << parentDict.name() << endl;
|
||||
|
||||
dynamicCode::checkSecurity
|
||||
(
|
||||
"functionEntries::codeStream::execute(..)",
|
||||
parentDict
|
||||
);
|
||||
|
||||
// get code dictionary
|
||||
// must reference parent for stringOps::expand to work nicely
|
||||
dictionary codeDict("#codeStream", parentDict, is);
|
||||
|
||||
streamingFunctionType function = getFunction(parentDict, codeDict);
|
||||
|
||||
// use function to write stream
|
||||
OStringStream os(is.format());
|
||||
(*function)(os, parentDict);
|
||||
@ -268,6 +281,7 @@ bool Foam::functionEntries::codeStream::execute
|
||||
IStringStream resultStream(os.str());
|
||||
entry.read(parentDict, resultStream);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -103,6 +103,9 @@ class dlLibraryTable;
|
||||
namespace functionEntries
|
||||
{
|
||||
|
||||
// Forward declaration of friend classes
|
||||
class calcEntry;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class codeStream Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -123,6 +126,14 @@ class codeStream
|
||||
//- Helper function: access to dlLibraryTable of Time
|
||||
static dlLibraryTable& libs(const dictionary& dict);
|
||||
|
||||
//- Construct, compile, load and return streaming function
|
||||
static streamingFunctionType getFunction
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
const dictionary& codeDict
|
||||
);
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
codeStream(const codeStream&);
|
||||
|
||||
@ -137,6 +148,11 @@ public:
|
||||
//- Name of the C code template to be used
|
||||
static const word codeTemplateC;
|
||||
|
||||
// Related types
|
||||
|
||||
//- Declare friendship with the calcEntry class
|
||||
friend class calcEntry;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("codeStream");
|
||||
|
||||
@ -328,6 +328,10 @@ Foam::string& Foam::stringOps::inplaceExpand
|
||||
if (ePtr)
|
||||
{
|
||||
OStringStream buf;
|
||||
// Force floating point numbers to be printed with at least
|
||||
// some decimal digits.
|
||||
buf << fixed;
|
||||
buf.precision(IOstream::defaultPrecision());
|
||||
if (ePtr->isDict())
|
||||
{
|
||||
ePtr->dict().write(buf, false);
|
||||
|
||||
@ -738,7 +738,6 @@ void Foam::triSurfaceMesh::findLineAll
|
||||
// we need something bigger since we're doing calculations)
|
||||
// - if the start-end vector is zero we still progress
|
||||
const vectorField dirVec(end-start);
|
||||
const scalarField magSqrDirVec(magSqr(dirVec));
|
||||
const vectorField smallVec
|
||||
(
|
||||
indexedOctree<treeDataTriSurface>::perturbTol()*dirVec
|
||||
|
||||
@ -255,7 +255,6 @@ void Foam::orientedSurface::findZoneSide
|
||||
zoneFaceI = -1;
|
||||
isOutside = false;
|
||||
|
||||
|
||||
List<pointIndexHit> hits;
|
||||
|
||||
forAll(faceZone, faceI)
|
||||
@ -305,7 +304,6 @@ void Foam::orientedSurface::findZoneSide
|
||||
{
|
||||
isOutside = ((n & d) > 0);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -354,6 +352,50 @@ bool Foam::orientedSurface::flipSurface
|
||||
}
|
||||
|
||||
|
||||
bool Foam::orientedSurface::orientConsistent(triSurface& s)
|
||||
{
|
||||
bool anyFlipped = false;
|
||||
|
||||
// Do initial flipping to make triangles consistent. Otherwise if the
|
||||
// nearest is e.g. on an edge inbetween inconsistent triangles it might
|
||||
// make the wrong decision.
|
||||
if (s.size() > 0)
|
||||
{
|
||||
// Whether face has to be flipped.
|
||||
// UNVISITED: unvisited
|
||||
// NOFLIP: no need to flip
|
||||
// FLIP: need to flip
|
||||
labelList flipState(s.size(), UNVISITED);
|
||||
|
||||
label faceI = 0;
|
||||
while (true)
|
||||
{
|
||||
label startFaceI = -1;
|
||||
while (faceI < s.size())
|
||||
{
|
||||
if (flipState[faceI] == UNVISITED)
|
||||
{
|
||||
startFaceI = faceI;
|
||||
break;
|
||||
}
|
||||
faceI++;
|
||||
}
|
||||
|
||||
if (startFaceI == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
flipState[startFaceI] = NOFLIP;
|
||||
walkSurface(s, startFaceI, flipState);
|
||||
}
|
||||
|
||||
anyFlipped = flipSurface(s, flipState);
|
||||
}
|
||||
return anyFlipped;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Null constructor
|
||||
@ -404,44 +446,10 @@ bool Foam::orientedSurface::orient
|
||||
const bool orientOutside
|
||||
)
|
||||
{
|
||||
bool anyFlipped = false;
|
||||
|
||||
// Do initial flipping to make triangles consistent. Otherwise if the
|
||||
// nearest is e.g. on an edge inbetween inconsistent triangles it might
|
||||
// make the wrong decision.
|
||||
if (s.size() > 0)
|
||||
{
|
||||
// Whether face has to be flipped.
|
||||
// UNVISITED: unvisited
|
||||
// NOFLIP: no need to flip
|
||||
// FLIP: need to flip
|
||||
labelList flipState(s.size(), UNVISITED);
|
||||
|
||||
label faceI = 0;
|
||||
while (true)
|
||||
{
|
||||
label startFaceI = -1;
|
||||
while (faceI < s.size())
|
||||
{
|
||||
if (flipState[faceI] == UNVISITED)
|
||||
{
|
||||
startFaceI = faceI;
|
||||
break;
|
||||
}
|
||||
faceI++;
|
||||
}
|
||||
|
||||
if (startFaceI == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
flipState[startFaceI] = NOFLIP;
|
||||
walkSurface(s, startFaceI, flipState);
|
||||
}
|
||||
|
||||
anyFlipped = flipSurface(s, flipState);
|
||||
}
|
||||
bool topoFlipped = orientConsistent(s);
|
||||
|
||||
|
||||
// Whether face has to be flipped.
|
||||
@ -497,7 +505,7 @@ bool Foam::orientedSurface::orient
|
||||
// Now finally flip triangles according to flipState.
|
||||
bool geomFlipped = flipSurface(s, flipState);
|
||||
|
||||
return anyFlipped || geomFlipped;
|
||||
return topoFlipped || geomFlipped;
|
||||
}
|
||||
|
||||
|
||||
@ -509,6 +517,11 @@ bool Foam::orientedSurface::orient
|
||||
const bool orientOutside
|
||||
)
|
||||
{
|
||||
// Do initial flipping to make triangles consistent. Otherwise if the
|
||||
// nearest is e.g. on an edge inbetween inconsistent triangles it might
|
||||
// make the wrong decision.
|
||||
bool topoFlipped = orientConsistent(s);
|
||||
|
||||
// Determine disconnected parts of surface
|
||||
boolList borderEdge(s.nEdges(), false);
|
||||
forAll(s.edgeFaces(), edgeI)
|
||||
@ -549,7 +562,11 @@ bool Foam::orientedSurface::orient
|
||||
}
|
||||
walkSurface(s, zoneFaceI, flipState);
|
||||
}
|
||||
return flipSurface(s, flipState);
|
||||
|
||||
// Now finally flip triangles according to flipState.
|
||||
bool geomFlipped = flipSurface(s, flipState);
|
||||
|
||||
return topoFlipped || geomFlipped;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -128,6 +128,9 @@ class orientedSurface
|
||||
// anything flipped.
|
||||
static bool flipSurface(triSurface& s, const labelList& flipState);
|
||||
|
||||
//- Make surface surface has consistent orientation across connected
|
||||
// triangles.
|
||||
static bool orientConsistent(triSurface& s);
|
||||
public:
|
||||
|
||||
ClassName("orientedSurface");
|
||||
|
||||
@ -201,9 +201,8 @@ const
|
||||
|
||||
if (inter.hit())
|
||||
{
|
||||
label sz = hits.size();
|
||||
hits.setSize(sz+1);
|
||||
hits[sz] = inter;
|
||||
hits.setSize(1);
|
||||
hits[0] = inter;
|
||||
|
||||
const vector dirVec(end-start);
|
||||
const scalar magSqrDirVec(magSqr(dirVec));
|
||||
|
||||
@ -25,14 +25,23 @@ Class
|
||||
Foam::incompressible::LESModels::kOmegaSSTSAS
|
||||
|
||||
Description
|
||||
kOmegaSSTSAS LES turbulence model for incompressible flows
|
||||
kOmegaSSTSAS LES turbulence model for incompressible flows
|
||||
based on:
|
||||
|
||||
"Evaluation of the SST-SAS model: channel flow, asymmetric diffuser
|
||||
and axi-symmetric hill".
|
||||
European Conference on Computational Fluid Dynamics ECCOMAS CFD 2006.
|
||||
Lars Davidson
|
||||
|
||||
|
||||
The first term of the Qsas expression is corrected following:
|
||||
|
||||
DESider A European Effort on Hybrid RANS-LES Modelling:
|
||||
Results of the European-Union Funded Project, 2004 - 2007
|
||||
(Notes on Numerical Fluid Mechanics and Multidisciplinary Design).
|
||||
Chapter 8 Formulation of the Scale-Adaptive Simulation (SAS) Model during
|
||||
the DESIDER Project. Published in Springer-Verlag Berlin Heidelberg 2009.
|
||||
Chapter 2, section 8 Formulation of the Scale-Adaptive Simulation (SAS)
|
||||
Model during the DESIDER Project. Published in Springer-Verlag Berlin
|
||||
Heidelberg 2009.
|
||||
F. R. Menter and Y. Egorov.
|
||||
|
||||
SourceFiles
|
||||
|
||||
Reference in New Issue
Block a user