36 void Foam::motionSmootherAlgo::checkConstraints
38 GeometricField<Type, pointPatchField, pointMesh>& pf
41 typedef GeometricField<Type, pointPatchField, pointMesh> FldType;
43 const polyMesh& mesh = pf.mesh();
45 const polyBoundaryMesh& bm = mesh.boundaryMesh();
49 label nPatchPatchPoints = 0;
53 if (!isA<emptyPolyPatch>(bm[patchi]))
55 nPatchPatchPoints += bm[
patchi].boundaryPoints().size();
60 typename FldType::GeometricBoundaryField& bFld = pf.boundaryField();
78 Field<Type> boundaryPointValues(nPatchPatchPoints);
79 nPatchPatchPoints = 0;
83 if (!isA<emptyPolyPatch>(bm[patchi]))
90 label ppp = meshPoints[bp[pointi]];
91 boundaryPointValues[nPatchPatchPoints++] = pf[ppp];
104 nPatchPatchPoints = 0;
108 if (!isA<emptyPolyPatch>(bm[patchi]))
115 label ppp = meshPoints[bp[pointi]];
117 const Type& savedVal = boundaryPointValues[nPatchPatchPoints++];
119 if (savedVal != pf[ppp])
123 "motionSmootherAlgo::checkConstraints" 124 "(GeometricField<Type, pointPatchField, pointMesh>&)" 125 ) <<
"Patch fields are not consistent on mesh point " 126 << ppp <<
" coordinate " << mesh.points()[ppp]
127 <<
" at patch " << bm[
patchi].name() <<
'.' 129 <<
"Reverse evaluation gives value " << savedVal
130 <<
" , forward evaluation gives value " << pf[ppp]
142 Foam::motionSmootherAlgo::avg
154 "avg("+fld.
name()+
')',
155 fld.
time().timeName(),
182 if (isMasterEdge_.
get(edgeI) == 1)
184 const edge&
e = edges[edgeI];
185 const scalar w = edgeWeight[edgeI];
187 res[e[0]] += w*fld[e[1]];
188 sumWeight[e[0]] += w;
190 res[e[1]] += w*fld[e[0]];
191 sumWeight[e[1]] += w;
220 if (
mag(sumWeight[pointI]) < VSMALL)
223 res[pointI] = fld[pointI];
227 res[pointI] /= sumWeight[pointI];
252 if (isInternalPoint(pointI))
254 newFld[pointI] = 0.5*fld[pointI] + 0.5*avgFld[pointI];
264 template<
class Type,
class CombineOp>
265 void Foam::motionSmootherAlgo::testSyncField
268 const CombineOp& cop,
275 Pout<<
"testSyncField : testing synchronisation of Field<Type>." 291 if (
mag(syncedFld[i] - fld[i]) > maxMag)
295 "motionSmootherAlgo::testSyncField" 296 "(const Field<Type>&, const CombineOp&" 297 ", const Type&, const bool)" 298 ) <<
"On element " << i <<
" value:" << fld[i]
299 <<
" synchronised value:" << syncedFld[i]
dimensioned< scalar > mag(const dimensioned< Type > &)
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
static const pointConstraints & New(const pointMesh &mesh)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const Mesh & mesh() const
Return mesh.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Generic dimensioned Type class.
const double e
Elementary charge.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const dimensionSet & dimensions() const
Return dimensions.
errorManip< error > abort(error &err)
const word & name() const
Return name.
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Generic GeometricField class.
#define forAllReverse(list, i)
Mesh consisting of general polyhedral cells.
Traits class for primitives.
List< label > labelList
A List of labels.
const Time & time() const
Return time.
fvOptions constrain(rhoEqn)
void smooth(const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight, GeometricField< Type, pointPatchField, pointMesh > &newFld) const
Fully explicit smoothing of fields (not positions)
const objectRegistry & db() const
Return the local objectRegistry.
A class for managing temporary objects.
prefixOSstream Pout(cout,"Pout")
unsigned int get(const label) const
Get value at index I.