diff --git a/applications/test/patchRegion/Make/files b/applications/test/patchRegion/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..80ccdd7e7c53847b68fc5b3646ded406cdcf4458 --- /dev/null +++ b/applications/test/patchRegion/Make/files @@ -0,0 +1,3 @@ +Test-patchRegion.C + +EXE = $(FOAM_USER_APPBIN)/Test-patchRegion diff --git a/applications/test/patchRegion/Make/options b/applications/test/patchRegion/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..d27c95d033dd5d7b1995c8ff8dc406e35ca1f586 --- /dev/null +++ b/applications/test/patchRegion/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/applications/test/patchRegion/README b/applications/test/patchRegion/README new file mode 100644 index 0000000000000000000000000000000000000000..64bd086d43744a0ea34b5aa054c9ac7aed7b8bf1 --- /dev/null +++ b/applications/test/patchRegion/README @@ -0,0 +1,2 @@ +2013-05-27 Detect 'pinches' in patch (i.e., non-manifold on point). Run on +cavity_pinched subdirectory. diff --git a/applications/test/patchRegion/Test-patchRegion.C b/applications/test/patchRegion/Test-patchRegion.C new file mode 100644 index 0000000000000000000000000000000000000000..2df8b3a8b095befdfbe046c8ae43768b73438d8f --- /dev/null +++ b/applications/test/patchRegion/Test-patchRegion.C @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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/>. + +Description + Detect point pinches + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "PatchTools.H" +#include "Time.H" +#include "polyMesh.H" +#include "patchEdgeFaceRegions.H" +#include "PatchEdgeFaceWave.H" +#include "globalIndex.H" +#include "syncTools.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// Main program: + +int main(int argc, char *argv[]) +{ + argList::validArgs.append("patch"); + +# include "setRootCase.H" +# include "createTime.H" + + const word patchName = args[1]; + +# include "createPolyMesh.H" + + Info<< "Mesh read in = " + << runTime.cpuTimeIncrement() + << " s\n" << endl << endl; + + + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + label patchI = pbm.findPatchID(patchName); + const polyPatch& patch = pbm[patchI]; + + Info<< "Patch:" << patch.name() << endl; + + + + // Data on all edges and faces + List<patchEdgeFaceRegions> allEdgeInfo(patch.nEdges()); + List<patchEdgeFaceRegions> allFaceInfo(patch.size()); + + // Determine parallel global indexing + const globalIndex globalNumbering(patch.size()); + + DynamicList<label> changedEdges(4*patch.size()); + DynamicList<patchEdgeFaceRegions> changedInfo(changedEdges.size()); + + forAll(patch, faceI) + { + const labelList& fEdges = patch.faceEdges()[faceI]; + + label globalFaceI = globalNumbering.toGlobal(faceI); + + forAll(fEdges, i) + { + changedEdges.append(fEdges[i]); + changedInfo.append + ( + patchEdgeFaceRegions(labelPair(globalFaceI, globalFaceI)) + ); + } + } + + // Walk + PatchEdgeFaceWave + < + primitivePatch, + patchEdgeFaceRegions + > calc + ( + mesh, + patch, + changedEdges, + changedInfo, + allEdgeInfo, + allFaceInfo, + returnReduce(patch.nEdges(), sumOp<label>()) + ); + + + Info<< "Time now = " << runTime.timeName() << endl; + + + // Detect points with multiple regions + labelList duplicateRegion(patch.nPoints(), -1); + { + labelList currentRegion(patch.nPoints(), -1); + + forAll(patch.localFaces(), faceI) + { + const face& f = patch.localFaces()[faceI]; + + forAll(f, fp) + { + label faceRegion = allFaceInfo[faceI].regions()[fp]; + + label pointI = f[fp]; + + if (currentRegion[pointI] == -1) + { + currentRegion[pointI] = faceRegion; + } + else if (currentRegion[pointI] != faceRegion) + { + if (duplicateRegion[pointI] == -1) + { + Pout<< "Multi region point:" + << patch.localPoints()[pointI] + << " with region:" << currentRegion[pointI] + << " and region:" << faceRegion + << endl; + duplicateRegion[pointI] = currentRegion[pointI]; + } + } + } + } + } + + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/patchRegion/cavity_pinched/README.txt b/applications/test/patchRegion/cavity_pinched/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..be28e421e926df356acb719c267f45c03dc69169 --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/README.txt @@ -0,0 +1,17 @@ +constant/ + cavity blockMesh + point (0.05 0.05 0.01) moved to (0.05 0.05 0.001) + +0.005/ + collapseEdges with + + collapseEdgesCoeffs.minimumEdgeLength 0.0011; + + so it collapses the one edge + + +processor*/0.005/ + decomposePar + + +mpirun -np 2 Test-patchRegion -parallel diff --git a/applications/test/patchRegion/cavity_pinched/constant/polyMesh/blockMeshDict b/applications/test/patchRegion/cavity_pinched/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..165a600c7b4a929aaa62ad1750bfbb9d279c2e65 --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/constant/polyMesh/blockMeshDict @@ -0,0 +1,75 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +vertices +( + (0 0 0) + (1 0 0) + (1 1 0) + (0 1 0) + (0 0 0.1) + (1 0 0.1) + (1 1 0.1) + (0 1 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + movingWall + { + type wall; + faces + ( + (3 7 6 2) + ); + } + fixedWalls + { + type wall; + faces + ( + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) + ); + } + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/applications/test/patchRegion/cavity_pinched/constant/transportProperties b/applications/test/patchRegion/cavity_pinched/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..fa1c1ca0b14b50fa06f4c8577b4998addd44b1f3 --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/constant/transportProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +nu nu [ 0 2 -1 0 0 0 0 ] 0.01; + + +// ************************************************************************* // diff --git a/applications/test/patchRegion/cavity_pinched/system/collapseDict b/applications/test/patchRegion/cavity_pinched/system/collapseDict new file mode 100644 index 0000000000000000000000000000000000000000..a059a67f1448ee95041781a359fdbdb6102e64d8 --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/system/collapseDict @@ -0,0 +1,89 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object collapseDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// If on, after collapsing check the quality of the mesh. If bad faces are +// generated then redo the collapsing with stricter filtering. +controlMeshQuality off; + + +collapseEdgesCoeffs +{ + // Edges shorter than this absolute value will be merged + minimumEdgeLength 0.0011; + + // The maximum angle between two edges that share a point attached to + // no other edges + maximumMergeAngle 30; +} + + +//collapseFacesCoeffs +//{ +// // The initial face length factor +// initialFaceLengthFactor 0.5; +// +// // If the face can't be collapsed to an edge, and it has a span less than +// // the target face length multiplied by this coefficient, collapse it +// // to a point. +// maxCollapseFaceToPointSideLengthCoeff 0.3; +// +// // Allow early collapse of edges to a point +// allowEarlyCollapseToPoint on; +// +// // Fraction to premultiply maxCollapseFaceToPointSideLengthCoeff by if +// // allowEarlyCollapseToPoint is enabled +// allowEarlyCollapseCoeff 0.2; +// +// // Defining how close to the midpoint (M) of the projected +// // vertices line a projected vertex (X) can be before making this +// // an invalid edge collapse +// // +// // X---X-g----------------M----X-----------g----X--X +// // +// // Only allow a collapse if all projected vertices are outwith +// // guardFraction (g) of the distance form the face centre to the +// // furthest vertex in the considered direction +// guardFraction 0.1; +//} +// +// +//controlMeshQualityCoeffs +//{ +// // Name of the dictionary that has the mesh quality coefficients used +// // by motionSmoother::checkMesh +// #include "meshQualityDict"; +// +// // The amount that minimumEdgeLength will be reduced by for each +// // edge if that edge's collapse generates a poor quality face +// edgeReductionFactor 0.5; +// +// // The amount that initialFaceLengthFactor will be reduced by for each +// // face if its collapse generates a poor quality face +// faceReductionFactor $initialFaceLengthFactor; +// +// // Maximum number of smoothing iterations for the reductionFactors +// maximumSmoothingIterations 2; +// +// // Maximum number of outer iterations is mesh quality checking is enabled +// maximumIterations 10; +// +// // Maximum number of iterations deletion of a point can cause a bad face +// // to be constructed before it is forced to not be deleted +// maxPointErrorCount 5; +//} + + +// ************************************************************************* // diff --git a/applications/test/patchRegion/cavity_pinched/system/controlDict b/applications/test/patchRegion/cavity_pinched/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..4fc602f95c1f428e7ac2cb5c0b14ea05c23d0bdc --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/system/controlDict @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +DebugSwitches +{ + PatchEdgeFaceWave 1; +} + +application icoFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 0.5; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 20; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/applications/test/patchRegion/cavity_pinched/system/decomposeParDict b/applications/test/patchRegion/cavity_pinched/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..8f0581f952e992f7a1190266feea2235559279ea --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/system/decomposeParDict @@ -0,0 +1,138 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +//- Keep owner and neighbour on same processor for faces in zones: +// preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_half0 cyclic_half1); + +//- Keep all of faceSet on a single processor. This puts all cells +// connected with a point, edge or face on the same processor. +// (just having face connected cells might not guarantee a balanced +// decomposition) +// The processor can be -1 (the decompositionMethod chooses the processor +// for a good load balance) or explicitly provided (upsets balance). +//singleProcessorFaceSets ((f0 -1)); + + +//- Use the volScalarField named here as a weight for each cell in the +// decomposition. For example, use a particle population field to decompose +// for a balanced number of particles in a lagrangian simulation. +// weightField dsmcRhoNMean; + +//method scotch; +method hierarchical; +// method simple; +// method metis; +// method manual; +// method multiLevel; +// method structured; // does 2D decomposition of structured mesh + +multiLevelCoeffs +{ + // Decomposition methods to apply in turn. This is like hierarchical but + // fully general - every method can be used at every level. + + level0 + { + numberOfSubdomains 64; + //method simple; + //simpleCoeffs + //{ + // n (2 1 1); + // delta 0.001; + //} + method scotch; + } + level1 + { + numberOfSubdomains 4; + method scotch; + } +} + +// Desired output + +simpleCoeffs +{ + n (2 1 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + /* + processorWeights + ( + 1 + 1 + 1 + 1 + ); + */ +} + +scotchCoeffs +{ + //processorWeights + //( + // 1 + // 1 + // 1 + // 1 + //); + //writeGraph true; + //strategy "b"; +} + +manualCoeffs +{ + dataFile "decompositionData"; +} + +structuredCoeffs +{ + // Patches to do 2D decomposition on. Structured mesh only; cells have + // to be in 'columns' on top of patches. + patches (movingWall); + + // Method to use on the 2D subset + method scotch; +} + +//// Is the case distributed? Note: command-line argument -roots takes +//// precedence +//distributed yes; +//// Per slave (so nProcs-1 entries) the directory above the case. +//roots +//( +// "/tmp" +// "/tmp" +//); + +// ************************************************************************* // diff --git a/applications/test/patchRegion/cavity_pinched/system/fvSchemes b/applications/test/patchRegion/cavity_pinched/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..c311eb8961a0e5567560c8f89a87efadf31973fd --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/system/fvSchemes @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian(nu,U) Gauss linear orthogonal; + laplacian((1|A(U)),p) Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; + interpolate(HbyA) linear; +} + +snGradSchemes +{ + default orthogonal; +} + +fluxRequired +{ + default no; + p ; +} + + +// ************************************************************************* // diff --git a/applications/test/patchRegion/cavity_pinched/system/fvSolution b/applications/test/patchRegion/cavity_pinched/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..a0130726c4ea6e852d5d4f3e51b06b19ebe3fce1 --- /dev/null +++ b/applications/test/patchRegion/cavity_pinched/system/fvSolution @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + //solver PCG; + //preconditioner DIC; + + solver GAMG; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration on; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 3; + mergeLevels 1; + + processorAgglomerator none; //procFaces; + //nAgglomeratingCells 20; + + tolerance 1e-06; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + + +// ************************************************************************* //