37 const dictionary&
dict,
43 return dict.get<Type>(
"average");
56 const word& redirectType,
57 const word& entryName,
65 setAverage_(
dict.getOrDefault(
"setAverage", false)),
66 average_(getAverage(
dict, setAverage_)),
95 fieldName_(rhs.fieldName_),
96 setAverage_(rhs.setAverage_),
97 average_(rhs.average_),
98 interpolationScheme_(rhs.interpolationScheme_)
110 if (this->sameRegion())
114 return thisMesh.template lookupObject<fieldType>(fieldName_);
118 const fvMesh& nbrMesh = refCast<const fvMesh>(this->sampleMesh());
119 return nbrMesh.template lookupObject<fieldType>(fieldName_);
129 if (this->sameRegion())
133 return thisMesh.template foundObject<fieldType>(fieldName_);
137 const fvMesh& nbrMesh = refCast<const fvMesh>(this->sampleMesh());
138 return nbrMesh.template foundObject<fieldType>(fieldName_);
157 const fvMesh& thisMesh = refCast<const fvMesh>
161 const fvMesh& nbrMesh = refCast<const fvMesh>(this->sampleMesh());
166 auto& newValues = tnewValues.ref();
168 if (!haveSampleField())
177 switch (this->
mode())
201 interpolationScheme_,
205 const auto& interp = *interpolator;
212 newValues[celli] = interp.interpolate
222 newValues = sampleField();
231 const label nbrPatchID =
237 <<
"Unable to find sample patch " << this->samplePatch()
238 <<
" in region " << this->sampleRegion()
243 const fieldType& nbrField = sampleField();
245 newValues = nbrField.boundaryField()[nbrPatchID];
246 this->distribute(newValues);
254 const fieldType& nbrField = sampleField();
258 label faceStart = pf.patch().start();
262 allValues[faceStart++] = pf[facei];
266 this->distribute(allValues);
267 newValues.transfer(allValues);
274 <<
"Unknown sampling mode: " << this->
mode() <<
nl
284 if (this->faceValues())
290 averagePsi =
gSum(magSf*newValues)/
gSum(magSf);
297 if (
mag(averagePsi) > 0.5*
mag(average_))
299 newValues *=
mag(average_)/
mag(averagePsi);
303 newValues += (average_ - averagePsi);
339 os.writeEntry(
"field", fieldName_);
342 os.writeEntry(
"setAverage",
"true");
343 os.writeEntry(
"average", average_);
346 os.writeEntry(
"interpolationScheme", interpolationScheme_);
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
PatchFunction1 to sample an existing field.
virtual tmp< Field< Type > > integrate(const scalar x1, const scalar x2) const
Integrate between two values.
bool haveSampleField() const
Field to sample. Either on my or nbr mesh.
const GeometricField< Type, fvPatchField, volMesh > & sampleField() const
Field to sample. Either on my or nbr mesh.
word interpolationScheme_
Interpolation scheme to use for nearestcell mode.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static int & msgType() noexcept
Message tag of standard messages.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
virtual bool write()
Write the output fields.
Mesh data needed to do the Finite Volume discretisation.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Uses the cell value for any location within the cell.
Class containing processor-to-processor mapping information.
void reverseDistribute(const label constructSize, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
const polyPatch & patch_
Patch to sample.
@ NEARESTCELL
nearest cell containing sample
@ NEARESTPATCHFACE
nearest face on selected patch
@ NEARESTPATCHFACEAMI
nearest patch face + AMI interpolation
@ NEARESTFACE
nearest face
sampleMode mode() const noexcept
What to sample.
static const complex max
complex (VGREAT,VGREAT)
A traits class, which is primarily used for primitives.
const word & name() const noexcept
The patch name.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
const polyMesh & mesh() const noexcept
Return the mesh reference.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Type gSum(const FieldField< Field, Type > &f)
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Type gAverage(const FieldField< Field, Type > &f)
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
scalarField samples(nIntervals, Zero)