Commit bbfec946 authored by mattijs's avatar mattijs
Browse files

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

parents 3410d4ee be6255f1
......@@ -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
......@@ -40,7 +40,7 @@ Description
Valid when:
\f[
rho_{k} << 1
\frac{beta(T - T_{ref})}{rho_{ref}} << 1
\f]
\*---------------------------------------------------------------------------*/
......
......@@ -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
......@@ -29,18 +29,18 @@ Description
Uses the Boussinesq approximation:
\f[
rho_{eff} = 1 - beta(T - T_{ref})
rho_{k} = 1 - beta(T - T_{ref})
\f]
where:
\f$ rho_{eff} \f$ = the effective (driving) density
\f$ rho_{k} \f$ = the effective (driving) density
beta = thermal expansion coefficient [1/K]
T = temperature [K]
\f$ T_{ref} \f$ = reference temperature [K]
Valid when:
\f[
rho_{eff} << 1
\frac{beta(T - T_{ref})}{rho_{ref}} << 1
\f]
\*---------------------------------------------------------------------------*/
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
......@@ -168,8 +168,14 @@ fvControls="system"
if [ -n "$regionName" ]
then
caseFile="$caseName{$regionName}.$extension"
fvControls="$fvControls/$regionName"
if [ ! -d constant/$regionName ]
then
echo "FATAL ERROR: Region $regionName does not exist"
exit 1
else
caseFile="$caseName{$regionName}.$extension"
fvControls="$fvControls/$regionName"
fi
fi
case "${optTouch:-false}" in
......
......@@ -46,8 +46,9 @@ Foam::Dictionary<T>::Dictionary(const Dictionary& dict)
template<class T>
bool Foam::Dictionary<T>::erase(const word& keyword)
{
T* tPtr;
if (tPtr = this->remove(keyword))
T* tPtr = this->remove(keyword);
if (tPtr)
{
delete tPtr;
return true;
......@@ -59,6 +60,4 @@ bool Foam::Dictionary<T>::erase(const word& keyword)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -264,6 +264,16 @@ extern messageStream Info;
#define IOInfoIn(fn, ios) \
::Foam::Info((fn), __FILE__, __LINE__, (ios))
/**
* \def Debug(variable)
* Report a variable name and value using Foam::Pout in
* file __FILE__ at line __LINE__
*/
#define Debug(var) \
::Foam::Pout<< "["<< __FILE__ << ":" << __LINE__ << "] " \
<< #var " = " << var << ::Foam::endl
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
......
......@@ -38,32 +38,13 @@ namespace Foam
//- Since dimensionSystems() can be reread we actually store a copy of
// the controlDict subDict (v.s. a reference to the subDict for e.g.
// dimensionedConstants)
autoPtr<dictionary> dimensionSystemsPtr_(NULL);
dictionary& dimensionSystems()
{
if (!dimensionSystemsPtr_.valid())
{
dictionary* cachedPtr = NULL;
dimensionSystemsPtr_.reset
(
new dictionary
(
debug::switchSet
(
"DimensionSets",
cachedPtr
)
)
);
}
return dimensionSystemsPtr_();
}
autoPtr<HashTable<dimensionedScalar> > unitSetPtr_;
autoPtr<dimensionSets> writeUnitSetPtr_;
dictionary* dimensionSystemsPtr_(NULL);
HashTable<dimensionedScalar>* unitSetPtr_(NULL);
dimensionSets* writeUnitSetPtr_(NULL);
//- Helper class to
// - register re-reader
// - deallocate demand-driven data
class addDimensionSetsToDebug
:
public ::Foam::simpleRegIOobject
......@@ -74,12 +55,18 @@ public:
::Foam::simpleRegIOobject(Foam::debug::addDimensionSetObject, name)
{}
virtual ~addDimensionSetsToDebug()
{}
{
deleteDemandDrivenData(dimensionSystemsPtr_);
deleteDemandDrivenData(unitSetPtr_);
deleteDemandDrivenData(writeUnitSetPtr_);
}
virtual void readData(Foam::Istream& is)
{
unitSetPtr_.clear();
writeUnitSetPtr_.clear();
dimensionSystemsPtr_.reset(new dictionary(is));
deleteDemandDrivenData(dimensionSystemsPtr_);
deleteDemandDrivenData(unitSetPtr_);
deleteDemandDrivenData(writeUnitSetPtr_);
dimensionSystemsPtr_ = new dictionary(is);
}
virtual void writeData(Foam::Ostream& os) const
{
......@@ -89,10 +76,27 @@ public:
addDimensionSetsToDebug addDimensionSetsToDebug_("DimensionSets");
dictionary& dimensionSystems()
{
if (!dimensionSystemsPtr_)
{
dictionary* cachedPtr = NULL;
dimensionSystemsPtr_ = new dictionary
(
debug::switchSet
(
"DimensionSets",
cachedPtr
)
);
}
return *dimensionSystemsPtr_;
}
const HashTable<dimensionedScalar>& unitSet()
{
if (!unitSetPtr_.valid())
if (!unitSetPtr_)
{
const dictionary& dict = dimensionSystems();
......@@ -114,10 +118,7 @@ const HashTable<dimensionedScalar>& unitSet()
const dictionary& unitDict = dict.subDict(unitSetCoeffs);
unitSetPtr_.reset
(
new HashTable<dimensionedScalar>(unitDict.size())
);
unitSetPtr_ = new HashTable<dimensionedScalar>(unitDict.size());
forAllConstIter(dictionary, unitDict, iter)
{
......@@ -145,14 +146,7 @@ const HashTable<dimensionedScalar>& unitSet()
)
);
writeUnitSetPtr_.reset
(
new dimensionSets
(
unitSetPtr_(),
writeUnitNames
)
);
writeUnitSetPtr_ = new dimensionSets(*unitSetPtr_, writeUnitNames);
if (writeUnitNames.size() != 0 && writeUnitNames.size() != 7)
{
......@@ -162,17 +156,17 @@ const HashTable<dimensionedScalar>& unitSet()
<< exit(FatalIOError);
}
}
return unitSetPtr_();
return *unitSetPtr_;
}
const dimensionSets& writeUnitSet()
{
if (!writeUnitSetPtr_.valid())
if (!writeUnitSetPtr_)
{
(void)unitSet();
}
return writeUnitSetPtr_();
return *writeUnitSetPtr_;
}
......
......@@ -108,7 +108,6 @@ void Foam::basicSource::setSelection(const dictionary& dict)
void Foam::basicSource::setCellSet()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
switch (selectionMode_)
{
case smPoints:
......@@ -237,7 +236,7 @@ void Foam::basicSource::setCellSet()
Info<< indent << "- selected "
<< returnReduce(cells_.size(), sumOp<label>())
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
<< " cell(s) with volume " << V_ << nl << endl;
}
}
......@@ -257,8 +256,8 @@ Foam::basicSource::basicSource
dict_(dict),
coeffs_(dict.subDict(modelType + "Coeffs")),
active_(readBool(dict_.lookup("active"))),
timeStart_(readScalar(dict_.lookup("timeStart"))),
duration_(readScalar(dict_.lookup("duration"))),
timeStart_(-1.0),
duration_(0.0),
selectionMode_
(
selectionModeTypeNames_.read(dict_.lookup("selectionMode"))
......@@ -273,9 +272,24 @@ Foam::basicSource::basicSource
fieldNames_(),
applied_()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
if (dict_.readIfPresent("timeStart", timeStart_))
{
dict_.lookup("duration") >> duration_;
Info<< indent << "- applying source at time " << timeStart_
<< " for duration " << duration_ << endl;
}
else
{
Info<< indent<< "-applying source for all time" << endl;
}
setSelection(dict_);
setCellSet();
Info<< decrIndent;
}
......@@ -325,12 +339,7 @@ Foam::basicSource::~basicSource()
bool Foam::basicSource::isActive()
{
if
(
active_
&& (mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= timeEnd())
)
if (active_ && inTimeLimits(mesh_.time().value()))
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
......
......@@ -277,8 +277,8 @@ public:
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return true if within time limits
inline bool inTimeLimits(const scalar time) const;
//- Return const access to the cell selection mode
inline const selectionModeType& selectionMode() const;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -63,9 +63,17 @@ inline Foam::scalar Foam::basicSource::duration() const
}
inline Foam::scalar Foam::basicSource::timeEnd() const
inline bool Foam::basicSource::inTimeLimits(const scalar time) const
{
return timeStart_ + duration_;
return
(
(timeStart_ < 0)
||
(
(mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= (timeStart_ + duration_))
)
);
}
......
......@@ -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
......@@ -62,8 +62,6 @@ Foam::wallDist::~wallDist()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Correct for mesh geom/topo changes. Might be more intelligent in the
// future (if only small topology change)
void Foam::wallDist::correct()
{
// Get patchids of walls
......
......@@ -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
......@@ -55,10 +55,9 @@ namespace Foam
// Forward declaration of classes
class polyMesh;
class wallPoint;
//template<class Type, class TrackingData> class MeshWave;
/*---------------------------------------------------------------------------*\
Class patchDataWave Declaration
Class patchDataWave Declaration
\*---------------------------------------------------------------------------*/
template<class TransferType>
......
......@@ -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
......@@ -27,7 +27,6 @@ License
#include "polyMesh.H"
#include "wallPoint.H"
#include "globalMeshData.H"
#include "SubField.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -132,7 +131,6 @@ Foam::label Foam::patchWave::getValues(const MeshWave<wallPoint>& waveInfo)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::patchWave::patchWave
(
const polyMesh& mesh,
......@@ -159,28 +157,19 @@ Foam::patchWave::~patchWave()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Correct for mesh geom/topo changes. Might be more intelligent in the
// future (if only small topology change)
void Foam::patchWave::correct()
{
//
// Set initial changed faces: set wallPoint for wall faces to wall centre
//
// Count walls
label nWalls = sumPatchSize(patchIDs_);
label nPatch = sumPatchSize(patchIDs_);
List<wallPoint> faceDist(nWalls);
labelList changedFaces(nWalls);
List<wallPoint> faceDist(nPatch);
labelList changedFaces(nPatch);
// Set to faceDist information to facecentre on walls.
setChangedFaces(patchIDs_, changedFaces, faceDist);
//
// Do calculate wall distance by 'growing' from faces.
//
MeshWave<wallPoint> waveInfo
(
mesh(),
......@@ -189,20 +178,13 @@ void Foam::patchWave::correct()
mesh().globalData().nTotalCells()+1 // max iterations
);
//
// Copy distance into return field
//
nUnset_ = getValues(waveInfo);
//
// Correct wall cells for true distance
//
if (correctWalls_)
{
Map<label> nearestFace(2 * nWalls);
Map<label> nearestFace(2*nPatch);
correctBoundaryFaceCells
(
......
......@@ -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
......@@ -51,7 +51,7 @@ class polyMesh;
class wallPoint;
/*---------------------------------------------------------------------------*\
Class patchWave Declaration
Class patchWave Declaration
\*---------------------------------------------------------------------------*/
class patchWave
......@@ -128,7 +128,7 @@ public:
return distance_;
}
//- Non const access so we can 'transfer' contents for efficiency.
//- Non const access so we can 'transfer' contents for efficiency
scalarField& distance()
{
return distance_;
......@@ -143,7 +143,6 @@ public:
{
return patchDistance_;
}
};
......
......@@ -118,17 +118,10 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
UPstream::msgType() = oldTag+1;
bool filmOk =
db().objectRegistry::foundObject<filmModelType>
(
"surfaceFilmProperties"
);
db().time().foundObject<filmModelType>("surfaceFilmProperties");
bool pyrOk =
db().objectRegistry::foundObject<pyrModelType>
(
"pyrolysisProperties"
);
bool pyrOk = db().time().foundObject<pyrModelType>("pyrolysisProperties");
if (!filmOk || !pyrOk)
{
......@@ -142,7 +135,7 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
// Retrieve film model
const filmModelType& filmModel =
db().lookupObject<filmModelType>("surfaceFilmProperties");
db().time().lookupObject<filmModelType>("surfaceFilmProperties");
const label filmPatchI = filmModel.regionPatchID(patchI);
......@@ -154,7 +147,7 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
// Retrieve pyrolysis model
const pyrModelType& pyrModel =
db().lookupObject<pyrModelType>("pyrolysisProperties");
db().time().lookupObject<pyrModelType>("pyrolysisProperties");
const label pyrPatchI = pyrModel.regionPatchID(patchI);
......
......@@ -117,20 +117,13 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
bool filmOk =
db().objectRegistry::foundObject<filmModelType>
(
"surfaceFilmProperties"
);
bool foundFilm =
db().time().foundObject<filmModelType>("surfaceFilmProperties");
bool pyrOk =
db().objectRegistry::foundObject<pyrModelType>
(
"pyrolysisProperties"
);
bool foundPyrolysis =
db().time().foundObject<pyrModelType>("pyrolysisProperties");
if (!filmOk || !pyrOk)
if (!foundFilm || !foundPyrolysis)
{
// do nothing on construction - film model doesn't exist yet
return;
......@@ -142,10 +135,7 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
// Retrieve film model
const filmModelType& filmModel =
db().objectRegistry::lookupObject<filmModelType>
(
"surfaceFilmProperties"
);
db().time().lookupObject<filmModelType>("surfaceFilmProperties");
const label filmPatchI = filmModel.regionPatchID(patchI);
......@@ -157,10 +147,7 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
// Retrieve pyrolysis model
const pyrModelType& pyrModel =
db().objectRegistry::lookupObject<pyrModelType>
(
"pyrolysisProperties"
);
db().time().lookupObject<pyrModelType>("pyrolysisProperties");
const label pyrPatchI = pyrModel.regionPatchID(patchI);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation