39 void Foam::volPointInterpolation::pushUntransformedData
47 const labelList& meshPoints = cpp.meshPoints();
49 const mapDistribute& slavesMap = gmd.globalCoPointSlavesMap();
52 List<Type> elems(slavesMap.constructSize());
55 elems[i] = pointData[meshPoints[i]];
66 elems[slavePoints[j]] = elems[i];
71 slavesMap.reverseDistribute(elems.size(), elems,
false);
76 pointData[meshPoints[i]] = elems[i];
82 void Foam::volPointInterpolation::addSeparated
84 GeometricField<Type, pointPatchField, pointMesh>& pf
89 Pout<<
"volPointInterpolation::addSeparated" <<
endl;
92 auto& pfi = pf.internalFieldRef();
93 auto& pfbf = pf.boundaryFieldRef();
101 refCast<coupledPointPatchField<Type>>
102 (pfbf[patchi]).initSwapAddSeparated
118 refCast<coupledPointPatchField<Type>>
119 (pfbf[patchi]).swapAddSeparated
132 const GeometricField<Type, fvPatchField, volMesh>& vf,
133 GeometricField<Type, pointPatchField, pointMesh>& pf
138 Pout<<
"volPointInterpolation::interpolateInternalField(" 139 <<
"const GeometricField<Type, fvPatchField, volMesh>&, " 140 <<
"GeometricField<Type, pointPatchField, pointMesh>&) : " 141 <<
"interpolating field " << vf.
name()
142 <<
" from cells to points " << pf.
name() <<
endl;
148 forAll(pointCells, pointi)
150 if (!isPatchPoint_[pointi])
153 const labelList& ppc = pointCells[pointi];
159 pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]];
169 const DimensionedField<Type, volMesh>& vf,
170 DimensionedField<Type, pointMesh>& pf
175 Pout<<
"volPointInterpolation::interpolateDimensionedInternalField(" 176 <<
"const DimensionedField<Type, volMesh>&, " 177 <<
"DimensionedField<Type, pointMesh>&) : " 178 <<
"interpolating field " << vf.
name() <<
" from cells to points " 182 const fvMesh&
mesh = vf.mesh();
194 forAll(pointCells, pointi)
196 const labelList& ppc = pointCells[pointi];
198 pf[pointi] = Type(
Zero);
202 label celli = ppc[pointCelli];
203 scalar pw = 1.0/
mag(
points[pointi] - cellCentres[celli]);
205 pf[pointi] += pw*vf[celli];
217 scalar
s = sumW[pointi];
229 const GeometricField<Type, fvPatchField, volMesh>& vf
232 const fvMesh&
mesh = vf.mesh();
235 tmp<Field<Type>> tboundaryVals
239 Field<Type>& boundaryVals = tboundaryVals.ref();
241 forAll(vf.boundaryField(), patchi)
247 !isA<emptyFvPatch>(bm[patchi])
248 && !vf.boundaryField()[patchi].coupled()
254 vf.boundaryField()[patchi].size(),
256 ) = vf.boundaryField()[patchi];
260 const polyPatch& pp = bm[patchi].patch();
264 boundaryVals[bFacei++] =
Zero;
269 return tboundaryVals;
296 label pointi =
mp[i];
298 if (isPatchPoint_[pointi])
301 const scalarList& pWeights = boundaryPointWeights_[i];
303 Type& val = pfi[pointi];
308 if (boundaryIsPatchFace_[
pFaces[j]])
310 val += pWeights[j]*boundaryVals[
pFaces[j]];
323 if (normalisationPtr_)
325 const scalarField& normalisation = normalisationPtr_();
328 pfi[
mp[i]] *= normalisation[i];
336 pushUntransformedData(pfi);
345 const bool overrideFixedValue
348 interpolateBoundaryField(vf, pf);
366 Pout<<
"volPointInterpolation::interpolate(" 367 <<
"const GeometricField<Type, fvPatchField, volMesh>&, " 368 <<
"GeometricField<Type, pointPatchField, pointMesh>&) : " 369 <<
"interpolating field " << vf.
name() <<
" from cells to points " 373 interpolateInternalField(vf, pf);
376 interpolateBoundaryField(vf, pf,
false);
395 "volPointInterpolate(" + vf.
name() +
')',
404 interpolateInternalField(vf, tpf.ref());
407 interpolateBoundaryField(vf, tpf.ref(),
true);
443 PointFieldType* pfPtr =
444 db.objectRegistry::template getObjectPtr<PointFieldType>(
name);
446 if (!cache || vf.
mesh().changing())
449 if (pfPtr && pfPtr->ownedByRegistry())
482 PointFieldType& pf = *pfPtr;
540 PointFieldType* pfPtr =
541 db.objectRegistry::template getObjectPtr<PointFieldType>(
name);
543 if (!cache || vf.
mesh().changing())
546 if (pfPtr && pfPtr->ownedByRegistry())
564 interpolateDimensionedInternalField(vf, tpf.ref());
579 PointFieldType& pf = *pfPtr;
588 interpolateDimensionedInternalField(vf, pf);
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
List< labelList > labelListList
A List of labelList.
tmp< GeometricField< Type, pointPatchField, pointMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
Interpolate volField using inverse distance weighting.
void size(const label n)
Older name for setAddressableSize.
void interpolateBoundaryField(const GeometricField< Type, fvPatchField, volMesh > &vf, GeometricField< Type, pointPatchField, pointMesh > &pf) const
Interpolate boundary field without applying constraints/boundary.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const word & name() const noexcept
Return the object name.
static const pointConstraints & New(const pointMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
static label nRequests() noexcept
Number of outstanding requests.
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool store()
Register object with its registry and transfer ownership to the registry.
Generic GeometricField class.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
virtual const pointField & points() const
Return raw points.
Mesh representing a set of points created from polyMesh.
#define forAll(list, i)
Loop across all elements in list.
Application of (multi-)patch point constraints.
A list of faces which address into the list of points.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Generic templated field type.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static void syncUntransformedData(const polyMesh &mesh, List< Type > &pointData, const CombineOp &cop)
Helper: sync data on collocated points only.
List< scalar > scalarList
A List of scalars.
const objectRegistry & thisDb() const
Return database. For now is its polyMesh.
const globalMeshData & globalData() const
Return parallel info.
void interpolateInternalField(const GeometricField< Type, fvPatchField, volMesh > &, GeometricField< Type, pointPatchField, pointMesh > &) const
Interpolate internal field from volField to pointField.
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
const labelListList & pointCells() const
const Mesh & mesh() const noexcept
Return mesh.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
int debug
Static debugging option.
void interpolateDimensionedInternalField(const DimensionedField< Type, volMesh > &vf, DimensionedField< Type, pointMesh > &pf) const
Interpolate dimensioned internal field from cells to points.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
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 fileName & instance() const noexcept
Read access to instance path component.
const fvMesh & mesh() const
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
"nonBlocking" : (MPI_Isend, MPI_Irecv)
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
A class for managing temporary objects.
Registry of regIOobjects.
static void cachePrintMessage(const char *message, const word &name, const FieldType &vf)
Helper for printing cache message.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Defines the attributes of an object for which implicit objectRegistry management is supported...
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const dimensionedScalar mp
Proton mass.
const dimensionSet & dimensions() const noexcept
Return dimensions.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
static constexpr const zero Zero
Global zero (0)