39void Foam::motionSmootherAlgo::checkConstraints
41 GeometricField<Type, pointPatchField, pointMesh>& pf
44 typedef GeometricField<Type, pointPatchField, pointMesh> FldType;
46 const polyMesh&
mesh = pf.mesh();
52 label nPatchPatchPoints = 0;
54 for (
const polyPatch& pp : bm)
56 if (!isA<emptyPolyPatch>(pp))
58 nPatchPatchPoints += pp.boundaryPoints().
size();
63 typename FldType::Boundary& bFld = pf.boundaryFieldRef();
81 Field<Type> boundaryPointValues(nPatchPatchPoints);
82 nPatchPatchPoints = 0;
86 if (!isA<emptyPolyPatch>(bm[patchi]))
88 const labelList& bp = bm[patchi].boundaryPoints();
89 const labelList& meshPoints = bm[patchi].meshPoints();
93 label ppp = meshPoints[bp[pointi]];
94 boundaryPointValues[nPatchPatchPoints++] = pf[ppp];
107 nPatchPatchPoints = 0;
111 if (!isA<emptyPolyPatch>(bm[patchi]))
113 const labelList& bp = bm[patchi].boundaryPoints();
114 const labelList& meshPoints = bm[patchi].meshPoints();
116 for (
const label pointi : bp)
118 const label ppp = meshPoints[pointi];
120 const Type& savedVal = boundaryPointValues[nPatchPatchPoints++];
122 if (savedVal != pf[ppp])
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]
141Foam::motionSmootherAlgo::avg
151 "avg("+
fld.name()+
')',
152 fld.time().timeName(),
161 auto& res = tres.ref();
176 for (
const label edgei : isMasterEdge_)
178 const edge&
e = edges[edgei];
179 const scalar w = edgeWeight[edgei];
181 res[
e[0]] += w*
fld[
e[1]];
182 sumWeight[
e[0]] += w;
184 res[
e[1]] += w*
fld[
e[0]];
185 sumWeight[
e[1]] += w;
213 if (
mag(sumWeight[pointi]) < VSMALL)
216 res[pointi] =
fld[pointi];
220 res[pointi] /= sumWeight[pointi];
244 if (isInternalPoint_.test(pointi))
246 newFld[pointi] = 0.5*
fld[pointi] + 0.5*avgFld[pointi];
255template<
class Type,
class CombineOp>
256void Foam::motionSmootherAlgo::testSyncField
259 const CombineOp& cop,
266 Pout<<
"testSyncField : testing synchronisation of Field<Type>."
270 Field<Type> syncedFld(
fld);
282 if (
mag(syncedFld[i] -
fld[i]) > maxMag)
285 <<
"On element " << i <<
" value:" <<
fld[i]
286 <<
" synchronised value:" << syncedFld[i]
300 const Type& defaultValue
303 Type val(defaultValue);
317 <<
"Entry '" << keyword <<
"' not found in dictionary "
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic GeometricField class.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
unsigned int get() const
Get value as unsigned, no range-checking.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
label size() const noexcept
The number of elements in the list.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const fileName & name() const noexcept
The dictionary name.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Generic dimensioned Type class.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
option
Enumeration for the data type and search/match modes (bitmask)
const polyMesh & mesh() const
Reference to mesh.
void smooth(const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight, GeometricField< Type, pointPatchField, pointMesh > &newFld) const
Fully explicit smoothing of fields (not positions)
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.
label nPoints() const noexcept
Number of mesh points.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.