mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,6 +35,116 @@ Description
|
||||
#include "meshTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void checkConnectedAgglomeration
|
||||
(
|
||||
const lduMesh& mesh,
|
||||
const labelUList& restrict,
|
||||
const label nCoarse
|
||||
)
|
||||
{
|
||||
if (mesh.lduAddr().size() != restrict.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"checkConnectedAgglomeration(const lduMesh&, const labelList&)"
|
||||
) << "nCells:" << mesh.lduAddr().size()
|
||||
<< " agglom:" << restrict.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Seed (master) for every region
|
||||
labelList regionToMaster(nCoarse, -1);
|
||||
labelList master(mesh.lduAddr().size(), -1);
|
||||
forAll(restrict, cellI)
|
||||
{
|
||||
label region = restrict[cellI];
|
||||
if (regionToMaster[region] == -1)
|
||||
{
|
||||
// Set cell to be master for region
|
||||
//Pout<< "For region " << region
|
||||
// << " allocating local master " << cellI
|
||||
// << endl;
|
||||
regionToMaster[region] = cellI;
|
||||
master[cellI] = cellI;
|
||||
}
|
||||
}
|
||||
|
||||
// Now loop and transport master through region
|
||||
const labelUList& lower = mesh.lduAddr().lowerAddr();
|
||||
const labelUList& upper = mesh.lduAddr().upperAddr();
|
||||
|
||||
while (true)
|
||||
{
|
||||
label nChanged = 0;
|
||||
|
||||
forAll(lower, faceI)
|
||||
{
|
||||
label own = lower[faceI];
|
||||
label nei = upper[faceI];
|
||||
|
||||
if (restrict[own] == restrict[nei])
|
||||
{
|
||||
// Region-internal face
|
||||
|
||||
if (master[own] != -1)
|
||||
{
|
||||
if (master[nei] == -1)
|
||||
{
|
||||
master[nei] = master[own];
|
||||
nChanged++;
|
||||
}
|
||||
else if (master[nei] != master[own])
|
||||
{
|
||||
FatalErrorIn("checkConnectedAgglomeration(..)")
|
||||
<< "problem" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
else if (master[nei] != -1)
|
||||
{
|
||||
master[own] = master[nei];
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nChanged, sumOp<label>());
|
||||
|
||||
if (nChanged == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that master is set for all cells
|
||||
boolList singleRegion(nCoarse, true);
|
||||
label nSet = nCoarse;
|
||||
forAll(master, cellI)
|
||||
{
|
||||
if (master[cellI] == -1)
|
||||
{
|
||||
label region = restrict[cellI];
|
||||
if (singleRegion[region] == true)
|
||||
{
|
||||
singleRegion[region] = false;
|
||||
nSet--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label totalNCoarse = returnReduce(nCoarse, sumOp<label>());
|
||||
label totalNVisited = returnReduce(nSet, sumOp<label>());
|
||||
|
||||
if (totalNVisited < totalNCoarse)
|
||||
{
|
||||
WarningIn("checkConnectedAgglomeration(..)")
|
||||
<< "out of " << totalNCoarse
|
||||
<< " agglomerated cells have " << totalNCoarse-totalNVisited
|
||||
<< " cells that are not a single connected region" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -117,6 +227,14 @@ int main(int argc, char *argv[])
|
||||
<< " agglomerated size : "
|
||||
<< returnReduce(coarseSize, sumOp<label>()) << endl;
|
||||
|
||||
checkConnectedAgglomeration
|
||||
(
|
||||
agglom.meshLevel(level),
|
||||
addr,
|
||||
coarseSize
|
||||
);
|
||||
|
||||
|
||||
forAll(addr, fineI)
|
||||
{
|
||||
const labelList& cellLabels = coarseToCell[fineI];
|
||||
|
||||
@ -222,14 +222,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
Info<< "Writing surface to " << outFileName << " ..." << endl;
|
||||
|
||||
// meshedSurface
|
||||
// (
|
||||
// xferMove(newPoints),
|
||||
// xferCopy(surf1.localFaces()),
|
||||
// xferCopy(surf1.surfZones())
|
||||
// ).write(outFileName);
|
||||
|
||||
surf1.write(outFileName);
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
@ -105,3 +105,30 @@ Boundary conditions must then be applied to all geometric patches in the usual,
|
||||
manner, and the cases can be executed in parallel (as shown when running the
|
||||
Allrun-parallel script) without any speacial treatment, i.e. the case set-up is
|
||||
the same as when operating in serial mode.
|
||||
|
||||
|
||||
checkMesh
|
||||
---------
|
||||
checkMesh will see the 'duplicate' boundary faces but does not know about
|
||||
the area factors so will complain:
|
||||
|
||||
***Boundary openness (-0.0103092 2.3845e-17 3.80774e-17) possible hole in boundary description.
|
||||
***Open cells found, max cell openness: 0.333333, number of open cells 136
|
||||
<<Writing 136 non closed cells to set nonClosedCells
|
||||
|
||||
As long as these non-closed cells are on the ACMI they can be ignored.
|
||||
|
||||
|
||||
paraFoam
|
||||
--------
|
||||
- display: it will not display the outside of the ACMI, there will be a hole.
|
||||
- cuttingPlanes: they leave out the duplicate faces (i.e. the cells on
|
||||
the ACMI patches)
|
||||
- interpolation: the interpolation does not take into account the
|
||||
area-weights on the ACMI.
|
||||
|
||||
|
||||
pointFields
|
||||
-----------
|
||||
Same as paraFoam: the interpolation does not take into account the
|
||||
area-weights on the ACMI.
|
||||
|
||||
Reference in New Issue
Block a user