Go to the documentation of this file.
47 bool Foam::volPointInterpolation::hasSeparated(
const pointMesh& pMesh)
49 const pointBoundaryMesh& pbm = pMesh.boundary();
51 bool hasSpecial =
false;
52 for (
const auto& pp : pbm)
54 if (isA<coupledFacePointPatch>(pp) && !isType<processorPointPatch>(pp))
61 reduce(hasSpecial, orOp<bool>());
66 void Foam::volPointInterpolation::calcBoundaryAddressing()
70 Pout<<
"volPointInterpolation::calcBoundaryAddressing() : "
71 <<
"constructing boundary addressing"
82 mesh().nBoundaryFaces(),
83 mesh().nInternalFaces()
90 boundaryIsPatchFace_.setSize(
boundary.size());
91 boundaryIsPatchFace_ =
false;
106 const polyPatch& pp = pbm[patchi];
110 !isA<emptyPolyPatch>(pp)
111 && !magSf.boundaryField()[patchi].coupled()
118 boundaryIsPatchFace_[bFacei] =
true;
124 isPatchPoint[
f[fp]] =
true;
141 isPatchPoint_.assign(isPatchPoint);
145 label nPatchFace = 0;
146 forAll(boundaryIsPatchFace_, i)
148 if (boundaryIsPatchFace_[i])
153 label nPatchPoint = 0;
156 if (isPatchPoint_[i])
163 <<
" of which on proper patch:" << nPatchFace <<
nl
165 <<
" of which on proper patch:" << nPatchPoint <<
endl;
170 void Foam::volPointInterpolation::makeInternalWeights(
scalarField& sumWeights)
174 Pout<<
"volPointInterpolation::makeInternalWeights() : "
175 <<
"constructing weighting factors for internal and non-coupled"
176 <<
" points." <<
endl;
184 pointWeights_.clear();
185 pointWeights_.setSize(
points.size());
191 if (!isPatchPoint_[pointi])
193 const labelList& pcp = pointCells[pointi];
201 1.0/
mag(
points[pointi] - cellCentres[pcp[pointCelli]]);
203 sumWeights[pointi] += pw[pointCelli];
210 void Foam::volPointInterpolation::makeBoundaryWeights(
scalarField& sumWeights)
214 Pout<<
"volPointInterpolation::makeBoundaryWeights() : "
215 <<
"constructing weighting factors for boundary points." <<
endl;
223 boundaryPointWeights_.clear();
224 boundaryPointWeights_.setSize(
boundary.meshPoints().size());
228 label pointi =
boundary.meshPoints()[i];
230 if (isPatchPoint_[pointi])
237 sumWeights[pointi] = 0.0;
241 if (boundaryIsPatchFace_[
pFaces[i]])
245 pw[i] = 1.0/
mag(
points[pointi] - faceCentres[facei]);
246 sumWeights[pointi] += pw[i];
258 void Foam::volPointInterpolation::interpolateOne
260 const tmp<scalarField>& tnormalisation,
266 Pout<<
"volPointInterpolation::interpolateOne("
267 <<
"pointScalarField&) : "
268 <<
"interpolating oneField"
269 <<
" from cells to BOUNDARY points "
275 Field<scalar>& pfi = pf.primitiveFieldRef();
282 const label pointi =
mp[i];
283 if (!isPatchPoint_[pointi])
287 scalar& val = pfi[pointi];
292 val += pw[pointCelli];
303 const label pointi =
mp[i];
305 if (isPatchPoint_[pointi])
308 const scalarList& pWeights = boundaryPointWeights_[i];
310 scalar& val = pfi[pointi];
315 if (boundaryIsPatchFace_[
pFaces[j]])
337 const scalarField& normalisation = tnormalisation();
340 pfi[
mp[i]] *= normalisation[i];
350 void Foam::volPointInterpolation::makeWeights()
354 Pout<<
"volPointInterpolation::makeWeights() : "
355 <<
"constructing weighting factors"
362 calcBoundaryAddressing();
366 tmp<pointScalarField> tsumWeights
372 "volPointSumWeights",
384 makeInternalWeights(sumWeights);
388 makeBoundaryWeights(sumWeights);
405 addSeparated(sumWeights);
412 pushUntransformedData(sumWeights);
416 forAll(pointWeights_, pointi)
422 pw[i] /= sumWeights[pointi];
429 const label pointi =
mp[i];
435 pw[i] /= sumWeights[pointi];
445 Pout<<
"volPointInterpolation::makeWeights() : "
446 <<
"detected separated coupled patches"
447 <<
" - allocating normalisation" <<
endl;
451 interpolateOne(tmp<scalarField>(), sumWeights);
455 normalisationPtr_.ref() = scalar(1.0);
460 normalisationPtr_.clear();
466 Pout<<
"volPointInterpolation::makeWeights() : "
467 <<
"finished constructing weighting factors"
475 Foam::volPointInterpolation::volPointInterpolation(
const fvMesh& vm)
515 interpolateInternalField(vf, pf);
518 interpolateBoundaryField(vf, pf);
int debug
Static debugging option.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Return raw points.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< scalar > scalarList
A List of scalars.
const dimensionedScalar mp
Proton mass.
const fileName & instance() const noexcept
static constexpr const zero Zero
Global zero (0)
static const pointConstraints & New(const pointMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
List< bool > boolList
A List of bools.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
void updateMesh(const mapPolyMesh &)
Update mesh topology using the morph engine.
#define forAll(list, i)
Loop across all elements in list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
virtual const fileName & name() const
Get the name of the stream.
void setSize(const label n)
Alias for resize()
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
Mesh representing a set of points created from polyMesh.
~volPointInterpolation()
Destructor.
Application of (multi-)patch point constraints.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
List< labelList > labelListList
A List of labelList.
const vectorField & cellCentres() const
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
static void syncUntransformedData(const polyMesh &mesh, List< Type > &pointData, const CombineOp &cop)
Helper: sync data on collocated points only.
label nInternalFaces() const noexcept
Number of internal faces.
bool movePoints()
Correct weighting factors for moving mesh.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const vectorField & faceCentres() const
const labelListList & pointCells() const
void interpolateDisplacement(const volVectorField &, pointVectorField &) const
Interpolate from volField to pointField.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
defineTypeNameAndDebug(combustionModel, 0)
Interpolate from cell centres to points (vertices) using inverse distance weighting.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::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].reset(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]
const dimensionSet dimless
Dimensionless.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField