46 void Foam::volPointInterpolation::makeWeights()
50 Pout<<
"volPointInterpolation::makeWeights() : "
51 <<
"constructing weighting factors"
68 mesh().nFaces() -
mesh().nInternalFaces(),
69 mesh().nInternalFaces()
77 pointWeights_.
clear();
79 boundaryPointWeights_.clear();
80 boundaryPointWeights_.setSize(
boundary.meshPoints().size());
81 boundaryPointNbrWeights_.clear();
82 boundaryPointNbrWeights_.setSize(
boundary.meshPoints().size());
85 boolList isCoupledPolyPatch(pbm.size(),
false);
86 boolList isCoupledFvPatch(fvbm.size(),
false);
106 const label patchFacei = pbm.patchFaceID()[
pFaces[pPointFacei]];
114 scalar nonCoupledMagSf = 0;
119 !isCoupledPolyPatch[
patches[i]]
120 && !isCoupledFvPatch[
patches[i]]
123 nonCoupledMagSf += fvbm[
patches[i]].magSf()[patchFaces[i]];
127 pointBoundaryFactor[pointi] =
130 pointBoundaryFactor[pointi],
131 nonCoupledMagSf/pbm[
patchi].magFaceAreas()[patchFacei]
147 if (pointBoundaryFactor[pointi] > 1 - rootSmall)
continue;
149 pointWeights_[pointi].
setSize(pointCells[pointi].size());
151 const scalar
f = pointBoundaryFactor[pointi];
153 forAll(pointCells[pointi], pointCelli)
155 const label celli = pointCells[pointi][pointCelli];
157 pointWeights_[pointi][pointCelli] =
173 !isCoupledPolyPatch[
patchi]
174 && isCoupledFvPatch[
patchi]
189 boundaryPointWeights_[bPointi].resize(
pFaces.size());
190 boundaryPointNbrWeights_[bPointi].resize(
pFaces.size());
196 const label patchFacei = pbm.patchFaceID()[
pFaces[bPointFacei]];
204 boundaryPointWeights_[bPointi][bPointFacei].resize
209 boundaryPointNbrWeights_[bPointi][bPointFacei].resize
218 fvbm[
patches[i]].magSf()[patchFaces[i]]
219 /pbm[
patchi].magFaceAreas()[patchFacei];
221 const scalar
f = pointBoundaryFactor[pointi];
229 !isCoupledPolyPatch[
patches[i]]
230 && isCoupledFvPatch[
patches[i]]
234 boundaryPointNbrWeights_[bPointi][bPointFacei][i] =
241 !isCoupledPolyPatch[
patches[i]]
242 && !isCoupledFvPatch[
patches[i]]
246 boundaryPointWeights_[bPointi][bPointFacei][i] =
258 "volPointSumWeights",
267 forAll(pointWeights_, pointi)
269 forAll(pointWeights_[pointi], i)
271 sumWeights[pointi] += pointWeights_[pointi][i];
279 forAll(boundaryPointWeights_[bPointi], i)
281 forAll(boundaryPointWeights_[bPointi][i], j)
283 sumWeights[pointi] += boundaryPointWeights_[bPointi][i][j];
284 sumWeights[pointi] += boundaryPointNbrWeights_[bPointi][i][j];
299 forAll(pointWeights_, pointi)
301 forAll(pointWeights_[pointi], i)
303 pointWeights_[pointi][i] /= sumWeights[pointi];
311 forAll(boundaryPointWeights_[bPointi], i)
313 forAll(boundaryPointWeights_[bPointi][i], j)
315 boundaryPointWeights_[bPointi][i][j] /= sumWeights[pointi];
316 boundaryPointNbrWeights_[bPointi][i][j] /= sumWeights[pointi];
378 interpolateUnconstrained(vf, pf);
static const Foam::dimensionedScalar C("C", Foam::dimTemperature, 234.5)
#define forAll(list, i)
Loop across all elements in list.
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
const fvMesh & mesh() const
static pointMesh & New(const polyMesh &mesh)
static const DimensionedField< Type, GeoMesh > & null()
Return a null DimensionedField.
const Mesh & mesh() const
Return mesh.
static const char *const typeName
Generic GeometricField class.
GeometricBoundaryField< Type, PatchField, GeoMesh > Boundary
Type of the boundary field.
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
Mesh data needed to do the Finite Volume discretisation.
const volVectorField & C() const
Return cell centres.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const UCompactListList< label > & polyBFacePatches() const
Return poly-bFace-patch addressing.
const UCompactListList< label > & polyBFacePatchFaces() const
Return poly-bFace-patch-face addressing.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelListList & pointCells() const
Interpolate from cell centres to points (vertices) using inverse distance weighting.
virtual bool movePoints()
Correct weighting factors for moving mesh.
virtual void topoChange(const polyTopoChangeMap &)
Update mesh topology using the morph engine.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
~volPointInterpolation()
Destructor.
volPointInterpolation(const fvMesh &)
Constructor given fvMesh.
void interpolateDisplacement(const volVectorField &, pointVectorField &) const
Interpolate from volField to pointField.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Template functions to aid in the implementation of demand driven data.
const fvPatchList & patches
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
List< scalar > scalarList
A List of scalars.
vector point
Point is a vector.
PointField< scalar > pointScalarField
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
Addressing for a faceList slice.
List< labelList > labelListList
A List of labelList.
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
prefixOSstream Pout(cout, "Pout")
UList< label > labelUList
faceListList boundary(nPatches)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("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]=cellShape(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, &mergedCyclicPolyPatch::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]