Go to the documentation of this file.
39 void 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]
141 Foam::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];
255 template<
class Type,
class CombineOp>
256 void 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 "
int debug
Static debugging option.
List< label > labelList
A List of labels.
virtual const pointField & points() const
Return raw points.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A class for handling words, derived from Foam::string.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
static const pointConstraints & New(const pointMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const fileName & name() const noexcept
The dictionary name.
Mesh consisting of general polyhedral cells.
label nPoints() const noexcept
Number of mesh points.
#define forAll(list, i)
Loop across all elements in list.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Generic dimensioned Type class.
errorManip< error > abort(error &err)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const polyMesh & mesh() const
Reference to mesh.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
void smooth(const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight, GeometricField< Type, pointPatchField, pointMesh > &newFld) const
Fully explicit smoothing of fields (not positions)
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Generic GeometricField class.
static Type get(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt, const Type &defaultValue=Zero)
Wrapper around dictionary::get which does not exit.
option
Enumeration for the data type and search/match modes (bitmask)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...