47bool 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>());
66void Foam::volPointInterpolation::calcBoundaryAddressing()
70 Pout<<
"volPointInterpolation::calcBoundaryAddressing() : "
71 <<
"constructing boundary addressing"
82 mesh().nBoundaryFaces(),
83 mesh().nInternalFaces()
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;
170void Foam::volPointInterpolation::makeInternalWeights(
scalarField& sumWeights)
174 Pout<<
"volPointInterpolation::makeInternalWeights() : "
175 <<
"constructing weighting factors for internal and non-coupled"
176 <<
" points." <<
endl;
184 pointWeights_.
clear();
191 if (!isPatchPoint_[pointi])
193 const labelList& pcp = pointCells[pointi];
201 1.0/
mag(
points[pointi] - cellCentres[pcp[pointCelli]]);
203 sumWeights[pointi] += pw[pointCelli];
210void 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];
258void 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];
350void 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);
456 normalisationPtr_.ref() /=
scalarField(sumWeights, mp);
460 normalisationPtr_.clear();
466 Pout<<
"volPointInterpolation::makeWeights() : "
467 <<
"finished constructing weighting factors"
515 interpolateInternalField(vf, pf);
518 interpolateBoundaryField(vf, pf);
const Mesh & mesh() const
Return mesh.
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
const fileName & instance() const noexcept
Read access to instance path component.
void setSize(const label n)
Alias for resize()
void clear()
Clear the list, i.e. set size to zero.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
virtual const fileName & name() const
Get the name of the stream.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
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.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void updateMesh()
Update for new mesh topology.
Application of (multi-)patch point constraints.
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.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
const vectorField & faceCentres() const
const labelListList & pointCells() const
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
Interpolate from cell centres to points (vertices) using inverse distance weighting.
bool movePoints()
Correct weighting factors for moving mesh.
~volPointInterpolation()
Destructor.
void interpolateDisplacement(const volVectorField &, pointVectorField &) const
Interpolate from volField to pointField.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const dimensionedScalar mp
Proton mass.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimless
Dimensionless.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
List< scalar > scalarList
A List of scalars.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< labelList > labelListList
A List of labelList.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
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];} 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]
#define forAll(list, i)
Loop across all elements in list.