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

This commit is contained in:
mattijs 2013-07-11 17:28:28 +01:00
commit ecd53eaef6
7 changed files with 456 additions and 9759 deletions

View File

@ -793,7 +793,6 @@ private:
faceList& faces,
labelList& owner,
labelList& neighbour,
wordList& patchTypes,
wordList& patchNames,
PtrList<dictionary>& patchDicts,
pointField& cellCentres,
@ -810,7 +809,6 @@ private:
faceList& faces,
labelList& owner,
labelList& neighbour,
wordList& patchTypes,
wordList& patchNames,
PtrList<dictionary>& patchDicts
);
@ -894,7 +892,6 @@ private:
label createPatchInfo
(
wordList& patchNames,
wordList& patchTypes,
PtrList<dictionary>& patchDicts
) const;
@ -909,7 +906,6 @@ private:
faceList& faces,
labelList& owner,
labelList& neighbour,
wordList& patchTypes,
wordList& patchNames,
PtrList<dictionary>& patchDicts,
labelListList& patchPointPairSlaves,
@ -976,7 +972,6 @@ private:
autoPtr<fvMesh> createDummyMesh
(
const IOobject& io,
const wordList& patchTypes,
const wordList& patchNames,
const PtrList<dictionary>& patchDicts
) const;
@ -986,7 +981,6 @@ private:
void checkProcessorPatchesMatch
(
const wordList& patchTypes,
const PtrList<dictionary>& patchDicts
) const;
@ -1005,7 +999,6 @@ private:
const fileName& instance,
const pointField& points,
faceList& faces,
const wordList& patchTypes,
const wordList& patchNames,
const PtrList<dictionary>& patchDicts
) const;
@ -1176,7 +1169,6 @@ public:
faceList& faces,
labelList& owner,
labelList& neighbour,
const wordList& patchTypes,
const wordList& patchNames,
const PtrList<dictionary>& patchDicts,
const pointField& cellCentres,

View File

@ -514,7 +514,6 @@ void Foam::conformalVoronoiMesh::calcDualMesh
faceList& faces,
labelList& owner,
labelList& neighbour,
wordList& patchTypes,
wordList& patchNames,
PtrList<dictionary>& patchDicts,
pointField& cellCentres,
@ -595,7 +594,6 @@ void Foam::conformalVoronoiMesh::calcDualMesh
faces,
owner,
neighbour,
patchTypes,
patchNames,
patchDicts,
patchToDelaunayVertex, // from patch face to Delaunay vertex (slavePp)
@ -624,7 +622,6 @@ void Foam::conformalVoronoiMesh::calcTetMesh
faceList& faces,
labelList& owner,
labelList& neighbour,
wordList& patchTypes,
wordList& patchNames,
PtrList<dictionary>& patchDicts
)
@ -679,7 +676,6 @@ void Foam::conformalVoronoiMesh::calcTetMesh
patchNames.setSize(patchNames.size() + 1);
patchNames[patchNames.size() - 1] = "foamyHexMesh_defaultPatch";
patchTypes.setSize(patchNames.size(), wallPolyPatch::typeName);
label nPatches = patchNames.size();
@ -1212,7 +1208,6 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
faceList faces;
labelList owner;
labelList neighbour;
wordList patchTypes;
wordList patchNames;
PtrList<dictionary> patchDicts;
pointField cellCentres;
@ -1229,7 +1224,6 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
faces,
owner,
neighbour,
patchTypes,
patchNames,
patchDicts,
patchToDelaunayVertex,
@ -1272,7 +1266,11 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
{
label totalPatchSize = readLabel(patchDicts[p].lookup("nFaces"));
if (patchTypes[p] == processorPolyPatch::typeName)
if
(
patchDicts.set(p)
&& word(patchDicts[p].lookup("type")) == processorPolyPatch::typeName
)
{
// Do not create empty processor patches
if (totalPatchSize > 0)
@ -1285,7 +1283,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
patchDicts[p],
nValidPatches,
pMesh.boundaryMesh(),
patchTypes[p]
processorPolyPatch::typeName
);
nValidPatches++;
@ -1300,7 +1298,6 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
{
patches[nValidPatches] = polyPatch::New
(
patchTypes[p],
patchNames[p],
patchDicts[p],
nValidPatches,
@ -2026,13 +2023,11 @@ void Foam::conformalVoronoiMesh::reindexDualVertices
Foam::label Foam::conformalVoronoiMesh::createPatchInfo
(
wordList& patchNames,
wordList& patchTypes,
PtrList<dictionary>& patchDicts
) const
{
patchNames = geometryToConformTo_.patchNames();
patchTypes.setSize(patchNames.size() + 1, wallPolyPatch::typeName);
patchDicts.setSize(patchNames.size() + 1);
const PtrList<dictionary>& patchInfo = geometryToConformTo_.patchInfo();
@ -2041,18 +2036,16 @@ Foam::label Foam::conformalVoronoiMesh::createPatchInfo
{
if (patchInfo.set(patchI))
{
patchTypes[patchI] =
patchInfo[patchI].lookupOrDefault<word>
(
"type",
wallPolyPatch::typeName
);
patchDicts.set(patchI, new dictionary(patchInfo[patchI]));
}
else
{
patchDicts.set(patchI, new dictionary());
patchDicts[patchI].set
(
"type",
wallPolyPatch::typeName
);
}
}
@ -2060,6 +2053,11 @@ Foam::label Foam::conformalVoronoiMesh::createPatchInfo
label defaultPatchIndex = patchNames.size() - 1;
patchNames[defaultPatchIndex] = "foamyHexMesh_defaultPatch";
patchDicts.set(defaultPatchIndex, new dictionary());
patchDicts[defaultPatchIndex].set
(
"type",
wallPolyPatch::typeName
);
label nProcPatches = 0;
@ -2117,7 +2115,6 @@ Foam::label Foam::conformalVoronoiMesh::createPatchInfo
label nTotalPatches = nNonProcPatches + nProcPatches;
patchNames.setSize(nTotalPatches);
patchTypes.setSize(nTotalPatches);
patchDicts.setSize(nTotalPatches);
for (label pI = nNonProcPatches; pI < nTotalPatches; ++pI)
{
@ -2130,20 +2127,24 @@ Foam::label Foam::conformalVoronoiMesh::createPatchInfo
{
if (procUsed[pUI])
{
patchTypes[nNonProcPatches + procAddI] =
processorPolyPatch::typeName;
patchNames[nNonProcPatches + procAddI] =
"procBoundary"
+ name(Pstream::myProcNo())
+ "to"
+ name(pUI);
patchDicts[nNonProcPatches + procAddI].set
(
"type",
processorPolyPatch::typeName
);
patchDicts[nNonProcPatches + procAddI].set
(
"myProcNo",
Pstream::myProcNo()
);
patchDicts[nNonProcPatches + procAddI].set("neighbProcNo", pUI);
procAddI++;
@ -2221,7 +2222,6 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
faceList& faces,
labelList& owner,
labelList& neighbour,
wordList& patchTypes,
wordList& patchNames,
PtrList<dictionary>& patchDicts,
labelListList& patchPointPairSlaves,
@ -2232,7 +2232,6 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
const label defaultPatchIndex = createPatchInfo
(
patchNames,
patchTypes,
patchDicts
);

View File

@ -371,7 +371,6 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
faceList faces;
labelList owner;
labelList neighbour;
wordList patchTypes;
wordList patchNames;
PtrList<dictionary> patchDicts;
pointField cellCentres;
@ -385,7 +384,6 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
faces,
owner,
neighbour,
patchTypes,
patchNames,
patchDicts,
cellCentres,
@ -405,7 +403,6 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
faces,
owner,
neighbour,
patchTypes,
patchNames,
patchDicts,
cellCentres,
@ -669,7 +666,6 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
(
const IOobject& io,
const wordList& patchTypes,
const wordList& patchNames,
const PtrList<dictionary>& patchDicts
) const
@ -690,7 +686,14 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
forAll(patches, patchI)
{
if (patchTypes[patchI] == processorPolyPatch::typeName)
if
(
patchDicts.set(patchI)
&& (
word(patchDicts[patchI].lookup("type"))
== processorPolyPatch::typeName
)
)
{
patches[patchI] = new processorPolyPatch
(
@ -708,7 +711,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
{
patches[patchI] = polyPatch::New
(
patchTypes[patchI],
patchDicts[patchI].lookup("type"),
patchNames[patchI],
0, //patchSizes[p],
0, //patchStarts[p],
@ -726,7 +729,6 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
(
const wordList& patchTypes,
const PtrList<dictionary>& patchDicts
) const
{
@ -737,9 +739,16 @@ void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
labelList(Pstream::nProcs(), -1)
);
forAll(patchTypes, patchI)
forAll(patchDicts, patchI)
{
if (patchTypes[patchI] == processorPolyPatch::typeName)
if
(
patchDicts.set(patchI)
&& (
word(patchDicts[patchI].lookup("type"))
== processorPolyPatch::typeName
)
)
{
const label procNeighb =
readLabel(patchDicts[patchI].lookup("neighbProcNo"));
@ -848,7 +857,6 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
const fileName& instance,
const pointField& points,
faceList& faces,
const wordList& patchTypes,
const wordList& patchNames,
const PtrList<dictionary>& patchDicts
) const
@ -856,7 +864,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
Info<< incrIndent << indent << "Reordering processor patches" << endl;
Info<< incrIndent;
checkProcessorPatchesMatch(patchTypes, patchDicts);
checkProcessorPatchesMatch(patchDicts);
// Create dummy mesh with correct proc boundaries to do sorting
autoPtr<fvMesh> sortMeshPtr
@ -872,7 +880,6 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
IOobject::NO_WRITE,
false
),
patchTypes,
patchNames,
patchDicts
)
@ -1034,7 +1041,6 @@ void Foam::conformalVoronoiMesh::writeMesh
faceList& faces,
labelList& owner,
labelList& neighbour,
const wordList& patchTypes,
const wordList& patchNames,
const PtrList<dictionary>& patchDicts,
const pointField& cellCentres,
@ -1058,7 +1064,6 @@ void Foam::conformalVoronoiMesh::writeMesh
instance,
points,
faces,
patchTypes,
patchNames,
patchDicts
);
@ -1094,7 +1099,14 @@ void Foam::conformalVoronoiMesh::writeMesh
{
label totalPatchSize = readLabel(patchDicts[p].lookup("nFaces"));
if (patchTypes[p] == processorPolyPatch::typeName)
if
(
patchDicts.set(p)
&& (
word(patchDicts[p].lookup("type"))
== processorPolyPatch::typeName
)
)
{
const_cast<dictionary&>(patchDicts[p]).set
(
@ -1112,7 +1124,7 @@ void Foam::conformalVoronoiMesh::writeMesh
patchDicts[p],
nValidPatches,
mesh.boundaryMesh(),
patchTypes[p]
processorPolyPatch::typeName
);
nValidPatches++;
@ -1127,7 +1139,6 @@ void Foam::conformalVoronoiMesh::writeMesh
{
patches[nValidPatches] = polyPatch::New
(
patchTypes[p],
patchNames[p],
patchDicts[p],
nValidPatches,

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
\*---------------------------------------------------------------------------*/
#include "polyMeshFilterSettings.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polyMeshFilterSettings::polyMeshFilterSettings(const dictionary& dict)
:
dict_(dict),
controlMeshQuality_
(
dict_.lookupOrDefault<Switch>("controlMeshQuality", false)
),
collapseEdgesCoeffDict_(dict_.subDict("collapseEdgesCoeffs")),
collapseFacesCoeffDict_(dict_.subOrEmptyDict("collapseFacesCoeffs")),
meshQualityCoeffDict_(dict_.subOrEmptyDict("controlMeshQualityCoeffs")),
minLen_(readScalar(collapseEdgesCoeffDict_.lookup("minimumEdgeLength"))),
maxCos_
(
::cos
(
degToRad
(
readScalar(collapseEdgesCoeffDict_.lookup("maximumMergeAngle"))
)
)
),
edgeReductionFactor_
(
meshQualityCoeffDict_.lookupOrDefault<scalar>("edgeReductionFactor", -1)
),
maxIterations_
(
meshQualityCoeffDict_.lookupOrAddDefault<label>("maximumIterations", 1)
),
maxSmoothIters_
(
meshQualityCoeffDict_.lookupOrAddDefault<label>
(
"maximumSmoothingIterations",
0
)
),
initialFaceLengthFactor_
(
collapseFacesCoeffDict_.lookupOrAddDefault<scalar>
(
"initialFaceLengthFactor",
-1
)
),
faceReductionFactor_
(
meshQualityCoeffDict_.lookupOrAddDefault<scalar>
(
"faceReductionFactor",
-1
)
),
maxPointErrorCount_
(
meshQualityCoeffDict_.lookupOrAddDefault<label>("maxPointErrorCount", 0)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::polyMeshFilterSettings::writeSettings(Ostream& os) const
{
os << "Merging:" << nl
<< " edges with length less than " << minLen() << " metres" << nl
<< " edges split by a point with edges in line to within "
<< radToDeg(::acos(maxCos())) << " degrees" << nl
<< " Minimum edge length reduction factor = "
<< edgeReductionFactor() << nl
<< endl;
if (collapseFacesCoeffDict().empty())
{
os << "Face collapsing is off" << endl;
}
else
{
os << "Face collapsing is on" << endl;
os << " Initial face length factor = "<< initialFaceLengthFactor()
<< endl;
}
os << "Control mesh quality = " << controlMeshQuality().asText() << endl;
if (controlMeshQuality())
{
os << " Minimum edge length reduction factor = "
<< edgeReductionFactor() << nl
<< " Minimum face area reduction factor = "
<< faceReductionFactor() << endl;
os << " Maximum number of collapse iterations = " << maxIterations()
<< endl;
os << " Maximum number of edge/face reduction factor smoothing "
<< "iterations = " << maxSmoothIters() << endl;
os << " Maximum number of times a point can contribute to bad "
<< "faces across " << nl
<< " collapse iterations = " << maxPointErrorCount()
<< endl;
}
os << "Selectively disabling wanted collapses until resulting quality"
<< " satisfies constraints in system/meshQualityDict" << nl
<< endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Class
Foam::polyMeshFilterSettings
Description
Class to store the settings for the polyMeshFilter class.
SourceFiles
polyMeshFilterSettings.C
\*---------------------------------------------------------------------------*/
#ifndef polyMeshFilterSettings_H
#define polyMeshFilterSettings_H
#include "dictionary.H"
#include "Switch.H"
#include "scalar.H"
#include "label.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class polyMeshFilterSettings Declaration
\*---------------------------------------------------------------------------*/
class polyMeshFilterSettings
{
// Private data
//- Dictionary containing the coefficient sub-dictionaries
const dictionary dict_;
//- After collapsing, check the mesh quality and redo the collapsing
// iteration if there are too many bad faces in the mesh
Switch controlMeshQuality_;
//- Coefficients for collapsing edges
const dictionary& collapseEdgesCoeffDict_;
//- Coefficients for collapsing faces
dictionary collapseFacesCoeffDict_;
//- Coefficients for controlling the mesh quality
dictionary meshQualityCoeffDict_;
//- Remove edges shorter than this length
const scalar minLen_;
//- Merge points that are only attached to two edges and have an angle
// between the edge greater than this value
const scalar maxCos_;
//- The amount that the local minimum edge length will be reduced by if
// the edge is part of a collapse string that generates poor quality
// faces
const scalar edgeReductionFactor_;
//- Maximum number of outer iterations
const label maxIterations_;
//- Maximum number of smoothing iterations of minEdgeLen_ and
// faceFilterFactor_
const label maxSmoothIters_;
//- Initialisation value of faceFilterFactor_
const scalar initialFaceLengthFactor_;
//- The amount that the local face size factor will be reduced by if
// the face is part of a collapse string that generates poor quality
// faces
const scalar faceReductionFactor_;
//- Maximum number of times a deleted point can be associated with the
// creation of a bad face it is forced to be kept.
const label maxPointErrorCount_;
public:
// Constructors
//- Construct from dictionary
explicit polyMeshFilterSettings(const dictionary& dict);
//- Destructor
~polyMeshFilterSettings(){};
// Member Functions
// Access
inline const dictionary& collapseEdgesCoeffDict() const;
inline const dictionary& collapseFacesCoeffDict() const;
inline const dictionary& meshQualityCoeffDict() const;
inline const Switch& controlMeshQuality() const;
inline const scalar& minLen() const;
inline const scalar& maxCos() const;
inline const scalar& edgeReductionFactor() const;
inline const label& maxIterations() const;
inline const label& maxSmoothIters() const;
inline const scalar& initialFaceLengthFactor() const;
inline const scalar& faceReductionFactor() const;
inline const label& maxPointErrorCount() const;
// Write
//- Write the settings to a stream
void writeSettings(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "polyMeshFilterSettingsI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 * * * * * * * * * * * * * //
inline const Foam::dictionary&
Foam::polyMeshFilterSettings::collapseEdgesCoeffDict() const
{
return collapseEdgesCoeffDict_;
}
inline const Foam::dictionary&
Foam::polyMeshFilterSettings::collapseFacesCoeffDict() const
{
return collapseFacesCoeffDict_;
}
inline const Foam::dictionary&
Foam::polyMeshFilterSettings::meshQualityCoeffDict() const
{
return meshQualityCoeffDict_;
}
inline const Foam::Switch&
Foam::polyMeshFilterSettings::controlMeshQuality() const
{
return controlMeshQuality_;
}
inline const Foam::scalar& Foam::polyMeshFilterSettings::minLen() const
{
return minLen_;
}
inline const Foam::scalar& Foam::polyMeshFilterSettings::maxCos() const
{
return maxCos_;
}
inline const Foam::scalar&
Foam::polyMeshFilterSettings::edgeReductionFactor() const
{
return edgeReductionFactor_;
}
inline const Foam::label& Foam::polyMeshFilterSettings::maxIterations() const
{
return maxIterations_;
}
inline const Foam::label& Foam::polyMeshFilterSettings::maxSmoothIters() const
{
return maxSmoothIters_;
}
inline const Foam::scalar&
Foam::polyMeshFilterSettings::initialFaceLengthFactor() const
{
return initialFaceLengthFactor_;
}
inline const Foam::scalar&
Foam::polyMeshFilterSettings::faceReductionFactor() const
{
return faceReductionFactor_;
}
inline const Foam::label&
Foam::polyMeshFilterSettings::maxPointErrorCount() const
{
return maxPointErrorCount_;
}
// ************************************************************************* //