36 void Foam::motionSmootherAlgo::checkConstraints
41 const polyMesh&
mesh = pf.mesh();
47 label nPatchPatchPoints = 0;
51 if (!isA<emptyPolyPatch>(bm[
patchi]))
53 nPatchPatchPoints += bm[
patchi].boundaryPoints().size();
76 Field<Type> boundaryPointValues(nPatchPatchPoints);
77 nPatchPatchPoints = 0;
81 if (!isA<emptyPolyPatch>(bm[
patchi]))
88 label ppp = meshPoints[bp[pointi]];
89 boundaryPointValues[nPatchPatchPoints++] = pf[ppp];
102 nPatchPatchPoints = 0;
106 if (!isA<emptyPolyPatch>(bm[
patchi]))
113 label ppp = meshPoints[bp[pointi]];
115 const Type& savedVal = boundaryPointValues[nPatchPatchPoints++];
117 if (savedVal != pf[ppp])
120 <<
"Patch fields are not consistent on mesh point "
121 << ppp <<
" coordinate " <<
mesh.
points()[ppp]
122 <<
" at patch " << bm[
patchi].name() <<
'.'
124 <<
"Reverse evaluation gives value " << savedVal
125 <<
" , forward evaluation gives value " << pf[ppp]
136 Foam::motionSmootherAlgo::avg
146 "avg("+
fld.name()+
')',
168 if (isMasterEdge_.get(edgeI) == 1)
170 const edge&
e = edges[edgeI];
171 const scalar w = edgeWeight[edgeI];
173 res[
e[0]] += w*
fld[
e[1]];
174 sumWeight[
e[0]] += w;
176 res[
e[1]] += w*
fld[
e[0]];
177 sumWeight[
e[1]] += w;
206 if (
mag(sumWeight[pointi]) < vSmall)
209 res[pointi] =
fld[pointi];
213 res[pointi] /= sumWeight[pointi];
237 if (isInternalPoint(pointi))
239 newFld[pointi] = 0.5*
fld[pointi] + 0.5*avgFld[pointi];
248 template<
class Type,
class CombineOp>
249 void Foam::motionSmootherAlgo::testSyncField
252 const CombineOp& cop,
259 Pout<<
"testSyncField : testing synchronisation of Field<Type>."
263 Field<Type> syncedFld(
fld);
275 if (
mag(syncedFld[i] -
fld[i]) > maxMag)
278 <<
"On element " << i <<
" value:" <<
fld[i]
279 <<
" synchronised value:" << syncedFld[i]
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
static pointConstraints & New(const word &name, const pointMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
GeometricBoundaryField< Type, pointPatchField, pointMesh > Boundary
Type of the boundary field.
Generic dimensioned Type class.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const polyMesh & mesh() const
Reference to mesh.
void smooth(const PointField< Type > &fld, const scalarField &edgeWeight, PointField< Type > &newFld) const
Fully explicit smoothing of fields (not positions)
void constrain(PointField< Type > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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.
errorManip< error > abort(error &err)
dimensioned< scalar > mag(const dimensioned< Type > &)
prefixOSstream Pout(cout, "Pout")