Commit 5d031f38 authored by mattijs's avatar mattijs
Browse files

Merge branch 'cvm' of /home/noisy3/OpenFOAM/OpenFOAM-dev into cvm

Conflicts:
	tutorials/mesh/cvMesh/simpleShapes/system/cvMeshDict
parents 5d9d7281 1c44de90
......@@ -397,8 +397,8 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if (debug)
{
const_cast<Time&>(mesh_.time())++;
Info<< "Time " << mesh_.time().timeName() << endl;
// const_cast<Time&>(mesh_.time())++;
// Info<< "Time " << mesh_.time().timeName() << endl;
meshCutter_.write();
mesh_.write();
cellWeights.write();
......@@ -424,8 +424,8 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
printMeshData(mesh_);
const_cast<Time&>(mesh_.time())++;
Info<< "Time " << mesh_.time().timeName() << endl;
// const_cast<Time&>(mesh_.time())++;
// Info<< "Time " << mesh_.time().timeName() << endl;
meshCutter_.write();
mesh_.write();
cellWeights.write();
......@@ -435,8 +435,8 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if (debug)
{
const_cast<Time&>(mesh_.time())++;
Info<< "Time " << mesh_.time().timeName() << endl;
// const_cast<Time&>(mesh_.time())++;
// Info<< "Time " << mesh_.time().timeName() << endl;
cellWeights.write();
mesh_.write();
}
......@@ -868,8 +868,8 @@ Foam::backgroundMeshDecomposition::distribute
{
if (debug)
{
const_cast<Time&>(mesh_.time())++;
Info<< "Time " << mesh_.time().timeName() << endl;
// const_cast<Time&>(mesh_.time())++;
// Info<< "Time " << mesh_.time().timeName() << endl;
cellWeights.write();
mesh_.write();
}
......@@ -878,10 +878,27 @@ Foam::backgroundMeshDecomposition::distribute
{
// Refine large cells if necessary
scalar cellWeightLimit =
label nOccupiedCells = 0;
forAll(cellWeights.internalField(), cI)
{
if (cellWeights.internalField()[cI] > 1 - SMALL)
{
nOccupiedCells++;
}
}
// Only look at occupied cells, as there is a possibility of runaway
// refinement if the number of cells grows too fast. Also, clip the
// minimum cellWeightLimit at maxCellWeightCoeff_
scalar cellWeightLimit = max
(
maxCellWeightCoeff_
*sum(cellWeights).value()
/mesh_.globalData().nTotalCells();
/returnReduce(nOccupiedCells, sumOp<label>()),
maxCellWeightCoeff_
);
if (debug)
{
......@@ -997,7 +1014,7 @@ Foam::backgroundMeshDecomposition::distribute
newCellI = cellSearch.findNearestCell(v);
Pout<< newCellI << endl;
// Pout<< newCellI << endl;
}
newCellVertices[newCellI].append(v);
......@@ -1049,8 +1066,8 @@ Foam::backgroundMeshDecomposition::distribute
<< " to " << mesh_.globalData().nTotalCells()
<< " cells." << endl;
const_cast<Time&>(mesh_.time())++;
Info<< "Time " << mesh_.time().timeName() << endl;
// const_cast<Time&>(mesh_.time())++;
// Info<< "Time " << mesh_.time().timeName() << endl;
cellWeights.write();
mesh_.write();
}
......@@ -1092,8 +1109,8 @@ Foam::backgroundMeshDecomposition::distribute
<< max(cellWeights.internalField())
<< endl;
const_cast<Time&>(mesh_.time())++;
Info<< "Time " << mesh_.time().timeName() << endl;
// const_cast<Time&>(mesh_.time())++;
// Info<< "Time " << mesh_.time().timeName() << endl;
mesh_.write();
cellWeights.write();
}
......
......@@ -88,7 +88,7 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
scalar spanMag = geometryToConformTo_.globalBounds().mag();
for(label i = 0; i < s; i++)
for (label i = 0; i < s; i++)
{
vector spoke
(
......@@ -439,7 +439,7 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs
insertPoints(pts, indices, types, true);
if(cvMeshControls().objOutput() && fName != fileName::null)
if (cvMeshControls().objOutput() && fName != fileName::null)
{
writePoints(fName, pts);
}
......@@ -478,7 +478,7 @@ void Foam::conformalVoronoiMesh::insertEdgePointGroups
insertPoints(pts, indices, types, true);
if(cvMeshControls().objOutput() && fName != fileName::null)
if (cvMeshControls().objOutput() && fName != fileName::null)
{
writePoints(fName, pts);
}
......@@ -768,7 +768,7 @@ void Foam::conformalVoronoiMesh::insertFeaturePoints()
// Insert the created points, distributing to the appropriate processor
insertPoints(pts, indices, types, true);
if(cvMeshControls().objOutput())
if (cvMeshControls().objOutput())
{
writePoints("featureVertices.obj", pts);
}
......@@ -1009,7 +1009,7 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints
}
}
if(skipEdge)
if (skipEdge)
{
Info<< "Skipping point " << ptI << nl << endl;
......@@ -1225,7 +1225,7 @@ void Foam::conformalVoronoiMesh::insertInitialPoints()
// which processor each point should be on, so give distribute = false
insertPoints(initPts, false);
if(cvMeshControls().objOutput())
if (cvMeshControls().objOutput())
{
writePoints("initialPoints.obj", true);
}
......@@ -1358,7 +1358,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground()
cellWeights.internalField()[cI] = max
(
cellVertices[cI].size(),
1e-2
1e-3
);
}
......@@ -1422,7 +1422,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground()
// Pout<< " Real vertices after distribution "
// << label(number_of_vertices() - 8) << endl;
if(cvMeshControls().objOutput())
if (cvMeshControls().objOutput())
{
writePoints("distributedPoints.obj", true);
}
......@@ -1927,7 +1927,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
// domain the processor they are on.
// reportProcessorOccupancy();
if(cvMeshControls().objOutput())
if (cvMeshControls().objOutput())
{
writePoints("allInitialPoints.obj", false);
}
......
......@@ -472,7 +472,7 @@ Foam::label Foam::conformalVoronoiMesh::mergeCloseDualVertices
continue;
}
if(c1I != -1 && c2I != -1 && (c1I != c2I))
if (c1I != -1 && c2I != -1 && (c1I != c2I))
{
if
(
......
......@@ -1724,7 +1724,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
if (edHit.hit())
{
if(!positionOnThisProc(edHit.hitPoint()))
if (!positionOnThisProc(edHit.hitPoint()))
{
continue;
}
......
......@@ -340,7 +340,7 @@ void Foam::conformalVoronoiMesh::writeMesh
const pointField& cellCentres
) const
{
if(cvMeshControls().objOutput())
if (cvMeshControls().objOutput())
{
writeObjMesh(points, faces, word(meshName + ".obj"));
}
......
......@@ -48,7 +48,7 @@ initialPointsMethod::initialPointsMethod
:
dictionary(initialPointsDict),
cvMesh_(cvMesh),
detailsDict_(subDict(type + "Details")),
detailsDict_(subDict(type + "Coeffs")),
minimumSurfaceDistanceCoeffSqr_
(
sqr
......
......@@ -74,42 +74,55 @@ std::list<Vb::Point> pointFile::initialPoints() const
<< exit(FatalError) << endl;
}
// Filter the points to be only those on this processor
boolList procPt(cvMesh_.positionOnThisProc(points));
if (Pstream::parRun())
{
List<boolList> allProcPt(Pstream::nProcs());
if (points.path().find("processor") != string::npos)
{
// Testing filePath to see if the file originated in a processor
// directory, if so, assume that the points in each processor file
// are unique. They are unlikely to belong on the current
// processor as the background mesh is unlikely to be the same.
allProcPt[Pstream::myProcNo()] = procPt;
cvMesh_.decomposition().distributePoints(points);
}
else
{
// Otherwise, this is assumed to be points covering the whole
// domain, so filter the points to be only those on this processor
boolList procPt(cvMesh_.positionOnThisProc(points));
Pstream::gatherList(allProcPt);
List<boolList> allProcPt(Pstream::nProcs());
Pstream::scatterList(allProcPt);
allProcPt[Pstream::myProcNo()] = procPt;
forAll(procPt, ptI)
{
bool foundAlready = false;
Pstream::gatherList(allProcPt);
Pstream::scatterList(allProcPt);
forAll(allProcPt, procI)
forAll(procPt, ptI)
{
// If a processor with a lower index has found this point to
// insert already, defer to it and don't insert.
if (foundAlready)
{
allProcPt[procI][ptI] = false;
}
else if (allProcPt[procI][ptI])
bool foundAlready = false;
forAll(allProcPt, procI)
{
foundAlready = true;
// If a processor with a lower index has found this point
// to insert already, defer to it and don't insert.
if (foundAlready)
{
allProcPt[procI][ptI] = false;
}
else if (allProcPt[procI][ptI])
{
foundAlready = true;
}
}
}
}
procPt = allProcPt[Pstream::myProcNo()];
}
procPt = allProcPt[Pstream::myProcNo()];
inplaceSubset(procPt, points);
inplaceSubset(procPt, points);
}
}
std::list<Vb::Point> initialPoints;
......
......@@ -114,7 +114,7 @@ initialPoints
// initialPointsMethod bodyCentredCubic;
// initialPointsMethod pointFile;
autoDensityDetails
autoDensityCoeffs
{
minLevels 1;
maxSizeRatio 2.0;
......@@ -122,21 +122,21 @@ initialPoints
surfaceSampleResolution 5;
}
uniformGridDetails
uniformGridCoeffs
{
initialCellSize 0.0015;
randomiseInitialGrid yes;
randomPerturbationCoeff 0.02;
}
bodyCentredCubicDetails
bodyCentredCubicCoeffs
{
initialCellSize 0.0015;
randomiseInitialGrid no;
randomPerturbationCoeff 0.1;
}
pointFileDetails
pointFileCoeffs
{
pointFile "constant/internalDelaunayVertices";
}
......
......@@ -111,7 +111,7 @@ initialPoints
initialPointsMethod pointFile;
pointFileDetails
pointFileCoeffs
{
pointFile "constant/internalDelaunayVertices";
}
......
......@@ -209,10 +209,9 @@ initialPoints
// initialPointsMethod bodyCentredCubic;
// initialPointsMethod pointFile;
// Take boundbox of all geometry. Sample with this box. If too much
// samples in box (due to target cell size) split box.
autoDensityDetails
// Take boundbox of all geometry. Samples with this box. If too much
// samples (due to target cell size) in box split box.
autoDensityCoeffs
{
// Initial number of refinement levels. Needs to be enough to pick
// up features due to size ratio. If not enough it will take longer
......@@ -226,7 +225,7 @@ initialPoints
surfaceSampleResolution 3;
}
uniformGridDetails
uniformGridCoeffs
{
// Absolute cell size.
initialCellSize 0.0015;
......@@ -234,14 +233,14 @@ initialPoints
randomPerturbationCoeff 0.02;
}
bodyCentredCubicDetails
bodyCentredCubicCoeffs
{
initialCellSize 0.0015;
randomiseInitialGrid no;
randomPerturbationCoeff 0.1;
}
pointFileDetails
pointFileCoeffs
{
// Reads points from file. Still rejects points that are too
// close to the surface (minimumSurfaceDistanceCoeff) or on the
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment