Merge branch 'master' of /home/dm4/OpenFOAM/repositories/OpenFOAM-dev

This commit is contained in:
mattijs
2013-12-11 14:24:51 +00:00
198 changed files with 3462 additions and 1615 deletions

View File

@ -39,7 +39,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "timeSelector.H"
#include "IOobjectList.H"
#include "labelIOList.H"
#include "processorPolyPatch.H"
@ -278,6 +279,151 @@ autoPtr<mapPolyMesh> mergeSharedPoints
}
boundBox procBounds
(
const argList& args,
const PtrList<Time>& databases,
const word& regionDir
)
{
boundBox bb = boundBox::invertedBox;
forAll(databases, procI)
{
fileName pointsInstance
(
databases[procI].findInstance
(
regionDir/polyMesh::meshSubDir,
"points"
)
);
if (pointsInstance != databases[procI].timeName())
{
FatalErrorIn(args.executable())
<< "Your time was specified as " << databases[procI].timeName()
<< " but there is no polyMesh/points in that time." << endl
<< "(there is a points file in " << pointsInstance
<< ")" << endl
<< "Please rerun with the correct time specified"
<< " (through the -constant, -time or -latestTime "
<< "(at your option)."
<< endl << exit(FatalError);
}
Info<< "Reading points from "
<< databases[procI].caseName()
<< " for time = " << databases[procI].timeName()
<< nl << endl;
pointIOField points
(
IOobject
(
"points",
databases[procI].findInstance
(
regionDir/polyMesh::meshSubDir,
"points"
),
regionDir/polyMesh::meshSubDir,
databases[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
boundBox domainBb(points, false);
bb.min() = min(bb.min(), domainBb.min());
bb.max() = max(bb.max(), domainBb.max());
}
return bb;
}
void writeCellDistance
(
Time& runTime,
const fvMesh& masterMesh,
const labelListList& cellProcAddressing
)
{
// Write the decomposition as labelList for use with 'manual'
// decomposition method.
labelIOList cellDecomposition
(
IOobject
(
"cellDecomposition",
masterMesh.facesInstance(),
masterMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
masterMesh.nCells()
);
forAll(cellProcAddressing, procI)
{
const labelList& pCells = cellProcAddressing[procI];
UIndirectList<label>(cellDecomposition, pCells) = procI;
}
cellDecomposition.write();
Info<< nl << "Wrote decomposition to "
<< cellDecomposition.objectPath()
<< " for use in manual decomposition." << endl;
// Write as volScalarField for postprocessing. Change time to 0
// if was 'constant'
{
const scalar oldTime = runTime.value();
const label oldIndex = runTime.timeIndex();
if (runTime.timeName() == runTime.constant() && oldIndex == 0)
{
runTime.setTime(0, oldIndex+1);
}
volScalarField cellDist
(
IOobject
(
"cellDist",
runTime.timeName(),
masterMesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
masterMesh,
dimensionedScalar("cellDist", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
forAll(cellDecomposition, cellI)
{
cellDist[cellI] = cellDecomposition[cellI];
}
cellDist.write();
Info<< nl << "Wrote decomposition as volScalarField to "
<< cellDist.name() << " for use in postprocessing."
<< endl;
// Restore time
runTime.setTime(oldTime, oldIndex);
}
}
int main(int argc, char *argv[])
{
argList::addNote
@ -390,7 +536,7 @@ int main(int argc, char *argv[])
Info<< "Found " << nProcs << " processor directories" << nl << endl;
// Read all databases.
// Read all time databases
PtrList<Time> databases(nProcs);
forAll(databases, procI)
@ -409,91 +555,47 @@ int main(int argc, char *argv[])
args.caseName()/fileName(word("processor") + name(procI))
)
);
}
Time& procTime = databases[procI];
instantList Times = procTime.times();
// use the times list from the master processor
// and select a subset based on the command-line options
instantList Times = timeSelector::select
(
databases[0].times(),
args
);
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
#include "checkTimeOptions.H"
procTime.setTime(Times[startTime], startTime);
if (procI > 0 && databases[procI-1].value() != procTime.value())
if (Times.empty())
{
FatalErrorIn(args.executable())
<< "Time not equal on processors." << nl
<< "Processor:" << procI-1
<< " time:" << databases[procI-1].value() << nl
<< "Processor:" << procI
<< " time:" << procTime.value()
<< "No times selected"
<< exit(FatalError);
}
// Loop over all times
forAll(Times, timeI)
{
// Set time for global database
runTime.setTime(Times[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl << endl;
// Set time for all databases
forAll(databases, procI)
{
databases[procI].setTime(Times[timeI], timeI);
}
// Set master time
Info<< "Setting master time to " << databases[0].timeName() << nl << endl;
runTime.setTime(databases[0]);
// Read point on individual processors to determine merge tolerance
// (otherwise single cell domains might give problems)
boundBox bb = boundBox::invertedBox;
for (label procI = 0; procI < nProcs; procI++)
{
fileName pointsInstance
(
databases[procI].findInstance
(
regionDir/polyMesh::meshSubDir,
"points"
)
);
if (pointsInstance != databases[procI].timeName())
{
FatalErrorIn(args.executable())
<< "Your time was specified as " << databases[procI].timeName()
<< " but there is no polyMesh/points in that time." << endl
<< "(there is a points file in " << pointsInstance
<< ")" << endl
<< "Please rerun with the correct time specified"
<< " (through the -constant, -time or -latestTime "
<< "(at your option)."
<< endl << exit(FatalError);
}
Info<< "Reading points from "
<< databases[procI].caseName()
<< " for time = " << databases[procI].timeName()
<< nl << endl;
pointIOField points
(
IOobject
(
"points",
databases[procI].findInstance
(
regionDir/polyMesh::meshSubDir,
"points"
),
regionDir/polyMesh::meshSubDir,
databases[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
boundBox domainBb(points, false);
bb.min() = min(bb.min(), domainBb.min());
bb.max() = max(bb.max(), domainBb.max());
}
const scalar mergeDist = mergeTol * bb.mag();
const boundBox bb = procBounds(args, databases, regionDir);
const scalar mergeDist = mergeTol*bb.mag();
Info<< "Overall mesh bounding box : " << bb << nl
<< "Relative tolerance : " << mergeTol << nl
@ -575,8 +677,8 @@ int main(int argc, char *argv[])
couples
);
// Update all addressing so xxProcAddressing points to correct item
// in masterMesh.
// Update all addressing so xxProcAddressing points to correct
// item in masterMesh.
// Processors that were already in masterMesh
for (label mergedI = 0; mergedI < procI; mergedI++)
@ -585,7 +687,11 @@ int main(int argc, char *argv[])
renumber(map().oldFaceMap(), faceProcAddressing[mergedI]);
renumber(map().oldPointMap(), pointProcAddressing[mergedI]);
// Note: boundary is special since can contain -1.
renumber(map().oldPatchMap(), boundaryProcAddressing[mergedI]);
renumber
(
map().oldPatchMap(),
boundaryProcAddressing[mergedI]
);
}
// Added processor
@ -617,78 +723,9 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
if (writeCellDist)
{
// Write the decomposition as labelList for use with 'manual'
// decomposition method.
labelIOList cellDecomposition
(
IOobject
(
"cellDecomposition",
masterMesh.facesInstance(),
masterMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
masterMesh.nCells()
);
forAll(cellProcAddressing, procI)
{
const labelList& pCells = cellProcAddressing[procI];
UIndirectList<label>(cellDecomposition, pCells) = procI;
}
cellDecomposition.write();
Info<< nl << "Wrote decomposition to "
<< cellDecomposition.objectPath()
<< " for use in manual decomposition." << endl;
// Write as volScalarField for postprocessing. Change time to 0
// if was 'constant'
{
const scalar oldTime = runTime.value();
const label oldIndex = runTime.timeIndex();
if (runTime.timeName() == runTime.constant() && oldIndex == 0)
{
runTime.setTime(0, oldIndex+1);
}
volScalarField cellDist
(
IOobject
(
"cellDist",
runTime.timeName(),
masterMesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
masterMesh,
dimensionedScalar("cellDist", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
forAll(cellDecomposition, cellI)
{
cellDist[cellI] = cellDecomposition[cellI];
}
cellDist.write();
Info<< nl << "Wrote decomposition as volScalarField to "
<< cellDist.name() << " for use in postprocessing."
<< endl;
// Restore time
runTime.setTime(oldTime, oldIndex);
}
writeCellDistance(runTime, masterMesh, cellProcAddressing);
}
}
@ -851,6 +888,7 @@ int main(int argc, char *argv[])
Info<< endl;
}
}
Info<< "End.\n" << endl;

View File

@ -81,4 +81,6 @@ wmake $makeType regionCoupled
postProcessing/Allwmake $*
wmake $makeType sixDoFRigidBodyMotion
# ----------------------------------------------------------------- end-of-file

View File

@ -73,6 +73,8 @@ primitives/functions/DataEntry/polynomial/polynomialIO.C
primitives/functions/Polynomial/polynomialFunction.C
primitives/subModelBase/subModelBase.C
strings = primitives/strings
$(strings)/string/string.C
$(strings)/string/stringIO.C

View File

@ -163,115 +163,6 @@ void Foam::Time::readDict()
}
//{
// // fundamentalConstants.C
// Info<< "constant::universal::hr:"
// << Foam::constant::universal::hr
// << endl;
// Info<< "constant::universal::c:"
// << Foam::constant::universal::c
// << endl;
// Info<< "constant::universal::G:"
// << Foam::constant::universal::G
// << endl;
// Info<< "constant::universal::h:"
// << Foam::constant::universal::h
// << endl;
// Info<< "constant::electromagnetic::e:"
// << Foam::constant::electromagnetic::e
// << endl;
// Info<< "constant::atomic::me:"
// << Foam::constant::atomic::me
// << endl;
// Info<< "constant::atomic::mp:"
// << Foam::constant::atomic::mp
// << endl;
// Info<< "constant::physicoChemical::mu:"
// << Foam::constant::physicoChemical::mu
// << endl;
// Info<< "constant::physicoChemical::NA:"
// << Foam::constant::physicoChemical::NA
// << endl;
// Info<< "constant::physicoChemical::k:"
// << Foam::constant::physicoChemical::k
// << endl;
// Info<< "constant::standard::Pstd:"
// << Foam::constant::standard::Pstd
// << endl;
// Info<< "constant::standard::Tstd:"
// << Foam::constant::standard::Tstd
// << endl;
//
// // universalConstants.C
// Info<< "constant::universal::hr:"
// << Foam::constant::universal::hr
// << endl;
//
// // electromagneticConstants.C
// Info<< "constant::electromagnetic::mu0:"
// << Foam::constant::electromagnetic::mu0
// << endl;
// Info<< "constant::electromagnetic::epsilon0:"
// << Foam::constant::electromagnetic::epsilon0
// << endl;
// Info<< "constant::electromagnetic::Z0:"
// << Foam::constant::electromagnetic::Z0
// << endl;
// Info<< "constant::electromagnetic::kappa:"
// << Foam::constant::electromagnetic::kappa
// << endl;
// Info<< "constant::electromagnetic::G0:"
// << Foam::constant::electromagnetic::G0
// << endl;
// Info<< "constant::electromagnetic::KJ:"
// << Foam::constant::electromagnetic::KJ
// << endl;
// Info<< "constant::electromagnetic::RK:"
// << Foam::constant::electromagnetic::RK
// << endl;
//
//
// // atomicConstants.C
// Info<< "constant::atomic::alpha:"
// << Foam::constant::atomic::alpha
// << endl;
// Info<< "constant::atomic::Rinf:"
// << Foam::constant::atomic::Rinf
// << endl;
// Info<< "constant::atomic::a0:"
// << Foam::constant::atomic::a0
// << endl;
// Info<< "constant::physiatomic::re:"
// << Foam::constant::atomic::re
// << endl;
// Info<< "constant::atomic::Eh:"
// << Foam::constant::atomic::Eh
// << endl;
//
//
// // physicoChemicalConstants.C
// Info<< "constant::physicoChemical::R:"
// << Foam::constant::physicoChemical::R
// << endl;
// Info<< "constant::physicoChemical::F:"
// << Foam::constant::physicoChemical::F
// << endl;
// Info<< "constant::physicoChemical::sigma:"
// << Foam::constant::physicoChemical::sigma
// << endl;
// Info<< "constant::physicoChemical::b:"
// << Foam::constant::physicoChemical::b
// << endl;
// Info<< "constant::physicoChemical::c1:"
// << Foam::constant::physicoChemical::c1
// << endl;
// Info<< "constant::physicoChemical::c2:"
// << Foam::constant::physicoChemical::c2
// << endl;
//}
// Dimension sets
if (controlDict_.found("DimensionSets"))
{
@ -302,7 +193,6 @@ void Foam::Time::readDict()
}
if (!deltaTchanged_)
{
deltaT_ = readScalar(controlDict_.lookup("deltaT"));

View File

@ -28,6 +28,7 @@ License
#include "dictionaryEntry.H"
#include "regExp.H"
#include "OSHA1stream.H"
#include "DynamicList.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
@ -277,6 +278,25 @@ Foam::SHA1Digest Foam::dictionary::digest() const
}
Foam::tokenList Foam::dictionary::tokens() const
{
// linearise dictionary into a string
OStringStream os;
write(os, false);
IStringStream is(os.str());
// parse string as tokens
DynamicList<token> tokens;
token t;
while (is.read(t))
{
tokens.append(t);
}
return tokenList(tokens.xfer());
}
bool Foam::dictionary::found
(
const word& keyword,

View File

@ -262,6 +262,9 @@ public:
//- Return the SHA1 digest of the dictionary contents
SHA1Digest digest() const;
//- Return the dictionary as a list of tokens
tokenList tokens() const;
// Search and lookup

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -71,9 +71,16 @@ bool Foam::primitiveEntry::expandVariable
// ...if defined append its tokens into this
if (ePtr)
{
if (ePtr->isDict())
{
append(ePtr->dict().tokens());
}
else
{
append(ePtr->stream());
}
}
else
{
// not in the dictionary - try an environment variable

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 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 "subModelBase.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
bool Foam::subModelBase::subModelBase::inLine() const
{
return (modelName_ != word::null);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::subModelBase::subModelBase(dictionary& properties)
:
modelName_(word::null),
properties_(properties),
dict_(dictionary::null),
baseName_(word::null),
modelType_(word::null),
coeffDict_(dictionary::null)
{}
Foam::subModelBase::subModelBase
(
dictionary& properties,
const dictionary& dict,
const word& baseName,
const word& modelType,
const word& dictExt
)
:
modelName_(word::null),
properties_(properties),
dict_(dict),
baseName_(baseName),
modelType_(modelType),
coeffDict_(dict.subDict(modelType + dictExt))
{}
Foam::subModelBase::subModelBase
(
const word& modelName,
dictionary& properties,
const dictionary& dict,
const word& baseName,
const word& modelType
)
:
modelName_(modelName),
properties_(properties),
dict_(dict),
baseName_(baseName),
modelType_(modelType),
coeffDict_(dict)
{}
Foam::subModelBase::subModelBase(const subModelBase& smb)
:
modelName_(smb.modelName_),
properties_(smb.properties_),
dict_(smb.dict_),
baseName_(smb.baseName_),
modelType_(smb.modelType_),
coeffDict_(smb.coeffDict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::subModelBase::~subModelBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::word& Foam::subModelBase::modelName() const
{
return modelName_;
}
const Foam::dictionary& Foam::subModelBase::dict() const
{
return dict_;
}
const Foam::word& Foam::subModelBase::baseName() const
{
return baseName_;
}
const Foam::word& Foam::subModelBase::modelType() const
{
return modelType_;
}
const Foam::dictionary& Foam::subModelBase::coeffDict() const
{
return coeffDict_;
}
const Foam::dictionary& Foam::subModelBase::properties() const
{
return properties_;
}
bool Foam::subModelBase::defaultCoeffs(const bool printMsg) const
{
bool def = coeffDict_.lookupOrDefault<bool>("defaultCoeffs", false);
if (printMsg && def)
{
Info<< incrIndent;
Info<< indent << "Employing default coefficients" << endl;
Info<< decrIndent;
}
return def;
}
bool Foam::subModelBase::active() const
{
return true;
}
void Foam::subModelBase::cacheFields(const bool)
{
// do nothing
}
bool Foam::subModelBase::outputTime() const
{
return active();
}
void Foam::subModelBase::write(Ostream& os) const
{
// not writing complete cloud dictionary, only coeffs
// os << dict_;
os << coeffDict_;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,18 +22,20 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SubModelBase
Foam::subModelBase
Description
Base class for cloud sub-models
Base class for generic sub-models requiring to be read from dictionary.
Provides a mechanism to read and write properties from a dictionary to
enable clean re-starts. Used by, e.g. clou dsub-models.
SourceFiles
SubModelBase.C
subModelBase.C
\*---------------------------------------------------------------------------*/
#ifndef SubModelBase_H
#define SubModelBase_H
#ifndef subModelBase_H
#define subModelBase_H
#include "dictionary.H"
@ -42,25 +44,32 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class SubModelBase;
/*---------------------------------------------------------------------------*\
Class SubModelBase Declaration
Class subModelBase Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class SubModelBase
class subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const subModelBase&);
protected:
// Protected Data
//- Reference to the cloud
CloudType& owner_;
//- Name of the sub-model
const word modelName_;
//- Reference to the cloud dictionary
//- Reference to properties dictionary e.g. for restart
dictionary& properties_;
//- Copy of dictionary used during construction
const dictionary dict_;
//- Name of the sub-model base class
@ -69,9 +78,6 @@ protected:
//- Type of the sub-model
const word modelType_;
//- Name of the sub-model
const word modelName_;
//- Coefficients dictionary
const dictionary coeffDict_;
@ -86,67 +92,61 @@ public:
// Constructors
//- Construct null from owner cloud
SubModelBase(CloudType& owner);
//- Construct null
subModelBase(dictionary& properties);
//- Construct from owner cloud, dictionary, and model type name
SubModelBase
//- Construct from components without name
subModelBase
(
CloudType& owner,
dictionary& properties,
const dictionary& dict,
const word& baseName,
const word& modelType,
const word& dictExt = "Coeffs"
);
//- Construct from owner cloud, dictionary, and model type name
SubModelBase
//- Construct from components with name
subModelBase
(
const word& modelName,
CloudType& owner,
dictionary& properties,
const dictionary& dict,
const word& baseName,
const word& modelType
);
//- Construct as copy
SubModelBase(const SubModelBase<CloudType>& smb);
subModelBase(const subModelBase& smb);
//- Destructor
virtual ~SubModelBase();
//- Type of cloud this model was instantiated for
typedef CloudType cloudType;
virtual ~subModelBase();
// Member Functions
// Access
//- Return const access to the owner cloud
const CloudType& owner() const;
//- Return const access to the name of the sub-model
const word& modelName() const;
//- Return const access to the cloud dictionary
const dictionary& dict() const;
//- Return const access to the sub-model type
const word& modelType() const;
//- Return const access to the base name of the sub-model
const word& baseName() const;
//- Return const access to the name of the sub-model
const word& modelName() const;
//- Return const access to the sub-model type
const word& modelType() const;
//- Return const access to the coefficients dictionary
const dictionary& coeffDict() const;
//- Return const access to the properties dictionary
const IOdictionary& properties() const;
const dictionary& properties() const;
//- Returns true if defaultCoeffs is true and outputs on printMsg
bool defaultCoeffs(const bool printMsg) const;
virtual bool defaultCoeffs(const bool printMsg) const;
//- Return the model 'active' status - default active = true
virtual bool active() const;
@ -155,14 +155,11 @@ public:
virtual void cacheFields(const bool store);
//- Flag to indicate when to write a property
bool outputTime() const;
virtual bool outputTime() const;
// Edit
//- Return non-const access to the owner cloud for manipulation
CloudType& owner();
// Base properties
//- Retrieve generic property from the base model
@ -215,7 +212,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "SubModelBase.C"
# include "subModelBaseTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::subModelBase::getBaseProperty
(
const word& entryName,
const Type& defaultValue
) const
{
Type result = defaultValue;
if (properties_.found(baseName_))
{
const dictionary& baseDict = properties_.subDict(baseName_);
baseDict.readIfPresent(entryName, result);
}
return result;
}
template<class Type>
void Foam::subModelBase::getBaseProperty
(
const word& entryName,
Type& value
) const
{
if (properties_.found(baseName_))
{
const dictionary& baseDict = properties_.subDict(baseName_);
baseDict.readIfPresent(entryName, value);
}
}
template<class Type>
void Foam::subModelBase::setBaseProperty
(
const word& entryName,
const Type& value
)
{
if (properties_.found(baseName_))
{
dictionary& baseDict = properties_.subDict(baseName_);
baseDict.add(entryName, value, true);
}
else
{
properties_.add(baseName_, dictionary());
properties_.subDict(baseName_).add(entryName, value);
}
}
template<class Type>
Type Foam::subModelBase::getModelProperty
(
const word& entryName,
const Type& defaultValue
) const
{
Type result = defaultValue;
if (properties_.found(baseName_))
{
const dictionary& baseDict = properties_.subDict(baseName_);
if (inLine() && baseDict.found(modelName_))
{
baseDict.subDict(modelName_).readIfPresent(entryName, result);
}
else if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).readIfPresent(entryName, result);
}
}
return result;
}
template<class Type>
void Foam::subModelBase::getModelProperty
(
const word& entryName,
Type& value
) const
{
if (properties_.found(baseName_))
{
const dictionary& baseDict = properties_.subDict(baseName_);
if (inLine() && baseDict.found(modelName_))
{
baseDict.subDict(modelName_).readIfPresent(entryName, value);
}
else if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).readIfPresent(entryName, value);
}
}
}
template<class Type>
void Foam::subModelBase::setModelProperty
(
const word& entryName,
const Type& value
)
{
if (properties_.found(baseName_))
{
dictionary& baseDict = properties_.subDict(baseName_);
if (inLine())
{
if (baseDict.found(modelName_))
{
baseDict.subDict(modelName_).add(entryName, value, true);
}
else
{
baseDict.add(modelName_, dictionary());
baseDict.subDict(modelName_).add(entryName, value, true);
}
}
else
{
if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).add(entryName, value, true);
}
else
{
baseDict.add(modelType_, dictionary());
baseDict.subDict(modelType_).add(entryName, value, true);
}
}
}
else
{
properties_.add(baseName_, dictionary());
if (inLine())
{
properties_.subDict(baseName_).add(modelName_, dictionary());
properties_.subDict(baseName_).subDict(modelName_).add
(
entryName,
value
);
}
else
{
properties_.subDict(baseName_).add(modelType_, dictionary());
properties_.subDict(baseName_).subDict(modelType_).add
(
entryName,
value
);
}
}
}
// ************************************************************************* //

View File

@ -69,7 +69,7 @@ Foam::motionSolver::motionSolver(const polyMesh& mesh)
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
IOobject::AUTO_WRITE
)
),
mesh_(mesh)
@ -146,7 +146,7 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
IOobject::AUTO_WRITE
)
);
@ -179,4 +179,15 @@ void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm)
{}
bool Foam::motionSolver::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const
{
return true;
}
// ************************************************************************* //

View File

@ -148,6 +148,14 @@ public:
//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&) = 0;
//- Write state using given format, version and compression
virtual bool writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -61,7 +61,7 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
}
this->jump_ = this->jumpTable_->value(Un);
this->jump_ = max(this->jumpTable_->value(Un), scalar(0));
}
}

View File

@ -62,7 +62,7 @@ inline Foam::KinematicParcel<ParcelType>::constantProperties::constantProperties
)
:
dict_(parentDict.subOrEmptyDict("constantProperties")),
parcelTypeId_(dict_, "parcelTypeId", 1),
parcelTypeId_(dict_, "parcelTypeId", -1),
rhoMin_(dict_, "rhoMin", 1e-15),
rho0_(dict_, "rho0"),
minParticleMass_(dict_, "minParticleMass", 1e-15)

View File

@ -39,7 +39,8 @@ void Foam::CloudFunctionObject<CloudType>::write()
template<class CloudType>
Foam::CloudFunctionObject<CloudType>::CloudFunctionObject(CloudType& owner)
:
SubModelBase<CloudType>(owner)
CloudSubModelBase<CloudType>(owner),
outputDir_()
{}
@ -48,11 +49,28 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
(
const dictionary& dict,
CloudType& owner,
const word& type
const word& modelName,
const word& objectType
)
:
SubModelBase<CloudType>(owner, dict, typeName, type, "")
{}
CloudSubModelBase<CloudType>(modelName, owner, dict, typeName, objectType),
outputDir_(owner.mesh().time().path())
{
const fileName relPath =
"postProcessing"/cloud::prefix/owner.name()/this->modelName();
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir_ = outputDir_/".."/relPath;
}
else
{
outputDir_ = outputDir_/relPath;
}
}
template<class CloudType>
@ -61,7 +79,7 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
const CloudFunctionObject<CloudType>& ppm
)
:
SubModelBase<CloudType>(ppm)
CloudSubModelBase<CloudType>(ppm)
{}
@ -131,6 +149,13 @@ void Foam::CloudFunctionObject<CloudType>::postFace
}
template<class CloudType>
const Foam::fileName& Foam::CloudFunctionObject<CloudType>::outputDir() const
{
return outputDir_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CloudFunctionObjectNew.C"

View File

@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,9 +56,15 @@ class tetIndices;
template<class CloudType>
class CloudFunctionObject
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
// Protected Member Functions
// Private data
//- Output path
fileName outputDir_;
// Private Member Functions
//- Write post-processing info
virtual void write();
@ -77,9 +83,10 @@ public:
dictionary,
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
),
(dict, owner)
(dict, owner, modelName)
);
@ -93,7 +100,8 @@ public:
(
const dictionary& dict,
CloudType& owner,
const word& modelType
const word& objectType,
const word& modelName
);
//- Construct copy
@ -118,7 +126,8 @@ public:
(
const dictionary& dict,
CloudType& owner,
const word& modelType
const word& objectType,
const word& modelName
);
@ -159,6 +168,12 @@ public:
const label faceI,
bool& keepParticle
);
// Input/output
//- Return the output path
const fileName& outputDir() 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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,13 +33,15 @@ Foam::CloudFunctionObject<CloudType>::New
(
const dictionary& dict,
CloudType& owner,
const word& modelType
const word& objectType,
const word& modelName
)
{
Info<< " Selecting cloud function " << modelType << endl;
Info<< " Selecting cloud function " << modelName << " of type "
<< objectType << endl;
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
dictionaryConstructorTablePtr_->find(objectType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
@ -48,16 +50,26 @@ Foam::CloudFunctionObject<CloudType>::New
"CloudFunctionObject<CloudType>::New"
"("
"const dictionary&, "
"CloudType&"
"CloudType&, "
"const word&, "
"const word&"
")"
) << "Unknown cloud function type "
<< modelType << nl << nl
<< objectType << nl << nl
<< "Valid cloud function types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<CloudFunctionObject<CloudType> >(cstrIter()(dict, owner));
return autoPtr<CloudFunctionObject<CloudType> >
(
cstrIter()
(
dict,
owner,
modelName
)
);
}

View File

@ -66,13 +66,19 @@ Foam::CloudFunctionObjectList<CloudType>::CloudFunctionObjectList
{
const word& modelName = modelNames[i];
const dictionary& modelDict(dict.subDict(modelName));
// read the type of the function object
const word objectType(modelDict.lookup("type"));
this->set
(
i,
CloudFunctionObject<CloudType>::New
(
dict,
modelDict,
owner,
objectType,
modelName
)
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,16 +50,17 @@ void Foam::FacePostProcessing<CloudType>::makeLogFile
if (Pstream::master())
{
const fileName logDir = outputDir_/this->owner().time().timeName();
// Create directory if does not exist
mkDir(logDir);
mkDir(this->outputDir());
// Open new file at start up
outputFilePtr_.set
(
zoneI,
new OFstream(logDir/(type() + '_' + zoneName + ".dat"))
new OFstream
(
this->outputDir()/(type() + '_' + zoneName + ".dat")
)
);
outputFilePtr_[zoneI]
@ -201,7 +202,7 @@ void Foam::FacePostProcessing<CloudType>::write()
writer->write
(
outputDir_/time.timeName(),
this->outputDir()/time.timeName(),
fZone.name(),
allPoints,
allFaces,
@ -212,7 +213,7 @@ void Foam::FacePostProcessing<CloudType>::write()
writer->write
(
outputDir_/time.timeName(),
this->outputDir()/time.timeName(),
fZone.name(),
allPoints,
allFaces,
@ -250,10 +251,11 @@ template<class CloudType>
Foam::FacePostProcessing<CloudType>::FacePostProcessing
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, typeName),
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
faceZoneIDs_(),
surfaceFormat_(this->coeffDict().lookup("surfaceFormat")),
resetOnWrite_(this->coeffDict().lookup("resetOnWrite")),
@ -263,7 +265,6 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
massFlowRate_(),
log_(this->coeffDict().lookup("log")),
outputFilePtr_(),
outputDir_(owner.mesh().time().path()),
timeOld_(owner.mesh().time().value())
{
wordList faceZoneNames(this->coeffDict().lookup("faceZones"));
@ -273,19 +274,6 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
outputFilePtr_.setSize(faceZoneNames.size());
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir_ =
outputDir_/".."/"postProcessing"/cloud::prefix/owner.name();
}
else
{
outputDir_ =
outputDir_/"postProcessing"/cloud::prefix/owner.name();
}
DynamicList<label> zoneIDs;
const faceZoneMesh& fzm = owner.mesh().faceZones();
const surfaceScalarField& magSf = owner.mesh().magSf();
@ -358,7 +346,6 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
massFlowRate_(pff.massFlowRate_),
log_(pff.log_),
outputFilePtr_(),
outputDir_(pff.outputDir_),
timeOld_(0.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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -91,9 +91,6 @@ class FacePostProcessing
//- Output file pointer per zone
PtrList<OFstream> outputFilePtr_;
//- Output directory
fileName outputDir_;
//- Last calculation time
scalar timeOld_;
@ -127,7 +124,12 @@ public:
// Constructors
//- Construct from dictionary
FacePostProcessing(const dictionary& dict, CloudType& owner);
FacePostProcessing
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
FacePostProcessing(const FacePostProcessing<CloudType>& ppm);

View File

@ -51,15 +51,13 @@ void Foam::ParticleCollector<CloudType>::makeLogFile
if (Pstream::master())
{
const fileName logDir = outputDir_/this->owner().time().timeName();
// Create directory if does not exist
mkDir(logDir);
mkDir(this->outputDir());
// Open new file at start up
outputFilePtr_.reset
(
new OFstream(logDir/(type() + ".dat"))
new OFstream(this->outputDir()/(type() + ".dat"))
);
outputFilePtr_()
@ -463,7 +461,7 @@ void Foam::ParticleCollector<CloudType>::write()
writer->write
(
outputDir_/time.timeName(),
this->outputDir()/time.timeName(),
"collector",
points_,
faces_,
@ -474,7 +472,7 @@ void Foam::ParticleCollector<CloudType>::write()
writer->write
(
outputDir_/time.timeName(),
this->outputDir()/time.timeName(),
"collector",
points_,
faces_,
@ -516,10 +514,11 @@ template<class CloudType>
Foam::ParticleCollector<CloudType>::ParticleCollector
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, typeName),
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
mode_(mtUnknown),
parcelType_(this->coeffDict().lookupOrDefault("parcelType", -1)),
removeCollected_(this->coeffDict().lookup("removeCollected")),
@ -542,22 +541,8 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
massFlowRate_(),
log_(this->coeffDict().lookup("log")),
outputFilePtr_(),
outputDir_(owner.mesh().time().path()),
timeOld_(owner.mesh().time().value())
{
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir_ =
outputDir_/".."/"postProcessing"/cloud::prefix/owner.name();
}
else
{
outputDir_ =
outputDir_/"postProcessing"/cloud::prefix/owner.name();
}
normal_ /= mag(normal_);
word mode(this->coeffDict().lookup("mode"));
@ -618,7 +603,6 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
massFlowRate_(pc.massFlowRate_),
log_(pc.log_),
outputFilePtr_(),
outputDir_(pc.outputDir_),
timeOld_(0.0)
{}

View File

@ -143,9 +143,6 @@ private:
//- Output file pointer
autoPtr<OFstream> outputFilePtr_;
//- Output directory
fileName outputDir_;
//- Last calculation time
scalar timeOld_;
@ -198,7 +195,12 @@ public:
// Constructors
//- Construct from dictionary
ParticleCollector(const dictionary& dict, CloudType& owner);
ParticleCollector
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
ParticleCollector(const ParticleCollector<CloudType>& pc);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,10 +66,11 @@ template<class CloudType>
Foam::ParticleErosion<CloudType>::ParticleErosion
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, typeName),
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
QPtr_(NULL),
patchIDs_(),
p_(readScalar(this->coeffDict().lookup("p"))),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -96,7 +96,12 @@ public:
// Constructors
//- Construct from dictionary
ParticleErosion(const dictionary& dict, CloudType& owner);
ParticleErosion
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
ParticleErosion(const ParticleErosion<CloudType>& pe);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,10 +59,11 @@ template<class CloudType>
Foam::ParticleTracks<CloudType>::ParticleTracks
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, typeName),
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
trackInterval_(readLabel(this->coeffDict().lookup("trackInterval"))),
maxSamples_(readLabel(this->coeffDict().lookup("maxSamples"))),
resetOnWrite_(this->coeffDict().lookup("resetOnWrite")),

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -95,7 +95,12 @@ public:
// Constructors
//- Construct from dictionary
ParticleTracks(const dictionary& dict, CloudType& owner);
ParticleTracks
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
ParticleTracks(const ParticleTracks<CloudType>& ppm);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,10 +32,11 @@ template<class CloudType>
Foam::ParticleTrap<CloudType>::ParticleTrap
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, typeName),
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
alphaName_
(
this->coeffDict().template lookupOrDefault<word>("alphaName", "alpha")

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,8 +29,9 @@ Description
Model is activated using:
particleTrap
particleTrap1
{
type particleTrap;
alphaName alpha; // name volume fraction field
threshold 0.95; // alpha value below which model is active
}
@ -91,7 +92,12 @@ public:
// Constructors
//- Construct from dictionary
ParticleTrap(const dictionary& dict, CloudType& owner);
ParticleTrap
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
ParticleTrap(const ParticleTrap<CloudType>& pe);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,22 +68,7 @@ void Foam::PatchPostProcessing<CloudType>::write()
{
const fvMesh& mesh = this->owner().mesh();
fileName outputDir = mesh.time().path();
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir =
outputDir/".."/"postProcessing"/cloud::prefix/
this->owner().name()/mesh.time().timeName();
}
else
{
outputDir =
outputDir/"postProcessing"/cloud::prefix/
this->owner().name()/mesh.time().timeName();
}
fileName outputDir = this->outputDir()/mesh.time().timeName();
// Create directory if it doesn't exist
mkDir(outputDir);
@ -141,10 +126,11 @@ template<class CloudType>
Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(dict, owner, typeName),
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
maxStoredParcels_(readScalar(this->coeffDict().lookup("maxStoredParcels"))),
patchIDs_(),
times_(),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -91,7 +91,12 @@ public:
// Constructors
//- Construct from dictionary
PatchPostProcessing(const dictionary& dict, CloudType& owner);
PatchPostProcessing
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
PatchPostProcessing(const PatchPostProcessing<CloudType>& ppm);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,10 +48,11 @@ template<class CloudType>
Foam::VoidFraction<CloudType>::VoidFraction
(
const dictionary& dict,
CloudType& owner
CloudType& owner,
const word& modelName
)
:
CloudFunctionObject<CloudType>(owner),
CloudFunctionObject<CloudType>(dict, owner, modelName, typeName),
thetaPtr_(NULL)
{}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -81,7 +81,12 @@ public:
// Constructors
//- Construct from dictionary
VoidFraction(const dictionary& dict, CloudType& owner);
VoidFraction
(
const dictionary& dict,
CloudType& owner,
const word& modelName
);
//- Construct copy
VoidFraction(const VoidFraction<CloudType>& vf);

View File

@ -0,0 +1,136 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 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 "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CloudSubModelBase<CloudType>::CloudSubModelBase(CloudType& owner)
:
subModelBase(owner.outputProperties()),
owner_(owner)
{}
template<class CloudType>
Foam::CloudSubModelBase<CloudType>::CloudSubModelBase
(
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& modelType,
const word& dictExt
)
:
subModelBase
(
owner.outputProperties(),
dict,
baseName,
modelType,
dictExt
),
owner_(owner)
{}
template<class CloudType>
Foam::CloudSubModelBase<CloudType>::CloudSubModelBase
(
const word& modelName,
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& modelType
)
:
subModelBase
(
modelName,
owner.outputProperties(),
dict,
baseName,
modelType
),
owner_(owner)
{}
template<class CloudType>
Foam::CloudSubModelBase<CloudType>::CloudSubModelBase
(
const CloudSubModelBase<CloudType>& smb
)
:
subModelBase(smb),
owner_(smb.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CloudSubModelBase<CloudType>::~CloudSubModelBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::CloudSubModelBase<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
CloudType& Foam::CloudSubModelBase<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
bool Foam::CloudSubModelBase<CloudType>::outputTime() const
{
return
active()
&& owner_.solution().transient()
&& owner_.db().time().outputTime();
}
template<class CloudType>
void Foam::CloudSubModelBase<CloudType>::write(Ostream& os) const
{
os.writeKeyword("owner") << owner_.name() << token::END_STATEMENT
<< nl;
subModelBase::write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 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::CloudSubModelBase
Description
Base class for cloud sub-models
SourceFiles
CloudSubModelBase.C
\*---------------------------------------------------------------------------*/
#ifndef CloudSubModelBase_H
#define CloudSubModelBase_H
#include "subModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class CloudSubModelBase Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class CloudSubModelBase
:
public subModelBase
{
protected:
// Protected Data
//- Reference to the cloud
CloudType& owner_;
public:
// Constructors
//- Construct null from owner cloud
CloudSubModelBase(CloudType& owner);
//- Construct from owner cloud without name
CloudSubModelBase
(
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& modelType,
const word& dictExt = "Coeffs"
);
//- Construct from owner cloud with name
CloudSubModelBase
(
const word& modelName,
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& modelType
);
//- Construct as copy
CloudSubModelBase(const CloudSubModelBase<CloudType>& smb);
//- Destructor
virtual ~CloudSubModelBase();
//- Type of cloud this model was instantiated for
typedef CloudType cloudType;
// Member Functions
// Access
//- Return const access to the owner cloud
const CloudType& owner() const;
//- Flag to indicate when to write a property
virtual bool outputTime() const;
// Edit
//- Return non-const access to the owner cloud for manipulation
CloudType& owner();
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CloudSubModelBase.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,7 @@ License
template<class CloudType>
Foam::CollisionModel<CloudType>::CollisionModel(CloudType& owner)
:
SubModelBase<CloudType>(owner)
CloudSubModelBase<CloudType>(owner)
{}
@ -42,14 +42,14 @@ Foam::CollisionModel<CloudType>::CollisionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type)
CloudSubModelBase<CloudType>(owner, dict, typeName, type)
{}
template<class CloudType>
Foam::CollisionModel<CloudType>::CollisionModel(CollisionModel<CloudType>& cm)
:
SubModelBase<CloudType>(cm)
CloudSubModelBase<CloudType>(cm)
{}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace Foam
template<class CloudType>
class CollisionModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
// Protected data

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,7 @@ License
template<class CloudType>
Foam::DispersionModel<CloudType>::DispersionModel(CloudType& owner)
:
SubModelBase<CloudType>(owner)
CloudSubModelBase<CloudType>(owner)
{}
@ -42,7 +42,7 @@ Foam::DispersionModel<CloudType>::DispersionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type)
CloudSubModelBase<CloudType>(owner, dict, typeName, type)
{}
@ -52,7 +52,7 @@ Foam::DispersionModel<CloudType>::DispersionModel
DispersionModel<CloudType>& dm
)
:
SubModelBase<CloudType>(dm)
CloudSubModelBase<CloudType>(dm)
{}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,7 +34,7 @@ Description
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,7 +48,7 @@ namespace Foam
template<class CloudType>
class DispersionModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
public:

View File

@ -282,7 +282,7 @@ void Foam::InjectionModel<CloudType>::postInjectCheck
template<class CloudType>
Foam::InjectionModel<CloudType>::InjectionModel(CloudType& owner)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
SOI_(0.0),
volumeTotal_(0.0),
massTotal_(0.0),
@ -310,7 +310,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
const word& modelType
)
:
SubModelBase<CloudType>(modelName, owner, dict, typeName, modelType),
CloudSubModelBase<CloudType>(modelName, owner, dict, typeName, modelType),
SOI_(0.0),
volumeTotal_(0.0),
massTotal_(0.0),
@ -387,7 +387,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
const InjectionModel<CloudType>& im
)
:
SubModelBase<CloudType>(im),
CloudSubModelBase<CloudType>(im),
SOI_(im.SOI_),
volumeTotal_(im.volumeTotal_),
massTotal_(im.massTotal_),

View File

@ -51,7 +51,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
#include "vector.H"
#include "TimeDataEntry.H"
@ -67,7 +67,7 @@ namespace Foam
template<class CloudType>
class InjectionModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
public:

View File

@ -109,7 +109,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
UName_("unknown_UName")
{}
@ -122,7 +122,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
UName_(this->coeffDict().lookupOrDefault("UName", word("U")))
{}
@ -133,7 +133,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
const PatchInteractionModel<CloudType>& pim
)
:
SubModelBase<CloudType>(pim),
CloudSubModelBase<CloudType>(pim),
UName_(pim.UName_)
{}

View File

@ -42,7 +42,7 @@ SourceFiles
#include "polyPatch.H"
#include "wallPolyPatch.H"
#include "tetIndices.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ namespace Foam
template<class CloudType>
class PatchInteractionModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
public:

View File

@ -45,7 +45,7 @@ Foam::StochasticCollisionModel<CloudType>::StochasticCollisionModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner)
CloudSubModelBase<CloudType>(owner)
{}
@ -55,7 +55,7 @@ Foam::StochasticCollisionModel<CloudType>::StochasticCollisionModel
const StochasticCollisionModel<CloudType>& cm
)
:
SubModelBase<CloudType>(cm)
CloudSubModelBase<CloudType>(cm)
{}
@ -67,7 +67,7 @@ Foam::StochasticCollisionModel<CloudType>::StochasticCollisionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type)
CloudSubModelBase<CloudType>(owner, dict, typeName, type)
{}

View File

@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace Foam
template<class CloudType>
class StochasticCollisionModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
protected:

View File

@ -35,7 +35,7 @@ using namespace Foam::constant;
template<class CloudType>
Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel(CloudType& owner)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
g_(owner.g()),
ejectedParcelType_(0),
massParcelPatch_(0),
@ -56,7 +56,7 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
g_(owner.g()),
ejectedParcelType_
(
@ -78,7 +78,7 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
const SurfaceFilmModel<CloudType>& sfm
)
:
SubModelBase<CloudType>(sfm),
CloudSubModelBase<CloudType>(sfm),
g_(sfm.g_),
ejectedParcelType_(sfm.ejectedParcelType_),
massParcelPatch_(sfm.massParcelPatch_),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,7 +64,7 @@ class mappedPatchBase;
template<class CloudType>
class SurfaceFilmModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,7 @@ License
template<class CloudType>
Foam::CompositionModel<CloudType>::CompositionModel(CloudType& owner)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
thermo_(owner.thermo()),
phaseProps_()
{}
@ -44,7 +44,7 @@ Foam::CompositionModel<CloudType>::CompositionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
thermo_(owner.thermo()),
phaseProps_
(
@ -62,7 +62,7 @@ Foam::CompositionModel<CloudType>::CompositionModel
const CompositionModel<CloudType>& cm
)
:
SubModelBase<CloudType>(cm),
CloudSubModelBase<CloudType>(cm),
thermo_(cm.thermo_),
phaseProps_(cm.phaseProps_)
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,7 @@ SourceFiles
#ifndef CompositionModel_H
#define CompositionModel_H
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
@ -60,7 +60,7 @@ namespace Foam
template<class CloudType>
class CompositionModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
// Private data
//- Reference to the thermo database

View File

@ -75,7 +75,7 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
enthalpyTransfer_(etLatentHeat),
dMass_(0.0)
{}
@ -87,7 +87,7 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
const PhaseChangeModel<CloudType>& pcm
)
:
SubModelBase<CloudType>(pcm),
CloudSubModelBase<CloudType>(pcm),
enthalpyTransfer_(pcm.enthalpyTransfer_),
dMass_(pcm.dMass_)
{}
@ -101,7 +101,7 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
enthalpyTransfer_
(
wordToEnthalpyTransfer(this->coeffDict().lookup("enthalpyTransfer"))

View File

@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace Foam
template<class CloudType>
class PhaseChangeModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
public:

View File

@ -33,7 +33,7 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
dMass_(0.0)
{}
@ -46,7 +46,7 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
dMass_(0.0)
{}
@ -57,7 +57,7 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
const DevolatilisationModel<CloudType>& dm
)
:
SubModelBase<CloudType>(dm),
CloudSubModelBase<CloudType>(dm),
dMass_(dm.dMass_)
{}

View File

@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace Foam
template<class CloudType>
class DevolatilisationModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,7 +33,7 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
dMass_(0.0)
{}
@ -46,7 +46,7 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
dMass_(0.0)
{}
@ -57,7 +57,7 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
const SurfaceReactionModel<CloudType>& srm
)
:
SubModelBase<CloudType>(srm),
CloudSubModelBase<CloudType>(srm),
dMass_(srm.dMass_)
{}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace Foam
template<class CloudType>
class SurfaceReactionModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
protected:

View File

@ -1,394 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "SubModelBase.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class CloudType>
bool Foam::SubModelBase<CloudType>::SubModelBase::inLine() const
{
return (modelName_ != word::null);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SubModelBase<CloudType>::SubModelBase(CloudType& owner)
:
owner_(owner),
dict_(dictionary::null),
baseName_(word::null),
modelType_(word::null),
modelName_(word::null),
coeffDict_(dictionary::null)
{}
template<class CloudType>
Foam::SubModelBase<CloudType>::SubModelBase
(
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& modelType,
const word& dictExt
)
:
owner_(owner),
dict_(dict),
baseName_(baseName),
modelType_(modelType),
modelName_(word::null),
coeffDict_(dict.subDict(modelType + dictExt))
{}
template<class CloudType>
Foam::SubModelBase<CloudType>::SubModelBase
(
const word& modelName,
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& modelType
)
:
owner_(owner),
dict_(dict),
baseName_(baseName),
modelType_(modelType),
modelName_(modelName),
coeffDict_(dict)
{}
template<class CloudType>
Foam::SubModelBase<CloudType>::SubModelBase(const SubModelBase<CloudType>& smb)
:
owner_(smb.owner_),
dict_(smb.dict_),
baseName_(smb.baseName_),
modelType_(smb.modelType_),
modelName_(smb.modelName_),
coeffDict_(smb.coeffDict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::SubModelBase<CloudType>::~SubModelBase()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
const CloudType& Foam::SubModelBase<CloudType>::owner() const
{
return owner_;
}
template<class CloudType>
const Foam::dictionary& Foam::SubModelBase<CloudType>::dict() const
{
return dict_;
}
template<class CloudType>
const Foam::word& Foam::SubModelBase<CloudType>::modelType() const
{
return modelType_;
}
template<class CloudType>
const Foam::word& Foam::SubModelBase<CloudType>::baseName() const
{
return baseName_;
}
template<class CloudType>
const Foam::word& Foam::SubModelBase<CloudType>::modelName() const
{
return modelName_;
}
template<class CloudType>
const Foam::dictionary& Foam::SubModelBase<CloudType>::coeffDict() const
{
return coeffDict_;
}
template<class CloudType>
bool Foam::SubModelBase<CloudType>::defaultCoeffs(const bool printMsg) const
{
bool def = coeffDict_.lookupOrDefault<bool>("defaultCoeffs", false);
if (printMsg && def)
{
Info<< incrIndent;
Info<< indent << "Employing default coefficients" << endl;
Info<< decrIndent;
}
return def;
}
template<class CloudType>
CloudType& Foam::SubModelBase<CloudType>::owner()
{
return owner_;
}
template<class CloudType>
bool Foam::SubModelBase<CloudType>::active() const
{
return true;
}
template<class CloudType>
void Foam::SubModelBase<CloudType>::cacheFields(const bool)
{
// do nothing
}
template<class CloudType>
bool Foam::SubModelBase<CloudType>::outputTime() const
{
return
active()
&& owner_.solution().transient()
&& owner_.db().time().outputTime();
}
template<class CloudType>
template<class Type>
Type Foam::SubModelBase<CloudType>::getBaseProperty
(
const word& entryName,
const Type& defaultValue
) const
{
Type result = defaultValue;
const dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
const dictionary& baseDict = properties.subDict(baseName_);
baseDict.readIfPresent(entryName, result);
}
return result;
}
template<class CloudType>
template<class Type>
void Foam::SubModelBase<CloudType>::getBaseProperty
(
const word& entryName,
Type& value
) const
{
const dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
const dictionary& baseDict = properties.subDict(baseName_);
baseDict.readIfPresent(entryName, value);
}
}
template<class CloudType>
template<class Type>
void Foam::SubModelBase<CloudType>::setBaseProperty
(
const word& entryName,
const Type& value
)
{
dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
dictionary& baseDict = properties.subDict(baseName_);
baseDict.add(entryName, value, true);
}
else
{
properties.add(baseName_, dictionary());
properties.subDict(baseName_).add(entryName, value);
}
}
template<class CloudType>
template<class Type>
Type Foam::SubModelBase<CloudType>::getModelProperty
(
const word& entryName,
const Type& defaultValue
) const
{
Type result = defaultValue;
const dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
const dictionary& baseDict = properties.subDict(baseName_);
if (inLine() && baseDict.found(modelName_))
{
baseDict.subDict(modelName_).readIfPresent(entryName, result);
}
else if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).readIfPresent(entryName, result);
}
}
return result;
}
template<class CloudType>
template<class Type>
void Foam::SubModelBase<CloudType>::getModelProperty
(
const word& entryName,
Type& value
) const
{
const dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
const dictionary& baseDict = properties.subDict(baseName_);
if (inLine() && baseDict.found(modelName_))
{
baseDict.subDict(modelName_).readIfPresent(entryName, value);
}
else if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).readIfPresent(entryName, value);
}
}
}
template<class CloudType>
template<class Type>
void Foam::SubModelBase<CloudType>::setModelProperty
(
const word& entryName,
const Type& value
)
{
dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
dictionary& baseDict = properties.subDict(baseName_);
if (inLine())
{
if (baseDict.found(modelName_))
{
baseDict.subDict(modelName_).add(entryName, value, true);
}
else
{
baseDict.add(modelName_, dictionary());
baseDict.subDict(modelName_).add(entryName, value, true);
}
}
else
{
if (baseDict.found(modelType_))
{
baseDict.subDict(modelType_).add(entryName, value, true);
}
else
{
baseDict.add(modelType_, dictionary());
baseDict.subDict(modelType_).add(entryName, value, true);
}
}
}
else
{
properties.add(baseName_, dictionary());
if (inLine())
{
properties.subDict(baseName_).add(modelName_, dictionary());
properties.subDict(baseName_).subDict(modelName_).add
(
entryName,
value
);
}
else
{
properties.subDict(baseName_).add(modelType_, dictionary());
properties.subDict(baseName_).subDict(modelType_).add
(
entryName,
value
);
}
}
}
template<class CloudType>
void Foam::SubModelBase<CloudType>::write(Ostream& os) const
{
os.writeKeyword("owner") << owner_.name() << token::END_STATEMENT
<< nl;
// not writing complete cloud dictionary, only coeffs
// os << dict_;
os << coeffDict_;
}
// ************************************************************************* //

View File

@ -30,7 +30,7 @@ License
template<class CloudType>
Foam::HeatTransferModel<CloudType>::HeatTransferModel(CloudType& owner)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
BirdCorrection_(false)
{}
@ -43,7 +43,7 @@ Foam::HeatTransferModel<CloudType>::HeatTransferModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
BirdCorrection_(this->coeffDict().lookup("BirdCorrection"))
{}
@ -54,7 +54,7 @@ Foam::HeatTransferModel<CloudType>::HeatTransferModel
const HeatTransferModel<CloudType>& htm
)
:
SubModelBase<CloudType>(htm),
CloudSubModelBase<CloudType>(htm),
BirdCorrection_(htm.BirdCorrection_)
{}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace Foam
template<class CloudType>
class HeatTransferModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
// Private data

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,7 +33,7 @@ Foam::AtomizationModel<CloudType>::AtomizationModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner)
CloudSubModelBase<CloudType>(owner)
{}
@ -43,7 +43,7 @@ Foam::AtomizationModel<CloudType>::AtomizationModel
const AtomizationModel<CloudType>& am
)
:
SubModelBase<CloudType>(am)
CloudSubModelBase<CloudType>(am)
{}
@ -55,7 +55,7 @@ Foam::AtomizationModel<CloudType>::AtomizationModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, typeName, type)
CloudSubModelBase<CloudType>(owner, dict, typeName, type)
{}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,7 +39,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "SubModelBase.H"
#include "CloudSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace Foam
template<class CloudType>
class AtomizationModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
public:

View File

@ -33,7 +33,7 @@ Foam::BreakupModel<CloudType>::BreakupModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner),
CloudSubModelBase<CloudType>(owner),
solveOscillationEq_(false),
y0_(0.0),
yDot0_(0.0),
@ -49,7 +49,7 @@ Foam::BreakupModel<CloudType>::BreakupModel
const BreakupModel<CloudType>& bum
)
:
SubModelBase<CloudType>(bum),
CloudSubModelBase<CloudType>(bum),
solveOscillationEq_(bum.solveOscillationEq_),
y0_(bum.y0_),
yDot0_(bum.yDot0_),
@ -68,7 +68,7 @@ Foam::BreakupModel<CloudType>::BreakupModel
bool solveOscillationEq
)
:
SubModelBase<CloudType>(owner, dict, typeName, type),
CloudSubModelBase<CloudType>(owner, dict, typeName, type),
solveOscillationEq_(solveOscillationEq),
y0_(0.0),
yDot0_(0.0),

View File

@ -52,7 +52,7 @@ namespace Foam
template<class CloudType>
class BreakupModel
:
public SubModelBase<CloudType>
public CloudSubModelBase<CloudType>
{
protected:

View File

@ -4,33 +4,4 @@ forces/forcesFunctionObject.C
forceCoeffs/forceCoeffs.C
forceCoeffs/forceCoeffsFunctionObject.C
sDoFRBM = pointPatchFields/derived/sixDoFRigidBodyMotion
$(sDoFRBM)/sixDoFRigidBodyMotion.C
$(sDoFRBM)/sixDoFRigidBodyMotionIO.C
$(sDoFRBM)/sixDoFRigidBodyMotionState.C
$(sDoFRBM)/sixDoFRigidBodyMotionStateIO.C
sDoFRBMR = $(sDoFRBM)/sixDoFRigidBodyMotionRestraint
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraintNew.C
$(sDoFRBMR)/linearAxialAngularSpring/linearAxialAngularSpring.C
$(sDoFRBMR)/linearSpring/linearSpring.C
$(sDoFRBMR)/sphericalAngularSpring/sphericalAngularSpring.C
$(sDoFRBMR)/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C
sDoFRBMC = $(sDoFRBM)/sixDoFRigidBodyMotionConstraint
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraintNew.C
$(sDoFRBMC)/fixedAxis/fixedAxis.C
$(sDoFRBMC)/fixedLine/fixedLine.C
$(sDoFRBMC)/fixedOrientation/fixedOrientation.C
$(sDoFRBMC)/fixedPlane/fixedPlane.C
$(sDoFRBMC)/fixedPoint/fixedPoint.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C
LIB = $(FOAM_LIBBIN)/libforces

View File

@ -142,6 +142,27 @@ void Foam::regionModels::regionModel::initialise()
<< "Region model has no mapped boundary conditions - transfer "
<< "between regions will not be possible" << endl;
}
if (!outputPropertiesPtr_.valid())
{
const fileName uniformPath(word("uniform")/"regionModels");
outputPropertiesPtr_.reset
(
new IOdictionary
(
IOobject
(
regionName_ + "OutputProperties",
time_.timeName(),
uniformPath/regionName_,
primaryMesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
)
);
}
}
@ -389,6 +410,7 @@ Foam::regionModels::regionModel::regionModel
modelName_("none"),
regionMeshPtr_(NULL),
coeffs_(dictionary::null),
outputPropertiesPtr_(NULL),
primaryPatchIDs_(),
intCoupledPatchIDs_(),
regionName_("none"),
@ -424,6 +446,7 @@ Foam::regionModels::regionModel::regionModel
modelName_(modelName),
regionMeshPtr_(NULL),
coeffs_(subOrEmptyDict(modelName + "Coeffs")),
outputPropertiesPtr_(NULL),
primaryPatchIDs_(),
intCoupledPatchIDs_(),
regionName_(lookup("regionName")),
@ -471,6 +494,7 @@ Foam::regionModels::regionModel::regionModel
modelName_(modelName),
regionMeshPtr_(NULL),
coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
outputPropertiesPtr_(NULL),
primaryPatchIDs_(),
intCoupledPatchIDs_(),
regionName_(dict.lookup("regionName")),
@ -519,6 +543,16 @@ void Foam::regionModels::regionModel::evolve()
info();
Info<< endl << decrIndent;
}
if (time_.outputTime())
{
outputProperties().writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
time_.writeCompression()
);
}
}
}

View File

@ -105,6 +105,9 @@ protected:
//- Model coefficients dictionary
dictionary coeffs_;
//- Dictionary of output properties
autoPtr<IOdictionary> outputPropertiesPtr_;
// Addressing
@ -216,6 +219,12 @@ public:
//- Return the solution dictionary
inline const dictionary& solution() const;
//- Return const access to the output properties dictionary
inline const IOdictionary& outputProperties() const;
//- Return output properties dictionary
inline IOdictionary& outputProperties();
// Addressing

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -112,6 +112,42 @@ Foam::regionModels::regionModel::solution() const
}
inline const Foam::IOdictionary&
Foam::regionModels::regionModel::outputProperties() const
{
if (!outputPropertiesPtr_.valid())
{
FatalErrorIn
(
"inline const Foam::IOdictionary& "
"Foam::regionModels::regionModel::outputProperties() const"
)
<< "outputProperties dictionary not available"
<< abort(FatalError);
}
return outputPropertiesPtr_();
}
inline Foam::IOdictionary&
Foam::regionModels::regionModel::outputProperties()
{
if (!outputPropertiesPtr_.valid())
{
FatalErrorIn
(
"inline Foam::IOdictionary& "
"Foam::regionModels::regionModel::outputProperties()"
)
<< "outputProperties dictionary not available"
<< abort(FatalError);
}
return outputPropertiesPtr_();
}
inline bool Foam::regionModels::regionModel::isCoupledPatch
(
const label regionPatchI

View File

@ -7,7 +7,7 @@ thermoSingleLayer/thermoSingleLayer.C
/* Sub-models */
submodels/subModelBase.C
submodels/filmSubModelBase.C
KINEMATICMODELS=submodels/kinematic
$(KINEMATICMODELS)/force/force/force.C

View File

@ -136,6 +136,16 @@ void kinematicSingleLayer::transferPrimaryRegionSourceFields()
rhoSp_.correctBoundaryConditions();
USp_.correctBoundaryConditions();
pSp_.correctBoundaryConditions();
// update addedMassTotal counter
if (time().outputTime())
{
scalar addedMassTotal = 0.0;
outputProperties().readIfPresent("addedMassTotal", addedMassTotal);
addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>());
outputProperties().add("addedMassTotal", addedMassTotal, true);
addedMassTotal_ = 0.0;
}
}
@ -1055,9 +1065,11 @@ void kinematicSingleLayer::info() const
const scalarField& deltaInternal = delta_.internalField();
const vectorField& Uinternal = U_.internalField();
scalar addedMassTotal = 0.0;
outputProperties().readIfPresent("addedMassTotal", addedMassTotal);
addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>());
Info<< indent << "added mass = "
<< returnReduce<scalar>(addedMassTotal_, sumOp<scalar>()) << nl
Info<< indent << "added mass = " << addedMassTotal << nl
<< indent << "current mass = "
<< gSum((deltaRho_*magSf())()) << nl
<< indent << "min/max(mag(U)) = " << gMin(mag(Uinternal)) << ", "

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "subModelBase.H"
#include "filmSubModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -36,31 +36,69 @@ namespace surfaceFilmModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
subModelBase::subModelBase(const surfaceFilmModel& owner)
filmSubModelBase::filmSubModelBase(surfaceFilmModel& owner)
:
owner_(owner),
coeffs_(dictionary::null)
subModelBase(owner.outputProperties()),
owner_(owner)
{}
subModelBase::subModelBase
filmSubModelBase::filmSubModelBase
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
surfaceFilmModel& owner,
const dictionary& dict,
const word& baseName,
const word& modelType,
const word& dictExt
)
:
owner_(owner),
coeffs_(dict.subOrEmptyDict(type + "Coeffs"))
subModelBase
(
owner.outputProperties(),
dict,
baseName,
modelType,
dictExt
),
owner_(owner)
{}
filmSubModelBase::filmSubModelBase
(
const word& modelName,
surfaceFilmModel& owner,
const dictionary& dict,
const word& baseName,
const word& modelType
)
:
subModelBase
(
modelName,
owner.outputProperties(),
dict,
baseName,
modelType
),
owner_(owner)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
subModelBase::~subModelBase()
filmSubModelBase::~filmSubModelBase()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool filmSubModelBase::outputTime() const
{
return active() && owner_.time().outputTime();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels

View File

@ -28,15 +28,16 @@ Description
Base class for surface film sub-models
SourceFiles
subModelBaseI.H
subModelBase.C
filmSubModelBaseI.H
filmSubModelBase.C
\*---------------------------------------------------------------------------*/
#ifndef subModelBase_H
#define subModelBase_H
#ifndef filmSubModelBase_H
#define filmSubModelBase_H
#include "surfaceFilmModel.H"
#include "subModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,22 +49,13 @@ namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class subModelBase Declaration
Class filmSubModelBase Declaration
\*---------------------------------------------------------------------------*/
class subModelBase
class filmSubModelBase
:
public subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
subModelBase(const subModelBase&);
//- Disallow default bitwise assignment
void operator=(const subModelBase&);
protected:
// Protected data
@ -71,42 +63,49 @@ protected:
//- Reference to the owner surface film model
const surfaceFilmModel& owner_;
//- Model coefficients dictionary
dictionary coeffs_;
public:
// Constructors
//- Construct null
subModelBase(const surfaceFilmModel& owner);
filmSubModelBase(surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
subModelBase
//- Construct from owner film wihout name
filmSubModelBase
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
surfaceFilmModel& owner,
const dictionary& dict,
const word& baseName,
const word& modelType,
const word& dictExt = "Coeffs"
);
//- Construct from owner film with name
filmSubModelBase
(
const word& modelName,
surfaceFilmModel& owner,
const dictionary& dict,
const word& baseName,
const word& modelType
);
//- Destructor
virtual ~subModelBase();
virtual ~filmSubModelBase();
// Member Functions
// Access
virtual const word& type() const = 0;
//- Flag to indicate when to write a property
virtual bool outputTime() const;
//- Return the reference to the owner surface film model
inline const surfaceFilmModel& owner() const;
//- Return the model coefficients dictionary
inline const dictionary& coeffs() const;
template<class FilmType>
inline const FilmType& filmType() const;
};
@ -120,12 +119,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "subModelBaseI.H"
#include "filmSubModelBaseI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "subModelBaseTemplates.C"
#include "filmSubModelBaseTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,18 +34,12 @@ namespace surfaceFilmModels
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const surfaceFilmModel& subModelBase::owner() const
inline const surfaceFilmModel& filmSubModelBase::owner() const
{
return owner_;
}
inline const dictionary& subModelBase::coeffs() const
{
return coeffs_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels

View File

@ -33,12 +33,12 @@ namespace surfaceFilmModels
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class FilmType>
const FilmType& subModelBase::filmType() const
const FilmType& filmSubModelBase::filmType() const
{
if (!isA<FilmType>(owner_))
{
FatalErrorIn("FilmType& subModelBase::film() const")
<< "Model " << type() << " requested film type "
FatalErrorIn("FilmType& surfaceFilmModel::film() const")
<< "Model " << this->modelType() << " requested film type "
<< FilmType::typeName << " but film is type " << owner_.type()
<< abort(FatalError);
}

View File

@ -49,7 +49,7 @@ addToRunTimeSelectionTable
void constantFilmThermo::init(thermoData& td)
{
if (coeffs_.readIfPresent(td.name_, td.value_))
if (coeffDict_.readIfPresent(td.name_, td.value_))
{
td.set_ = true;
}
@ -60,12 +60,12 @@ void constantFilmThermo::init(thermoData& td)
constantFilmThermo::constantFilmThermo
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:
filmThermoModel(typeName, owner, dict),
name_(coeffs_.lookup("specieName")),
name_(coeffDict_.lookup("specieName")),
rho0_("rho0"),
mu0_("mu0"),
sigma0_("sigma0"),
@ -110,7 +110,7 @@ scalar constantFilmThermo::rho
{
if (!rho0_.set_)
{
coeffs_.lookup(rho0_.name_) >> rho0_.value_;
coeffDict_.lookup(rho0_.name_) >> rho0_.value_;
rho0_.set_ = true;
}
@ -126,7 +126,7 @@ scalar constantFilmThermo::mu
{
if (!mu0_.set_)
{
coeffs_.lookup(mu0_.name_) >> mu0_.value_;
coeffDict_.lookup(mu0_.name_) >> mu0_.value_;
mu0_.set_ = true;
}
@ -142,7 +142,7 @@ scalar constantFilmThermo::sigma
{
if (!sigma0_.set_)
{
coeffs_.lookup(sigma0_.name_) >> sigma0_.value_;
coeffDict_.lookup(sigma0_.name_) >> sigma0_.value_;
sigma0_.set_ = true;
}
@ -158,7 +158,7 @@ scalar constantFilmThermo::Cp
{
if (!Cp0_.set_)
{
coeffs_.lookup(Cp0_.name_) >> Cp0_.value_;
coeffDict_.lookup(Cp0_.name_) >> Cp0_.value_;
Cp0_.set_ = true;
}
@ -174,7 +174,7 @@ scalar constantFilmThermo::kappa
{
if (!kappa0_.set_)
{
coeffs_.lookup(kappa0_.name_) >> kappa0_.value_;
coeffDict_.lookup(kappa0_.name_) >> kappa0_.value_;
kappa0_.set_ = true;
}
@ -190,7 +190,7 @@ scalar constantFilmThermo::D
{
if (!D0_.set_)
{
coeffs_.lookup(D0_.name_) >> D0_.value_;
coeffDict_.lookup(D0_.name_) >> D0_.value_;
D0_.set_ = true;
}
@ -206,7 +206,7 @@ scalar constantFilmThermo::hl
{
if (!hl0_.set_)
{
coeffs_.lookup(hl0_.name_) >> hl0_.value_;
coeffDict_.lookup(hl0_.name_) >> hl0_.value_;
hl0_.set_ = true;
}
@ -222,7 +222,7 @@ scalar constantFilmThermo::pv
{
if (!pv0_.set_)
{
coeffs_.lookup(pv0_.name_) >> pv0_.value_;
coeffDict_.lookup(pv0_.name_) >> pv0_.value_;
pv0_.set_ = true;
}
@ -234,7 +234,7 @@ scalar constantFilmThermo::W() const
{
if (!W0_.set_)
{
coeffs_.lookup(W0_.name_) >> W0_.value_;
coeffDict_.lookup(W0_.name_) >> W0_.value_;
W0_.set_ = true;
}
@ -246,7 +246,7 @@ scalar constantFilmThermo::Tb(const scalar p) const
{
if (!Tb0_.set_)
{
coeffs_.lookup(Tb0_.name_) >> Tb0_.value_;
coeffDict_.lookup(Tb0_.name_) >> Tb0_.value_;
Tb0_.set_ = true;
}

View File

@ -144,7 +144,7 @@ public:
//- Construct from surface film model and dictionary
constantFilmThermo
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

View File

@ -43,21 +43,21 @@ defineRunTimeSelectionTable(filmThermoModel, dictionary);
filmThermoModel::filmThermoModel
(
const surfaceFilmModel& owner
surfaceFilmModel& owner
)
:
subModelBase(owner)
filmSubModelBase(owner)
{}
filmThermoModel::filmThermoModel
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
filmSubModelBase(owner, dict, typeName, modelType)
{}

View File

@ -36,7 +36,7 @@ SourceFiles
#ifndef filmThermoModel_H
#define filmThermoModel_H
#include "subModelBase.H"
#include "filmSubModelBase.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,7 +54,7 @@ namespace surfaceFilmModels
class filmThermoModel
:
public subModelBase
public filmSubModelBase
{
private:
@ -81,7 +81,7 @@ public:
filmThermoModel,
dictionary,
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
@ -90,13 +90,13 @@ public:
// Constructors
//- Construct null
filmThermoModel(const surfaceFilmModel& owner);
filmThermoModel(surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
filmThermoModel
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
);
@ -106,7 +106,7 @@ public:
//- Return a reference to the selected phase change model
static autoPtr<filmThermoModel> New
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

View File

@ -38,7 +38,7 @@ namespace surfaceFilmModels
autoPtr<filmThermoModel> filmThermoModel::New
(
const surfaceFilmModel& model,
surfaceFilmModel& model,
const dictionary& dict
)
{
@ -53,7 +53,7 @@ autoPtr<filmThermoModel> filmThermoModel::New
{
FatalErrorIn
(
"filmThermoModel::New(const surfaceFilmModel&, const dictionary&)"
"filmThermoModel::New(surfaceFilmModel&, const dictionary&)"
) << "Unknown filmThermoModel type " << modelType << nl << nl
<< "Valid filmThermoModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()

View File

@ -104,7 +104,7 @@ void liquidFilmThermo::initLiquid(const dictionary& dict)
liquidFilmThermo::liquidFilmThermo
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:
@ -112,16 +112,16 @@ liquidFilmThermo::liquidFilmThermo
name_("unknown_liquid"),
liquidPtr_(NULL),
ownLiquid_(false),
useReferenceValues_(readBool(coeffs_.lookup("useReferenceValues"))),
useReferenceValues_(readBool(coeffDict_.lookup("useReferenceValues"))),
pRef_(0.0),
TRef_(0.0)
{
initLiquid(coeffs_);
initLiquid(coeffDict_);
if (useReferenceValues_)
{
coeffs_.lookup("pRef") >> pRef_;
coeffs_.lookup("TRef") >> TRef_;
coeffDict_.lookup("pRef") >> pRef_;
coeffDict_.lookup("TRef") >> TRef_;
}
}

View File

@ -107,7 +107,7 @@ public:
//- Construct from surface film model and dictionary
liquidFilmThermo
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

View File

@ -41,20 +41,20 @@ defineRunTimeSelectionTable(filmTurbulenceModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
filmTurbulenceModel::filmTurbulenceModel(const surfaceFilmModel& owner)
filmTurbulenceModel::filmTurbulenceModel(surfaceFilmModel& owner)
:
subModelBase(owner)
filmSubModelBase(owner)
{}
filmTurbulenceModel::filmTurbulenceModel
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
filmSubModelBase(owner, dict, typeName, modelType)
{}

View File

@ -36,7 +36,7 @@ SourceFiles
#ifndef filmTurbulenceModel_H
#define filmTurbulenceModel_H
#include "subModelBase.H"
#include "filmSubModelBase.H"
#include "runTimeSelectionTables.H"
#include "fvMatricesFwd.H"
#include "volFieldsFwd.H"
@ -56,7 +56,7 @@ namespace surfaceFilmModels
class filmTurbulenceModel
:
public subModelBase
public filmSubModelBase
{
private:
@ -83,7 +83,7 @@ public:
filmTurbulenceModel,
dictionary,
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
@ -92,13 +92,13 @@ public:
// Constructors
//- Construct null
filmTurbulenceModel(const surfaceFilmModel& owner);
filmTurbulenceModel(surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
filmTurbulenceModel
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
);
@ -108,7 +108,7 @@ public:
//- Return a reference to the selected injection model
static autoPtr<filmTurbulenceModel> New
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

View File

@ -38,7 +38,7 @@ namespace surfaceFilmModels
autoPtr<filmTurbulenceModel> filmTurbulenceModel::New
(
const surfaceFilmModel& model,
surfaceFilmModel& model,
const dictionary& dict
)
{
@ -55,7 +55,7 @@ autoPtr<filmTurbulenceModel> filmTurbulenceModel::New
(
"filmTurbulenceModel::New"
"("
"const surfaceFilmModel&, "
"surfaceFilmModel&, "
"const dictionary&"
")"
) << "Unknown filmTurbulenceModel type " << modelType

View File

@ -51,12 +51,12 @@ addToRunTimeSelectionTable(filmTurbulenceModel, laminar, dictionary);
laminar::laminar
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:
filmTurbulenceModel(type(), owner, dict),
Cf_(readScalar(coeffs_.lookup("Cf")))
Cf_(readScalar(coeffDict_.lookup("Cf")))
{}

View File

@ -80,7 +80,7 @@ public:
// Constructors
//- Construct from surface film model
laminar(const surfaceFilmModel& owner, const dictionary& dict);
laminar(surfaceFilmModel& owner, const dictionary& dict);
//- Destructor

View File

@ -48,12 +48,12 @@ addToRunTimeSelectionTable(force, contactAngleForce, dictionary);
void contactAngleForce::initialise()
{
const wordReList zeroForcePatches(coeffs_.lookup("zeroForcePatches"));
const wordReList zeroForcePatches(coeffDict_.lookup("zeroForcePatches"));
if (zeroForcePatches.size())
{
const polyBoundaryMesh& pbm = owner_.regionMesh().boundaryMesh();
scalar dLim = readScalar(coeffs_.lookup("zeroForceDistance"));
scalar dLim = readScalar(coeffDict_.lookup("zeroForceDistance"));
Info<< " Assigning zero contact force within " << dLim
<< " of patches:" << endl;
@ -77,18 +77,18 @@ void contactAngleForce::initialise()
contactAngleForce::contactAngleForce
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:
force(typeName, owner, dict),
Ccf_(readScalar(coeffs_.lookup("Ccf"))),
Ccf_(readScalar(coeffDict_.lookup("Ccf"))),
rndGen_(label(0), -1),
distribution_
(
distributionModels::distributionModel::New
(
coeffs_.subDict("contactAngleDistribution"),
coeffDict_.subDict("contactAngleDistribution"),
rndGen_
)
),

View File

@ -99,7 +99,7 @@ public:
//- Construct from surface film model
contactAngleForce
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,20 +41,20 @@ defineRunTimeSelectionTable(force, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
force::force(const surfaceFilmModel& owner)
force::force(surfaceFilmModel& owner)
:
subModelBase(owner)
filmSubModelBase(owner)
{}
force::force
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
filmSubModelBase(owner, dict, typeName, modelType)
{}

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef force_H
#define force_H
#include "subModelBase.H"
#include "filmSubModelBase.H"
#include "runTimeSelectionTables.H"
#include "fvMatrices.H"
@ -54,7 +54,7 @@ namespace surfaceFilmModels
class force
:
public subModelBase
public filmSubModelBase
{
private:
@ -81,7 +81,7 @@ public:
force,
dictionary,
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
@ -90,13 +90,13 @@ public:
// Constructors
//- Construct null
force(const surfaceFilmModel& owner);
force(surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
force
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
);
@ -106,7 +106,7 @@ public:
//- Return a reference to the selected force model
static autoPtr<force> New
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict,
const word& modelType
);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,7 @@ namespace surfaceFilmModels
autoPtr<force> force::New
(
const surfaceFilmModel& model,
surfaceFilmModel& model,
const dictionary& dict,
const word& modelType
)

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ namespace surfaceFilmModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
forceList::forceList(const surfaceFilmModel& owner)
forceList::forceList(surfaceFilmModel& owner)
:
PtrList<force>()
{}
@ -44,7 +44,7 @@ forceList::forceList(const surfaceFilmModel& owner)
forceList::forceList
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,12 +60,12 @@ public:
// Constructors
//- Construct null
forceList(const surfaceFilmModel& owner);
forceList(surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
forceList
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ addToRunTimeSelectionTable(force, thermocapillaryForce, dictionary);
thermocapillaryForce::thermocapillaryForce
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,7 +76,7 @@ public:
//- Construct from surface film model
thermocapillaryForce
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

View File

@ -220,13 +220,13 @@ tmp<scalarField> curvatureSeparation::calcCosAngle
curvatureSeparation::curvatureSeparation
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:
injectionModel(type(), owner, dict),
gradNHat_(fvc::grad(owner.nHat())),
deltaByR1Min_(coeffs().lookupOrDefault<scalar>("deltaByR1Min", 0.0)),
deltaByR1Min_(coeffDict_.lookupOrDefault<scalar>("deltaByR1Min", 0.0)),
definedPatchRadii_(),
magG_(mag(owner.g().value())),
gHat_(vector::zero)
@ -247,7 +247,7 @@ curvatureSeparation::curvatureSeparation
gHat_ = owner.g().value()/magG_;
List<Tuple2<word, scalar> > prIn(coeffs().lookup("definedPatchRadii"));
List<Tuple2<word, scalar> > prIn(coeffDict_.lookup("definedPatchRadii"));
const wordList& allPatchNames = owner.regionMesh().boundaryMesh().names();
DynamicList<Tuple2<label, scalar> > prData(allPatchNames.size());
@ -339,6 +339,8 @@ void curvatureSeparation::correct
diameterToInject = separated*delta;
availableMass -= separated*availableMass;
addToInjectedMass(sum(separated*availableMass));
if (debug && mesh.time().outputTime())
{
volScalarField volFnet
@ -358,6 +360,8 @@ void curvatureSeparation::correct
volFnet.correctBoundaryConditions();
volFnet.write();
}
injectionModel::correct();
}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -121,7 +121,7 @@ public:
//- Construct from surface film model
curvatureSeparation
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

View File

@ -50,19 +50,19 @@ addToRunTimeSelectionTable(injectionModel, drippingInjection, dictionary);
drippingInjection::drippingInjection
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:
injectionModel(type(), owner, dict),
deltaStable_(readScalar(coeffs_.lookup("deltaStable"))),
particlesPerParcel_(readScalar(coeffs_.lookup("particlesPerParcel"))),
deltaStable_(readScalar(coeffDict_.lookup("deltaStable"))),
particlesPerParcel_(readScalar(coeffDict_.lookup("particlesPerParcel"))),
rndGen_(label(0), -1),
parcelDistribution_
(
distributionModels::distributionModel::New
(
coeffs_.subDict("parcelDistribution"),
coeffDict_.subDict("parcelDistribution"),
rndGen_
)
),
@ -137,6 +137,8 @@ void drippingInjection::correct
// Retrieve new particle diameter sample
diam = parcelDistribution_->sample();
addToInjectedMass(massDrip[cellI]);
}
else
{
@ -151,6 +153,8 @@ void drippingInjection::correct
diameterToInject[cellI] = 0.0;
}
}
injectionModel::correct();
}

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -105,7 +105,7 @@ public:
//- Construct from surface film model
drippingInjection
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
);

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,22 +39,32 @@ namespace surfaceFilmModels
defineTypeNameAndDebug(injectionModel, 0);
defineRunTimeSelectionTable(injectionModel, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void injectionModel::addToInjectedMass(const scalar dMass)
{
injectedMass_ += dMass;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
injectionModel::injectionModel(const surfaceFilmModel& owner)
injectionModel::injectionModel(surfaceFilmModel& owner)
:
subModelBase(owner)
filmSubModelBase(owner),
injectedMass_(0.0)
{}
injectionModel::injectionModel
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
filmSubModelBase(owner, dict, typeName, modelType),
injectedMass_(0.0)
{}
@ -64,6 +74,27 @@ injectionModel::~injectionModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void injectionModel::correct()
{
if (outputTime())
{
scalar injectedMass0 = getModelProperty<scalar>("injectedMass");
injectedMass0 += returnReduce(injectedMass_, sumOp<scalar>());
setModelProperty<scalar>("injectedMass", injectedMass0);
injectedMass_ = 0.0;
}
}
scalar injectionModel::injectedMassTotal() const
{
scalar injectedMass0 = getModelProperty<scalar>("injectedMass");
return injectedMass0 + returnReduce(injectedMass_, sumOp<scalar>());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ SourceFiles
#ifndef injectionModel_H
#define injectionModel_H
#include "subModelBase.H"
#include "filmSubModelBase.H"
#include "runTimeSelectionTables.H"
#include "scalarField.H"
@ -55,10 +55,16 @@ namespace surfaceFilmModels
class injectionModel
:
public subModelBase
public filmSubModelBase
{
private:
// Private data
//- Injected mass
scalar injectedMass_;
// Private Member Functions
//- Disallow default bitwise copy construct
@ -68,6 +74,17 @@ private:
void operator=(const injectionModel&);
protected:
// Protected Member Functions
//- Add to injected mass
void addToInjectedMass(const scalar dMass);
//- Correct
void correct();
public:
//- Runtime type information
@ -82,7 +99,7 @@ public:
injectionModel,
dictionary,
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
@ -91,13 +108,13 @@ public:
// Constructors
//- Construct null
injectionModel(const surfaceFilmModel& owner);
injectionModel(surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
injectionModel
(
const word& type,
const surfaceFilmModel& owner,
const word& modelType,
surfaceFilmModel& owner,
const dictionary& dict
);
@ -107,7 +124,7 @@ public:
//- Return a reference to the selected injection model
static autoPtr<injectionModel> New
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict,
const word& mdoelType
);
@ -128,6 +145,9 @@ public:
scalarField& massToInject,
scalarField& diameterToInject
) = 0;
//- Return the total mass injected
scalar injectedMassTotal() 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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,7 @@ namespace surfaceFilmModels
autoPtr<injectionModel> injectionModel::New
(
const surfaceFilmModel& model,
surfaceFilmModel& model,
const dictionary& dict,
const word& modelType
)
@ -52,7 +52,12 @@ autoPtr<injectionModel> injectionModel::New
{
FatalErrorIn
(
"injectionModel::New(const surfaceFilmModel&, const dictionary&)"
"injectionModel::New"
"("
"surfaceFilmModel&, "
"const dictionary&, "
"const word&"
")"
) << "Unknown injectionModel type " << modelType
<< nl << nl << "Valid injectionModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,25 +36,23 @@ namespace surfaceFilmModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
injectionModelList::injectionModelList(const surfaceFilmModel& owner)
injectionModelList::injectionModelList(surfaceFilmModel& owner)
:
PtrList<injectionModel>(),
owner_(owner),
dict_(dictionary::null),
injectedMassTotal_(0.0)
dict_(dictionary::null)
{}
injectionModelList::injectionModelList
(
const surfaceFilmModel& owner,
surfaceFilmModel& owner,
const dictionary& dict
)
:
PtrList<injectionModel>(),
owner_(owner),
dict_(dict),
injectedMassTotal_(0.0)
dict_(dict)
{
const wordList activeModels(dict.lookup("injectionModels"));
@ -109,9 +107,6 @@ void injectionModelList::correct
im.correct(availableMass, massToInject, diameterToInject);
}
injectedMassTotal_ += sum(massToInject.internalField());
// Push values to boundaries ready for transfer to the primary region
massToInject.correctBoundaryConditions();
diameterToInject.correctBoundaryConditions();
@ -120,8 +115,14 @@ void injectionModelList::correct
void injectionModelList::info(Ostream& os) const
{
os << indent << "injected mass = "
<< returnReduce<scalar>(injectedMassTotal_, sumOp<scalar>()) << nl;
scalar injectedMass = 0.0;
forAll(*this, i)
{
const injectionModel& im = operator[](i);
injectedMass += im.injectedMassTotal();
}
os << indent << "injected mass = " << injectedMass << nl;
}

Some files were not shown because too many files have changed in this diff Show More