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))
65 void Foam::volPointInterpolation::calcBoundaryAddressing()
69 Pout<<
"volPointInterpolation::calcBoundaryAddressing() : " 70 <<
"constructing boundary addressing" 81 mesh().nBoundaryFaces(),
82 mesh().nInternalFaces()
90 boundaryIsPatchFace_ =
false;
105 const polyPatch&
pp =
pbm[patchi];
109 !isA<emptyPolyPatch>(
pp)
110 && !magSf.boundaryField()[patchi].coupled()
117 boundaryIsPatchFace_[bFacei] =
true;
123 isPatchPoint[
f[fp]] =
true;
140 isPatchPoint_.assign(isPatchPoint);
144 label nPatchFace = 0;
145 forAll(boundaryIsPatchFace_, i)
147 if (boundaryIsPatchFace_[i])
152 label nPatchPoint = 0;
155 if (isPatchPoint_[i])
162 <<
" of which on proper patch:" << nPatchFace <<
nl 164 <<
" of which on proper patch:" << nPatchPoint <<
endl;
169 void Foam::volPointInterpolation::makeInternalWeights(
scalarField& sumWeights)
173 Pout<<
"volPointInterpolation::makeInternalWeights() : " 174 <<
"constructing weighting factors for internal and non-coupled" 175 <<
" points." <<
endl;
183 pointWeights_.
clear();
190 if (!isPatchPoint_[pointi])
192 const labelList& pcp = pointCells[pointi];
200 1.0/
mag(
points[pointi] - cellCentres[pcp[pointCelli]]);
202 sumWeights[pointi] += pw[pointCelli];
209 void Foam::volPointInterpolation::makeBoundaryWeights(
scalarField& sumWeights)
213 Pout<<
"volPointInterpolation::makeBoundaryWeights() : " 214 <<
"constructing weighting factors for boundary points." <<
endl;
222 boundaryPointWeights_.clear();
223 boundaryPointWeights_.setSize(
boundary.meshPoints().
size());
227 label pointi =
boundary.meshPoints()[i];
229 if (isPatchPoint_[pointi])
236 sumWeights[pointi] = 0.0;
240 if (boundaryIsPatchFace_[
pFaces[i]])
244 pw[i] = 1.0/
mag(
points[pointi] - faceCentres[facei]);
245 sumWeights[pointi] += pw[i];
257 void Foam::volPointInterpolation::interpolateOne
259 const tmp<scalarField>& tnormalisation,
265 Pout<<
"volPointInterpolation::interpolateOne(" 266 <<
"pointScalarField&) : " 267 <<
"interpolating oneField" 268 <<
" from cells to BOUNDARY points " 274 Field<scalar>& pfi = pf.primitiveFieldRef();
281 const label pointi =
mp[i];
282 if (!isPatchPoint_[pointi])
286 scalar& val = pfi[pointi];
291 val += pw[pointCelli];
302 const label pointi =
mp[i];
304 if (isPatchPoint_[pointi])
307 const scalarList& pWeights = boundaryPointWeights_[i];
309 scalar& val = pfi[pointi];
314 if (boundaryIsPatchFace_[
pFaces[j]])
336 const scalarField& normalisation = tnormalisation();
339 pfi[
mp[i]] *= normalisation[i];
349 void Foam::volPointInterpolation::makeWeights()
353 Pout<<
"volPointInterpolation::makeWeights() : " 354 <<
"constructing weighting factors" 361 calcBoundaryAddressing();
365 tmp<pointScalarField> tsumWeights
371 "volPointSumWeights",
383 makeInternalWeights(sumWeights);
387 makeBoundaryWeights(sumWeights);
404 addSeparated(sumWeights);
411 pushUntransformedData(sumWeights);
415 forAll(pointWeights_, pointi)
421 pw[i] /= sumWeights[pointi];
428 const label pointi =
mp[i];
434 pw[i] /= sumWeights[pointi];
444 Pout<<
"volPointInterpolation::makeWeights() : " 445 <<
"detected separated coupled patches" 446 <<
" - allocating normalisation" <<
endl;
450 interpolateOne(tmp<scalarField>(), sumWeights);
454 normalisationPtr_.ref() = scalar(1.0);
459 normalisationPtr_.clear();
465 Pout<<
"volPointInterpolation::makeWeights() : " 466 <<
"finished constructing weighting factors" 474 Foam::volPointInterpolation::volPointInterpolation(
const fvMesh& vm)
476 MeshObject<fvMesh,
Foam::UpdateableMeshObject, volPointInterpolation>(vm),
477 hasSeparated_(hasSeparated(pointMesh::
New(vm)))
514 interpolateInternalField(vf, pf);
517 interpolateBoundaryField(vf, pf);
List< scalar > scalarList
List of scalar.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
void updateMesh(const mapPolyMesh &)
Update mesh topology using the morph engine.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static const pointConstraints & New(const pointMesh &mesh, Args &&... args)
Get existing or create a new MeshObject. Registered with typeName.
constexpr char nl
The newline '\n' character (0x0a)
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
const dimensionSet dimless
Dimensionless.
List< labelList > labelListList
List of labelList.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
Application of (multi-)patch point constraints.
vectorField pointField
pointField is a vectorField.
void setSize(const label n)
Alias for resize()
void clear()
Clear the list, i.e. set size to zero.
~volPointInterpolation()
Destructor.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
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.
label nInternalFaces() const noexcept
Number of internal faces.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
const vectorField & cellCentres() const
const labelListList & pointCells() const
const Mesh & mesh() const noexcept
Return mesh.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
void interpolateDisplacement(const volVectorField &, pointVectorField &) const
Interpolate from volField to pointField.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field...
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 vectorField & faceCentres() const
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
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.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< bool > boolList
A List of bools.
bool movePoints()
Correct weighting factors for moving mesh.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const dimensionedScalar mp
Proton mass.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)