Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2012-02-24 10:12:47 +00:00
10 changed files with 117 additions and 37 deletions

View File

@ -203,7 +203,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
// Grab zone ID. If a point is not in a zone, it will return -1 // Grab zone ID. If a point is not in a zone, it will return -1
zoneID = pz.whichZone(pointI); zoneID = pz.whichZone(pointI);
if (zoneID > 0) if (zoneID >= 0)
{ {
// Translate zone ID into the new index // Translate zone ID into the new index
zoneID = pointZoneIndices[zoneID]; zoneID = pointZoneIndices[zoneID];
@ -240,7 +240,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
// Grab zone ID. If a cell is not in a zone, it will return -1 // Grab zone ID. If a cell is not in a zone, it will return -1
zoneID = cz.whichZone(cellI); zoneID = cz.whichZone(cellI);
if (zoneID > 0) if (zoneID >= 0)
{ {
// Translate zone ID into the new index // Translate zone ID into the new index
zoneID = cellZoneIndices[zoneID]; zoneID = cellZoneIndices[zoneID];
@ -343,7 +343,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
newZone = fz.whichZone(faceI); newZone = fz.whichZone(faceI);
newZoneFlip = false; newZoneFlip = false;
if (newZone > -1) if (newZone >= 0)
{ {
newZoneFlip = fz[newZone].flipMap()[fz[newZone].whichFace(faceI)]; newZoneFlip = fz[newZone].flipMap()[fz[newZone].whichFace(faceI)];

View File

@ -1,5 +1,5 @@
EXE_INC = \ EXE_INC = \
-DFULLDEBUG -g -O0 \ /* -DFULLDEBUG -g -O0 */ \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \

View File

@ -108,6 +108,7 @@ label getBand(const labelList& owner, const labelList& neighbour)
// Calculate band of matrix // Calculate band of matrix
void getBand void getBand
( (
const bool calculateIntersect,
const label nCells, const label nCells,
const labelList& owner, const labelList& owner,
const labelList& neighbour, const labelList& neighbour,
@ -129,17 +130,22 @@ void getBand
cellBandwidth[nei] = max(cellBandwidth[nei], diff); cellBandwidth[nei] = max(cellBandwidth[nei], diff);
} }
bandwidth = max(cellBandwidth);
profile = sum(1.0*cellBandwidth);
sumSqrIntersect = 0.0;
if (calculateIntersect)
{
forAll(nIntersect, cellI) forAll(nIntersect, cellI)
{ {
for (label colI = cellI-cellBandwidth[cellI]; colI <= cellI; colI++) for (label colI = cellI-cellBandwidth[cellI]; colI <= cellI; colI++)
{ {
nIntersect[colI]++; nIntersect[colI] += 1.0;
} }
} }
bandwidth = max(cellBandwidth);
profile = sum(cellBandwidth);
sumSqrIntersect = sum(Foam::sqr(nIntersect)); sumSqrIntersect = sum(Foam::sqr(nIntersect));
}
} }
@ -565,6 +571,11 @@ int main(int argc, char *argv[])
"dict", "dict",
"renumber according to system/renumberMeshDict" "renumber according to system/renumberMeshDict"
); );
argList::addBoolOption
(
"frontWidth",
"calculate the rms of the frontwidth"
);
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
@ -582,7 +593,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const bool readDict = args.optionFound("dict"); const bool readDict = args.optionFound("dict");
const bool doFrontWidth = args.optionFound("frontWidth");
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");
label band; label band;
@ -590,6 +601,7 @@ int main(int argc, char *argv[])
scalar sumSqrIntersect; scalar sumSqrIntersect;
getBand getBand
( (
doFrontWidth,
mesh.nCells(), mesh.nCells(),
mesh.faceOwner(), mesh.faceOwner(),
mesh.faceNeighbour(), mesh.faceNeighbour(),
@ -1028,6 +1040,7 @@ int main(int argc, char *argv[])
scalar sumSqrIntersect; scalar sumSqrIntersect;
getBand getBand
( (
doFrontWidth,
mesh.nCells(), mesh.nCells(),
mesh.faceOwner(), mesh.faceOwner(),
mesh.faceNeighbour(), mesh.faceNeighbour(),

View File

@ -41,6 +41,7 @@ method CuthillMcKee;
//method manual; //method manual;
//method random; //method random;
//method spring; //method spring;
//method boundaryFirst;
//CuthillMcKeeCoeffs //CuthillMcKeeCoeffs
//{ //{

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -221,10 +221,31 @@ void Foam::Time::setControls()
timeIndex_ = startTimeIndex_; timeIndex_ = startTimeIndex_;
} }
scalar timeValue;
if (timeDict.readIfPresent("value", timeValue)) // Check if values stored in time dictionary are consistent
// 1. Based on time name
bool checkValue = true;
string storedTimeName;
if (timeDict.readIfPresent("name", storedTimeName))
{ {
word storedTimeName(timeName(timeValue)); if (storedTimeName == timeName())
{
// Same time. No need to check stored value
checkValue = false;
}
}
// 2. Based on time value
// (consistent up to the current time writing precision so it won't
// trigger if we just change the write precision)
if (checkValue)
{
scalar storedTimeValue;
if (timeDict.readIfPresent("value", storedTimeValue))
{
word storedTimeName(timeName(storedTimeValue));
if (storedTimeName != timeName()) if (storedTimeName != timeName())
{ {
@ -233,10 +254,12 @@ void Foam::Time::setControls()
<< " differs from actual time " << timeName() << '.' << nl << " differs from actual time " << timeName() << '.' << nl
<< " This may cause unexpected database behaviour." << " This may cause unexpected database behaviour."
<< " If you are not interested" << nl << " If you are not interested" << nl
<< " in preserving time state delete the time dictionary." << " in preserving time state delete"
<< " the time dictionary."
<< endl; << endl;
} }
} }
}
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -293,12 +293,14 @@ bool Foam::Time::writeObject
{ {
if (outputTime()) if (outputTime())
{ {
const word tmName(timeName());
IOdictionary timeDict IOdictionary timeDict
( (
IOobject IOobject
( (
"time", "time",
timeName(), tmName,
"uniform", "uniform",
*this, *this,
IOobject::NO_READ, IOobject::NO_READ,
@ -308,6 +310,7 @@ bool Foam::Time::writeObject
); );
timeDict.add("value", value()); timeDict.add("value", value());
timeDict.add("name", string(tmName));
timeDict.add("index", timeIndex_); timeDict.add("index", timeIndex_);
timeDict.add("deltaT", deltaT_); timeDict.add("deltaT", deltaT_);
timeDict.add("deltaT0", deltaT0_); timeDict.add("deltaT0", deltaT0_);
@ -317,7 +320,7 @@ bool Foam::Time::writeObject
if (writeOK && purgeWrite_) if (writeOK && purgeWrite_)
{ {
previousOutputTimes_.push(timeName()); previousOutputTimes_.push(tmName);
while (previousOutputTimes_.size() > purgeWrite_) while (previousOutputTimes_.size() > purgeWrite_)
{ {

View File

@ -46,6 +46,7 @@ SourceFiles
#include "Random.H" #include "Random.H"
#include "FixedList.H" #include "FixedList.H"
#include "UList.H" #include "UList.H"
#include "triPointRef.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -196,6 +197,8 @@ public:
inline const Point& d() const; inline const Point& d() const;
//- Return i-th face
inline triPointRef tri(const label faceI) const;
// Properties // Properties
@ -242,7 +245,8 @@ public:
List<scalar>& bary List<scalar>& bary
) const; ) const;
//- Return nearest point to p on tetrahedron //- Return nearest point to p on tetrahedron. Is p itself
// if inside.
inline pointHit nearestPoint(const point& p) const; inline pointHit nearestPoint(const point& p) const;
//- Return true if point is inside tetrahedron //- Return true if point is inside tetrahedron

View File

@ -97,6 +97,41 @@ inline const Point& Foam::tetrahedron<Point, PointRef>::d() const
} }
template<class Point, class PointRef>
inline Foam::triPointRef Foam::tetrahedron<Point, PointRef>::tri
(
const label faceI
) const
{
// Warning. Ordering of faces needs to be the same for a tetrahedron
// class, a tetrahedron cell shape model and a tetCell
if (faceI == 0)
{
return triPointRef(b_, c_, d_);
}
else if (faceI == 1)
{
return triPointRef(a_, d_, c_);
}
else if (faceI == 2)
{
return triPointRef(a_, b_, d_);
}
else if (faceI == 3)
{
return triPointRef(a_, c_, b_);
}
else
{
FatalErrorIn("tetrahedron::tri(const label faceI) const")
<< "index out of range 0 -> 3. faceI = " << faceI
<< abort(FatalError);
return triPointRef(b_, c_, d_);
}
}
template<class Point, class PointRef> template<class Point, class PointRef>
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sa() const inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sa() const
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -93,6 +93,7 @@ Foam::engineTime::engineTime
startTime_ = degToTime(startTime_); startTime_ = degToTime(startTime_);
value() = degToTime(value()); value() = degToTime(value());
deltaTSave_ = deltaT_;
deltaT0_ = deltaT_; deltaT0_ = deltaT_;
} }

View File

@ -76,7 +76,7 @@ public:
//- Return the order in which cells need to be visited, i.e. //- Return the order in which cells need to be visited, i.e.
// from ordered back to original cell label. // from ordered back to original cell label.
// Use the mesh connectivity (if needed) // This is only defined for geometric renumberMethods.
virtual labelList renumber(const pointField&) const; virtual labelList renumber(const pointField&) const;
//- Return the order in which cells need to be visited, i.e. //- Return the order in which cells need to be visited, i.e.