Go to the documentation of this file.
76 file <<
"# vtk DataFile Version 3.0\n";
77 file <<
"vtk output\n";
79 file <<
"DATASET POLYDATA\n";
87 file <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
91 file << op.
x() <<
' ' << op.
y() <<
' ' << op.
z() <<
nl;
99 file << 2 <<
" " << 2*eI <<
" " << (2*eI+1) <<
nl;
109 bool validLayer(
true);
111 # pragma omp parallel for schedule(dynamic, 40)
115 if( faceInLayer[bfI] < 0 )
118 const face& bf = bFaces[bfI];
126 Info <<
"Number of independent layers in the mesh is " << nGroups <<
endl;
127 Info <<
"Is valid layer " << validLayer <<
endl;
133 std::map<word, label> patchNameToIndex;
134 forAll(boundaries, patchI)
135 patchNameToIndex[boundaries[patchI].patchName()] = patchI;
143 groupsAtPatch[facePatch[bfI]].appendIfNotIn(faceInLayer[bfI]);
146 forAll(groupsAtPatch, patchI)
177 boundaries[patchI].patchName()
193 label maxNumLayers(1);
194 bool hasLocalValue(
false);
199 const word pName = layerPatches[lpI];
201 std::map<word, label>::const_iterator it =
213 nLayersAtPatch[patchNameToIndex[pName]] = it->second;
214 protectedValue[patchNameToIndex[pName]] =
true;
215 hasLocalValue =
true;
220 maxNumLayers =
Foam::max(maxNumLayers, it->second);
221 hasLocalValue =
true;
233 const label ptchI = patchNameToIndex[layerPatches[lpI]];
235 if( !protectedValue[ptchI] )
236 nLayersAtPatch[ptchI] = maxNumLayers;
252 # pragma omp parallel for schedule(dynamic, 50)
256 const face& bf = bFaces[bfI];
260 if( !zMinPoint[bf[pI]] )
261 allZMin[facePatch[bfI]] =
false;
262 if( !zMaxPoint[bf[pI]] )
263 allZMax[facePatch[bfI]] =
false;
270 if( allZMin[patchI] ^ allZMax[patchI] )
272 nLayersAtPatch[patchI] = -1;
282 Pout <<
"nLayersAtPatch " << nLayersAtPatch <<
endl;
291 # pragma omp parallel for schedule(dynamic, 50)
295 const label patchI = facePatch[bfI];
297 if( nLayersAtPatch[patchI] < 0 )
314 Pout <<
"Boundary face " << bfI <<
" in patch "
341 const label nThreads = 3 * omp_get_num_procs();
343 const label nThreads = 1;
347 # pragma omp parallel num_threads(nThreads)
352 # pragma omp for schedule(static, 1)
362 bool overridenThickness(
false);
364 const label bpI = bp[
e.start()];
368 const label bfI = pointFaces(bpI, pfI);
373 const word& patchName =
374 boundaries[facePatch[bfI]].patchName();
381 const std::map<word, scalar>::const_iterator rIt =
389 const std::map<word, scalar>::const_iterator tIt =
393 if( overridenThickness )
395 thickness =
Foam::min(thickness, tIt->second);
399 thickness = tIt->second;
400 overridenThickness =
true;
406 firstLayerThickness[seI] = thickness;
407 thicknessRatio[seI] = ratio;
408 nLayersAtEdge[seI] = nLayers;
412 nNodesAtEdge[seI] = nLayers + 1;
416 nNodesAtEdge[seI] = 3;
435 std::map<label, LongList<labelPair> > exchangeNumLayers;
436 std::map<label, LongList<labelPair> > exchangeNumNodesAtEdge;
437 std::map<label, LongList<labelledScalar> > exchangeThickness;
438 std::map<label, LongList<labelledScalar> > exchangeRatio;
441 exchangeNumNodesAtEdge.insert
445 exchangeNumLayers.insert
449 exchangeThickness.insert
468 const label eI = pointEdges(
s, peI);
470 if( edges[eI] == se )
477 const label geI = globalEdgeLabel[edgeI];
479 if( globalToLocal.found(geI) )
483 const label neiProc = edgeAtProcs(edgeI, i);
488 exchangeNumNodesAtEdge[neiProc].append
492 exchangeNumLayers[neiProc].append
496 exchangeThickness[neiProc].append
500 exchangeRatio[neiProc].append
512 forAll(receivedNumLayers, i)
514 const labelPair& lp = receivedNumLayers[i];
516 const edge&
e = edges[eI];
531 receivedNumLayers.
clear();
534 forAll(receivedNumLayers, i)
536 const labelPair& lp = receivedNumLayers[i];
538 const edge&
e = edges[eI];
560 const edge&
e = edges[eI];
571 thicknessRatio[seI] =
std::max(thicknessRatio[seI], ls.
value());
575 receivedScalar.
clear();
582 const edge&
e = edges[eI];
593 firstLayerThickness[seI] =
601 numPointsAtThread.
setSize(nThreads);
602 numPointsAtThread = 0;
605 # pragma omp parallel for num_threads(nThreads) schedule(static, 1)
610 const label threadI = omp_get_thread_num();
612 const label threadI(0);
615 numPointsAtThread[threadI] += nNodesAtEdge[seI] - 2;
624 forAll(numPointsAtThread, threadI)
626 const label nPts = numPointsAtThread[threadI];
627 numPointsAtThread[threadI] = numPoints;
631 points.setSize(numPoints);
634 Info <<
"Generating split vertices" <<
endl;
639 # pragma omp parallel num_threads(nThreads)
643 const label threadI = omp_get_thread_num();
645 const label threadI(0);
651 # pragma omp for schedule(static, 1)
658 const scalar magv =
mag(v);
662 scalar firstThickness = magv / nLayersAtEdge[seI];
663 if( thicknessRatio[seI] > (1. + SMALL) )
668 (1 -
Foam::pow(thicknessRatio[seI], nLayersAtEdge[seI]))
669 / (1.0 - thicknessRatio[seI])
673 Pout <<
"Thread " << threadI <<
endl;
674 Pout <<
"Generating vertices at split edge "
675 <<
" start point " <<
points[
e.start()]
677 Pout <<
"Edge length " << magv <<
endl;
678 Pout <<
"Thickness of the first layer "
679 << firstThickness <<
endl;
686 Foam::max(firstLayerThickness[seI], SMALL),
692 scalar t = firstThickness;
694 for(
label i=1;i<nLayersAtEdge[seI]-1;++i)
695 t += firstThickness *
Foam::pow(thicknessRatio[seI], i);
703 scalar param = firstThickness;
704 const vector vec = v / (magv + VSMALL);
706 for(
label pI=1;pI<nLayers;++pI)
712 Pout <<
"Split edge " << seI <<
" edge points " <<
e
713 <<
" start point " <<
points[
e.start()]
714 <<
" end point " <<
points[
e.end()]
715 <<
" param " << param
717 <<
" has coordinates " << newP <<
endl;
720 param += firstThickness *
Foam::pow(thicknessRatio[seI], pI);
748 <<
" has new points "
752 Pout <<
"Point " << i <<
" on edge ha coordinates "
760 Info <<
"Finished generating vertices at split edges" <<
endl;
scalar globalThicknessRatio_
global thickness ratio
VRWGraph splitEdgesAtPoint_
split edges at point
const labelList & bp() const
const polyMeshGenAddressing & addressingData() const
addressing which may be needed
A class for handling words, derived from string.
const VRWGraph & pointEdges() const
const meshSurfaceEngine & surfaceEngine() const
Return reference to meshSurfaceEngine.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
bool is2DMesh_
a flag whether a 2D mesh generation is active or not
#define forAll(list, i)
Loop across all elements in list.
LongList< edge > splitEdges_
a list of edges which shall be refined
A List obtained as a section of another List.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
void clear()
Clear the list, i.e. set next free to zero.
std::map< word, scalar > maxThicknessForPatch_
local maximum layer thickness for selected patches
std::map< word, label > numLayersForPatch_
number of boundary layers for user-selected patches
static bool & parRun()
Is this a parallel run?
std::map< word, scalar > thicknessRatioForPatch_
local thickness ratio for selected patches
const VRWGraph & pointFaces() const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void generateNewVertices()
generate new points on edges, faces and in cells
const labelList & boundaryFacePatches() const
patch label for each boundary face
const Type & first() const
Return first.
const labelLongList & globalEdgeLabel() const
const Map< label > & globalToLocalEdgeAddressing() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
const pointFieldPMG & points() const
access to points
label size() const
Size of the active part of the list.
std::set< word > discontinuousLayersForPatch_
allow discontinuous layers for patch
dimensioned< scalar > mag(const dimensioned< Type > &)
const boolList & zMinPoints() const
labelList nLayersAtBndFace_
label scalarLabel() const
return scalar label
const scalar & value() const
return the value
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const faceList::subList & boundaryFaces() const
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const edgeLongList & hairEdges() const
return hair edges found in the detection process
const Type & second() const
Return second.
List< DynList< label > > layerAtPatch_
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
#define forAllRow(graph, rowI, index)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const DynList< label > & edgeNeiProcs() const
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
const boolList & zMaxPoints() const
label globalNumLayers_
global number of boundary layers
const double e
Elementary charge.
const edgeList & edges() const
Return mesh edges.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
scalar globalMaxThicknessFirstLayer_
global maximum thickness of the first layer
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void setSize(const label)
Reset size of List.
bool analyseLayers()
analyse layers to check their topology
label start() const
Return start vertex label.
void reverseAddressing(const label nRows, const GraphType &origGraph)
An ordered pair of two objects of type <T> with first() and second() elements.
prefixOSstream Pout(cout, "Pout")
const PtrList< boundaryPatch > & boundaries() const
ordinary boundaries
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label)
Reset size of List.
List< DynList< word > > patchesInLayer_
which patches are part of a single layer
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
const VRWGraph & edgeAtProcs() const
A face is a list of labels corresponding to mesh vertices.
const labelList & faceInLayer() const
index of a layer to which a boundary faces belong to
void size(const label)
Override size to be inconsistent with allocated storage.
polyMeshGen & mesh_
Reference to the mesh.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Pair< label > labelPair
Label pair.
const polyMeshGen & mesh() const
VRWGraph newVerticesForSplitEdge_
new vertices for on edges which shall be refined
void setSizeAndRowSize(const ListType &)
Set the number of rows and the size of each row.
label positionOfEdgeInFace(const edge &e, const faceType &f)
return the position of edge in the face, -1 otherwise
dimensionedScalar pos(const dimensionedScalar &ds)
label nDistinctLayers() const
number of distinct layers which are at the boundary of the mesh