mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -202,6 +202,7 @@ $(dll)/codedBase/codedBase.C
|
||||
|
||||
db/functionObjects/functionObject/functionObject.C
|
||||
db/functionObjects/functionObjectList/functionObjectList.C
|
||||
db/functionObjects/functionObjectFile/functionObjectFile.C
|
||||
db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,266 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 "functionObjectFile.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word Foam::functionObjectFile::outputPrefix = "postProcessing";
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::functionObjectFile::baseFileDir() const
|
||||
{
|
||||
fileName baseDir = obr_.time().path();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
baseDir = baseDir/".."/outputPrefix;
|
||||
}
|
||||
else
|
||||
{
|
||||
baseDir = baseDir/outputPrefix;
|
||||
}
|
||||
|
||||
// append mesh name if not default region
|
||||
if (isA<polyMesh>(obr_))
|
||||
{
|
||||
const polyMesh& mesh = refCast<const polyMesh>(obr_);
|
||||
if (mesh.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
baseDir = baseDir/mesh.name();
|
||||
}
|
||||
}
|
||||
|
||||
return baseDir;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::functionObjectFile::baseTimeDir() const
|
||||
{
|
||||
return baseFileDir()/prefix_/obr_.time().timeName();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::createFiles()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
const word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(wordHashSet, names_, iter)
|
||||
{
|
||||
if (!filePtrs_.set(i))
|
||||
{
|
||||
fileName outputDir(baseFileDir()/prefix_/startTimeName);
|
||||
|
||||
mkDir(outputDir);
|
||||
|
||||
filePtrs_.set(i, new OFstream(outputDir/(iter.key() + ".dat")));
|
||||
|
||||
writeFileHeader(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::writeFileHeader(const label i)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::write()
|
||||
{
|
||||
createFiles();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::resetNames(const wordList& names)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(names);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
|
||||
createFiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::resetName(const word& name)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(name);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(1);
|
||||
|
||||
createFiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFile::functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix
|
||||
)
|
||||
:
|
||||
obr_(obr),
|
||||
prefix_(prefix),
|
||||
names_(),
|
||||
filePtrs_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::functionObjectFile::functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& name
|
||||
)
|
||||
:
|
||||
obr_(obr),
|
||||
prefix_(prefix),
|
||||
names_(),
|
||||
filePtrs_()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(name);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
|
||||
// cannot create files - need to access virtual function
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::functionObjectFile::functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const wordList& names
|
||||
)
|
||||
:
|
||||
obr_(obr),
|
||||
prefix_(prefix),
|
||||
names_(names),
|
||||
filePtrs_()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(names);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
|
||||
// cannot create files - need to access virtual function
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFile::~functionObjectFile()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordHashSet& Foam::functionObjectFile::names() const
|
||||
{
|
||||
return names_;
|
||||
}
|
||||
|
||||
|
||||
Foam::OFstream& Foam::functionObjectFile::file()
|
||||
{
|
||||
if (!Pstream::master())
|
||||
{
|
||||
FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::file()")
|
||||
<< "Request for file() can only be done by the master process"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (filePtrs_.size() != 1)
|
||||
{
|
||||
WarningIn("Foam::Ostream& Foam::functionObjectFile::file()")
|
||||
<< "Requested single file, but multiple files are present"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return filePtrs_[0];
|
||||
}
|
||||
|
||||
|
||||
Foam::PtrList<Foam::OFstream>& Foam::functionObjectFile::files()
|
||||
{
|
||||
if (!Pstream::master())
|
||||
{
|
||||
FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::files()")
|
||||
<< "Request for files() can only be done by the master process"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return filePtrs_;
|
||||
}
|
||||
|
||||
|
||||
Foam::OFstream& Foam::functionObjectFile::file(const label i)
|
||||
{
|
||||
if (!Pstream::master())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::OFstream& Foam::functionObjectFile::file(const label)"
|
||||
)
|
||||
<< "Request for file(i) can only be done by the master process"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return filePtrs_[i];
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,163 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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::functionObjectFile
|
||||
|
||||
Description
|
||||
Base class for output file data handling
|
||||
|
||||
See Also
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
functionObjectFile.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjectFile_H
|
||||
#define functionObjectFile_H
|
||||
|
||||
#include "objectRegistry.H"
|
||||
#include "OFstream.H"
|
||||
#include "PtrList.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObjectFile Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class functionObjectFile
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Prefix
|
||||
const word& prefix_;
|
||||
|
||||
//- File names
|
||||
wordHashSet names_;
|
||||
|
||||
//- File pointer
|
||||
PtrList<OFstream> filePtrs_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Return the base directory for output
|
||||
virtual fileName baseFileDir() const;
|
||||
|
||||
//- Return the base directory for the current time value
|
||||
virtual fileName baseTimeDir() const;
|
||||
|
||||
//- Create the output file
|
||||
virtual void createFiles();
|
||||
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i = 0);
|
||||
|
||||
//- Write function
|
||||
virtual void write();
|
||||
|
||||
//- Reset the list of names from a wordList
|
||||
virtual void resetNames(const wordList& names);
|
||||
|
||||
//- Reset the list of names to a single name entry
|
||||
virtual void resetName(const word& name);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
functionObjectFile(const functionObjectFile&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const functionObjectFile&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Folder prefix
|
||||
static const word outputPrefix;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
functionObjectFile(const objectRegistry& obr, const word& prefix);
|
||||
|
||||
//- Construct from components
|
||||
functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& name
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const wordList& names
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~functionObjectFile();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return const access to the names
|
||||
const wordHashSet& names() const;
|
||||
|
||||
//- Return access to the file (if only 1)
|
||||
OFstream& file();
|
||||
|
||||
//- Return access to the files
|
||||
PtrList<OFstream>& files();
|
||||
|
||||
//- Return file 'i'
|
||||
OFstream& file(const label i);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -34,53 +34,9 @@ defineTypeNameAndDebug(Foam::cloudInfo, 0);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::cloudInfo::makeFiles()
|
||||
void Foam::cloudInfo::writeFileHeader(const label i)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating cloudInfo output files." << endl;
|
||||
}
|
||||
|
||||
outputFilePtr_.clear();
|
||||
outputFilePtr_.setSize(cloudSet_.size());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
label i = 0;
|
||||
forAllConstIter(wordHashSet, cloudSet_, iter)
|
||||
{
|
||||
const word& cloudName = iter.key();
|
||||
fileName cloudInfoDir(obr_.time().path());
|
||||
word timeName = Foam::name(obr_.time().startTime().value());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
cloudInfoDir = cloudInfoDir/".."/name_/timeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
cloudInfoDir = cloudInfoDir/name_/timeName;
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(cloudInfoDir);
|
||||
|
||||
// Open new files at start up
|
||||
outputFilePtr_.set
|
||||
(
|
||||
i,
|
||||
new OFstream(cloudInfoDir/(cloudName + ".dat"))
|
||||
);
|
||||
|
||||
// Add headers
|
||||
outputFilePtr_[i]
|
||||
<< "# Time" << tab << "nParcels" << tab << "mass" << endl;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
file(i) << "# Time" << tab << "nParcels" << tab << "mass" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -94,11 +50,10 @@ Foam::cloudInfo::cloudInfo
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
cloudSet_(),
|
||||
outputFilePtr_()
|
||||
active_(true)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -116,19 +71,17 @@ void Foam::cloudInfo::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
cloudSet_.insert(wordList(dict.lookup("clouds")));
|
||||
functionObjectFile::resetNames(dict.lookup("clouds"));
|
||||
|
||||
Info<< type() << ": ";
|
||||
if (cloudSet_.size())
|
||||
if (names().size())
|
||||
{
|
||||
Info<< "applying to clouds:" << nl;
|
||||
forAllConstIter(wordHashSet, cloudSet_, iter)
|
||||
forAllConstIter(wordHashSet, names(), iter)
|
||||
{
|
||||
Info<< " " << iter.key() << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
makeFiles();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -154,8 +107,10 @@ void Foam::cloudInfo::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(wordHashSet, cloudSet_, iter)
|
||||
forAllConstIter(wordHashSet, names(), iter)
|
||||
{
|
||||
const word& cloudName = iter.key();
|
||||
|
||||
@ -168,7 +123,7 @@ void Foam::cloudInfo::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_[i]
|
||||
file(i)
|
||||
<< obr_.time().value() << token::TAB
|
||||
<< nParcels << token::TAB
|
||||
<< massInSystem << endl;
|
||||
|
||||
@ -72,7 +72,7 @@ SourceFiles
|
||||
#ifndef cloudInfo_H
|
||||
#define cloudInfo_H
|
||||
|
||||
#include "OFstream.H"
|
||||
#include "functionObjectFile.H"
|
||||
#include "PtrList.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "volFields.H"
|
||||
@ -93,6 +93,8 @@ class mapPolyMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cloudInfo
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -101,22 +103,17 @@ protected:
|
||||
//- Name of this set of cloudInfo object
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Clouds to process
|
||||
wordHashSet cloudSet_;
|
||||
|
||||
//- Output file pointers
|
||||
PtrList<OFstream> outputFilePtr_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- If the output file has not been created create it
|
||||
void makeFiles();
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
cloudInfo(const cloudInfo&);
|
||||
|
||||
@ -128,7 +128,6 @@ namespace Foam
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class fieldAverageItem;
|
||||
class OFstream;
|
||||
template<class Type>
|
||||
class List;
|
||||
class mapPolyMesh;
|
||||
|
||||
@ -62,14 +62,13 @@ Foam::fieldMinMax::fieldMinMax
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
write_(true),
|
||||
log_(false),
|
||||
mode_(mdMag),
|
||||
fieldSet_(),
|
||||
fieldMinMaxFilePtr_(NULL)
|
||||
fieldSet_()
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
@ -99,7 +98,6 @@ void Foam::fieldMinMax::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
write_ = dict.lookupOrDefault<Switch>("write", true);
|
||||
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||
|
||||
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
|
||||
@ -108,72 +106,25 @@ void Foam::fieldMinMax::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldMinMax::makeFile()
|
||||
void Foam::fieldMinMax::writeFileHeader(const label i)
|
||||
{
|
||||
// Create the fieldMinMax file if not already created
|
||||
if (fieldMinMaxFilePtr_.empty())
|
||||
file()
|
||||
<< "# Time" << token::TAB << "field" << token::TAB
|
||||
<< "min" << token::TAB << "position(min)";
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating fieldMinMax file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName fieldMinMaxDir;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
fieldMinMaxDir =
|
||||
obr_.time().path()/".."/name_/obr_.time().timeName();
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldMinMaxDir =
|
||||
obr_.time().path()/name_/obr_.time().timeName();
|
||||
}
|
||||
|
||||
// Create directory if does not exist.
|
||||
mkDir(fieldMinMaxDir);
|
||||
|
||||
// Open new file at start up
|
||||
fieldMinMaxFilePtr_.reset
|
||||
(
|
||||
new OFstream(fieldMinMaxDir/(type() + ".dat"))
|
||||
);
|
||||
|
||||
// Add headers to output data
|
||||
writeFileHeader();
|
||||
}
|
||||
file() << token::TAB << "proc";
|
||||
}
|
||||
}
|
||||
|
||||
file() << token::TAB << "max" << token::TAB << "position(max)";
|
||||
|
||||
void Foam::fieldMinMax::writeFileHeader()
|
||||
{
|
||||
if (fieldMinMaxFilePtr_.valid())
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_()
|
||||
<< "# Time" << token::TAB << "field" << token::TAB
|
||||
<< "min" << token::TAB << "position(min)";
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << token::TAB << "proc";
|
||||
}
|
||||
|
||||
fieldMinMaxFilePtr_()
|
||||
<< token::TAB << "max" << token::TAB << "position(max)";
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << token::TAB << "proc";
|
||||
}
|
||||
|
||||
fieldMinMaxFilePtr_() << endl;
|
||||
file() << token::TAB << "proc";
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -193,11 +144,7 @@ void Foam::fieldMinMax::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
// Create the fieldMinMax file if not already created
|
||||
if (write_)
|
||||
{
|
||||
makeFile();
|
||||
}
|
||||
functionObjectFile::write();
|
||||
|
||||
if (log_)
|
||||
{
|
||||
|
||||
@ -76,6 +76,7 @@ SourceFiles
|
||||
#ifndef fieldMinMax_H
|
||||
#define fieldMinMax_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "HashSet.H"
|
||||
@ -99,6 +100,8 @@ class mapPolyMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fieldMinMax
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
public:
|
||||
|
||||
@ -115,8 +118,8 @@ protected:
|
||||
//- Mode type names
|
||||
static const NamedEnum<modeType, 2> modeTypeNames_;
|
||||
|
||||
//- Name of this set of field min/max.
|
||||
// Also used as the name of the output directory.
|
||||
//- Name of this set of field min/max
|
||||
// Also used as the name of the output directory
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
@ -124,9 +127,6 @@ protected:
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Switch to enable/disable writing to file
|
||||
Switch write_;
|
||||
|
||||
//- Switch to send output to Info as well
|
||||
Switch log_;
|
||||
|
||||
@ -136,15 +136,9 @@ protected:
|
||||
//- Fields to assess min/max
|
||||
wordList fieldSet_;
|
||||
|
||||
//- Min/max file ptr
|
||||
autoPtr<OFstream> fieldMinMaxFilePtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- If the output file has not been created create it
|
||||
void makeFile();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fieldMinMax(const fieldMinMax&);
|
||||
|
||||
@ -152,7 +146,7 @@ protected:
|
||||
void operator=(const fieldMinMax&);
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -83,29 +83,25 @@ void Foam::fieldMinMax::calcMinMaxFields
|
||||
scalar maxValue = maxVs[maxI];
|
||||
const vector& maxC = maxCs[maxI];
|
||||
|
||||
if (write_)
|
||||
file()
|
||||
<< obr_.time().value() << token::TAB
|
||||
<< fieldName << token::TAB
|
||||
<< minValue << token::TAB << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_()
|
||||
<< obr_.time().value() << token::TAB
|
||||
<< fieldName << token::TAB
|
||||
<< minValue << token::TAB << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << token::TAB << minI;
|
||||
}
|
||||
|
||||
fieldMinMaxFilePtr_()
|
||||
<< token::TAB << maxValue << token::TAB << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << token::TAB << maxI;
|
||||
}
|
||||
|
||||
fieldMinMaxFilePtr_() << endl;
|
||||
file() << token::TAB << minI;
|
||||
}
|
||||
|
||||
file() << token::TAB << maxValue << token::TAB << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file() << token::TAB << maxI;
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " min(mag(" << fieldName << ")) = "
|
||||
@ -163,29 +159,25 @@ void Foam::fieldMinMax::calcMinMaxFields
|
||||
Type maxValue = maxVs[maxI];
|
||||
const vector& maxC = maxCs[maxI];
|
||||
|
||||
if (write_)
|
||||
file()
|
||||
<< obr_.time().value() << token::TAB
|
||||
<< fieldName << token::TAB
|
||||
<< minValue << token::TAB << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_()
|
||||
<< obr_.time().value() << token::TAB
|
||||
<< fieldName << token::TAB
|
||||
<< minValue << token::TAB << minC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << token::TAB << minI;
|
||||
}
|
||||
|
||||
fieldMinMaxFilePtr_()
|
||||
<< token::TAB << maxValue << token::TAB << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << token::TAB << maxI;
|
||||
}
|
||||
|
||||
fieldMinMaxFilePtr_() << endl;
|
||||
file() << token::TAB << minI;
|
||||
}
|
||||
|
||||
file() << token::TAB << maxValue << token::TAB << maxC;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
file() << token::TAB << maxI;
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " min(" << fieldName << ") = "
|
||||
|
||||
@ -153,24 +153,21 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::cellSource::writeFileHeader()
|
||||
void Foam::fieldValues::cellSource::writeFileHeader(const label i)
|
||||
{
|
||||
if (outputFilePtr_.valid())
|
||||
file()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Cells : " << nCells_ << nl
|
||||
<< "# Time" << tab << "sum(V)";
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Cells : " << nCells_ << nl
|
||||
<< "# Time" << tab << "sum(V)";
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< tab << operationTypeNames_[operation_]
|
||||
<< "(" << fields_[i] << ")";
|
||||
}
|
||||
|
||||
outputFilePtr_() << endl;
|
||||
file()
|
||||
<< tab << operationTypeNames_[operation_]
|
||||
<< "(" << fields_[i] << ")";
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -184,7 +181,7 @@ Foam::fieldValues::cellSource::cellSource
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, loadFromFiles),
|
||||
fieldValue(name, obr, dict, typeName, loadFromFiles),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
nCells_(0),
|
||||
@ -223,7 +220,7 @@ void Foam::fieldValues::cellSource::write()
|
||||
scalar totalVolume = gSum(filterField(mesh().V()));
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_() << obr_.time().value() << tab << totalVolume;
|
||||
file() << obr_.time().value() << tab << totalVolume;
|
||||
}
|
||||
|
||||
forAll(fields_, i)
|
||||
@ -237,7 +234,7 @@ void Foam::fieldValues::cellSource::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_()<< endl;
|
||||
file()<< endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
|
||||
@ -214,7 +214,7 @@ protected:
|
||||
) const;
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -195,7 +195,7 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName)
|
||||
}
|
||||
|
||||
|
||||
outputFilePtr_()<< tab << result;
|
||||
file()<< tab << result;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
|
||||
@ -472,24 +472,21 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::writeFileHeader()
|
||||
void Foam::fieldValues::faceSource::writeFileHeader(const label i)
|
||||
{
|
||||
if (outputFilePtr_.valid())
|
||||
file()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Faces : " << nFaces_ << nl
|
||||
<< "# Time" << tab << "sum(magSf)";
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Faces : " << nFaces_ << nl
|
||||
<< "# Time" << tab << "sum(magSf)";
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< tab << operationTypeNames_[operation_]
|
||||
<< "(" << fields_[i] << ")";
|
||||
}
|
||||
|
||||
outputFilePtr_() << endl;
|
||||
file()
|
||||
<< tab << operationTypeNames_[operation_]
|
||||
<< "(" << fields_[i] << ")";
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -532,7 +529,7 @@ Foam::fieldValues::faceSource::faceSource
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, loadFromFiles),
|
||||
fieldValue(name, obr, dict, typeName, loadFromFiles),
|
||||
surfaceWriterPtr_(NULL),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
@ -586,7 +583,7 @@ void Foam::fieldValues::faceSource::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_() << obr_.time().value() << tab << totalArea;
|
||||
file() << obr_.time().value() << tab << totalArea;
|
||||
}
|
||||
|
||||
forAll(fields_, i)
|
||||
@ -600,7 +597,7 @@ void Foam::fieldValues::faceSource::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_()<< endl;
|
||||
file()<< endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
|
||||
@ -296,7 +296,7 @@ protected:
|
||||
) const;
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -269,19 +269,8 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
||||
combineMeshGeometry(faces, points);
|
||||
}
|
||||
|
||||
fileName outputDir;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir = obr_.time().path()/".."/name_;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_;
|
||||
}
|
||||
|
||||
outputDir = outputDir/"surface"/obr_.time().timeName();
|
||||
fileName outputDir =
|
||||
baseFileDir()/name_/"surface"/obr_.time().timeName();
|
||||
|
||||
surfaceWriterPtr_->write
|
||||
(
|
||||
@ -302,7 +291,7 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
||||
{
|
||||
Type result = processValues(values, Sf, weightField);
|
||||
|
||||
outputFilePtr_()<< tab << result;
|
||||
file()<< tab << result;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
|
||||
@ -49,48 +49,6 @@ void Foam::fieldValue::movePoints(const Field<point>&)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::makeFile()
|
||||
{
|
||||
// Create the output file if not already created
|
||||
if (outputFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir;
|
||||
word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
obr_.time().path()/".."/name_/startTimeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_/startTimeName;
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(outputDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
writeFileHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
@ -106,12 +64,12 @@ void Foam::fieldValue::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
}
|
||||
|
||||
makeFile();
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,17 +81,18 @@ Foam::fieldValue::fieldValue
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const word& valueType,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, valueType),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(false),
|
||||
sourceName_(dict.lookupOrDefault<word>("sourceName", "sampledSurface")),
|
||||
fields_(dict.lookup("fields")),
|
||||
valueOutput_(dict.lookup("valueOutput")),
|
||||
outputFilePtr_(NULL)
|
||||
valueOutput_(dict.lookup("valueOutput"))
|
||||
{
|
||||
// Only active if obr is an fvMesh
|
||||
if (isA<fvMesh>(obr_))
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#ifndef fieldValue_H
|
||||
#define fieldValue_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "Switch.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "OFstream.H"
|
||||
@ -58,6 +59,8 @@ class mapPolyMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fieldValue
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
|
||||
protected:
|
||||
@ -85,18 +88,9 @@ protected:
|
||||
//- Output field values flag
|
||||
Switch valueOutput_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
|
||||
// Functions to be over-ridden from IOoutputFilter class
|
||||
|
||||
//- Make the output file
|
||||
virtual void makeFile();
|
||||
|
||||
//- Write the output file header
|
||||
virtual void writeFileHeader() = 0;
|
||||
|
||||
//- Update mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
@ -116,6 +110,7 @@ public:
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const word& valueType,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
@ -65,32 +65,13 @@ void Foam::regionSizeDistribution::writeGraph
|
||||
const scalarField& values
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
const wordList valNames(1, valueName);
|
||||
|
||||
fileName outputPath;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
outputPath = mesh.time().path()/".."/name_;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputPath = mesh.time().path()/name_;
|
||||
}
|
||||
fileName outputPath = baseTimeDir();
|
||||
mkDir(outputPath);
|
||||
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
outputPath = outputPath/mesh.name();
|
||||
}
|
||||
OFstream str(outputPath/formatterPtr_().getFileName(coords, valNames));
|
||||
|
||||
mkDir(outputPath/mesh.time().timeName());
|
||||
OFstream str
|
||||
(
|
||||
outputPath
|
||||
/ mesh.time().timeName()
|
||||
/ formatterPtr_().getFileName(coords, valNames)
|
||||
);
|
||||
Info<< "Writing distribution of " << valueName << " to " << str.name()
|
||||
<< endl;
|
||||
|
||||
@ -341,6 +322,7 @@ Foam::regionSizeDistribution::regionSizeDistribution
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
|
||||
@ -98,6 +98,7 @@ SourceFiles
|
||||
#ifndef regionSizeDistribution_H
|
||||
#define regionSizeDistribution_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "writer.H"
|
||||
#include "Map.H"
|
||||
@ -121,6 +122,8 @@ class polyMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class regionSizeDistribution
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
|
||||
@ -629,8 +629,8 @@ void Foam::streamLine::write()
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"sets"/name()
|
||||
: runTime.path()/"sets"/name()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
|
||||
@ -756,8 +756,8 @@ void Foam::wallBoundedStreamLine::write()
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"sets"/name()
|
||||
: runTime.path()/"sets"/name()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
|
||||
@ -85,14 +85,11 @@ void Foam::forceCoeffs::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::forceCoeffs::writeFileHeader()
|
||||
void Foam::forceCoeffs::writeFileHeader(const label i)
|
||||
{
|
||||
if (forcesFilePtr_.valid())
|
||||
{
|
||||
forcesFilePtr_()
|
||||
<< "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab
|
||||
<< "Cl(f)" << "Cl(r)" << endl;
|
||||
}
|
||||
file()
|
||||
<< "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab
|
||||
<< "Cl(f)" << "Cl(r)" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -112,12 +109,12 @@ void Foam::forceCoeffs::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
// Create the forces file if not already created
|
||||
makeFile();
|
||||
forces::calcForcesMoment();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
|
||||
|
||||
Field<vector> totForce(force_[0] + force_[1]);
|
||||
@ -140,7 +137,7 @@ void Foam::forceCoeffs::write()
|
||||
scalar Clf = Cl/2.0 - Cm;
|
||||
scalar Clr = Cl/2.0 + Cm;
|
||||
|
||||
forcesFilePtr_()
|
||||
file()
|
||||
<< obr_.time().value() << tab
|
||||
<< Cm << tab << Cd << tab << Cl << tab << Clf << tab << Clr
|
||||
<< endl;
|
||||
@ -169,8 +166,7 @@ void Foam::forceCoeffs::write()
|
||||
mag(binPoints_)
|
||||
);
|
||||
|
||||
fileName forcesDir =
|
||||
baseFileDir()/"bins"/obr_.time().timeName();
|
||||
fileName forcesDir = baseTimeDir();
|
||||
mkDir(forcesDir);
|
||||
|
||||
if (log_)
|
||||
@ -178,7 +174,7 @@ void Foam::forceCoeffs::write()
|
||||
Info<< " Writing bins to " << forcesDir << endl;
|
||||
}
|
||||
|
||||
OFstream osCoeffs(forcesDir/"forceCoeffs");
|
||||
OFstream osCoeffs(forcesDir/"forceCoeffs_bins");
|
||||
binWriterPtr->write(axis, fieldNames, coeffs, osCoeffs);
|
||||
}
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ class forceCoeffs
|
||||
protected:
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -45,74 +45,21 @@ defineTypeNameAndDebug(Foam::forces, 0);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::forces::baseFileDir() const
|
||||
void Foam::forces::writeFileHeader(const label i)
|
||||
{
|
||||
fileName baseDir;
|
||||
file()
|
||||
<< "# Time" << tab
|
||||
<< "forces(pressure, viscous) moment(pressure, viscous)";
|
||||
|
||||
if (Pstream::parRun())
|
||||
if (localSystem_)
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
baseDir = obr_.time().path()/".."/name_;
|
||||
}
|
||||
else
|
||||
{
|
||||
baseDir = obr_.time().path()/name_;
|
||||
file()
|
||||
<< tab
|
||||
<< "local forces(pressure, viscous) "
|
||||
<< "local moment(pressure, viscous)";
|
||||
}
|
||||
|
||||
return baseDir;
|
||||
}
|
||||
|
||||
|
||||
void Foam::forces::makeFile()
|
||||
{
|
||||
// Create the forces file if not already created
|
||||
if (forcesFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating forces file" << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
fileName forcesDir = baseFileDir()/startTimeName;
|
||||
|
||||
// Create directory if does not exist.
|
||||
mkDir(forcesDir);
|
||||
|
||||
// Open new file at start up
|
||||
forcesFilePtr_.reset(new OFstream(forcesDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
writeFileHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::forces::writeFileHeader()
|
||||
{
|
||||
if (forcesFilePtr_.valid())
|
||||
{
|
||||
forcesFilePtr_()
|
||||
<< "# Time" << tab
|
||||
<< "forces(pressure, viscous) moment(pressure, viscous)";
|
||||
|
||||
if (localSystem_)
|
||||
{
|
||||
forcesFilePtr_()
|
||||
<< tab
|
||||
<< "local forces(pressure, viscous) "
|
||||
<< "local moment(pressure, viscous)";
|
||||
}
|
||||
|
||||
forcesFilePtr_()<< endl;
|
||||
}
|
||||
file()<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -281,21 +228,20 @@ void Foam::forces::writeBins() const
|
||||
autoPtr<writer<vector> > binWriterPtr(writer<vector>::New(binFormat_));
|
||||
coordSet axis("forces", "distance", binPoints_, mag(binPoints_));
|
||||
|
||||
fileName forcesDir = baseFileDir()/"bins"/obr_.time().timeName();
|
||||
fileName forcesDir = baseTimeDir();
|
||||
mkDir(forcesDir);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " Writing bins to " << forcesDir << endl;
|
||||
|
||||
}
|
||||
|
||||
wordList fieldNames(IStringStream("(pressure viscous)")());
|
||||
|
||||
OFstream osForce(forcesDir/"force");
|
||||
OFstream osForce(forcesDir/"force_bins");
|
||||
binWriterPtr->write(axis, fieldNames, force_, osForce);
|
||||
|
||||
OFstream osMoment(forcesDir/"moment");
|
||||
OFstream osMoment(forcesDir/"moment_bins");
|
||||
binWriterPtr->write(axis, fieldNames, moment_, osMoment);
|
||||
|
||||
|
||||
@ -327,6 +273,7 @@ Foam::forces::forces
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, word(dict.lookup("type"))),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
@ -348,8 +295,7 @@ Foam::forces::forces
|
||||
binDx_(0.0),
|
||||
binMin_(GREAT),
|
||||
binPoints_(),
|
||||
binFormat_("undefined"),
|
||||
forcesFilePtr_(NULL)
|
||||
binFormat_("undefined")
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
@ -385,6 +331,7 @@ Foam::forces::forces
|
||||
const coordinateSystem& coordSys
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
@ -406,8 +353,7 @@ Foam::forces::forces
|
||||
binDx_(0.0),
|
||||
binMin_(GREAT),
|
||||
binPoints_(),
|
||||
binFormat_("undefined"),
|
||||
forcesFilePtr_(NULL)
|
||||
binFormat_("undefined")
|
||||
{}
|
||||
|
||||
|
||||
@ -592,13 +538,12 @@ void Foam::forces::write()
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the forces file if not already created
|
||||
makeFile();
|
||||
|
||||
calcForcesMoment();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " output:" << nl
|
||||
@ -609,7 +554,7 @@ void Foam::forces::write()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
forcesFilePtr_() << obr_.time().value() << tab
|
||||
file() << obr_.time().value() << tab
|
||||
<< "(" << sum(force_[0]) << "," << sum(force_[1]) << ") "
|
||||
<< "(" << sum(moment_[0]) << "," << sum(moment_[1]) << ")"
|
||||
<< endl;
|
||||
@ -621,7 +566,7 @@ void Foam::forces::write()
|
||||
vectorField localMomentP(coordSys_.localVector(moment_[0]));
|
||||
vectorField localMomentV(coordSys_.localVector(moment_[1]));
|
||||
|
||||
forcesFilePtr_() << obr_.time().value() << tab
|
||||
file() << obr_.time().value() << tab
|
||||
<< "(" << sum(localForceP) << "," << sum(localForceV) << ") "
|
||||
<< "(" << sum(localMomentP) << "," << sum(localMomentV) << ")"
|
||||
<< endl;
|
||||
@ -633,8 +578,6 @@ void Foam::forces::write()
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
forcesFilePtr_() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,6 +103,7 @@ SourceFiles
|
||||
#ifndef forces_H
|
||||
#define forces_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "coordinateSystems.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
@ -129,6 +130,8 @@ class mapPolyMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class forces
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -207,20 +210,10 @@ protected:
|
||||
word binFormat_;
|
||||
|
||||
|
||||
//- Forces/moment file ptr
|
||||
autoPtr<OFstream> forcesFilePtr_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Return the base file directory for output
|
||||
fileName baseFileDir() const;
|
||||
|
||||
//- If the forces file has not been created create it
|
||||
void makeFile();
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Return the effective viscous stress (laminar + turbulent).
|
||||
tmp<volSymmTensorField> devRhoReff() const;
|
||||
|
||||
@ -35,49 +35,13 @@ License
|
||||
defineTypeNameAndDebug(Foam::DESModelRegions, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::DESModelRegions::makeFile()
|
||||
void Foam::DESModelRegions::writeFileHeader(const label i)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
if (outputFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir;
|
||||
word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
obr_.time().path()/".."/name_/startTimeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_/startTimeName;
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(outputDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
outputFilePtr_() << "# DES model region coverage (% volume)" << nl
|
||||
<< "# time " << token::TAB << "LES" << token::TAB << "RAS"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
file() << "# DES model region coverage (% volume)" << nl
|
||||
<< "# time " << token::TAB << "LES" << token::TAB << "RAS"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -91,11 +55,11 @@ Foam::DESModelRegions::DESModelRegions
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(false),
|
||||
outputFilePtr_(NULL)
|
||||
log_(false)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
@ -114,8 +78,6 @@ Foam::DESModelRegions::DESModelRegions
|
||||
<< endl;
|
||||
}
|
||||
|
||||
makeFile();
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -159,6 +121,8 @@ void Foam::DESModelRegions::write()
|
||||
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
if (log_)
|
||||
@ -203,7 +167,7 @@ void Foam::DESModelRegions::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_() << obr_.time().timeName() << token::TAB
|
||||
file() << obr_.time().timeName() << token::TAB
|
||||
<< prc << token::TAB << 100.0 - prc << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#ifndef DESModelRegions_H
|
||||
#define DESModelRegions_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
@ -64,8 +65,12 @@ class fvMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class DESModelRegions
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of DESModelRegions object
|
||||
word name_;
|
||||
@ -78,14 +83,11 @@ class DESModelRegions
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Make the output file
|
||||
virtual void makeFile();
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
DESModelRegions(const DESModelRegions&);
|
||||
|
||||
@ -35,49 +35,14 @@ License
|
||||
defineTypeNameAndDebug(Foam::wallShearStress, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::wallShearStress::makeFile()
|
||||
void Foam::wallShearStress::writeFileHeader(const label i)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
if (outputFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir;
|
||||
word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
obr_.time().path()/".."/name_/startTimeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_/startTimeName;
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(outputDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
outputFilePtr_() << "# Wall shear stress" << nl
|
||||
<< "# time " << token::TAB << "patch" << token::TAB
|
||||
<< "min" << token::TAB << "max" << endl;
|
||||
}
|
||||
}
|
||||
// Add headers to output data
|
||||
file() << "# Wall shear stress" << nl
|
||||
<< "# time " << token::TAB << "patch" << token::TAB
|
||||
<< "min" << token::TAB << "max" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -101,12 +66,15 @@ void Foam::wallShearStress::calcShearStress
|
||||
|
||||
ssp = (-Sfp/magSfp) & Reffp;
|
||||
|
||||
vector minSsp = min(ssp);
|
||||
vector maxSsp = max(ssp);
|
||||
vector minSsp = gMin(ssp);
|
||||
vector maxSsp = gMax(ssp);
|
||||
|
||||
outputFilePtr_() << mesh.time().timeName() << token::TAB
|
||||
<< pp.name() << token::TAB << minSsp
|
||||
<< token::TAB << maxSsp << endl;
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << mesh.time().timeName() << token::TAB
|
||||
<< pp.name() << token::TAB << minSsp
|
||||
<< token::TAB << maxSsp << endl;
|
||||
}
|
||||
|
||||
if (log_)
|
||||
{
|
||||
@ -128,12 +96,12 @@ Foam::wallShearStress::wallShearStress
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(false),
|
||||
phiName_("phi"),
|
||||
outputFilePtr_(NULL)
|
||||
phiName_("phi")
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
@ -152,8 +120,6 @@ Foam::wallShearStress::wallShearStress
|
||||
<< endl;
|
||||
}
|
||||
|
||||
makeFile();
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -195,6 +161,8 @@ void Foam::wallShearStress::write()
|
||||
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volVectorField wallShearStress
|
||||
|
||||
@ -54,6 +54,7 @@ SourceFiles
|
||||
#ifndef wallShearStress_H
|
||||
#define wallShearStress_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
@ -75,8 +76,12 @@ class fvMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wallShearStress
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of wallShearStress object
|
||||
word name_;
|
||||
@ -92,14 +97,11 @@ class wallShearStress
|
||||
//- Name of mass/volume flux field (optional, default = phi)
|
||||
word phiName_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Make the output file
|
||||
virtual void makeFile();
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Calculate the shear stress
|
||||
void calcShearStress
|
||||
|
||||
@ -39,48 +39,12 @@ defineTypeNameAndDebug(Foam::yPlusLES, 0);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::yPlusLES::makeFile()
|
||||
void Foam::yPlusLES::writeFileHeader(const label i)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
if (outputFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir;
|
||||
word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
obr_.time().path()/".."/name_/startTimeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_/startTimeName;
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(outputDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
outputFilePtr_() << "# y+ (LES)" << nl
|
||||
<< "# time " << token::TAB << "patch" << token::TAB
|
||||
<< "min" << token::TAB << "max" << token::TAB << "average"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
file() << "# y+ (LES)" << nl
|
||||
<< "# time " << token::TAB << "patch" << token::TAB
|
||||
<< "min" << token::TAB << "max" << token::TAB << "average"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -120,20 +84,20 @@ void Foam::yPlusLES::calcIncompressibleYPlus
|
||||
|
||||
const scalarField& Yp = yPlus.boundaryField()[patchI];
|
||||
|
||||
scalar minYp = min(Yp);
|
||||
scalar maxYp = max(Yp);
|
||||
scalar avgYp = average(Yp);
|
||||
scalar minYp = gMin(Yp);
|
||||
scalar maxYp = gMax(Yp);
|
||||
scalar avgYp = gAverage(Yp);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " patch " << currPatch.name()
|
||||
<< " y+ : min = " << min(Yp) << ", max = " << max(Yp)
|
||||
<< ", average = " << average(Yp) << nl;
|
||||
<< " y+ : min = " << minYp << ", max = " << maxYp
|
||||
<< ", average = " << avgYp << nl;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_() << obr_.time().value() << token::TAB
|
||||
file() << obr_.time().value() << token::TAB
|
||||
<< currPatch.name() << token::TAB
|
||||
<< minYp << token::TAB << maxYp << token::TAB
|
||||
<< avgYp << endl;
|
||||
@ -186,20 +150,20 @@ void Foam::yPlusLES::calcCompressibleYPlus
|
||||
|
||||
const scalarField& Yp = yPlus.boundaryField()[patchI];
|
||||
|
||||
scalar minYp = min(Yp);
|
||||
scalar maxYp = max(Yp);
|
||||
scalar avgYp = average(Yp);
|
||||
scalar minYp = gMin(Yp);
|
||||
scalar maxYp = gMax(Yp);
|
||||
scalar avgYp = gAverage(Yp);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " patch " << currPatch.name()
|
||||
<< " y+ : min = " << min(Yp) << ", max = " << max(Yp)
|
||||
<< ", average = " << average(Yp) << nl;
|
||||
<< " y+ : min = " << minYp << ", max = " << maxYp
|
||||
<< ", average = " << avgYp << nl;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_() << obr_.time().value() << token::TAB
|
||||
file() << obr_.time().value() << token::TAB
|
||||
<< currPatch.name() << token::TAB
|
||||
<< minYp << token::TAB << maxYp << token::TAB
|
||||
<< avgYp << endl;
|
||||
@ -224,13 +188,13 @@ Foam::yPlusLES::yPlusLES
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(false),
|
||||
phiName_("phi"),
|
||||
UName_("U"),
|
||||
outputFilePtr_(NULL)
|
||||
UName_("U")
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
@ -248,8 +212,6 @@ Foam::yPlusLES::yPlusLES
|
||||
) << "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
makeFile();
|
||||
}
|
||||
|
||||
|
||||
@ -287,6 +249,8 @@ void Foam::yPlusLES::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
obr_.lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#ifndef yPlusLES_H
|
||||
#define yPlusLES_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
@ -61,6 +62,8 @@ class fvMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class yPlusLES
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -81,14 +84,11 @@ class yPlusLES
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Make the output file
|
||||
virtual void makeFile();
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Calculate incompressible form of y+
|
||||
void calcIncompressibleYPlus
|
||||
|
||||
@ -41,48 +41,12 @@ defineTypeNameAndDebug(Foam::yPlusRAS, 0);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::yPlusRAS::makeFile()
|
||||
void Foam::yPlusRAS::writeFileHeader(const label i)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
if (outputFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir;
|
||||
word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
obr_.time().path()/".."/name_/startTimeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_/startTimeName;
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(outputDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
outputFilePtr_() << "# y+ (RAS)" << nl
|
||||
<< "# time " << token::TAB << "patch" << token::TAB
|
||||
<< "min" << token::TAB << "max" << token::TAB << "average"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
file() << "# y+ (RAS)" << nl
|
||||
<< "# time " << token::TAB << "patch" << token::TAB
|
||||
<< "min" << token::TAB << "max" << token::TAB << "average"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -115,9 +79,9 @@ void Foam::yPlusRAS::calcIncompressibleYPlus
|
||||
yPlus.boundaryField()[patchI] = nutPw.yPlus();
|
||||
const scalarField& Yp = yPlus.boundaryField()[patchI];
|
||||
|
||||
scalar minYp = min(Yp);
|
||||
scalar maxYp = max(Yp);
|
||||
scalar avgYp = average(Yp);
|
||||
scalar minYp = gMin(Yp);
|
||||
scalar maxYp = gMax(Yp);
|
||||
scalar avgYp = gAverage(Yp);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
@ -128,7 +92,7 @@ void Foam::yPlusRAS::calcIncompressibleYPlus
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_() << obr_.time().value() << token::TAB
|
||||
file() << obr_.time().value() << token::TAB
|
||||
<< nutPw.patch().name() << token::TAB
|
||||
<< minYp << token::TAB << maxYp << token::TAB
|
||||
<< avgYp << endl;
|
||||
@ -173,9 +137,9 @@ void Foam::yPlusRAS::calcCompressibleYPlus
|
||||
yPlus.boundaryField()[patchI] = mutPw.yPlus();
|
||||
const scalarField& Yp = yPlus.boundaryField()[patchI];
|
||||
|
||||
scalar minYp = min(Yp);
|
||||
scalar maxYp = max(Yp);
|
||||
scalar avgYp = average(Yp);
|
||||
scalar minYp = gMin(Yp);
|
||||
scalar maxYp = gMax(Yp);
|
||||
scalar avgYp = gAverage(Yp);
|
||||
|
||||
if (log_)
|
||||
{
|
||||
@ -186,7 +150,7 @@ void Foam::yPlusRAS::calcCompressibleYPlus
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputFilePtr_() << obr_.time().value() << token::TAB
|
||||
file() << obr_.time().value() << token::TAB
|
||||
<< mutPw.patch().name() << token::TAB
|
||||
<< minYp << token::TAB << maxYp << token::TAB
|
||||
<< avgYp << endl;
|
||||
@ -212,12 +176,12 @@ Foam::yPlusRAS::yPlusRAS
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(false),
|
||||
phiName_("phi"),
|
||||
outputFilePtr_(NULL)
|
||||
phiName_("phi")
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
@ -235,8 +199,6 @@ Foam::yPlusRAS::yPlusRAS
|
||||
) << "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
makeFile();
|
||||
}
|
||||
|
||||
|
||||
@ -274,6 +236,8 @@ void Foam::yPlusRAS::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFile::write();
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
obr_.lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#ifndef yPlusRAS_H
|
||||
#define yPlusRAS_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
@ -61,6 +62,8 @@ class fvMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class yPlusRAS
|
||||
:
|
||||
public functionObjectFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -78,14 +81,11 @@ class yPlusRAS
|
||||
//- Name of mass/volume flux field (optional, default = phi)
|
||||
word phiName_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Make the output file
|
||||
virtual void makeFile();
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Calculate incompressible form of y+
|
||||
void calcIncompressibleYPlus(const fvMesh& mesh, volScalarField& yPlus);
|
||||
|
||||
@ -215,9 +215,15 @@ void temperatureThermoBaffleFvPatchScalarField::write(Ostream& os) const
|
||||
os.writeKeyword(word(thermoModel + "Coeffs"));
|
||||
os << dict_.subDict(thermoModel + "Coeffs") << nl;
|
||||
|
||||
os.writeKeyword("thermoType");
|
||||
os << dict_.subDict("thermoType") << nl;
|
||||
|
||||
os.writeKeyword("mixture");
|
||||
os << dict_.subDict("mixture") << nl;
|
||||
}
|
||||
|
||||
os.writeKeyword("radiation");
|
||||
os << dict_.subDict("radiation") << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ Foam::label Foam::probes::prepare()
|
||||
{
|
||||
probeSubDir = probeSubDir/mesh_.name();
|
||||
}
|
||||
probeSubDir = probeSubDir/mesh_.time().timeName();
|
||||
probeSubDir = "postProcessing"/probeSubDir/mesh_.time().timeName();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
|
||||
@ -144,11 +144,11 @@ Foam::sampledSets::sampledSets
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
outputPath_ = mesh_.time().path()/".."/name_;
|
||||
outputPath_ = mesh_.time().path()/".."/"postProcessing"/name_;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputPath_ = mesh_.time().path()/name_;
|
||||
outputPath_ = mesh_.time().path()/"postProcessing"/name_;
|
||||
}
|
||||
if (mesh_.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
|
||||
@ -99,11 +99,11 @@ Foam::sampledSurfaces::sampledSurfaces
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
outputPath_ = mesh_.time().path()/".."/name_;
|
||||
outputPath_ = mesh_.time().path()/".."/"postProcessing"/name_;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputPath_ = mesh_.time().path()/name_;
|
||||
outputPath_ = mesh_.time().path()/"postProcessing"/name_;
|
||||
}
|
||||
|
||||
read(dict);
|
||||
|
||||
@ -96,12 +96,6 @@ dictionaryReplacement
|
||||
{
|
||||
kappa 1.0;
|
||||
}
|
||||
radiation
|
||||
{
|
||||
sigmaS 0;
|
||||
kappaRad 0;
|
||||
emissivity 0;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Hf 0;
|
||||
|
||||
@ -101,12 +101,6 @@ dictionaryReplacement
|
||||
{
|
||||
kappa 1;
|
||||
}
|
||||
radiation
|
||||
{
|
||||
sigmaS 0;
|
||||
kappaRad 0;
|
||||
emissivity 0;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Hf 0;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
forces
|
||||
forceCoeffs1
|
||||
{
|
||||
type forceCoeffs;
|
||||
functionObjectLibs ( "libforces.so" );
|
||||
|
||||
Reference in New Issue
Block a user