Commit 188469b9 authored by Henry's avatar Henry
Browse files
parents 119f1fdc ba01d338
......@@ -1210,12 +1210,13 @@ int main(int argc, char *argv[])
<< endl;
label nSide = 0;
forAll(zoneSidePatch, zoneI)
{
if (oneD)
{
// Always add empty patches, one per zone.
word patchName = faceZones[zoneI].name() + "_" + "side";
// Reuse single empty patch.
word patchName = "oneDEmptPatch";
zoneSidePatch[zoneI] = addPatch<emptyPolyPatch>
(
......
......@@ -6,6 +6,7 @@
#include "faceSet.H"
#include "pointSet.H"
#include "IOmanip.H"
#include "emptyPolyPatch.H"
Foam::label Foam::checkTopology
(
......@@ -21,6 +22,29 @@ Foam::label Foam::checkTopology
// Check if the boundary definition is unique
mesh.boundaryMesh().checkDefinition(true);
// Check that empty patches cover all sides of the mesh
{
label nEmpty = 0;
forAll(mesh.boundaryMesh(), patchI)
{
if (isA<emptyPolyPatch>(mesh.boundaryMesh()[patchI]))
{
nEmpty += mesh.boundaryMesh()[patchI].size();
}
}
reduce(nEmpty, sumOp<label>());
label nTotCells = returnReduce(mesh.cells().size(), sumOp<label>());
// These are actually warnings, not errors.
if (nEmpty % nTotCells)
{
Info<< " ***Total number of faces on empty patches"
<< " is not divisible by the number of cells in the mesh."
<< " Hence this mesh is not 1D or 2D."
<< endl;
}
}
// Check if the boundary processor patches are correct
mesh.boundaryMesh().checkParallelSync(true);
......@@ -41,6 +65,8 @@ Foam::label Foam::checkTopology
noFailedChecks++;
}
{
pointSet points(mesh, "unusedPoints", mesh.nPoints()/100);
if (mesh.checkPoints(true, &points))
......@@ -74,6 +100,22 @@ Foam::label Foam::checkTopology
}
}
{
faceSet faces(mesh, "outOfRangeFaces", mesh.nFaces()/100);
if (mesh.checkFaceVertices(true, &faces))
{
noFailedChecks++;
label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with out-of-range or duplicate vertices to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
if (allTopology)
{
cellSet cells(mesh, "zipUpCells", mesh.nCells()/100);
......@@ -91,22 +133,6 @@ Foam::label Foam::checkTopology
}
}
{
faceSet faces(mesh, "outOfRangeFaces", mesh.nFaces()/100);
if (mesh.checkFaceVertices(true, &faces))
{
noFailedChecks++;
label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with out-of-range or duplicate vertices to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
if (allTopology)
{
faceSet faces(mesh, "edgeFaces", mesh.nFaces()/100);
......
......@@ -228,6 +228,8 @@ Foam::Time::Time
objectRegistry(*this),
libs_(),
controlDict_
(
IOobject
......@@ -257,9 +259,10 @@ Foam::Time::Time
graphFormat_("raw"),
runTimeModifiable_(true),
libs_(controlDict_, "libs"),
functionObjects_(*this)
{
libs_.open(controlDict_, "libs");
// Explicitly set read flags on objectRegistry so anything constructed
// from it reads as well (e.g. fvSolution).
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
......@@ -313,6 +316,8 @@ Foam::Time::Time
objectRegistry(*this),
libs_(),
controlDict_
(
IOobject
......@@ -343,9 +348,11 @@ Foam::Time::Time
graphFormat_("raw"),
runTimeModifiable_(true),
libs_(controlDict_, "libs"),
functionObjects_(*this)
{
libs_.open(controlDict_, "libs");
// Explicitly set read flags on objectRegistry so anything constructed
// from it reads as well (e.g. fvSolution).
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
......@@ -401,6 +408,8 @@ Foam::Time::Time
objectRegistry(*this),
libs_(),
controlDict_
(
IOobject
......@@ -430,9 +439,10 @@ Foam::Time::Time
graphFormat_("raw"),
runTimeModifiable_(true),
libs_(controlDict_, "libs"),
functionObjects_(*this)
{}
{
libs_.open(controlDict_, "libs");
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
......
......@@ -75,6 +75,10 @@ class Time
//- file-change monitor for all registered files
mutable autoPtr<fileMonitor> monitorPtr_;
//- Any loaded dynamic libraries. Make sure to construct before
// reading controlDict.
dlLibraryTable libs_;
//- The controlDict
IOdictionary controlDict_;
......@@ -166,9 +170,6 @@ private:
//- Is runtime modification of dictionaries allowed?
Switch runTimeModifiable_;
//- Any loaded dynamic libraries
dlLibraryTable libs_;
//- Function objects executed at start and on ++, +=
mutable functionObjectList functionObjects_;
......
......@@ -131,11 +131,7 @@ bool Foam::functionEntries::codeStream::execute
// see if library is loaded
void* lib = NULL;
if
(
isA<IOdictionary>(topDict(parentDict))
&& parentDict.dictName() != Time::controlDictName
)
if (isA<IOdictionary>(topDict(parentDict)))
{
lib = libs(parentDict).findLibrary(libPath);
}
......@@ -150,11 +146,7 @@ bool Foam::functionEntries::codeStream::execute
// avoid compilation if possible by loading an existing library
if (!lib)
{
if
(
isA<IOdictionary>(topDict(parentDict))
&& parentDict.dictName() != Time::controlDictName
)
if (isA<IOdictionary>(topDict(parentDict)))
{
// Cached access to dl libs. Guarantees clean up upon destruction
// of Time.
......@@ -223,11 +215,7 @@ bool Foam::functionEntries::codeStream::execute
// all processes must wait for compile to finish
reduce(create, orOp<bool>());
if
(
isA<IOdictionary>(topDict(parentDict))
&& parentDict.dictName() != Time::controlDictName
)
if (isA<IOdictionary>(topDict(parentDict)))
{
// Cached access to dl libs. Guarantees clean up upon destruction
// of Time.
......
......@@ -25,6 +25,12 @@ License
#include "dlLibraryTable.H"
#include "OSspecific.H"
#include "long.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::dlLibraryTable, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -55,7 +61,11 @@ Foam::dlLibraryTable::~dlLibraryTable()
// bug in dlclose - does not call static destructors of
// loaded library when actually unloading the library.
// See https://bugzilla.novell.com/show_bug.cgi?id=680125 and 657627.
// Seems related to using a non-system compiler!
if (debug)
{
Info<< "dlLibraryTable::~dlLibraryTable() : closing " << iter()
<< " with handle " << long(iter.key()) << endl;
}
dlClose(iter.key());
}
}
......@@ -73,6 +83,12 @@ bool Foam::dlLibraryTable::open
{
void* functionLibPtr = dlOpen(functionLibName);
if (debug)
{
Info<< "dlLibraryTable::open : opened " << functionLibName
<< " resulting in handle " << long(functionLibPtr) << endl;
}
if (!functionLibPtr)
{
if (verbose)
......@@ -107,6 +123,12 @@ bool Foam::dlLibraryTable::close
void* libPtr = findLibrary(functionLibName);
if (libPtr)
{
if (debug)
{
Info<< "dlLibraryTable::close : closing " << functionLibName
<< " with handle " << long(libPtr) << endl;
}
erase(libPtr);
if (!dlClose(libPtr))
......
......@@ -63,6 +63,9 @@ class dlLibraryTable
public:
// Declare name of the class and its debug switch
ClassName("dlLibraryTable");
// Constructors
//- Construct null
......
......@@ -81,30 +81,6 @@ void Foam::addPatchCellLayer::addVertex
f[fp++] = pointI;
}
}
// Check for duplicates.
if (debug)
{
label n = 0;
for (label i = 0; i < fp; i++)
{
if (f[i] == pointI)
{
n++;
if (n == 2)
{
f.setSize(fp);
FatalErrorIn
(
"addPatchCellLayer::addVertex(const label, face&"
", label&)"
) << "Point " << pointI << " already present in face "
<< f << abort(FatalError);
}
}
}
}
}
......@@ -1641,11 +1617,11 @@ void Foam::addPatchCellLayer::setRefinement
{
label offset =
addedPoints_[vStart].size() - numEdgeSideFaces;
for (label ioff = offset; ioff > 0; ioff--)
for (label ioff = offset-1; ioff >= 0; ioff--)
{
addVertex
(
addedPoints_[vStart][ioff-1],
addedPoints_[vStart][ioff],
newFace,
newFp
);
......@@ -1660,6 +1636,51 @@ void Foam::addPatchCellLayer::setRefinement
newFace.setSize(newFp);
if (debug)
{
labelHashSet verts(2*newFace.size());
forAll(newFace, fp)
{
if (!verts.insert(newFace[fp]))
{
FatalErrorIn
(
"addPatchCellLayer::setRefinement(..)"
) << "Duplicate vertex in face"
<< " to be added." << nl
<< "newFace:" << newFace << nl
<< "points:"
<< UIndirectList<point>
(
meshMod.points(),
newFace
) << nl
<< "Layer:" << i
<< " out of:" << numEdgeSideFaces << nl
<< "ExtrudeEdge:" << meshEdgeI
<< " at:"
<< mesh_.edges()[meshEdgeI].line
(
mesh_.points()
) << nl
<< "string:" << stringedVerts
<< "stringpoints:"
<< UIndirectList<point>
(
pp.localPoints(),
stringedVerts
) << nl
<< "stringNLayers:"
<< UIndirectList<label>
(
nPointLayers,
stringedVerts
) << nl
<< abort(FatalError);
}
}
}
label nbrFaceI = nbrFace
(
pp.edgeFaces(),
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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::pimpleLoop
Description
PIMPLE loop class to formalise the iteration and automate the handling
of the "finalIteration" mesh data entry.
\*---------------------------------------------------------------------------*/
#ifndef pimpleLoop_H
#define pimpleLoop_H
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pimpleLoop Declaration
\*---------------------------------------------------------------------------*/
class pimpleLoop
{
// Private data
//- Reference to the mesh
fvMesh& mesh_;
//- Number of PIMPLE correctors
const int nCorr_;
//- Current PIMPLE corrector
int corr_;
// Private Member Functions
//- Disallow default bitwise copy construct
pimpleLoop(const pimpleLoop&);
//- Disallow default bitwise assignment
void operator=(const pimpleLoop&);
public:
// Constructors
//- Construct from components
pimpleLoop(fvMesh& mesh, const int nCorr)
:
mesh_(mesh),
nCorr_(nCorr),
corr_(0)
{}
//- Destructor
~pimpleLoop()
{}
// Member Functions
bool loop()
{
if (finalIter())
{
mesh_.data::add("finalIteration", true);
}
return corr_ < nCorr_;
}
bool finalIter() const
{
return corr_ == nCorr_-1;
}
// Member Operators
void operator++(int)
{
if (finalIter())
{
mesh_.data::remove("finalIteration");
}
corr_++;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -137,7 +137,7 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
{
Info<< " field " << residualControl_[i].name << token::TAB
<< ": relTol " << residualControl_[i].relTol
<< ", absTol " << residualControl_[i].absTol
<< ", tolerance " << residualControl_[i].absTol
<< nl;
}
Info<< endl;
......
......@@ -68,7 +68,7 @@ bool Foam::simpleControl::criteriaSatisfied()
{
Info<< algorithmName_ << " solution statistics:" << endl;
Info<< " " << variableName << ": abs tol = " << residual
Info<< " " << variableName << ": tolerance = " << residual
<< " (" << residualControl_[fieldI].absTol << ")"
<< endl;
}
......@@ -96,7 +96,7 @@ Foam::simpleControl::simpleControl(fvMesh& mesh)
forAll(residualControl_, i)
{
Info<< " field " << residualControl_[i].name << token::TAB
<< " absTol " << residualControl_[i].absTol
<< " tolerance " << residualControl_[i].absTol
<< nl;
}
Info<< endl;
......
......@@ -68,7 +68,7 @@ void Foam::solutionControl::read(const bool absTolOnly)
if (iter().isDict())
{
const dictionary& fieldDict(iter().dict());
fd.absTol = readScalar(fieldDict.lookup("absTol"));
fd.absTol = readScalar(fieldDict.lookup("tolerance"));
fd.relTol = readScalar(fieldDict.lookup("relTol"));
fd.initialResidual = 0.0;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -138,18 +138,21 @@ emptyFvPatchField<Type>::emptyFvPatchField
template<class Type>
void emptyFvPatchField<Type>::updateCoeffs()
{
if
(
this->patch().patch().size()
% this->dimensionedInternalField().mesh().nCells()
)
{
FatalErrorIn("emptyFvPatchField<Type>::updateCoeffs()")
<< "This mesh contains patches of type empty but is not 1D or 2D\n"
" by virtue of the fact that the number of faces of this\n"
" empty patch is not divisible by the number of cells."
<< exit(FatalError);
}
//- Check moved to checkMesh. Test here breaks down if multiple empty
// patches.
//if
//(
// this->patch().patch().size()
// % this->dimensionedInternalField().mesh().nCells()
//)
//{
// FatalErrorIn("emptyFvPatchField<Type>::updateCoeffs()")
// << "This mesh contains patches of type empty but is not"
// << "1D or 2D\n"
// " by virtue of the fact that the number of faces of this\n"
// " empty patch is not divisible by the number of cells."
// << exit(FatalError);
//}
}
......
......@@ -518,7 +518,7 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::Re
const scalar muc
) const