53 Pout<<
"volPointInterpolationAdjoint::calcBoundaryAddressing() : " 54 <<
"constructing boundary addressing" 65 mesh().nBoundaryFaces(),
66 mesh().nInternalFaces()
90 const polyPatch&
pp =
pbm[patchi];
94 !isA<emptyPolyPatch>(
pp)
95 && !magSf.boundaryField()[patchi].coupled()
96 && !isA<symmetryPolyPatch>(
pp)
97 && !isA<symmetryPlanePolyPatch>(
pp)
110 isPatchPoint[
f[fp]] =
true;
114 else if (isA<symmetryPolyPatch>(
pp) || isA<symmetryPlanePolyPatch>(
pp))
117 for (
const label pointI : meshPoints)
119 isSymmetryPoint[pointI] =
true;
142 label nPatchFace = 0;
150 label nPatchPoint = 0;
160 <<
" of which on proper patch:" << nPatchFace <<
nl 162 <<
" of which on proper patch:" << nPatchPoint <<
endl;
174 Pout<<
"volPointInterpolationAdjoint::makeBoundaryWeights() : " 175 <<
"constructing weighting factors for boundary points." <<
endl;
183 boundaryPointWeights_.clear();
184 boundaryPointWeights_.setSize(
boundary.meshPoints().
size());
188 label pointi =
boundary.meshPoints()[i];
190 if (isPatchPoint_[pointi])
197 sumWeights[pointi] = 0.0;
201 if (boundaryIsPatchFace_[
pFaces[i]])
205 pw[i] = 1.0/
mag(
points[pointi] - faceCentres[facei]);
206 sumWeights[pointi] += pw[i];
222 Pout<<
"volPointInterpolationAdjoint::makeWeights() : " 223 <<
"constructing weighting factors" 230 calcBoundaryAddressing();
234 tmp<pointScalarField> tsumWeights
240 "volPointSumWeights",
252 makeBoundaryWeights(sumWeights);
272 pushUntransformedData(sumWeights);
277 const label pointi =
mp[i];
283 pw[i] /= sumWeights[pointi];
289 Pout<<
"volPointInterpolationAdjoint::makeWeights() : " 290 <<
"finished constructing weighting factors" 348 label pointi =
mp[i];
350 if (isPatchPoint_[pointi])
353 const scalarList& pWeights = boundaryPointWeights_[i];
354 const vector& val = pf[pointi];
363 scalar mod(isSymmetryPoint_[pointi] ? 0.5 : 1);
367 if (boundaryIsPatchFace_[
pFaces[j]])
369 boundaryVals[
pFaces[j]] += mod*pWeights[j]*val;
376 label nPassedFaces(0);
381 SubList<vector> patchFaceSens(vf,
patch.size(), nPassedFaces);
382 patchFaceSens = SubList<vector>(boundaryVals,
patch.size(), bFacei);
383 nPassedFaces +=
patch.size();
List< scalar > scalarList
List of scalar.
const labelList patchIDs(pbm.indices(polyPatchNames, true))
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
bitSet isPatchPoint_
Per mesh(!) point whether is on non-coupled, non-empty patch (on.
void calcBoundaryAddressing()
Construct addressing over all boundary faces.
void updateMesh(const mapPolyMesh &)
Update mesh topology using the morph engine.
constexpr char nl
The newline '\n' character (0x0a)
void setSize(const label n, unsigned int val=0u)
Alias for resize()
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
Dimensionless.
~volPointInterpolationAdjoint()
Destructor.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bitSet isSymmetryPoint_
Per mesh(!) point whether is on symmetry plane.
virtual const pointField & points() const
Return raw points.
autoPtr< primitivePatch > boundaryPtr_
Boundary addressing.
#define forAll(list, i)
Loop across all elements in list.
Interpolate from cell centres to points (vertices) using inverse distance weighting.
A list of faces which address into the list of points.
vectorField pointField
pointField is a vectorField.
void makeWeights()
Construct all point weighting factors.
void setSize(const label n)
Alias for resize()
bool movePoints()
Correct weighting factors for moving mesh.
const fvMesh & mesh() const noexcept
Reference to the mesh.
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.
bitSet boundaryIsPatchFace_
Per boundary face whether is on non-coupled, non-empty patch.
label nInternalFaces() const noexcept
Number of internal faces.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
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
void makeBoundaryWeights(scalarField &sumWeights)
Make weights for points on uncoupled patches.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
volPointInterpolationAdjoint(const volPointInterpolationAdjoint &)=delete
No copy construct.
const std::string patch
OpenFOAM patch number as a std::string.
void assign(const UList< bool > &bools)
Copy assign all entries from a list of bools.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
List< label > labelList
A List of labels.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
void interpolateSensitivitiesField(const GeometricField< Type, pointPatchField, pointMesh > &pf, typename GeometricField< Type, fvPatchField, volMesh >::Boundary &vf, const labelHashSet &patchIDs) const
Interpolate sensitivties from points to faces.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
List< bool > boolList
A List of bools.
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)