Go to the documentation of this file.
51 const label baseFaceI,
57 const cell&
c = mesh_.cells()[cellI];
67 if(
c[fI] == baseFaceI )
72 const face&
f = faces[
c[fI]];
77 const edge e =
f.faceEdge(eI);
89 faceEdges[fI][eI] =
pos;
93 const face& bf = faces[
c[baseFace]];
98 const label nextEdge = faceEdges[baseFace][pI];
99 const label prevEdge = faceEdges[baseFace][bf.rcIndex(pI)];
101 if( edgeFaces[nextEdge].size() != 2 || edgeFaces[prevEdge].size() != 2 )
105 label otherNextFace = edgeFaces[nextEdge][0];
106 if( otherNextFace == baseFace )
107 otherNextFace = edgeFaces[nextEdge][1];
110 label otherPrevFace = edgeFaces[prevEdge][0];
111 if( otherPrevFace == baseFace )
112 otherPrevFace = edgeFaces[prevEdge][1];
115 for(commonEdge=0;commonEdge<edges.
size();++commonEdge)
117 edgeFaces[commonEdge].contains(otherNextFace) &&
118 edgeFaces[commonEdge].contains(otherPrevFace)
122 if( commonEdge == edges.
size() )
126 if( edges[commonEdge].start() == bf[pI] )
128 hairEdges[pI] = edges[commonEdge];
132 hairEdges[pI] = edges[commonEdge].reverseEdge();
146 const edge&
he = hairEdges_[heI];
147 const edge& nhe = hairEdges_[heJ];
152 const vector dv = ep - sp;
153 const scalar magDv =
mag(dv);
156 const scalar currThickness =
he.mag(
points);
157 scalar retThickness = currThickness;
159 const scalar currNeiThickness = nhe.mag(
points);
160 scalar suggestedNeiThickness = currNeiThickness;
164 const scalar currHeight =
mag(npAlpha -
points[
he[1]]);
165 scalar retHeight = currHeight;
166 const scalar cosAlpha =
sign((npAlpha - sp) & dv) *
mag(npAlpha - sp);
173 Foam::min(1.0, cosAlpha / (currThickness + VSMALL))
180 const scalar currNeiHeight =
mag(npBeta -
points[nhe[1]]);
181 scalar suggestedNeiHeight = currNeiHeight;
182 const scalar cosBeta =
sign((npBeta - ep) & -dv) *
mag(npBeta - ep);
189 Foam::min(1.0, cosBeta / (currNeiThickness + VSMALL))
196 const scalar gamma = M_PI - (
alpha +
beta);
206 featureSizeFactor_ * magDv * sinBeta / sinGamma
208 retHeight *= (retThickness / (currThickness + VSMALL));
212 suggestedNeiThickness =
215 suggestedNeiThickness,
216 featureSizeFactor_ * magDv * sinAlpha / sinGamma
218 suggestedNeiHeight *=
219 (suggestedNeiThickness / (currNeiThickness + VSMALL));
223 const scalar tanVal = (retHeight - suggestedNeiHeight) / (magDv + VSMALL);
225 if( tanVal > relThicknessTol_ )
227 retHeight = suggestedNeiHeight + relThicknessTol_ * magDv;
229 retThickness = (retHeight / currHeight) * currThickness;
239 const label baseFaceI
245 const cell&
c = mesh_.cells()[cellI];
247 const face& bf = faces[baseFaceI];
249 const edge&
he = hairEdges_[heI];
254 scalar maxThickness =
he.mag(
points);
264 if(
c[fI] == baseFaceI )
267 const face&
f = faces[
c[fI]];
297 const label start = mesh_.nInternalFaces();
304 # pragma omp parallel for schedule(dynamic, 50)
306 forAll(hairEdges_, hairEdgeI)
310 hairLength[hairEdgeI] = (
Foam::mag(
n) + VSMALL);
311 hairDirections[hairEdgeI] =
n / hairLength[hairEdgeI];
319 boolList activeHairEdge(hairEdges_.size(),
true);
326 boolList modifiedHairEdge(hairEdges_.size(),
false);
327 boolList influencedEdges(hairEdges_.size(),
false);
332 # pragma omp parallel for schedule(dynamic, 50)
334 forAll(hairEdges_, hairEdgeI)
338 (hairEdgeType_[hairEdgeI] & edgeType) &&
339 activeHairEdge[hairEdgeI]
342 const edge&
he = hairEdges_[hairEdgeI];
344 const label bpI = bp[
he.start()];
346 scalar maxThickness = hairLength[hairEdgeI];
354 const face& bf = bFaces[bfI];
358 const label baseFaceI = start + bfI;
359 const label cOwn = faceOwner[bfI];
366 calculateThicknessOverCell
376 hairEdgesAtBndFace(faceOwner[bfI], baseFaceI, hairEdges);
380 const edge& nhe = hairEdges[pI];
384 forAllRow(hairEdgesAtBndPoint_, bpJ, peJ)
386 const label heJ = hairEdgesAtBndPoint_(bpJ, peJ);
388 if( hairEdgeI == heJ )
391 if( nhe == hairEdges_[heJ] )
395 const scalar edgeThickness =
396 calculateThickness(hairEdgeI, heJ);
405 if( hairLength[hairEdgeI] > maxThickness )
408 hairLength[hairEdgeI] = maxThickness;
409 modifiedHairEdge[hairEdgeI] =
true;
412 thinnedHairEdge_[hairEdgeI] =
true;
415 influencedEdges[influencers[i]] =
true;
472 const edgeList& edges = mesh_.addressingData().edges();
473 const VRWGraph& pointEdges = mesh_.addressingData().pointEdges();
475 mesh_.addressingData().edgeAtProcs();
477 mesh_.addressingData().globalEdgeLabel();
479 mesh_.addressingData().globalToLocalEdgeAddressing();
481 mesh_.addressingData().edgeNeiProcs();
483 std::map<label, LongList<labelledScalar> > exchangeData;
485 exchangeData[eNeiProcs[i]].clear();
489 const label bpI = it();
493 const label hairEdgeI = hairEdgesAtBndPoint_(bpI, i);
495 if( !(hairEdgeType_[hairEdgeI] & edgeType) )
498 const edge&
he = hairEdges_[hairEdgeI];
502 const label edgeI = pointEdges(
he.start(), peI);
504 if(
he == edges[edgeI] )
508 globalEdgeLabel[edgeI],
509 hairLength[hairEdgeI]
514 const label neiProc = edgesAtProcs(edgeI, j);
520 exchangeData[neiProc];
536 const edge&
e = edges[edgeI];
539 for(
label pI=0;pI<2;++pI)
541 const label bpI = bp[
e[pI]];
548 const label hairEdgeI = hairEdgesAtBndPoint_(bpI, i);
550 if( hairEdges_[hairEdgeI] ==
e )
552 if( lScalar.
value() < hairLength[hairEdgeI] )
554 hairLength[hairEdgeI] = lScalar.
value();
556 thinnedHairEdge_[hairEdgeI] =
true;
557 modifiedHairEdge[hairEdgeI] =
true;
579 # pragma omp parallel for schedule(dynamic, 100)
581 forAll(hairEdges_, hairEdgeI)
583 if( hairEdgeType_[hairEdgeI] & edgeType )
585 const edge&
he = hairEdges_[hairEdgeI];
586 const vector& hv = hairDirections[hairEdgeI];
589 points[
he.end()] =
s + hairLength[hairEdgeI] * hv;
594 activeHairEdge.
transfer(influencedEdges);
595 }
while( changed && (++nIter < 1000) );
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
const labelList & bp() const
void append(const T &e)
Append an element at the end of the list.
point nearestPointOnTheEdge(const point &edgePoint0, const point &edgePoint1, const point &p)
find the vertex on the line of the edge nearest to the point p
#define forAll(list, i)
Loop across all elements in list.
Template functions to aid in the implementation of demand driven data.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
dimensionedScalar sin(const dimensionedScalar &ds)
A List obtained as a section of another List.
edge faceEdge(const label n) const
Return n-th face edge.
static bool & parRun()
Is this a parallel run?
const VRWGraph & pointFaces() const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
bool lineFaceIntersection(const point &, const point &, const face &, const pointField &fp, point &intersection)
check if the line and the face intersect
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensionedScalar sign(const dimensionedScalar &ds)
label scalarLabel() const
return scalar label
label which(const label globalIndex) const
Navigation through face vertices.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void hairEdgesAtBndFace(const label cellI, const label baseFaceI, DynList< edge > &) const
calculate hair edges at a boundary faces
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
scalar calculateThickness(const label heI, const label heJ) const
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.
Pre-declare SubField and related Field type.
#define forAllRow(graph, rowI, index)
const double e
Elementary charge.
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))
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
label containsAtPosition(const T &e) const
void optimiseThicknessVariation(const direction edgeType=(INSIDE|BOUNDARY))
optimise thickness variation
scalar calculateThicknessOverCell(const label heI, const label cellI, const label baseFaceI) const
label start() const
Return start vertex label.
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.
dimensionedScalar acos(const dimensionedScalar &ds)
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
const dimensionedScalar c
Speed of light in a vacuum.
A face is a list of labels corresponding to mesh vertices.
const Map< label > & globalToLocalBndPointAddressing() const
global point label to local label. Only for processors points
void size(const label)
Override size to be inconsistent with allocated storage.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
A cell is defined as a list of faces with extra functionality.
bool shareAnEdge(const faceType1 &f1, const faceType2 &f2)
check if two faces share an edge
void append(const T &e)
Append an element at the end of the list.
const labelList & faceOwners() const
dimensionedScalar pos(const dimensionedScalar &ds)