Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "meshRefinement.H"
#include "Time.H"
#include "refinementSurfaces.H"
#include "refinementFeatures.H"
#include "shellSurfaces.H"
#include "triSurfaceMesh.H"
#include "treeDataCell.H"
#include "searchableSurfaces.H"
#include "DynamicField.H"
#include "transportData.H"
#include "FaceCellWave.H"
#include "volFields.H"
#include "zeroGradientFvPatchFields.H"
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label Foam::meshRefinement::markSurfaceGapRefinement
(
const scalar planarCos,
const label nAllowRefine,
const labelList& neiLevel,
const pointField& neiCc,
labelList& refineCell,
label& nRefine
) const
{
const labelList& cellLevel = meshCutter_.cellLevel();
const pointField& cellCentres = mesh_.cellCentres();
// Get the gap level for the shells
const labelList maxLevel(shells_.maxGapLevel());
label oldNRefine = nRefine;
if (max(maxLevel) > 0)
{
// Use cached surfaceIndex_ to detect if any intersection. If so
// re-intersect to determine level wanted.
// Collect candidate faces
// ~~~~~~~~~~~~~~~~~~~~~~~
labelList testFaces(getRefineCandidateFaces(refineCell));
// Collect segments
// ~~~~~~~~~~~~~~~~
pointField start(testFaces.size());
pointField end(testFaces.size());
{
labelList minLevel(testFaces.size());
calcCellCellRays
(
neiCc,
neiLevel,
testFaces,
start,
end,
minLevel
);
}
// Collect cells to test for inside/outside in shell
labelList cellToCompact(mesh_.nCells(), -1);
labelList bFaceToCompact(mesh_.nFaces()-mesh_.nInternalFaces(), -1);
List<FixedList<label, 3>> shellGapInfo;
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
List<volumeType> shellGapMode;
{
DynamicField<point> compactToCc(mesh_.nCells()/10);
DynamicList<label> compactToLevel(compactToCc.capacity());
forAll(testFaces, i)
{
label faceI = testFaces[i];
label own = mesh_.faceOwner()[faceI];
if (cellToCompact[own] == -1)
{
cellToCompact[own] = compactToCc.size();
compactToCc.append(cellCentres[own]);
compactToLevel.append(cellLevel[own]);
}
if (mesh_.isInternalFace(faceI))
{
label nei = mesh_.faceNeighbour()[faceI];
if (cellToCompact[nei] == -1)
{
cellToCompact[nei] = compactToCc.size();
compactToCc.append(cellCentres[nei]);
compactToLevel.append(cellLevel[nei]);
}
}
else
{
label bFaceI = faceI - mesh_.nInternalFaces();
if (bFaceToCompact[bFaceI] == -1)
{
bFaceToCompact[bFaceI] = compactToCc.size();
compactToCc.append(neiCc[bFaceI]);
compactToLevel.append(neiLevel[bFaceI]);
}
}
}
shells_.findHigherGapLevel
(
compactToCc,
compactToLevel,
shellGapInfo,
shellGapMode
);
}
const List<FixedList<label, 3>>& extendedGapLevel =
surfaces_.extendedGapLevel();
const List<volumeType>& extendedGapMode =
surfaces_.extendedGapMode();
labelList ccSurface1;
List<pointIndexHit> ccHit1;
labelList ccRegion1;
vectorField ccNormal1;
labelList ccSurface2;
List<pointIndexHit> ccHit2;
labelList ccRegion2;
vectorField ccNormal2;
surfaces_.findNearestIntersection
(
identity(surfaces_.surfaces().size()),
start,
end,
ccSurface1,
ccHit1,
ccRegion1,
ccNormal1,
ccSurface2,
ccHit2,
ccRegion2,
ccNormal2
);
}
start.clear();
end.clear();
DynamicField<point> rayStart(2*ccSurface1.size());
DynamicField<point> rayEnd(2*ccSurface1.size());
DynamicField<scalar> gapSize(2*ccSurface1.size());
DynamicField<point> rayStart2(2*ccSurface1.size());
DynamicField<point> rayEnd2(2*ccSurface1.size());
DynamicField<scalar> gapSize2(2*ccSurface1.size());
DynamicList<label> cellMap(2*ccSurface1.size());
DynamicList<label> compactMap(2*ccSurface1.size());
forAll(ccSurface1, i)
label surfI = ccSurface1[i];
if (surfI != -1)
{
label globalRegionI =
surfaces_.globalRegion(surfI, ccRegion1[i]);
label faceI = testFaces[i];
const point& surfPt = ccHit1[i].hitPoint();
Loading
Loading full blame...