Removed whitespace

This commit is contained in:
Henry
2012-12-07 17:58:35 +00:00
396 changed files with 3043 additions and 1884 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ defineTypeNameAndDebug(Foam::IOobject, 0);
// ----- ------
// "foo" ("", "", "foo")
// "foo/bar" ("foo", "", "bar")
// "/XXX" ERROR - no absolute path
// "/XXX/bar" ("/XXX", "", "bar")
// "foo/bar/" ERROR - no name
// "foo/xxx/bar" ("foo", "xxx", "bar")
// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar")
@ -64,14 +64,6 @@ bool Foam::IOobject::IOobject::fileNameComponents
return false;
}
if (path.isAbsolute())
{
// called with absolute path
WarningIn("IOobject::fileNameComponents(const fileName&, ...)")
<< "called with absolute path: " << path << "\n";
return false;
}
string::size_type first = path.find('/');
if (first == string::npos)
@ -81,6 +73,15 @@ bool Foam::IOobject::IOobject::fileNameComponents
// check afterwards
name.string::operator=(path);
}
else if (first == 0)
{
// Leading '/'. Absolute fileName
string::size_type last = path.rfind('/');
instance = path.substr(0, last);
// check afterwards
name.string::operator=(path.substr(last+1));
}
else
{
instance = path.substr(0, first);
@ -246,7 +247,14 @@ const Foam::fileName& Foam::IOobject::rootPath() const
Foam::fileName Foam::IOobject::path() const
{
return rootPath()/caseName()/instance()/db_.dbDir()/local();
if (instance().isAbsolute())
{
return instance();
}
else
{
return rootPath()/caseName()/instance()/db_.dbDir()/local();
}
}
@ -256,61 +264,80 @@ Foam::fileName Foam::IOobject::path
const fileName& local
) const
{
//Note: can only be called with relative instance since is word type
return rootPath()/caseName()/instance/db_.dbDir()/local;
}
Foam::fileName Foam::IOobject::filePath() const
{
fileName path = this->path();
fileName objectPath = path/name();
if (isFile(objectPath))
if (instance().isAbsolute())
{
return objectPath;
fileName objectPath = instance()/name();
if (isFile(objectPath))
{
return objectPath;
}
else
{
return fileName::null;
}
}
else
{
if
(
time().processorCase()
&& (
instance() == time().system()
|| instance() == time().constant()
)
)
{
fileName parentObjectPath =
rootPath()/caseName()
/".."/instance()/db_.dbDir()/local()/name();
fileName path = this->path();
fileName objectPath = path/name();
if (isFile(parentObjectPath))
{
return parentObjectPath;
}
if (isFile(objectPath))
{
return objectPath;
}
if (!isDir(path))
else
{
word newInstancePath = time().findInstancePath(instant(instance()));
if (newInstancePath.size())
if
(
time().processorCase()
&& (
instance() == time().system()
|| instance() == time().constant()
)
)
{
fileName fName
(
fileName parentObjectPath =
rootPath()/caseName()
/newInstancePath/db_.dbDir()/local()/name()
/".."/instance()/db_.dbDir()/local()/name();
if (isFile(parentObjectPath))
{
return parentObjectPath;
}
}
if (!isDir(path))
{
word newInstancePath = time().findInstancePath
(
instant(instance())
);
if (isFile(fName))
if (newInstancePath.size())
{
return fName;
fileName fName
(
rootPath()/caseName()
/newInstancePath/db_.dbDir()/local()/name()
);
if (isFile(fName))
{
return fName;
}
}
}
}
}
return fileName::null;
return fileName::null;
}
}

View File

@ -148,7 +148,7 @@ void Foam::Time::setControls()
else
{
// Search directory for valid time directories
instantList timeDirs = findTimes(path());
instantList timeDirs = findTimes(path(), constant());
if (startFrom == "firstTime")
{
@ -694,13 +694,13 @@ Foam::word Foam::Time::timeName() const
// Search the construction path for times
Foam::instantList Foam::Time::times() const
{
return findTimes(path());
return findTimes(path(), constant());
}
Foam::word Foam::Time::findInstancePath(const instant& t) const
{
instantList timeDirs = findTimes(path());
instantList timeDirs = findTimes(path(), constant());
forAllReverse(timeDirs, timeI)
{
@ -716,7 +716,7 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const
Foam::instant Foam::Time::findClosestTime(const scalar t) const
{
instantList timeDirs = findTimes(path());
instantList timeDirs = findTimes(path(), constant());
// there is only one time (likely "constant") so return it
if (timeDirs.size() == 1)
@ -755,15 +755,16 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const
//
// Foam::instant Foam::Time::findClosestTime(const scalar t) const
// {
// instantList timeDirs = findTimes(path());
// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0);
// instantList timeDirs = findTimes(path(), constant());
// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0, constant());
// return timeDirs[timeIndex];
// }
Foam::label Foam::Time::findClosestTimeIndex
(
const instantList& timeDirs,
const scalar t
const scalar t,
const word& constantName
)
{
label nearestIndex = -1;
@ -771,7 +772,7 @@ Foam::label Foam::Time::findClosestTimeIndex
forAll(timeDirs, timeI)
{
if (timeDirs[timeI].name() == "constant") continue;
if (timeDirs[timeI].name() == constantName) continue;
scalar diff = mag(timeDirs[timeI].value() - t);
if (diff < deltaT)

View File

@ -374,7 +374,12 @@ public:
instant findClosestTime(const scalar) const;
//- Search instantList for the time index closest to the given time
static label findClosestTimeIndex(const instantList&, const scalar);
static label findClosestTimeIndex
(
const instantList&,
const scalar,
const word& constantName = "constant"
);
//- Write using given format, version and compression
virtual bool writeObject
@ -404,7 +409,11 @@ public:
virtual word timeName() const;
//- Search a given directory for valid time directories
static instantList findTimes(const fileName&);
static instantList findTimes
(
const fileName&,
const word& constantName = "constant"
);
//- Return start time index
virtual label startTimeIndex() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,7 +34,11 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::instantList Foam::Time::findTimes(const fileName& directory)
Foam::instantList Foam::Time::findTimes
(
const fileName& directory,
const word& constantName
)
{
if (debug)
{
@ -53,7 +57,7 @@ Foam::instantList Foam::Time::findTimes(const fileName& directory)
bool haveConstant = false;
forAll(dirEntries, i)
{
if (dirEntries[i] == "constant")
if (dirEntries[i] == constantName)
{
Times[nTimes].value() = 0;
Times[nTimes].name() = dirEntries[i];

View File

@ -155,7 +155,8 @@ void Foam::timeSelector::addOptions
Foam::List<Foam::instant> Foam::timeSelector::select
(
const instantList& timeDirs,
const argList& args
const argList& args,
const word& constantName
)
{
if (timeDirs.size())
@ -168,7 +169,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select
forAll(timeDirs, timeI)
{
if (timeDirs[timeI].name() == "constant")
if (timeDirs[timeI].name() == constantName)
{
constantIdx = timeI;
}
@ -250,7 +251,12 @@ Foam::List<Foam::instant> Foam::timeSelector::select0
const argList& args
)
{
instantList timeDirs = timeSelector::select(runTime.times(), args);
instantList timeDirs = timeSelector::select
(
runTime.times(),
args,
runTime.constant()
);
if (timeDirs.empty())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,7 +138,8 @@ public:
static instantList select
(
const instantList&,
const argList& args
const argList& args,
const word& constantName = "constant"
);
//- Return the set of times selected based on the argList options

View File

@ -117,11 +117,12 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
if (keyword.size() > 2 && keyword[1] == token::BEGIN_BLOCK)
{
// Recursive substitution mode. Replace between {} with
// expansion.
// expansion and then let standard variable expansion deal
// with rest.
string s(keyword(2, keyword.size()-3));
// Substitute dictionary and environment variables. Allow
// Substitute dictionary and environment variables. Do not allow
// empty substitutions.
stringOps::inplaceExpand(s, parentDict, true, true);
stringOps::inplaceExpand(s, parentDict, true, false);
keyword.std::string::replace(1, keyword.size()-1, s);
}
parentDict.substituteScopedKeyword(keyword);

View File

@ -47,13 +47,11 @@ bool Foam::primitiveEntry::expandVariable
{
if (w.size() > 2 && w[0] == '$' && w[1] == token::BEGIN_BLOCK)
{
// Recursive substitution mode. Replace between {} with
// expansion.
// Recursive substitution mode. Replace between {} with expansion.
string s(w(2, w.size()-3));
// Substitute dictionary and environment variables. Allow
// Substitute dictionary and environment variables. Do not allow
// empty substitutions.
stringOps::inplaceExpand(s, dict, true, true);
stringOps::inplaceExpand(s, dict, true, false);
string newW(w);
newW.std::string::replace(1, newW.size()-1, s);
@ -83,6 +81,15 @@ bool Foam::primitiveEntry::expandVariable
if (envStr.empty())
{
FatalIOErrorIn
(
"primitiveEntry::expandVariable"
"(const string&, const dictionary&",
dict
) << "Illegal dictionary entry or environment variable name "
<< varName << endl << "Valid dictionary entries are "
<< dict.toc() << exit(FatalIOError);
return false;
}
append(tokenList(IStringStream('(' + envStr + ')')()));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
(
const word& outputFilterName,
const objectRegistry& obr,
const fileName& dictName,
const word& dictName,
const IOobject::readOption rOpt,
const bool readFromFiles
)
@ -66,6 +66,30 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
{}
template<class OutputFilter>
Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
(
const word& outputFilterName,
const objectRegistry& obr,
const fileName& dictName,
const IOobject::readOption rOpt,
const bool readFromFiles
)
:
IOdictionary
(
IOobject
(
dictName,
obr,
rOpt,
IOobject::NO_WRITE
)
),
OutputFilter(outputFilterName, obr, *this, readFromFiles)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class OutputFilter>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,7 +89,19 @@ public:
(
const word& outputFilterName,
const objectRegistry&,
const fileName& dictName = OutputFilter::typeName() + "Dict",
const word& dictName = OutputFilter::typeName() + "Dict",
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
const bool loadFromFile = false
);
//- Construct for given objectRegistry and dictionary
// Dictionary read from full path.
// Allow the possibility to load fields from files
IOOutputFilter
(
const word& outputFilterName,
const objectRegistry&,
const fileName& dictName,
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
const bool loadFromFile = false
);

View File

@ -0,0 +1,10 @@
//
// addDictOption.H
// ~~~~~~~~~~~~~~~~~
Foam::argList::addOption
(
"dict",
"file",
"read control dictionary from specified location"
);

View File

@ -0,0 +1,33 @@
//
// setConstantMeshDictionaryIO.H
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName dictPath = "";
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
IOobject dictIO
(
dictName,
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
}

View File

@ -0,0 +1,33 @@
//
// setSystemMeshDictionaryIO.H
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName dictPath = "";
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
IOobject dictIO
(
dictName,
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
}

View File

@ -0,0 +1,33 @@
//
// setSystemRunTimeDictionaryIO.H
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName dictPath = "";
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
IOobject dictIO
(
dictName,
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
}

View File

@ -312,7 +312,7 @@ Foam::string Foam::stringOps::getVariable
" const bool\n"
")\n",
dict
) << "Cannot find environment variable "
) << "Cannot find dictionary variable "
<< name << exit(FatalIOError);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,7 +138,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh
IOobject
(
polyMesh::defaultRegion,
"constant",
registry.time().constant(),
registry
),
xferMove(points_),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,7 @@ License
#include "meshReader.H"
#include "IOMap.H"
#include "OFstream.H"
#include "Time.H"
// * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
@ -80,7 +80,7 @@ void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const
IOobject
(
"interfaces",
"constant",
registry.time().constant(),
polyMesh::meshSubDir,
registry,
IOobject::NO_READ,
@ -115,7 +115,7 @@ void Foam::meshReader::writeMeshLabelList
IOobject
(
propertyName,
"constant",
registry.time().constant(),
polyMesh::meshSubDir,
registry,
IOobject::NO_READ,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,7 +72,7 @@ void Foam::meshWriters::STARCD::getCellTable()
IOobject
(
"cellTableId",
"constant",
mesh_.time().constant(),
polyMesh::meshSubDir,
mesh_,
IOobject::READ_IF_PRESENT,
@ -506,7 +506,7 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const
if
(
mesh_.time().timeName() != "0"
&& mesh_.time().timeName() != "constant"
&& mesh_.time().timeName() != mesh_.time().constant()
)
{
baseName += "_" + mesh_.time().timeName();

View File

@ -105,7 +105,7 @@ Foam::fileName Foam::fileFormats::edgeMeshFormatsCore::findMeshInstance
}
}
return "constant";
return t.constant();
}
@ -148,7 +148,7 @@ Foam::fileName Foam::fileFormats::edgeMeshFormatsCore::findMeshFile
}
// fallback to "constant"
return t.path()/"constant"/localName;
return t.path()/t.constant()/localName;
}
#endif

View File

@ -3,13 +3,17 @@ basicSource/basicSourceIO.C
basicSource/basicSourceList.C
basicSource/IObasicSourceList.C
general/semiImplicitSource/semiImplicitSource.C
general/explicitSetValue/explicitSetValue.C
general/codedSource/codedSource.C
general/explicitSetValue/explicitSetValue.C
general/semiImplicitSource/semiImplicitSource.C
derived/actuationDiskSource/actuationDiskSource.C
derived/explicitPorositySource/explicitPorositySource.C
derived/fixedTemperatureSource/fixedTemperatureSource.C
derived/MRFSource/MRFSource.C
derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C
derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
derived/radialActuationDiskSource/radialActuationDiskSource.C
derived/rotorDiskSource/rotorDiskSource.C
derived/rotorDiskSource/bladeModel/bladeModel.C
derived/rotorDiskSource/profileModel/profileModel.C
@ -21,15 +25,11 @@ derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C
derived/rotorDiskSource/trimModel/fixed/fixedTrim.C
derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
derived/actuationDiskSource/actuationDiskSource.C
derived/radialActuationDiskSource/radialActuationDiskSource.C
interRegion = derived/interRegionHeatTransferModel
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C
$(interRegion)/constantHeatTransfer/constantHeatTransfer.C
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C
$(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C
$(interRegion)/variableHeatTransfer/variableHeatTransfer.C
derived/fixedTemperatureSource/fixedTemperatureSource.C
LIB = $(FOAM_LIBBIN)/libfieldSources

View File

@ -481,4 +481,36 @@ void Foam::basicSource::setValue(fvMatrix<tensor>& eqn, const label fieldI)
}
void Foam::basicSource::relativeFlux(surfaceScalarField& phi) const
{
// do nothing
}
void Foam::basicSource::relativeFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const
{
// do nothing
}
void Foam::basicSource::absoluteFlux(surfaceScalarField& phi) const
{
// do nothing
}
void Foam::basicSource::absoluteFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const
{
// do nothing
}
// ************************************************************************* //

View File

@ -427,6 +427,29 @@ public:
);
// Flux manipulations
//- Make the given absolute flux relative
virtual void relativeFlux(surfaceScalarField& phi) const;
//- Make the given absolute mass-flux relative
virtual void relativeFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const;
//- Make the given relative flux absolute
virtual void absoluteFlux(surfaceScalarField& phi) const;
//- Make the given relative mass-flux absolute
virtual void absoluteFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const;
// I-O
//- Write the source header information

View File

@ -108,6 +108,50 @@ void Foam::basicSourceList::reset(const dictionary& dict)
}
void Foam::basicSourceList::relativeFlux(surfaceScalarField& phi) const
{
forAll(*this, i)
{
this->operator[](i).relativeFlux(phi);
}
}
void Foam::basicSourceList::relativeFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const
{
forAll(*this, i)
{
this->operator[](i).relativeFlux(rho, phi);
}
}
void Foam::basicSourceList::absoluteFlux(surfaceScalarField& phi) const
{
forAll(*this, i)
{
this->operator[](i).absoluteFlux(phi);
}
}
void Foam::basicSourceList::absoluteFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const
{
forAll(*this, i)
{
this->operator[](i).absoluteFlux(rho, phi);
}
}
bool Foam::basicSourceList::read(const dictionary& dict)
{
checkTimeIndex_ = mesh_.time().timeIndex() + 2;

View File

@ -152,6 +152,29 @@ public:
void constrain(fvMatrix<Type>& eqn, const word& fieldName);
// Flux manipulations
//- Make the given absolute flux relative
void relativeFlux(surfaceScalarField& phi) const;
//- Make the given absolute mass-flux relative
void relativeFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const;
//- Make the given relative flux absolute
void absoluteFlux(surfaceScalarField& phi) const;
//- Make the given relative mass-flux absolute
void absoluteFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const;
// I-O
//- Read dictionary

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "MRFSource.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "MRFZone.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(MRFSource, 0);
addToRunTimeSelectionTable
(
basicSource,
MRFSource,
dictionary
);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::MRFSource::initialise()
{
if (selectionMode_ != smCellZone)
{
FatalErrorIn("void Foam::MRFSource::initialise()")
<< "The porosity region must be specified as a cellZone. Current "
<< "selection mode is " << selectionModeTypeNames_[selectionMode_]
<< exit(FatalError);
}
mrfPtr_.reset
(
new MRFZone
(
name_,
mesh_,
coeffs_,
cellSetName_
)
);
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
mrfPtr_->correctBoundaryVelocity(const_cast<volVectorField&>(U));
fieldNames_.setSize(1, UName_);
applied_.setSize(1, false);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::MRFSource::MRFSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, modelType, dict, mesh),
mrfPtr_(NULL),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho"))
{
initialise();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::MRFSource::addSup
(
fvMatrix<vector>& eqn,
const label fieldI
)
{
if (eqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
// use 'true' flag to add to rhs of equation
mrfPtr_->addCoriolis(rho, eqn, true);
}
else
{
// use 'true' flag to add to rhs of equation
mrfPtr_->addCoriolis(eqn, true);
}
}
void Foam::MRFSource::relativeFlux(surfaceScalarField& phi) const
{
mrfPtr_->relativeFlux(phi);
}
void Foam::MRFSource::relativeFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const
{
mrfPtr_->relativeFlux(rho, phi);
}
void Foam::MRFSource::absoluteFlux(surfaceScalarField& phi) const
{
mrfPtr_->absoluteFlux(phi);
}
void Foam::MRFSource::absoluteFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const
{
mrfPtr_->absoluteFlux(rho, phi);
}
void Foam::MRFSource::writeData(Ostream& os) const
{
os << indent << name_ << endl;
dict_.write(os);
}
bool Foam::MRFSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
coeffs_.readIfPresent("UName", UName_);
coeffs_.readIfPresent("rhoName", rhoName_);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::MRFSource
Description
Multiple Reference Frame (MRF) source
Example usage:
MRFSourceCoeffs
{
origin (0 0 0);
axis (0 0 1);
omega 104.72;
}
SourceFiles
MRFSource.C
\*---------------------------------------------------------------------------*/
#ifndef MRFSource_H
#define MRFSource_H
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class MRFZone;
/*---------------------------------------------------------------------------*\
Class MRFSource Declaration
\*---------------------------------------------------------------------------*/
class MRFSource
:
public basicSource
{
protected:
// Protected data
//- Run-time selectable porosity model
autoPtr<MRFZone> mrfPtr_;
//- Velocity field name, default = U
word UName_;
//- Density field name, default = rho
word rhoName_;
// Protected Member Functions
//- Initialise
void initialise();
private:
// Private Member Functions
//- Disallow default bitwise copy construct
MRFSource(const MRFSource&);
//- Disallow default bitwise assignment
void operator=(const MRFSource&);
public:
//- Runtime type information
TypeName("MRFSource");
// Constructors
//- Construct from components
MRFSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~MRFSource()
{}
// Member Functions
// Add explicit and implicit contributions
//- Vector
virtual void addSup
(
fvMatrix<vector>& eqn,
const label fieldI
);
// Flux manipulations
//- Make the given absolute flux relative
virtual void relativeFlux(surfaceScalarField& phi) const;
//- Make the given absolute mass-flux relative
virtual void relativeFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const;
//- Make the given relative flux absolute
virtual void absoluteFlux(surfaceScalarField& phi) const;
//- Make the given relative mass-flux absolute
virtual void absoluteFlux
(
const surfaceScalarField& rho,
surfaceScalarField& phi
) const;
// I-O
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,145 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "explicitPorositySource.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "porosityModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(explicitPorositySource, 0);
addToRunTimeSelectionTable
(
basicSource,
explicitPorositySource,
dictionary
);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::explicitPorositySource::initialise()
{
if (selectionMode_ != smCellZone)
{
FatalErrorIn("void Foam::explicitPorositySource::initialise()")
<< "The porosity region must be specified as a cellZone. Current "
<< "selection mode is " << selectionModeTypeNames_[selectionMode_]
<< exit(FatalError);
}
porosityPtr_.reset
(
porosityModel::New
(
name_,
mesh_,
coeffs_,
cellSetName_
).ptr()
),
fieldNames_.setSize(1, UName_);
applied_.setSize(1, false);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::explicitPorositySource::explicitPorositySource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, modelType, dict, mesh),
porosityPtr_(NULL),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho")),
muName_(coeffs_.lookupOrDefault<word>("muName", "thermo:mu"))
{
initialise();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::explicitPorositySource::addSup
(
fvMatrix<vector>& eqn,
const label fieldI
)
{
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
if (eqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName_);
porosityPtr_->addResistance(porosityEqn, rho, mu);
}
else
{
porosityPtr_->addResistance(porosityEqn);
}
eqn -= porosityEqn;
}
void Foam::explicitPorositySource::writeData(Ostream& os) const
{
os << indent << name_ << endl;
dict_.write(os);
}
bool Foam::explicitPorositySource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
coeffs_.readIfPresent("UName", UName_);
coeffs_.readIfPresent("rhoName", rhoName_);
coeffs_.readIfPresent("muName", muName_);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::explicitPorositySource
Description
Explicit porosity source
Sources described by, for example using the DarcyForchheimer model:
explicitPorositySourceCoeffs
{
type DarcyForchheimer;
DarcyForchheimerCoeffs
{
d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
f f [0 -1 0 0 0 0 0] (0 0 0);
coordinateSystem
{
e1 (0.70710678 0.70710678 0);
e2 (0 0 1);
}
}
}
Note:
The porous region must be selected as a cellZone.
SourceFiles
explicitPorositySource.C
\*---------------------------------------------------------------------------*/
#ifndef explicitPorositySource_H
#define explicitPorositySource_H
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class porosityModel;
/*---------------------------------------------------------------------------*\
Class explicitPorositySource Declaration
\*---------------------------------------------------------------------------*/
class explicitPorositySource
:
public basicSource
{
protected:
// Protected data
//- Run-time selectable porosity model
autoPtr<porosityModel> porosityPtr_;
//- Velocity field name, default = U
word UName_;
//- Density field name (compressible case only), default = rho
word rhoName_;
//- Dynamic viscosity field name (compressible case only)
// default = thermo:mu
word muName_;
// Protected Member Functions
//- Initialise
void initialise();
private:
// Private Member Functions
//- Disallow default bitwise copy construct
explicitPorositySource(const explicitPorositySource&);
//- Disallow default bitwise assignment
void operator=(const explicitPorositySource&);
public:
//- Runtime type information
TypeName("explicitPorositySource");
// Constructors
//- Construct from components
explicitPorositySource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~explicitPorositySource()
{}
// Member Functions
// Add explicit and implicit contributions
//- Vector
virtual void addSup
(
fvMatrix<vector>& eqn,
const label fieldI
);
// I-O
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,13 +32,12 @@ Description
fixedTemperatureSourceCoeffs
{
fieldNames (h e hs); // names of fields to apply source
mode uniform; // constant or lookup
mode uniform; // uniform or lookup
// uniform option
temperature constant 500; // fixed temperature [K]
temperature constant 500; // fixed temperature with time [K]
// loolup option
// lookup option
// TName T; // optional temperature field name
}

View File

@ -230,15 +230,16 @@ Foam::MRFZone::MRFZone
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
mesh_(mesh),
name_(name),
coeffs_(dict),
active_(readBool(coeffs_.lookup("active"))),
cellZoneName_(coeffs_.lookup("cellZone")),
cellZoneID_(mesh_.cellZones().findZoneID(cellZoneName_)),
active_(true),
cellZoneName_(cellZoneName),
cellZoneID_(),
excludedPatchNames_
(
coeffs_.lookupOrDefault("nonRotatingPatches", wordList(0))
@ -247,12 +248,20 @@ Foam::MRFZone::MRFZone
axis_(coeffs_.lookup("axis")),
omega_(DataEntry<scalar>::New("omega", coeffs_))
{
if (cellZoneName_ == word::null)
{
coeffs_.lookup("active") >> active_;
coeffs_.lookup("cellZone") >> cellZoneName_;
}
if (!active_)
{
cellZoneID_ = -1;
}
else
{
cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
axis_ = axis_/mag(axis_);
@ -268,7 +277,13 @@ Foam::MRFZone::MRFZone
{
FatalErrorIn
(
"MRFZone(const word&, const fvMesh&, const dictionary&)"
"MRFZone"
"("
"const word&, "
"const fvMesh&, "
"const dictionary&, "
"const word&"
")"
)
<< "cannot find MRF patch " << excludedPatchNames_[i]
<< exit(FatalError);
@ -283,7 +298,13 @@ Foam::MRFZone::MRFZone
{
FatalErrorIn
(
"MRFZone(const word&, const fvMesh&, const dictionary&)"
"MRFZone"
"("
"const word&, "
"const fvMesh&, "
"const dictionary&, "
"const word&"
")"
)
<< "cannot find MRF cellZone " << cellZoneName_
<< exit(FatalError);
@ -328,7 +349,7 @@ void Foam::MRFZone::addCoriolis
}
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn, const bool rhs) const
{
if (cellZoneID_ == -1)
{
@ -342,10 +363,21 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
const vector Omega = this->Omega();
forAll(cells, i)
if (rhs)
{
label celli = cells[i];
Usource[celli] -= V[celli]*(Omega ^ U[celli]);
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] += V[celli]*(Omega ^ U[celli]);
}
}
else
{
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] -= V[celli]*(Omega ^ U[celli]);
}
}
}
@ -353,7 +385,8 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
void Foam::MRFZone::addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
fvVectorMatrix& UEqn,
const bool rhs
) const
{
if (cellZoneID_ == -1)
@ -368,10 +401,21 @@ void Foam::MRFZone::addCoriolis
const vector Omega = this->Omega();
forAll(cells, i)
if (rhs)
{
label celli = cells[i];
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] += V[celli]*rho[celli]*(Omega ^ U[celli]);
}
}
else
{
forAll(cells, i)
{
label celli = cells[i];
Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
}
}
}

View File

@ -144,7 +144,13 @@ public:
// Constructors
//- Construct from fvMesh
MRFZone(const word& name, const fvMesh& mesh, const dictionary& dict);
MRFZone
(
const word& name,
const fvMesh& mesh,
const dictionary& dict,
const word& cellZoneName = word::null
);
//- Return clone
autoPtr<MRFZone> clone() const
@ -185,13 +191,20 @@ public:
) const;
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const;
// Adds to the lhs of the equation; optionally add to rhs
void addCoriolis
(
fvVectorMatrix& UEqn,
const bool rhs = false
) const;
//- Add the Coriolis force contribution to the momentum equation
// Adds to the lhs of the equation; optionally add to rhs
void addCoriolis
(
const volScalarField& rho,
fvVectorMatrix& UEqn
fvVectorMatrix& UEqn,
const bool rhs = false
) const;
//- Make the given absolute velocity relative within the MRF region

View File

@ -47,15 +47,16 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
porosityModel(name, modelType, mesh, dict),
porosityModel(name, modelType, mesh, dict, cellZoneName),
coordSys_(coeffs_, mesh),
D_("D", dimless/sqr(dimLength), tensor::zero),
F_("F", dimless/dimLength, tensor::zero),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")),
muName_(coeffs_.lookupOrDefault<word>("mu", "mu")),
muName_(coeffs_.lookupOrDefault<word>("mu", "thermo:mu")),
nuName_(coeffs_.lookupOrDefault<word>("nu", "nu"))
{
// local-to-global transformation tensor

View File

@ -136,7 +136,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
);
//- Destructor

View File

@ -102,10 +102,11 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
porosityModel(name, modelType, mesh, dict),
porosityModel(name, modelType, mesh, dict, cellZoneName),
coordSys_(coeffs_, mesh),
alpha_("alpha", dimless/dimTime, tensor::zero),
beta_("beta", dimless/dimLength, tensor::zero)

View File

@ -113,7 +113,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
);
//- Destructor

View File

@ -73,17 +73,26 @@ Foam::porosityModel::porosityModel
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
name_(name),
mesh_(mesh),
dict_(dict),
coeffs_(dict.subDict(modelType + "Coeffs")),
active_(readBool(dict_.lookup("active"))),
zoneName_(dict_.lookup("cellZone")),
cellZoneIds_(mesh_.cellZones().findIndices(zoneName_))
active_(true),
zoneName_(cellZoneName),
cellZoneIds_()
{
if (zoneName_ == word::null)
{
dict.lookup("active") >> active_;
dict_.lookup("cellZone") >> zoneName_;
}
cellZoneIds_ = mesh_.cellZones().findIndices(zoneName_);
Info<< " creating porous zone: " << zoneName_ << endl;
bool foundZone = !cellZoneIds_.empty();
@ -99,6 +108,7 @@ Foam::porosityModel::porosityModel
"const word&, "
"const fvMesh&, "
"const dictionary&"
"const word&, "
")"
) << "cannot find porous cellZone " << zoneName_
<< exit(FatalError);

View File

@ -127,9 +127,10 @@ public:
const word& modelName,
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
),
(modelName, name, mesh, dict)
(modelName, name, mesh, dict, cellZoneName)
);
//- Constructor
@ -138,7 +139,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName = word::null
);
//- Return pointer to new porosityModel object created on the freestore
@ -182,7 +184,8 @@ public:
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName = word::null
);
//- Destructor

View File

@ -31,7 +31,8 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
{
const word modelType(dict.lookup("type"));
@ -48,9 +49,10 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
(
"porosityModel::New"
"("
"const word& name,"
"const word&, "
"const fvMesh&, "
"const dictionary&"
"const dictionary&, "
"const word&"
")"
)
<< "Unknown " << typeName << " type " << modelType << nl << nl
@ -59,7 +61,17 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
<< exit(FatalError);
}
return autoPtr<porosityModel>(cstrIter()(name, modelType, mesh, dict));
return autoPtr<porosityModel>
(
cstrIter()
(
name,
modelType,
mesh,
dict,
cellZoneName
)
);
}

View File

@ -47,10 +47,11 @@ Foam::porosityModels::powerLaw::powerLaw
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
porosityModel(name, modelType, mesh, dict),
porosityModel(name, modelType, mesh, dict, cellZoneName),
C0_(readScalar(coeffs_.lookup("C0"))),
C1_(readScalar(coeffs_.lookup("C1"))),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho"))

View File

@ -117,7 +117,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
);
//- Destructor

View File

@ -38,6 +38,9 @@ supersonicFreestreamFvPatchVectorField
)
:
mixedFvPatchVectorField(p, iF),
TName_("T"),
pName_("p"),
psiName_("thermo:psi"),
UInf_(vector::zero),
pInf_(0),
TInf_(0),
@ -59,6 +62,9 @@ supersonicFreestreamFvPatchVectorField
)
:
mixedFvPatchVectorField(ptf, p, iF, mapper),
TName_(ptf.TName_),
pName_(ptf.pName_),
psiName_(ptf.psiName_),
UInf_(ptf.UInf_),
pInf_(ptf.pInf_),
TInf_(ptf.TInf_),
@ -75,6 +81,9 @@ supersonicFreestreamFvPatchVectorField
)
:
mixedFvPatchVectorField(p, iF),
TName_(dict.lookupOrDefault<word>("T", "T")),
pName_(dict.lookupOrDefault<word>("p", "p")),
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
UInf_(dict.lookup("UInf")),
pInf_(readScalar(dict.lookup("pInf"))),
TInf_(readScalar(dict.lookup("TInf"))),
@ -120,6 +129,9 @@ supersonicFreestreamFvPatchVectorField
)
:
mixedFvPatchVectorField(sfspvf),
TName_(sfspvf.TName_),
pName_(sfspvf.pName_),
psiName_(sfspvf.psiName_),
UInf_(sfspvf.UInf_),
pInf_(sfspvf.pInf_),
TInf_(sfspvf.TInf_),
@ -135,6 +147,9 @@ supersonicFreestreamFvPatchVectorField
)
:
mixedFvPatchVectorField(sfspvf, iF),
TName_(sfspvf.TName_),
pName_(sfspvf.pName_),
psiName_(sfspvf.psiName_),
UInf_(sfspvf.UInf_),
pInf_(sfspvf.pInf_),
TInf_(sfspvf.TInf_),
@ -152,13 +167,13 @@ void Foam::supersonicFreestreamFvPatchVectorField::updateCoeffs()
}
const fvPatchField<scalar>& pT =
patch().lookupPatchField<volScalarField, scalar>("T");
patch().lookupPatchField<volScalarField, scalar>(TName_);
const fvPatchField<scalar>& pp =
patch().lookupPatchField<volScalarField, scalar>("p");
patch().lookupPatchField<volScalarField, scalar>(pName_);
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>("thermo:psi");
patch().lookupPatchField<volScalarField, scalar>(psiName_);
// Need R of the free-stream flow. Assume R is independent of location
// along patch so use face 0
@ -288,6 +303,9 @@ void Foam::supersonicFreestreamFvPatchVectorField::updateCoeffs()
void Foam::supersonicFreestreamFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "T", "T", TName_);
writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
os.writeKeyword("UInf") << UInf_ << token::END_STATEMENT << nl;
os.writeKeyword("pInf") << pInf_ << token::END_STATEMENT << nl;
os.writeKeyword("TInf") << TInf_ << token::END_STATEMENT << nl;

View File

@ -40,6 +40,9 @@ Description
\table
Property | Description | Required | Default value
TName | Temperature field name | no | T
pName | Pressure field name | no | p
psiName | Compressibility field name | no | thermo:psi
UInf | free-stream velocity | yes |
pInf | free-stream pressure | yes |
TInf | free-stream temperature | yes |
@ -88,6 +91,15 @@ class supersonicFreestreamFvPatchVectorField
{
// Private data
//- Name of temperature field, default = "T"
word TName_;
//- Name of pressure field, default = "p"
word pName_;
//- Name of compressibility field field, default = "thermo:psi"
word psiName_;
//- Velocity of the free stream
vector UInf_;

View File

@ -40,7 +40,7 @@ Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
fixedValueFvPatchScalarField(p, iF),
UName_("U"),
phiName_("phi"),
psiName_("psi"),
psiName_("thermo:psi"),
gamma_(0.0),
T0_(p.size(), 0.0)
{}
@ -73,7 +73,7 @@ Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
fixedValueFvPatchScalarField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
gamma_(readScalar(dict.lookup("gamma"))),
T0_("T0", dict, p.size())
{
@ -179,7 +179,7 @@ void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const
fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "psi", "psi", psiName_);
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os);
writeEntry("value", os);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ Description
Property | Description | Required | Default value
U | Velocity field name | no | U
phi | Flux field name | no | phi
psi | Compressibility field name | no | psi
psi | Compressibility field name | no | thermo:psi
gamma | ratio of specific heats (Cp/Cv) | yes |
T0 | reference temperature | yes |
\endtable

View File

@ -41,7 +41,7 @@ Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
)
:
advectiveFvPatchField<Type>(p, iF),
psiName_("psi"),
psiName_("thermo:psi"),
gamma_(0.0)
{}
@ -70,7 +70,7 @@ Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
)
:
advectiveFvPatchField<Type>(p, iF, dict),
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
gamma_(readScalar(dict.lookup("gamma")))
{}
@ -108,27 +108,21 @@ Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
{
// Lookup the velocity and compressibility of the patch
const fvPatchField<scalar>& psip =
this->patch().template lookupPatchField<volScalarField, scalar>
(
psiName_
);
this->patch().template
lookupPatchField<volScalarField, scalar>(psiName_);
const surfaceScalarField& phi =
this->db().template lookupObject<surfaceScalarField>(this->phiName_);
fvsPatchField<scalar> phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
this->phiName_
);
this->patch().template
lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchScalarField& rhop =
this->patch().template lookupPatchField<volScalarField, scalar>
(
this->rhoName_
);
this->patch().template
lookupPatchField<volScalarField, scalar>(this->rhoName_);
phip /= rhop;
}
@ -145,18 +139,12 @@ void Foam::waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
if (this->phiName_ != "phi")
{
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
}
if (this->rhoName_ != "rho")
{
os.writeKeyword("rho") << this->rhoName_ << token::END_STATEMENT << nl;
}
if (psiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
this->template
writeEntryIfDifferent<word>(os, "phi", "phi", this->phiName_);
this->template
writeEntryIfDifferent<word>(os, "rho", "rho", this->rhoName_);
this->template
writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_);
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;

View File

@ -2372,11 +2372,13 @@ void Foam::autoLayerDriver::getLayerCellsFaces
Foam::autoLayerDriver::autoLayerDriver
(
meshRefinement& meshRefiner,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
)
:
meshRefiner_(meshRefiner),
globalToPatch_(globalToPatch)
globalToMasterPatch_(globalToMasterPatch),
globalToSlavePatch_(globalToSlavePatch)
{}
@ -2435,7 +2437,12 @@ void Foam::autoLayerDriver::addLayers
// Create baffles (pairs of faces that share the same points)
// Baffles stored as owner and neighbour face that have been created.
List<labelPair> baffles;
meshRefiner_.createZoneBaffles(globalToPatch_, baffles);
meshRefiner_.createZoneBaffles
(
globalToMasterPatch_,
globalToSlavePatch_,
baffles
);
if (debug&meshRefinement::MESH)
{

View File

@ -99,7 +99,10 @@ class autoLayerDriver
meshRefinement& meshRefiner_;
//- From surface region to patch
const labelList globalToPatch_;
const labelList globalToMasterPatch_;
//- From surface region to patch
const labelList globalToSlavePatch_;
@ -518,7 +521,8 @@ public:
autoLayerDriver
(
meshRefinement& meshRefiner,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
);

View File

@ -1135,6 +1135,12 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
<< " " << medialRatio.name()
<< " : ratio of medial distance to wall distance" << nl
<< endl;
meshRefiner_.mesh().setInstance(meshRefiner_.timeName());
meshRefiner_.write
(
debug,
mesh.time().path()/meshRefiner_.timeName()
);
dispVec.write();
medialDist.write();
medialVec.write();
@ -1409,6 +1415,94 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
*dispVec[pointI];
}
//XXXXX
// // Smear displacement away from fixed values (medialRatio=0 or 1)
// {
// const edgeList& edges = mesh.edges();
// scalarField edgeWeight(edges.size(), 0.0);
// forAll(edges, edgeI)
// {
// if (isMasterEdge[edgeI])
// {
// scalar eMag = edges[edgeI].mag(mesh.points());
// if (eMag > VSMALL)
// {
// edgeWeight[edgeI] = 1.0/eMag;
// }
// else
// {
// edgeWeight[edgeI] = GREAT;
// }
// }
// }
// scalarField invSumWeight(mesh.nPoints());
// sumWeights(isMasterEdge, edgeWeight, invSumWeight);
//
//
// // Get smoothly varying patch field.
// Info<< "shrinkMeshDistance : Smoothing displacement ..." << endl;
//
// const scalar lambda = 0.33;
// const scalar mu = -0.34;
//
// pointField average(mesh.nPoints());
// for (label iter = 0; iter < 90; iter++)
// {
// // Calculate average of field
// averageNeighbours
// (
// mesh,
// edgeWeight,
// invSumWeight,
// displacement,
// average
// );
//
// forAll(displacement, i)
// {
// if (medialRatio[i] > SMALL && medialRatio[i] < 1-SMALL)
// {
// displacement[i] =
// (1-lambda)*displacement[i]
// +lambda*average[i];
// }
// }
//
//
// // Calculate average of field
// averageNeighbours
// (
// mesh,
// edgeWeight,
// invSumWeight,
// displacement,
// average
// );
//
// forAll(displacement, i)
// {
// if (medialRatio[i] > SMALL && medialRatio[i] < 1-SMALL)
// {
// displacement[i] = (1-mu)*displacement[i]+mu*average[i];
// }
// }
//
//
// // Do residual calculation every so often.
// if ((iter % 10) == 0)
// {
// Info<< " Iteration " << iter << " residual "
// << gSum(mag(displacement-average))
// /returnReduce(average.size(), sumOp<label>())
// << endl;
// }
// }
// }
//XXXXX
if (debug&meshRefinement::MESH || debug&meshRefinement::LAYERINFO)
{
const_cast<Time&>(mesh.time())++;

View File

@ -57,13 +57,15 @@ Foam::autoRefineDriver::autoRefineDriver
meshRefinement& meshRefiner,
decompositionMethod& decomposer,
fvMeshDistribute& distributor,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
)
:
meshRefiner_(meshRefiner),
decomposer_(decomposer),
distributor_(distributor),
globalToPatch_(globalToPatch)
globalToMasterPatch_(globalToMasterPatch),
globalToSlavePatch_(globalToSlavePatch)
{}
@ -313,7 +315,8 @@ void Foam::autoRefineDriver::removeInsideCells
meshRefiner_.splitMesh
(
nBufferLayers, // nBufferLayers
globalToPatch_,
globalToMasterPatch_,
globalToSlavePatch_,
refineParams.keepPoints()[0]
);
@ -521,7 +524,8 @@ void Foam::autoRefineDriver::baffleAndSplitMesh
!handleSnapProblems, // merge free standing baffles?
motionDict,
const_cast<Time&>(mesh.time()),
globalToPatch_,
globalToMasterPatch_,
globalToSlavePatch_,
refineParams.keepPoints()[0]
);
}
@ -606,7 +610,8 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
//true, // merge free standing baffles?
motionDict,
const_cast<Time&>(mesh.time()),
globalToPatch_,
globalToMasterPatch_,
globalToSlavePatch_,
refineParams.keepPoints()[0]
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,7 +65,10 @@ class autoRefineDriver
fvMeshDistribute& distributor_;
//- From surface region to patch
const labelList globalToPatch_;
const labelList globalToMasterPatch_;
//- From surface region to patch
const labelList globalToSlavePatch_;
// Private Member Functions
@ -146,7 +149,8 @@ public:
meshRefinement& meshRefiner,
decompositionMethod& decomposer,
fvMeshDistribute& distributor,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
);

View File

@ -573,11 +573,13 @@ bool Foam::autoSnapDriver::outwardsDisplacement
Foam::autoSnapDriver::autoSnapDriver
(
meshRefinement& meshRefiner,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
)
:
meshRefiner_(meshRefiner),
globalToPatch_(globalToPatch)
globalToMasterPatch_(globalToMasterPatch),
globalToSlavePatch_(globalToSlavePatch)
{}
@ -1191,7 +1193,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
if (hitSurface[i] != -1 && !isZonedFace.get(faceI))
{
closestPatch[i] = globalToPatch_
closestPatch[i] = globalToMasterPatch_
[
surfaces.globalRegion
(
@ -1265,7 +1267,12 @@ void Foam::autoSnapDriver::doSnap
// Create baffles (pairs of faces that share the same points)
// Baffles stored as owner and neighbour face that have been created.
List<labelPair> baffles;
meshRefiner_.createZoneBaffles(globalToPatch_, baffles);
meshRefiner_.createZoneBaffles
(
globalToMasterPatch_,
globalToSlavePatch_,
baffles
);
// Selectively 'forget' about the baffles, i.e. not check across them

View File

@ -59,8 +59,11 @@ class autoSnapDriver
//- Mesh+surface
meshRefinement& meshRefiner_;
//- From surface region to patch
const labelList globalToPatch_;
//- From global surface region to master side patch
const labelList globalToMasterPatch_;
//- From global surface region to slave side patch
const labelList globalToSlavePatch_;
// Private Member Functions
@ -390,7 +393,8 @@ public:
autoSnapDriver
(
meshRefinement& meshRefiner,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
);

View File

@ -573,7 +573,7 @@ void Foam::autoSnapDriver::calcNearestFacePointProperties
pFc[i] = pp.faceCentres()[faceI];
//label meshFaceI = pp.addressing()[faceI];
//pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI);
pFid[i] = globalToPatch_[faceSurfaceGlobalRegion[faceI]];
pFid[i] = globalToMasterPatch_[faceSurfaceGlobalRegion[faceI]];
}
}

View File

@ -55,6 +55,7 @@ License
#include "searchableSurfaces.H"
#include "treeBoundBox.H"
#include "zeroGradientFvPatchFields.H"
#include "fvMeshTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1700,7 +1701,7 @@ Foam::label Foam::meshRefinement::addPatch
oldToNew[addedPatchI] = insertPatchI;
// Shuffle into place
polyPatches.reorder(oldToNew);
polyPatches.reorder(oldToNew, true);
fvPatches.reorder(oldToNew);
reorderPatchFields<volScalarField>(mesh, oldToNew);
@ -1736,6 +1737,28 @@ Foam::label Foam::meshRefinement::addMeshedPatch
// Add patch
label patchI = addPatch(mesh_, name, patchInfo);
// dictionary patchDict(patchInfo);
// patchDict.set("nFaces", 0);
// patchDict.set("startFace", 0);
// autoPtr<polyPatch> ppPtr
// (
// polyPatch::New
// (
// name,
// patchDict,
// 0,
// mesh_.boundaryMesh()
// )
// );
// label patchI = fvMeshTools::addPatch
// (
// mesh_,
// ppPtr(),
// dictionary(), // optional field values
// calculatedFvPatchField<scalar>::typeName,
// true
// );
// Store
label sz = meshedPatches_.size();
meshedPatches_.setSize(sz+1);

View File

@ -330,10 +330,11 @@ private:
// Baffle handling
//- Get faces to repatch. Returns map from face to patch.
Map<label> getZoneBafflePatches
Map<labelPair> getZoneBafflePatches
(
const bool allowBoundary,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
) const;
//- Geometric test on see whether face needs to be baffled:
@ -349,7 +350,7 @@ private:
//- Determine patches for baffles
void getBafflePatches
(
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& neiLevel,
const pointField& neiCc,
labelList& ownPatch,
@ -426,7 +427,7 @@ private:
const dictionary& motionDict,
const bool removeEdgeConnectedCells,
const scalarField& perpendicularAngle,
const labelList& globalToPatch
const labelList& globalToMasterPatch
) const;
@ -707,7 +708,8 @@ public:
const bool mergeFreeStanding,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
const point& keepPoint
);
@ -716,7 +718,8 @@ public:
autoPtr<mapPolyMesh> splitMesh
(
const label nBufferLayers,
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
const point& keepPoint
);
@ -741,7 +744,8 @@ public:
// baffles.
autoPtr<mapPolyMesh> createZoneBaffles
(
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
List<labelPair>&
);

View File

@ -259,7 +259,7 @@ bool Foam::meshRefinement::validBaffleTopology
// Determine patches for baffles on all intersected unnamed faces
void Foam::meshRefinement::getBafflePatches
(
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& neiLevel,
const pointField& neiCc,
@ -376,11 +376,11 @@ void Foam::meshRefinement::getBafflePatches
}
// Pick up the patches
ownPatch[faceI] = globalToPatch
ownPatch[faceI] = globalToMasterPatch
[
surfaces_.globalRegion(surface1[i], region1[i])
];
neiPatch[faceI] = globalToPatch
neiPatch[faceI] = globalToMasterPatch
[
surfaces_.globalRegion(surface2[i], region2[i])
];
@ -406,14 +406,14 @@ void Foam::meshRefinement::getBafflePatches
}
// Get faces to repatch. Returns map from face to patch.
Foam::Map<Foam::label> Foam::meshRefinement::getZoneBafflePatches
Foam::Map<Foam::labelPair> Foam::meshRefinement::getZoneBafflePatches
(
const bool allowBoundary,
const labelList& globalToPatch
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch
) const
{
Map<label> bafflePatch(mesh_.nFaces()/1000);
Map<labelPair> bafflePatch(mesh_.nFaces()/1000);
const wordList& faceZoneNames = surfaces_.faceZoneNames();
const faceZoneMesh& fZones = mesh_.faceZones();
@ -427,40 +427,39 @@ Foam::Map<Foam::label> Foam::meshRefinement::getZoneBafflePatches
const faceZone& fZone = fZones[zoneI];
//// Get patch allocated for zone
//label patchI = surfaceToCyclicPatch_[surfI];
// Get patch of (first region) of surface
label patchI = globalToPatch[surfaces_.globalRegion(surfI, 0)];
// Get patch allocated for zone
label globalRegionI = surfaces_.globalRegion(surfI, 0);
labelPair zPatches
(
globalToMasterPatch[globalRegionI],
globalToSlavePatch[globalRegionI]
);
Info<< "For surface "
<< surfaces_.names()[surfI]
<< " found faceZone " << fZone.name()
<< " and patch " << mesh_.boundaryMesh()[patchI].name()
Info<< "For zone " << fZone.name() << " found patches "
<< mesh_.boundaryMesh()[zPatches[0]].name() << " and "
<< mesh_.boundaryMesh()[zPatches[1]].name()
<< endl;
forAll(fZone, i)
{
label faceI = fZone[i];
if (allowBoundary || mesh_.isInternalFace(faceI))
{
if (!bafflePatch.insert(faceI, patchI))
labelPair patches = zPatches;
if (fZone.flipMap()[i])
{
label oldPatchI = bafflePatch[faceI];
patches = patches.reversePair();
}
if (oldPatchI != patchI)
{
FatalErrorIn("getZoneBafflePatches(const bool)")
<< "Face " << faceI
<< " fc:" << mesh_.faceCentres()[faceI]
<< " in zone " << fZone.name()
<< " is in patch "
<< mesh_.boundaryMesh()[oldPatchI].name()
<< " and in patch "
<< mesh_.boundaryMesh()[patchI].name()
<< abort(FatalError);
}
if (!bafflePatch.insert(faceI, patches))
{
FatalErrorIn("getZoneBafflePatches(..)")
<< "Face " << faceI
<< " fc:" << mesh_.faceCentres()[faceI]
<< " in zone " << fZone.name()
<< " is in multiple zones!"
<< abort(FatalError);
}
}
}
@ -698,7 +697,8 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::getDuplicateFaces
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
(
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
List<labelPair>& baffles
)
{
@ -714,20 +714,30 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
// Get faces (internal only) to be baffled. Map from face to patch
// label.
Map<label> faceToPatch(getZoneBafflePatches(false, globalToPatch));
Map<labelPair> faceToPatch
(
getZoneBafflePatches
(
false,
globalToMasterPatch,
globalToSlavePatch
)
);
label nZoneFaces = returnReduce(faceToPatch.size(), sumOp<label>());
if (nZoneFaces > 0)
{
// Convert into labelLists
labelList ownPatch(mesh_.nFaces(), -1);
forAllConstIter(Map<label>, faceToPatch, iter)
labelList neiPatch(mesh_.nFaces(), -1);
forAllConstIter(Map<labelPair>, faceToPatch, iter)
{
ownPatch[iter.key()] = iter();
ownPatch[iter.key()] = iter().first();
neiPatch[iter.key()] = iter().second();
}
// Create baffles. both sides same patch.
map = createBaffles(ownPatch, ownPatch);
map = createBaffles(ownPatch, neiPatch);
// Get pairs of faces created.
// Just loop over faceMap and store baffle if we encounter a slave
@ -744,7 +754,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
label oldFaceI = faceMap[faceI];
// Does face originate from face-to-patch
Map<label>::const_iterator iter = faceToPatch.find(oldFaceI);
Map<labelPair>::const_iterator iter = faceToPatch.find
(
oldFaceI
);
if (iter != faceToPatch.end())
{
@ -1344,7 +1357,8 @@ void Foam::meshRefinement::findCellZoneGeometric
// Sync
syncTools::syncFaceList(mesh_, namedSurfaceIndex, maxEqOp<label>());
}
//XXXXXXXXX
void Foam::meshRefinement::findCellZoneInsideWalk
(
const labelList& locationSurfaces, // indices of surfaces with inside point
@ -1446,7 +1460,6 @@ void Foam::meshRefinement::findCellZoneInsideWalk
}
}
}
//XXXXXXXXX
bool Foam::meshRefinement::calcRegionToZone
@ -1827,7 +1840,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
const bool mergeFreeStanding,
const dictionary& motionDict,
Time& runTime,
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
const point& keepPoint
)
{
@ -1849,7 +1863,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
labelList ownPatch, neiPatch;
getBafflePatches
(
globalToPatch,
globalToMasterPatch,
neiLevel,
neiCc,
@ -1899,7 +1913,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToPatch
globalToMasterPatch
)
//markFacesOnProblemCellsGeometric(motionDict)
);
@ -1917,7 +1931,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
motionDict,
removeEdgeConnectedCells,
perpendicularAngle,
globalToPatch
globalToMasterPatch
)
);
forAll(facePatchTopo, faceI)
@ -2051,7 +2065,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
(
const label nBufferLayers,
const labelList& globalToPatch,
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
const point& keepPoint
)
{
@ -2066,7 +2081,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
labelList ownPatch, neiPatch;
getBafflePatches
(
globalToPatch,
globalToMasterPatch,
neiLevel,
neiCc,
@ -2129,9 +2144,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
// Patch for exposed faces for lack of anything sensible.
label defaultPatch = 0;
if (globalToPatch.size())
if (globalToMasterPatch.size())
{
defaultPatch = globalToPatch[0];
defaultPatch = globalToMasterPatch[0];
}
for (label i = 0; i < nBufferLayers; i++)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,7 +85,7 @@ const Foam::coordinateSystems& Foam::coordinateSystems::New
IOobject
(
typeName,
"constant",
obr.time().constant(),
obr,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE

View File

@ -9,4 +9,4 @@ EXE_INC = \
-I../decompositionMethods/lnInclude
LIB_LIBS = \
-L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lrt
-L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch -lrt

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,12 +68,7 @@ int main(int argc, char *argv[])
"noFlow",
"suppress creating flow models (execFlowFunctionObjects only)"
);
Foam::argList::addOption
(
"dict",
"name",
"dictionary to use"
);
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTime.H"

View File

@ -765,7 +765,7 @@ kinematicSingleLayer::kinematicSingleLayer
(
IOobject
(
"mu", // must have same name as mu to enable mapping
"thermo:mu", // must have same name as mu to enable mapping
time().timeName(),
regionMesh(),
IOobject::NO_READ,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -105,7 +105,7 @@ Foam::fileName Foam::fileFormats::surfaceFormatsCore::findMeshInstance
}
}
return "constant";
return t.constant();
}
@ -148,7 +148,7 @@ Foam::fileName Foam::fileFormats::surfaceFormatsCore::findMeshFile
}
// fallback to "constant"
return t.path()/"constant"/localName;
return t.path()/t.constant()/localName;
}
#endif

View File

@ -52,7 +52,7 @@ Foam::radiation::noRadiation::noRadiation
const volScalarField& T
)
:
radiationModel(dict, T)
radiationModel(T)
{}

View File

@ -43,6 +43,33 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::IOobject Foam::radiation::radiationModel::createIOobject
(
const fvMesh& mesh
) const
{
IOobject io
(
"radiationProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.headerOk())
{
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
return io;
}
else
{
io.readOpt() = IOobject::NO_READ;
return io;
}
}
void Foam::radiation::radiationModel::initialise()
{
if (radiation_)
@ -62,35 +89,6 @@ void Foam::radiation::radiationModel::initialise()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
:
IOdictionary
(
IOobject
(
"radiationProperties",
T.time().constant(),
T.mesh(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
mesh_(T.mesh()),
time_(T.time()),
T_(T),
radiation_(false),
coeffs_(dictionary::null),
solverFreq_(0),
firstIter_(true),
absorptionEmission_(NULL),
scatter_(NULL)
{}
Foam::radiation::radiationModel::radiationModel
(
const dictionary& dict,
const volScalarField& T
)
:
IOdictionary
(
@ -101,8 +99,7 @@ Foam::radiation::radiationModel::radiationModel
T.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
dict
)
),
mesh_(T.mesh()),
time_(T.time()),
@ -122,17 +119,7 @@ Foam::radiation::radiationModel::radiationModel
const volScalarField& T
)
:
IOdictionary
(
IOobject
(
"radiationProperties",
T.time().constant(),
T.mesh(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
IOdictionary(createIOobject(T.mesh())),
mesh_(T.mesh()),
time_(T.time()),
T_(T),
@ -143,6 +130,11 @@ Foam::radiation::radiationModel::radiationModel
absorptionEmission_(NULL),
scatter_(NULL)
{
if (readOpt() == IOobject::NO_READ)
{
radiation_ = false;
}
initialise();
}

View File

@ -109,6 +109,9 @@ private:
// Private Member Functions
//- Create IO object if dictionary is present
IOobject createIOobject(const fvMesh& mesh) const;
//- Initialise
void initialise();
@ -156,9 +159,6 @@ public:
//- Null constructor
radiationModel(const volScalarField& T);
//- Construct with dictionary
radiationModel(const dictionary& dict, const volScalarField& T);
//- Construct from components
radiationModel(const word& type, const volScalarField& T);

View File

@ -33,23 +33,27 @@ Foam::radiation::radiationModel::New
const volScalarField& T
)
{
// get model name, but do not register the dictionary
const word modelType
IOobject radIO
(
IOdictionary
(
IOobject
(
"radiationProperties",
T.time().constant(),
T.mesh(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("radiationModel")
"radiationProperties",
T.time().constant(),
T.mesh(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
);
word modelType("none");
if (radIO.headerOk())
{
IOdictionary(radIO).lookup("radiationModel") >> modelType;
}
else
{
Info<< "Radiation model not active: radiationProperties not found"
<< endl;
}
Info<< "Selecting radiationModel " << modelType << endl;
TConstructorTable::iterator cstrIter =

View File

@ -83,7 +83,7 @@ Foam::fileName Foam::triSurface::triSurfInstance(const Time& d)
<< "reading " << foamName
<< " from constant/" << endl;
}
return "constant";
return d.constant();
}