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

This commit is contained in:
Henry
2013-08-01 17:14:56 +01:00
8 changed files with 126 additions and 49 deletions

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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,6 +48,7 @@ Description
#include "faceCoupleInfo.H" #include "faceCoupleInfo.H"
#include "fvMeshAdder.H" #include "fvMeshAdder.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "zeroGradientFvPatchFields.H"
using namespace Foam; using namespace Foam;
@ -297,6 +298,12 @@ int main(int argc, char *argv[])
"fullMatch", "fullMatch",
"do (slower) geometric matching on all boundary faces" "do (slower) geometric matching on all boundary faces"
); );
argList::addBoolOption
(
"cellDist",
"write cell distribution as a labelList - for use with 'manual' "
"decomposition method or as a volScalarField for post-processing."
);
#include "addTimeOptions.H" #include "addTimeOptions.H"
#include "addRegionOption.H" #include "addRegionOption.H"
@ -362,6 +369,7 @@ int main(int argc, char *argv[])
<< nl << "This assumes a correct decomposition." << endl; << nl << "This assumes a correct decomposition." << endl;
} }
bool writeCellDist = args.optionFound("cellDist");
int nProcs = 0; int nProcs = 0;
@ -507,7 +515,7 @@ int main(int argc, char *argv[])
{ {
// Construct empty mesh. // Construct empty mesh.
Info<< "Constructing empty mesh to add to." << nl << endl; Info<< "Constructing empty mesh to add to." << nl << endl;
polyMesh masterMesh fvMesh masterMesh
( (
IOobject IOobject
( (
@ -528,7 +536,7 @@ int main(int argc, char *argv[])
<< " for time = " << databases[procI].timeName() << " for time = " << databases[procI].timeName()
<< nl << endl; << nl << endl;
polyMesh meshToAdd fvMesh meshToAdd
( (
IOobject IOobject
( (
@ -560,7 +568,7 @@ int main(int argc, char *argv[])
// Add elements to mesh // Add elements to mesh
Info<< "Adding to master mesh" << nl << endl; Info<< "Adding to master mesh" << nl << endl;
autoPtr<mapAddedPolyMesh> map = polyMeshAdder::add autoPtr<mapAddedPolyMesh> map = fvMeshAdder::add
( (
masterMesh, masterMesh,
meshToAdd, meshToAdd,
@ -608,6 +616,67 @@ int main(int argc, char *argv[])
<< "Failed writing polyMesh." << "Failed writing polyMesh."
<< exit(FatalError); << 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.
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;
}
} }
@ -770,6 +839,7 @@ int main(int argc, char *argv[])
Info<< endl; Info<< endl;
} }
Info<< "End.\n" << endl; Info<< "End.\n" << endl;
return 0; return 0;

View File

@ -974,28 +974,6 @@ int main(int argc, char *argv[])
const word extractionMethod = surfaceDict.lookup("extractionMethod"); const word extractionMethod = surfaceDict.lookup("extractionMethod");
#ifndef ENABLE_CURVATURE
if (curvature)
{
WarningIn(args.executable())
<< "Curvature calculation has been requested but "
<< args.executable() << " has not " << nl
<< " been compiled with CGAL. "
<< "Skipping the curvature calculation." << endl;
}
#else
if (curvature && env("FOAM_SIGFPE"))
{
WarningIn(args.executable())
<< "Detected floating point exception trapping (FOAM_SIGFPE)."
<< " This might give" << nl
<< " problems when calculating curvature on straight angles"
<< " (infinite curvature)" << nl
<< " Switch it off in case of problems." << endl;
}
#endif
Info<< nl << "Feature line extraction is only valid on closed manifold " Info<< nl << "Feature line extraction is only valid on closed manifold "
<< "surfaces." << endl; << "surfaces." << endl;

View File

@ -223,11 +223,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
) )
{ {
label start = offsets_[i]; label start = offsets_[i];
return UList<T> return UList<T>(m_.begin() + start, offsets_[i+1] - start);
(
(m_.size() ? m_.begin() + start : NULL),
offsets_[i+1] - start
);
} }
@ -241,7 +237,7 @@ Foam::CompactListList<T, Container>::operator[]
label start = offsets_[i]; label start = offsets_[i];
return UList<T> return UList<T>
( (
(m_.size() ? const_cast<T*>(m_.begin() + start) : NULL), const_cast<T*>(m_.begin() + start),
offsets_[i+1] - start offsets_[i+1] - start
); );
} }

View File

@ -34,10 +34,11 @@ SourceFiles
PatchToolsCheck.C PatchToolsCheck.C
PatchToolsEdgeOwner.C PatchToolsEdgeOwner.C
PatchToolsGatherAndMerge.C PatchToolsGatherAndMerge.C
PatchToolsMatch.C
PatchToolsNormals.C
PatchToolsSearch.C PatchToolsSearch.C
PatchToolsSortEdges.C PatchToolsSortEdges.C
PatchToolsNormals.C PatchToolsSortPoints.C
PatchToolsMatch.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -1047,7 +1047,12 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
} }
// Remove any now dangling parts // Remove any now dangling parts
meshRefiner_.splitMeshRegions(refineParams.keepPoints()[0]); meshRefiner_.splitMeshRegions
(
globalToMasterPatch_,
globalToSlavePatch_,
refineParams.keepPoints()[0]
);
if (debug) if (debug)
{ {

View File

@ -131,7 +131,7 @@ void Foam::meshRefinement::calcNeighbourData
// Other cell more refined. Adjust normal distance // Other cell more refined. Adjust normal distance
d *= 0.5; d *= 0.5;
} }
neiLevel[bFaceI] = cellLevel[ownLevel]; neiLevel[bFaceI] = faceLevel;
// Calculate other cell centre by extrapolation // Calculate other cell centre by extrapolation
neiCc[bFaceI] = faceCentres[i] + d*fn; neiCc[bFaceI] = faceCentres[i] + d*fn;
bFaceI++; bFaceI++;
@ -1901,8 +1901,6 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI];
// Check all coupled. Avoid using .coupled() so we also pick up AMI. // Check all coupled. Avoid using .coupled() so we also pick up AMI.
if (isA<coupledPolyPatch>(patches[patchI])) if (isA<coupledPolyPatch>(patches[patchI]))
{ {
@ -1913,9 +1911,9 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const
if (cpp.separated() || !cpp.parallel()) if (cpp.separated() || !cpp.parallel())
{ {
forAll(pp, i) forAll(cpp, i)
{ {
selected[pp.start()+i] = true; selected[cpp.start()+i] = true;
} }
} }
} }
@ -1925,6 +1923,8 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
( (
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
const point& keepPoint const point& keepPoint
) )
{ {
@ -1933,7 +1933,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
// Determine connected regions. regionSplit is the labelList with the // Determine connected regions. regionSplit is the labelList with the
// region per cell. // region per cell.
regionSplit cellRegion(mesh_);
boolList blockedFace(mesh_.nFaces(), false);
selectSeparatedCoupledFaces(blockedFace);
regionSplit cellRegion(mesh_, blockedFace);
label regionI = -1; label regionI = -1;
@ -1985,22 +1989,39 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
removeCells cellRemover(mesh_); removeCells cellRemover(mesh_);
labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemove)); labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemove));
labelList exposedPatch;
if (exposedFaces.size()) label nExposedFaces = returnReduce(exposedFaces.size(), sumOp<label>());
if (nExposedFaces)
{ {
FatalErrorIn //FatalErrorIn
//(
// "meshRefinement::splitMeshRegions(const point&)"
//) << "Removing non-reachable cells should only expose"
// << " boundary faces" << nl
// << "ExposedFaces:" << exposedFaces << abort(FatalError);
// Patch for exposed faces for lack of anything sensible.
label defaultPatch = 0;
if (globalToMasterPatch.size())
{
defaultPatch = globalToMasterPatch[0];
}
WarningIn
( (
"meshRefinement::splitMeshRegions(const point&)" "meshRefinement::splitMeshRegions(const point&)"
) << "Removing non-reachable cells should only expose boundary faces" ) << "Removing non-reachable cells exposes "
<< nl << nExposedFaces << " internal or coupled faces." << endl
<< "ExposedFaces:" << exposedFaces << abort(FatalError); << " These get put into patch " << defaultPatch << endl;
exposedPatch.setSize(exposedFaces.size(), defaultPatch);
} }
return doRemoveCells return doRemoveCells
( (
cellsToRemove, cellsToRemove,
exposedFaces, exposedFaces,
labelList(exposedFaces.size(),-1), // irrelevant since 0 size. exposedPatch,
cellRemover cellRemover
); );
} }

View File

@ -868,7 +868,12 @@ public:
void selectSeparatedCoupledFaces(boolList&) const; void selectSeparatedCoupledFaces(boolList&) const;
//- Split mesh. Keep part containing point. //- Split mesh. Keep part containing point.
autoPtr<mapPolyMesh> splitMeshRegions(const point& keepPoint); autoPtr<mapPolyMesh> splitMeshRegions
(
const labelList& globalToMasterPatch,
const labelList& globalToSlavePatch,
const point& keepPoint
);
//- Update local numbering for mesh redistribution //- Update local numbering for mesh redistribution
void distribute(const mapDistributePolyMesh&); void distribute(const mapDistributePolyMesh&);

View File

@ -1411,6 +1411,7 @@ void Foam::meshRefinement::findCellZoneInsideWalk
{ {
// Analyse regions. Reuse regionsplit // Analyse regions. Reuse regionsplit
boolList blockedFace(mesh_.nFaces()); boolList blockedFace(mesh_.nFaces());
//selectSeparatedCoupledFaces(blockedFace);
forAll(namedSurfaceIndex, faceI) forAll(namedSurfaceIndex, faceI)
{ {
@ -2055,7 +2056,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
runTime++; runTime++;
} }
splitMeshRegions(keepPoint); splitMeshRegions(globalToMasterPatch, globalToSlavePatch, keepPoint);
if (debug) if (debug)
{ {