mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://hunt/home/hunt2/OpenFOAM/OpenFOAM-dev
This commit is contained in:
121
src/OSspecific/Unix/regularExpression.H
Normal file
121
src/OSspecific/Unix/regularExpression.H
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 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::regularExpression
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wrapper around regular expressions.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef regularExpression_H
|
||||||
|
#define regularExpression_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class regularExpression Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class regularExpression
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Precompiled regular expression
|
||||||
|
regex_t* preg_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
regularExpression(const regularExpression&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const regularExpression&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from string
|
||||||
|
inline regularExpression(const string& s)
|
||||||
|
{
|
||||||
|
preg_ = new regex_t;
|
||||||
|
|
||||||
|
if (regcomp(preg_, s.c_str(), REG_EXTENDED|REG_NOSUB) != 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"regularExpression::regularExpression(const char*)"
|
||||||
|
) << "Failed to compile regular expression " << s
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
//- Construct from string
|
||||||
|
inline ~regularExpression()
|
||||||
|
{
|
||||||
|
if (preg_)
|
||||||
|
{
|
||||||
|
regfree(preg_);
|
||||||
|
delete preg_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Matches?
|
||||||
|
inline bool matches(const string& s)
|
||||||
|
{
|
||||||
|
size_t nmatch = 0;
|
||||||
|
regmatch_t *pmatch = NULL;
|
||||||
|
|
||||||
|
return regexec(preg_, s.c_str(), nmatch, pmatch, 0) == 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -526,7 +526,7 @@ Foam::point Foam::face::centre(const pointField& meshPoints) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::face::normal(const pointField& meshPoints) const
|
Foam::vector Foam::face::normal(const pointField& p) const
|
||||||
{
|
{
|
||||||
// Calculate the normal by summing the face triangle normals.
|
// Calculate the normal by summing the face triangle normals.
|
||||||
// Changed to deal with small concavity by using a central decomposition
|
// Changed to deal with small concavity by using a central decomposition
|
||||||
@ -539,38 +539,43 @@ Foam::vector Foam::face::normal(const pointField& meshPoints) const
|
|||||||
{
|
{
|
||||||
return triPointRef
|
return triPointRef
|
||||||
(
|
(
|
||||||
meshPoints[operator[](0)],
|
p[operator[](0)],
|
||||||
meshPoints[operator[](1)],
|
p[operator[](1)],
|
||||||
meshPoints[operator[](2)]
|
p[operator[](2)]
|
||||||
).normal();
|
).normal();
|
||||||
}
|
}
|
||||||
|
|
||||||
vector n = vector::zero;
|
|
||||||
|
|
||||||
point centrePoint = Foam::average(points(meshPoints));
|
|
||||||
|
|
||||||
label nPoints = size();
|
label nPoints = size();
|
||||||
|
|
||||||
point nextPoint = centrePoint;
|
|
||||||
|
|
||||||
register label pI;
|
register label pI;
|
||||||
|
|
||||||
|
point centrePoint = vector::zero;
|
||||||
|
for (pI = 0; pI < nPoints; pI++)
|
||||||
|
{
|
||||||
|
centrePoint += p[operator[](pI)];
|
||||||
|
}
|
||||||
|
centrePoint /= nPoints;
|
||||||
|
|
||||||
|
vector n = vector::zero;
|
||||||
|
|
||||||
|
point nextPoint = centrePoint;
|
||||||
|
|
||||||
for (pI = 0; pI < nPoints; pI++)
|
for (pI = 0; pI < nPoints; pI++)
|
||||||
{
|
{
|
||||||
if (pI < nPoints - 1)
|
if (pI < nPoints - 1)
|
||||||
{
|
{
|
||||||
nextPoint = meshPoints[operator[](pI + 1)];
|
nextPoint = p[operator[](pI + 1)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextPoint = meshPoints[operator[](0)];
|
nextPoint = p[operator[](0)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: for best accuracy, centre point always comes last
|
// Note: for best accuracy, centre point always comes last
|
||||||
//
|
//
|
||||||
n += triPointRef
|
n += triPointRef
|
||||||
(
|
(
|
||||||
meshPoints[operator[](pI)],
|
p[operator[](pI)],
|
||||||
nextPoint,
|
nextPoint,
|
||||||
centrePoint
|
centrePoint
|
||||||
).normal();
|
).normal();
|
||||||
|
|||||||
@ -25,9 +25,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
|
#include "regularExpression.H"
|
||||||
#include <sys/types.h>
|
|
||||||
#include <regex.h>
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -41,24 +39,12 @@ labelList findStrings(const string& regexp, const StringList& sl)
|
|||||||
{
|
{
|
||||||
labelList matches(sl.size());
|
labelList matches(sl.size());
|
||||||
|
|
||||||
regex_t *preg = new regex_t;
|
regularExpression re(regexp);
|
||||||
|
|
||||||
if (regcomp(preg, regexp.c_str(), REG_EXTENDED|REG_NOSUB) != 0)
|
|
||||||
{
|
|
||||||
WarningIn("findStrings(const string& regexp, const stringList& sl)")
|
|
||||||
<< "Failed to compile regular expression " << regexp
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
return matches;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t nmatch = 0;
|
|
||||||
regmatch_t *pmatch = NULL;
|
|
||||||
|
|
||||||
label matchi = 0;
|
label matchi = 0;
|
||||||
forAll(sl, i)
|
forAll(sl, i)
|
||||||
{
|
{
|
||||||
if (regexec(preg, sl[i].c_str(), nmatch, pmatch, 0) == 0)
|
if (re.matches(sl[i]))
|
||||||
{
|
{
|
||||||
matches[matchi++] = i;
|
matches[matchi++] = i;
|
||||||
}
|
}
|
||||||
@ -66,9 +52,6 @@ labelList findStrings(const string& regexp, const StringList& sl)
|
|||||||
|
|
||||||
matches.setSize(matchi);
|
matches.setSize(matchi);
|
||||||
|
|
||||||
regfree(preg);
|
|
||||||
delete preg;
|
|
||||||
|
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -205,11 +205,12 @@ void faceSet::sync(const polyMesh& mesh)
|
|||||||
|
|
||||||
reduce(nAdded, sumOp<label>());
|
reduce(nAdded, sumOp<label>());
|
||||||
|
|
||||||
if (nAdded > 0)
|
//if (nAdded > 0)
|
||||||
{
|
//{
|
||||||
Info<< "Added an additional " << nAdded << " faces on coupled patches. "
|
// Info<< "Added an additional " << nAdded
|
||||||
<< "(processorPolyPatch, cyclicPolyPatch)" << endl;
|
// << " faces on coupled patches. "
|
||||||
}
|
// << "(processorPolyPatch, cyclicPolyPatch)" << endl;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,5 +6,6 @@ wmake libo postCalc
|
|||||||
wmake libso forces
|
wmake libso forces
|
||||||
wmake libso fieldAverage
|
wmake libso fieldAverage
|
||||||
wmake libso foamCalcFunctions
|
wmake libso foamCalcFunctions
|
||||||
|
wmake libso minMaxFields
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
50
src/postProcessing/minMaxFields/IOminMaxFields.H
Normal file
50
src/postProcessing/minMaxFields/IOminMaxFields.H
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 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
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::IOminMaxFields
|
||||||
|
|
||||||
|
Description
|
||||||
|
Instance of the generic IOOutputFilter for minMaxFields.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IOminMaxFields_H
|
||||||
|
#define IOminMaxFields_H
|
||||||
|
|
||||||
|
#include "minMaxFields.H"
|
||||||
|
#include "IOOutputFilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef IOOutputFilter<minMaxFields> IOminMaxFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
4
src/postProcessing/minMaxFields/Make/files
Normal file
4
src/postProcessing/minMaxFields/Make/files
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
minMaxFields.C
|
||||||
|
minMaxFieldsFunctionObject.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libminMaxFields
|
||||||
8
src/postProcessing/minMaxFields/Make/options
Normal file
8
src/postProcessing/minMaxFields/Make/options
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
203
src/postProcessing/minMaxFields/minMaxFields.C
Normal file
203
src/postProcessing/minMaxFields/minMaxFields.C
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 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 "minMaxFields.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(minMaxFields, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::minMaxFields::minMaxFields
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const bool loadFromFiles
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
obr_(obr),
|
||||||
|
active_(true),
|
||||||
|
log_(false),
|
||||||
|
fieldSet_(),
|
||||||
|
minMaxFieldsFilePtr_(NULL)
|
||||||
|
{
|
||||||
|
// Check if the available mesh is an fvMesh otherise deactivate
|
||||||
|
if (!isA<fvMesh>(obr_))
|
||||||
|
{
|
||||||
|
active_ = false;
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"minMaxFields::minMaxFields"
|
||||||
|
"(const objectRegistry& obr, const dictionary& dict)"
|
||||||
|
) << "No fvMesh available, deactivating."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::minMaxFields::~minMaxFields()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::minMaxFields::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||||
|
|
||||||
|
dict.lookup("fields") >> fieldSet_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::minMaxFields::makeFile()
|
||||||
|
{
|
||||||
|
// Create the minMaxFields file if not already created
|
||||||
|
if (!minMaxFieldsFilePtr_.valid())
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating minMaxFields file." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// File update
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
fileName minMaxFieldsDir;
|
||||||
|
if (Pstream::parRun())
|
||||||
|
{
|
||||||
|
// Put in undecomposed case (Note: gives problems for
|
||||||
|
// distributed data running)
|
||||||
|
minMaxFieldsDir =
|
||||||
|
obr_.time().path()/".."/name_/obr_.time().timeName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minMaxFieldsDir =
|
||||||
|
obr_.time().path()/name_/obr_.time().timeName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create directory if does not exist.
|
||||||
|
mkDir(minMaxFieldsDir);
|
||||||
|
|
||||||
|
// Open new file at start up
|
||||||
|
minMaxFieldsFilePtr_.reset
|
||||||
|
(
|
||||||
|
new OFstream(minMaxFieldsDir/(type() + ".dat"))
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add headers to output data
|
||||||
|
writeFileHeader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::minMaxFields::writeFileHeader()
|
||||||
|
{
|
||||||
|
if (minMaxFieldsFilePtr_.valid())
|
||||||
|
{
|
||||||
|
minMaxFieldsFilePtr_()
|
||||||
|
<< "# Time" << tab << "field" << tab << "min" << tab << "max"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::minMaxFields::execute()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
void Foam::minMaxFields::write()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
// Create the minMaxFields file if not already created
|
||||||
|
makeFile();
|
||||||
|
|
||||||
|
forAll(fieldSet_, fieldI)
|
||||||
|
{
|
||||||
|
calcMinMaxFields<scalar>(fieldSet_[fieldI]);
|
||||||
|
calcMinMaxFields<vector>(fieldSet_[fieldI]);
|
||||||
|
calcMinMaxFields<sphericalTensor>(fieldSet_[fieldI]);
|
||||||
|
calcMinMaxFields<symmTensor>(fieldSet_[fieldI]);
|
||||||
|
calcMinMaxFields<tensor>(fieldSet_[fieldI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void Foam::minMaxFields::calcMinMaxFields<Foam::scalar>
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (obr_.foundObject<volScalarField>(fieldName))
|
||||||
|
{
|
||||||
|
const scalarField& field = obr_.lookupObject<scalarField>(fieldName);
|
||||||
|
scalar minValue = min(field);
|
||||||
|
scalar maxValue = max(field);
|
||||||
|
|
||||||
|
reduce(minValue, minOp<scalar>());
|
||||||
|
reduce(maxValue, maxOp<scalar>());
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
minMaxFieldsFilePtr_() << obr_.time().value() << tab
|
||||||
|
<< fieldName << tab << minValue << tab << maxValue << endl;
|
||||||
|
|
||||||
|
if (log_)
|
||||||
|
{
|
||||||
|
Info<< "minMaxFields output:" << nl
|
||||||
|
<< " min(" << fieldName << ") = " << minValue << nl
|
||||||
|
<< " max(" << fieldName << ") = " << maxValue << nl
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
182
src/postProcessing/minMaxFields/minMaxFields.H
Normal file
182
src/postProcessing/minMaxFields/minMaxFields.H
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 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::minMaxFields
|
||||||
|
|
||||||
|
Description
|
||||||
|
Calculates scalar minimim and maximum field values.
|
||||||
|
|
||||||
|
For variables with rank > 0, computes the magnitude of the min/max
|
||||||
|
values.
|
||||||
|
|
||||||
|
Data written to the file \<timeDir\>/minMaxFields.dat
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
minMaxFields.C
|
||||||
|
IOminMaxFields.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef minMaxFields_H
|
||||||
|
#define minMaxFields_H
|
||||||
|
|
||||||
|
#include "primitiveFieldsFwd.H"
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "labelHashSet.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
#include "pointFieldFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class dictionary;
|
||||||
|
class mapPolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class minMaxFields Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class minMaxFields
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of this set of forces,
|
||||||
|
// Also used as the name of the probes directory.
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
//- on/off switch
|
||||||
|
bool active_;
|
||||||
|
|
||||||
|
//- Switch to send output to Info as well as to file
|
||||||
|
Switch log_;
|
||||||
|
|
||||||
|
//- Patches to integrate forces over
|
||||||
|
wordList fieldSet_;
|
||||||
|
|
||||||
|
|
||||||
|
//- Forces/moment file ptr
|
||||||
|
autoPtr<OFstream> minMaxFieldsFilePtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- If the forces file has not been created create it
|
||||||
|
void makeFile();
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
minMaxFields(const minMaxFields&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const minMaxFields&);
|
||||||
|
|
||||||
|
//- Output file header information
|
||||||
|
virtual void writeFileHeader();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("minMaxFields");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for given objectRegistry and dictionary.
|
||||||
|
// Allow the possibility to load fields from files
|
||||||
|
minMaxFields
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry&,
|
||||||
|
const dictionary&,
|
||||||
|
const bool loadFromFiles = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~minMaxFields();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name of the set of forces
|
||||||
|
virtual const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read the forces data
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
//- Execute
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Calculate the field min/max
|
||||||
|
template<class Type>
|
||||||
|
void calcMinMaxFields(const word& fieldName);
|
||||||
|
|
||||||
|
//- Write the minMaxFields
|
||||||
|
virtual void write();
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void updateMesh(const mapPolyMesh&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void movePoints(const pointField&)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Template specialisation for scalar fields
|
||||||
|
template<>
|
||||||
|
void minMaxFields::calcMinMaxFields<scalar>(const word& fieldName);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "minMaxFieldsTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
43
src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.C
Normal file
43
src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.C
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 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 "minMaxFieldsFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineNamedTemplateTypeNameAndDebug(minMaxFieldsFunctionObject, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
minMaxFieldsFunctionObject,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
55
src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.H
Normal file
55
src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.H
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 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
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::minMaxFieldsFunctionObject
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject wrapper around minMaxFields to allow them to be created via
|
||||||
|
the functions list within controlDict.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
minMaxFieldsFunctionObject.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef minMaxFieldsFunctionObject_H
|
||||||
|
#define minMaxFieldsFunctionObject_H
|
||||||
|
|
||||||
|
#include "minMaxFields.H"
|
||||||
|
#include "OutputFilterFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef OutputFilterFunctionObject<minMaxFields>
|
||||||
|
minMaxFieldsFunctionObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
65
src/postProcessing/minMaxFields/minMaxFieldsTemplates.C
Normal file
65
src/postProcessing/minMaxFields/minMaxFieldsTemplates.C
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 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 "minMaxFields.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::minMaxFields::calcMinMaxFields(const word& fieldName)
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
if (obr_.foundObject<fieldType>(fieldName))
|
||||||
|
{
|
||||||
|
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
|
||||||
|
scalar minValue = min(mag(field)).value();
|
||||||
|
scalar maxValue = max(mag(field)).value();
|
||||||
|
|
||||||
|
reduce(minValue, minOp<scalar>());
|
||||||
|
reduce(maxValue, maxOp<scalar>());
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
minMaxFieldsFilePtr_() << obr_.time().value() << tab
|
||||||
|
<< fieldName << tab << minValue << tab << maxValue << endl;
|
||||||
|
|
||||||
|
if (log_)
|
||||||
|
{
|
||||||
|
Info<< "minMaxFields output:" << nl
|
||||||
|
<< " min(mag(" << fieldName << ")) = " << minValue << nl
|
||||||
|
<< " max(mag(" << fieldName << ")) = " << maxValue << nl
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -41,33 +41,6 @@ namespace compressible
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
wordList replaceWallBoundaryTypes
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const wordList& oldTypeNames,
|
|
||||||
const wordList& newTypeNames
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const fvBoundaryMesh& bm = mesh.boundary();
|
|
||||||
|
|
||||||
wordList boundaryTypes(bm.size());
|
|
||||||
|
|
||||||
forAll(bm, patchI)
|
|
||||||
{
|
|
||||||
if (isType<wallFvPatch>(bm[patchI]))
|
|
||||||
{
|
|
||||||
boundaryTypes[patchI] = newTypeNames[patchI];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boundaryTypes[patchI] = oldTypeNames[patchI];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return boundaryTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<volScalarField> autoCreateMut
|
tmp<volScalarField> autoCreateMut
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
@ -93,20 +66,23 @@ tmp<volScalarField> autoCreateMut
|
|||||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
||||||
<< "selectable wall functions" << endl;
|
<< "selectable wall functions" << endl;
|
||||||
|
|
||||||
wordList mutBoundaryTypes = replaceWallBoundaryTypes
|
const fvBoundaryMesh& bm = mesh.boundary();
|
||||||
(
|
|
||||||
mesh,
|
wordList mutBoundaryTypes(bm.size());
|
||||||
wordList
|
|
||||||
(
|
forAll(bm, patchI)
|
||||||
mesh.boundary().size(),
|
{
|
||||||
calculatedFvPatchField<scalar>::typeName
|
if (isType<wallFvPatch>(bm[patchI]))
|
||||||
),
|
{
|
||||||
wordList
|
mutBoundaryTypes[patchI] =
|
||||||
(
|
RASModels::mutWallFunctionFvPatchScalarField::typeName;
|
||||||
mesh.boundary().size(),
|
}
|
||||||
RASModels::mutWallFunctionFvPatchScalarField::typeName
|
else
|
||||||
)
|
{
|
||||||
);
|
mutBoundaryTypes[patchI] =
|
||||||
|
calculatedFvPatchField<scalar>::typeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tmp<volScalarField> mut
|
tmp<volScalarField> mut
|
||||||
(
|
(
|
||||||
@ -141,12 +117,16 @@ tmp<volScalarField> autoCreateEpsilon
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
|
RASModels::epsilonWallFunctionFvPatchScalarField
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,12 +136,16 @@ tmp<volScalarField> autoCreateOmega
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::omegaWallFunctionFvPatchScalarField::typeName
|
RASModels::omegaWallFunctionFvPatchScalarField
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -171,12 +155,16 @@ tmp<volScalarField> autoCreateK
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
|
RASModels::kQRWallFunctionFvPatchField<scalar>
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,12 +174,16 @@ tmp<volScalarField> autoCreateQ
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
|
RASModels::kQRWallFunctionFvPatchField<scalar>
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -201,12 +193,16 @@ tmp<volSymmTensorField> autoCreateR
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<symmTensor>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
symmTensor,
|
||||||
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName
|
RASModels::kQRWallFunctionFvPatchField<symmTensor>
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,15 +46,6 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
namespace compressible
|
namespace compressible
|
||||||
{
|
{
|
||||||
|
|
||||||
//- Replace old wall BCs with new wall function BCs
|
|
||||||
wordList replaceWallBoundaryTypes
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const wordList& oldTypeNames,
|
|
||||||
const wordList& newTypeNames
|
|
||||||
);
|
|
||||||
|
|
||||||
//- mut
|
//- mut
|
||||||
tmp<volScalarField> autoCreateMut
|
tmp<volScalarField> autoCreateMut
|
||||||
(
|
(
|
||||||
@ -98,13 +89,12 @@ namespace compressible
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Helper function to create the new field
|
//- Helper function to create the new field
|
||||||
template<class Type>
|
template<class Type, class PatchType>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
autoCreateWallFunctionField
|
autoCreateWallFunctionField
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh
|
||||||
const word& wallFunctionName
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,8 @@ License
|
|||||||
#include "backwardsCompatibilityWallFunctions.H"
|
#include "backwardsCompatibilityWallFunctions.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
|
#include "wallPolyPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -36,13 +38,12 @@ namespace compressible
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class PatchType>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
autoCreateWallFunctionField
|
autoCreateWallFunctionField
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh
|
||||||
const word& wallFunctionName
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOobject mutHeader
|
IOobject mutHeader
|
||||||
@ -97,16 +98,32 @@ autoCreateWallFunctionField
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
wordList fieldBoundaryTypes = replaceWallBoundaryTypes
|
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
||||||
(
|
|
||||||
mesh,
|
forAll(newPatchFields, patchI)
|
||||||
fieldOrig().boundaryField().types(),
|
{
|
||||||
wordList
|
if (isType<wallPolyPatch>(mesh.boundaryMesh()[patchI]))
|
||||||
(
|
{
|
||||||
fieldOrig().boundaryField().types().size(),
|
newPatchFields.set
|
||||||
wallFunctionName
|
(
|
||||||
)
|
patchI,
|
||||||
);
|
new PatchType
|
||||||
|
(
|
||||||
|
mesh.boundary()[patchI],
|
||||||
|
fieldOrig().dimensionedInternalField()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
newPatchFields[patchI] == fieldOrig().boundaryField()[patchI];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPatchFields.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
|
fieldOrig().boundaryField()[patchI].clone()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tmp<fieldType> fieldNew
|
tmp<fieldType> fieldNew
|
||||||
(
|
(
|
||||||
@ -122,18 +139,12 @@ autoCreateWallFunctionField
|
|||||||
false
|
false
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dimensioned<Type>
|
fieldOrig().dimensions(),
|
||||||
(
|
fieldOrig().internalField(),
|
||||||
"zero",
|
newPatchFields
|
||||||
fieldOrig().dimensions(),
|
|
||||||
pTraits<Type>::zero
|
|
||||||
),
|
|
||||||
fieldBoundaryTypes
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
fieldNew() == fieldOrig();
|
|
||||||
|
|
||||||
Info<< " Writing backup of original " << fieldName << " to "
|
Info<< " Writing backup of original " << fieldName << " to "
|
||||||
<< fieldName << ".old" << endl;
|
<< fieldName << ".old" << endl;
|
||||||
fieldOrig().rename(fieldName + ".old");
|
fieldOrig().rename(fieldName + ".old");
|
||||||
|
|||||||
@ -41,33 +41,6 @@ namespace incompressible
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
wordList replaceWallBoundaryTypes
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const wordList& oldTypeNames,
|
|
||||||
const wordList& newTypeNames
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const fvBoundaryMesh& bm = mesh.boundary();
|
|
||||||
|
|
||||||
wordList boundaryTypes(bm.size());
|
|
||||||
|
|
||||||
forAll(bm, patchI)
|
|
||||||
{
|
|
||||||
if (isType<wallFvPatch>(bm[patchI]))
|
|
||||||
{
|
|
||||||
boundaryTypes[patchI] = newTypeNames[patchI];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boundaryTypes[patchI] = oldTypeNames[patchI];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return boundaryTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<volScalarField> autoCreateNut
|
tmp<volScalarField> autoCreateNut
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
@ -93,20 +66,23 @@ tmp<volScalarField> autoCreateNut
|
|||||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
||||||
<< "selectable wall functions" << endl;
|
<< "selectable wall functions" << endl;
|
||||||
|
|
||||||
wordList nutBoundaryTypes = replaceWallBoundaryTypes
|
const fvBoundaryMesh& bm = mesh.boundary();
|
||||||
(
|
|
||||||
mesh,
|
wordList nutBoundaryTypes(bm.size());
|
||||||
wordList
|
|
||||||
(
|
forAll(bm, patchI)
|
||||||
mesh.boundary().size(),
|
{
|
||||||
calculatedFvPatchField<scalar>::typeName
|
if (isType<wallFvPatch>(bm[patchI]))
|
||||||
),
|
{
|
||||||
wordList
|
nutBoundaryTypes[patchI] =
|
||||||
(
|
RASModels::nutWallFunctionFvPatchScalarField::typeName;
|
||||||
mesh.boundary().size(),
|
}
|
||||||
RASModels::nutWallFunctionFvPatchScalarField::typeName
|
else
|
||||||
)
|
{
|
||||||
);
|
nutBoundaryTypes[patchI] =
|
||||||
|
calculatedFvPatchField<scalar>::typeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tmp<volScalarField> nut
|
tmp<volScalarField> nut
|
||||||
(
|
(
|
||||||
@ -141,12 +117,16 @@ tmp<volScalarField> autoCreateEpsilon
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
|
RASModels::epsilonWallFunctionFvPatchScalarField
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,12 +136,16 @@ tmp<volScalarField> autoCreateOmega
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::omegaWallFunctionFvPatchScalarField::typeName
|
RASModels::omegaWallFunctionFvPatchScalarField
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -171,12 +155,16 @@ tmp<volScalarField> autoCreateK
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
|
RASModels::kQRWallFunctionFvPatchField<scalar>
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,12 +174,16 @@ tmp<volScalarField> autoCreateQ
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<scalar>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
scalar,
|
||||||
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
|
RASModels::kQRWallFunctionFvPatchField<scalar>
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -201,12 +193,16 @@ tmp<volSymmTensorField> autoCreateR
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return autoCreateWallFunctionField<symmTensor>
|
return
|
||||||
(
|
autoCreateWallFunctionField
|
||||||
fieldName,
|
<
|
||||||
mesh,
|
symmTensor,
|
||||||
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName
|
RASModels::kQRWallFunctionFvPatchField<symmTensor>
|
||||||
);
|
>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,15 +46,6 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
namespace incompressible
|
namespace incompressible
|
||||||
{
|
{
|
||||||
|
|
||||||
//- Replace old wall BCs with new wall function BCs
|
|
||||||
wordList replaceWallBoundaryTypes
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const wordList& oldTypeNames,
|
|
||||||
const wordList& newTypeNames
|
|
||||||
);
|
|
||||||
|
|
||||||
//- nut
|
//- nut
|
||||||
tmp<volScalarField> autoCreateNut
|
tmp<volScalarField> autoCreateNut
|
||||||
(
|
(
|
||||||
@ -98,13 +89,12 @@ namespace incompressible
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Helper function to create the new field
|
//- Helper function to create the new field
|
||||||
template<class Type>
|
template<class Type, class PatchType>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
autoCreateWallFunctionField
|
autoCreateWallFunctionField
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh
|
||||||
const word& wallFunctionName
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,8 @@ License
|
|||||||
#include "backwardsCompatibilityWallFunctions.H"
|
#include "backwardsCompatibilityWallFunctions.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
|
#include "wallPolyPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -36,13 +38,12 @@ namespace incompressible
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class PatchType>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
autoCreateWallFunctionField
|
autoCreateWallFunctionField
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh
|
||||||
const word& wallFunctionName
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOobject nutHeader
|
IOobject nutHeader
|
||||||
@ -97,16 +98,32 @@ autoCreateWallFunctionField
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
wordList fieldBoundaryTypes = replaceWallBoundaryTypes
|
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
||||||
(
|
|
||||||
mesh,
|
forAll(newPatchFields, patchI)
|
||||||
fieldOrig().boundaryField().types(),
|
{
|
||||||
wordList
|
if (isType<wallPolyPatch>(mesh.boundaryMesh()[patchI]))
|
||||||
(
|
{
|
||||||
fieldOrig().boundaryField().types().size(),
|
newPatchFields.set
|
||||||
wallFunctionName
|
(
|
||||||
)
|
patchI,
|
||||||
);
|
new PatchType
|
||||||
|
(
|
||||||
|
mesh.boundary()[patchI],
|
||||||
|
fieldOrig().dimensionedInternalField()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
newPatchFields[patchI] == fieldOrig().boundaryField()[patchI];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPatchFields.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
|
fieldOrig().boundaryField()[patchI].clone()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tmp<fieldType> fieldNew
|
tmp<fieldType> fieldNew
|
||||||
(
|
(
|
||||||
@ -122,18 +139,12 @@ autoCreateWallFunctionField
|
|||||||
false
|
false
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dimensioned<Type>
|
fieldOrig().dimensions(),
|
||||||
(
|
fieldOrig().internalField(),
|
||||||
"zero",
|
newPatchFields
|
||||||
fieldOrig().dimensions(),
|
|
||||||
pTraits<Type>::zero
|
|
||||||
),
|
|
||||||
fieldBoundaryTypes
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
fieldNew() == fieldOrig();
|
|
||||||
|
|
||||||
Info<< " Writing backup of original " << fieldName << " to "
|
Info<< " Writing backup of original " << fieldName << " to "
|
||||||
<< fieldName << ".old" << endl;
|
<< fieldName << ".old" << endl;
|
||||||
fieldOrig().rename(fieldName + ".old");
|
fieldOrig().rename(fieldName + ".old");
|
||||||
|
|||||||
@ -137,6 +137,16 @@ done
|
|||||||
# is returned and not of colouring pipe.
|
# is returned and not of colouring pipe.
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# Define function to colour output by argument 1
|
||||||
|
colourPipe(){
|
||||||
|
if [ "$1" ]; then
|
||||||
|
(while read line; do setterm -foreground $1; echo "$line" ; done; setterm -foreground default)
|
||||||
|
else
|
||||||
|
cat
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
colourIndex=0
|
colourIndex=0
|
||||||
|
|
||||||
while :
|
while :
|
||||||
@ -156,14 +166,14 @@ do
|
|||||||
if lockfile -r0 "$lockFile" 2>/dev/null; then
|
if lockfile -r0 "$lockFile" 2>/dev/null; then
|
||||||
if [ "$WM_COLOURS" ]; then
|
if [ "$WM_COLOURS" ]; then
|
||||||
# Set colour
|
# Set colour
|
||||||
colourString=`setterm -foreground ${colours[$colourIndex]}`
|
colour="${colours[$colourIndex]}"
|
||||||
|
|
||||||
if [ "$host" = "$HOST" ]; then
|
if [ "$host" = "$HOST" ]; then
|
||||||
eval $* 2>&1 | sed -e "s/^/$colourString/"
|
eval $* 2>&1 | colourPipe "$colour"
|
||||||
elif [ -n "$JOB_ID" ]; then
|
elif [ -n "$JOB_ID" ]; then
|
||||||
qrsh -inherit -v PWD $host "$rcmd"
|
qrsh -inherit -v PWD $host "$rcmd"
|
||||||
else
|
else
|
||||||
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | sed -e "s/^/$colourString/"
|
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe "$colour"
|
||||||
fi
|
fi
|
||||||
retval=$?
|
retval=$?
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user