43 patchName_(patchName),
50 triCumulativeMagSf_(),
51 sumTriMagSf_(Pstream::nProcs() + 1, 0.0)
56 <<
"Requested patch " << patchName_ <<
" not found" <<
nl 67 patchName_(pib.patchName_),
68 patchId_(pib.patchId_),
69 patchArea_(pib.patchArea_),
70 patchNormal_(pib.patchNormal_),
71 cellOwners_(pib.cellOwners_),
72 triFace_(pib.triFace_),
73 triToFace_(pib.triToFace_),
74 triCumulativeMagSf_(pib.triCumulativeMagSf_),
75 sumTriMagSf_(pib.sumTriMagSf_)
101 triMagSf.append(0.0);
108 const face&
f = patch[facei];
114 triToFace.append(facei);
116 triMagSf.append(triEngine.
triPoints(i, f).mag(points));
130 for (
label i = 1; i < triMagSf.size(); i++)
132 triMagSf[i] += triMagSf[i-1];
200 const triPointRef tri(points[tf[0]], points[tf[1]], points[tf[2]]);
204 const scalar a = rnd.
scalarAB(0.1, 0.5);
215 if (tetFacei == -1 ||tetPti == -1)
222 if (tetFacei == -1 ||tetPti == -1)
234 for (
label teti=1; teti<cellTetIs.
size()-1; teti++)
238 + cellTetIs[teti].tet(mesh).mag()/V[cellOwner];
240 cTetVFrac.
last() = 1;
243 const scalar volFrac = rnd.
sample01<scalar>();
247 if (cTetVFrac[vfI] > volFrac)
253 position = cellTetIs[teti].tet(mesh).randomPoint(rnd);
254 tetFacei = cellTetIs[teti].face();
255 tetPti = cellTetIs[teti].tetPt();
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#define forAll(list, i)
Loop across all elements in list.
A triangle primitive used to calculate face areas and swept volumes.
labelList triToFace_
Addressing from per triangle to patch face.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
virtual void setPositionAndCell(const fvMesh &mesh, Random &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
scalar scalarAB(const scalar a, const scalar b)
Advance the state and return a scalar sample from a uniform.
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Traits class for primitives.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
label findPatchID(const word &patchName) const
Find patch index given a name.
patchInjectionBase(const polyMesh &mesh, const word &patchName)
Construct from mesh and patch name.
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
vectorList patchNormal_
Patch face normal directions.
Type sample01()
Advance the state and return a sample of a given type from a.
const labelUList & faceCells() const
Return face-cell addressing.
A class for handling words, derived from string.
A triangular face using a FixedList of labels corresponding to mesh vertices.
triFaceList triFace_
Decomposed patch faces as a list of triangles.
void findCellFacePt(const point &p, label &celli, label &tetFacei, label &tetPti) const
Find the cell, tetFacei and tetPti for point p.
scalarList sumTriMagSf_
Cumulative area fractions per processor.
wordList names() const
Return a list of patch names.
Base class for patch-based injection models.
const Field< PointType > & points() const
Return reference to global points.
const label patchId_
Patch ID.
scalar globalScalar01()
Advance the state and return a scalar sample from a uniform.
scalarList triCumulativeMagSf_
Cumulative triangle area per triangle face.
const vectorField & cellCentres() const
const vectorField::subField faceAreas() const
Return face areas.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
scalar patchArea_
Patch area - total across all processors.
const scalarField::subField magFaceAreas() const
Return face area magnitudes.
Triangulation of three-dimensional polygons.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing.
labelList cellOwners_
List of cell labels corresponding to injector positions.
void findTetFacePt(const label celli, const point &p, label &tetFacei, label &tetPti) const
Find the tetFacei and tetPti for point p in celli.
Point randomPoint(Random &rndGen) const
Return a random point on the triangle from a uniform.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
T & last()
Return the last element of the list.
const UList< triFace > & triPoints() const
Get the triangles' points.
virtual ~patchInjectionBase()
Destructor.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.