47bool Foam::volPointInterpolation::hasSeparated(
const pointMesh& pMesh)
49 const pointBoundaryMesh&
pbm = pMesh.boundary();
51 bool hasSpecial =
false;
52 for (
const auto&
pp :
pbm)
65void Foam::volPointInterpolation::calcBoundaryAddressing()
69 Pout<<
"volPointInterpolation::calcBoundaryAddressing() : "
70 <<
"constructing boundary addressing"
77 const auto&
boundary = *boundaryPtr_;
80 boundaryIsPatchFace_ =
false;
98 && !magSf.boundaryField()[patchi].coupled()
103 for (
const auto&
f :
pp.faces())
120 isPatchPoint_.reset();
122 isPatchPoint_.assign(isPatchPoint);
126 label nPatchFace = boundaryIsPatchFace_.count();
127 label nPatchPoint = isPatchPoint_.count();
131 <<
" of which on proper patch:" << nPatchFace <<
nl
133 <<
" of which on proper patch:" << nPatchPoint <<
endl;
138void Foam::volPointInterpolation::makeInternalWeights(
scalarField& sumWeights)
142 Pout<<
"volPointInterpolation::makeInternalWeights() : "
143 <<
"constructing weighting factors for internal and non-coupled"
144 <<
" points." <<
endl;
152 pointWeights_.
clear();
159 if (!isPatchPoint_[pointi])
164 pw.setSize(pcp.size());
169 1.0/
mag(
points[pointi] - cellCentres[pcp[pointCelli]]);
171 sumWeights[pointi] += pw[pointCelli];
178void Foam::volPointInterpolation::makeBoundaryWeights(
scalarField& sumWeights)
182 Pout<<
"volPointInterpolation::makeBoundaryWeights() : "
183 <<
"constructing weighting factors for boundary points." <<
endl;
191 boundaryPointWeights_.clear();
192 boundaryPointWeights_.setSize(
boundary.meshPoints().
size());
196 label pointi =
boundary.meshPoints()[i];
198 if (isPatchPoint_[pointi])
203 pw.setSize(
pFaces.size());
205 sumWeights[pointi] = 0.0;
209 if (boundaryIsPatchFace_[
pFaces[i]])
213 pw[i] = 1.0/
mag(
points[pointi] - faceCentres[facei]);
214 sumWeights[pointi] += pw[i];
226void Foam::volPointInterpolation::interpolateOne
234 Pout<<
"volPointInterpolation::interpolateOne("
235 <<
"pointScalarField&) : "
236 <<
"interpolating oneField"
237 <<
" from cells to BOUNDARY points "
238 << pf.name() <<
endl;
250 const label pointi =
mp[i];
251 if (!isPatchPoint_[pointi])
255 scalar& val = pfi[pointi];
260 val += pw[pointCelli];
271 const label pointi =
mp[i];
273 if (isPatchPoint_[pointi])
276 const scalarList& pWeights = boundaryPointWeights_[i];
278 scalar& val = pfi[pointi];
283 if (boundaryIsPatchFace_[
pFaces[j]])
305 const scalarField& normalisation = tnormalisation();
308 pfi[
mp[i]] *= normalisation[i];
318void Foam::volPointInterpolation::makeWeights()
322 Pout<<
"volPointInterpolation::makeWeights() : "
323 <<
"constructing weighting factors"
330 calcBoundaryAddressing();
340 "volPointSumWeights",
352 makeInternalWeights(sumWeights);
356 makeBoundaryWeights(sumWeights);
373 addSeparated(sumWeights);
380 pushUntransformedData(sumWeights);
384 forAll(pointWeights_, pointi)
390 pw[i] /= sumWeights[pointi];
397 const label pointi =
mp[i];
403 pw[i] /= sumWeights[pointi];
413 Pout<<
"volPointInterpolation::makeWeights() : "
414 <<
"detected separated coupled patches"
415 <<
" - allocating normalisation" <<
endl;
423 normalisationPtr_.ref() = scalar(1.0);
424 normalisationPtr_.ref() /=
scalarField(sumWeights, mp);
428 normalisationPtr_.clear();
434 Pout<<
"volPointInterpolation::makeWeights() : "
435 <<
"finished constructing weighting factors"
443Foam::volPointInterpolation::volPointInterpolation(
const fvMesh& vm)
446 hasSeparated_(hasSeparated(pointMesh::
New(vm)))
483 interpolateInternalField(vf, pf);
486 interpolateBoundaryField(vf, pf);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
const Mesh & mesh() const noexcept
Return const reference to mesh.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const fileName & instance() const noexcept
Read access to instance path component.
label size() const noexcept
The number of elements in the list.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void clear()
Clear the list, i.e. set size to zero.
static FOAM_NO_DANGLING_REFERENCE const pointConstraints & New(const pointMesh &mesh, Args &&... args)
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
Mesh data needed to do the Finite Volume discretisation.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
A range or interval of labels defined by a start and a size.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Smooth ATC in cells having a point to a set of patches supplied by type.
Application of (multi-)patch point constraints.
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
static void syncUntransformedData(const polyMesh &mesh, List< Type > &pointData, const CombineOp &cop)
Helper: sync data on collocated points only.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Mesh representing a set of points created from polyMesh.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
const faceList::subList faces() const
Return mesh faces for the entire boundary.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
const vectorField & faceCentres() const
const labelListList & pointCells() const
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
A class for managing temporary objects.
Interpolate from cell centres to points (vertices) using inverse distance weighting.
bool movePoints()
Correct weighting factors for moving mesh.
void interpolateBoundaryField(const GeometricField< Type, fvPatchField, volMesh > &vf, GeometricField< Type, pointPatchField, pointMesh > &pf) const
Interpolate boundary field without applying constraints/boundary.
void interpolateInternalField(const GeometricField< Type, fvPatchField, volMesh > &, GeometricField< Type, pointPatchField, pointMesh > &) const
Interpolate internal field from volField to pointField.
~volPointInterpolation()
Destructor.
void interpolateDisplacement(const volVectorField &, pointVectorField &) const
Interpolate from volField to pointField.
void updateMesh(const mapPolyMesh &)
Update mesh topology using the morph engine.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const dimensionedScalar mp
Proton mass.
Namespace for handling debugging switches.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
List< labelList > labelListList
List of labelList.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
List< label > labelList
A List of labels.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
bool isType(const U &obj)
Check if typeid of the object and Type are identical.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
List< scalar > scalarList
List of scalar.
constexpr char nl
The newline '\n' character (0x0a).
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];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } 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};constexpr 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< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.