Go to the documentation of this file.
42 const word& fieldName,
43 const bool setAverage,
45 const word& interpolationScheme
49 patchField_(patchField),
50 fieldName_(fieldName),
51 setAverage_(setAverage),
53 interpolationScheme_(interpolationScheme)
66 patchField_(patchField),
69 dict.template lookupOrDefault<word>
72 patchField_.dimensionedInternalField().name()
81 dict.
lookup(
"interpolationScheme") >> interpolationScheme_;
94 patchField_(patchField),
95 fieldName_(patchField_.dimensionedInternalField().name()),
126 patchField_(patchField),
142 const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
144 if (mapper_.sameRegion())
146 if (fieldName_ == patchField_.dimensionedInternalField().name())
150 dynamic_cast<const fieldType&
>
152 patchField_.dimensionedInternalField()
158 return thisMesh.template lookupObject<fieldType>(fieldName_);
163 return nbrMesh.template lookupObject<fieldType>(fieldName_);
179 const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
185 switch (mapper_.mode())
210 interpolationScheme_,
231 newValues = sampleField();
241 const label nbrPatchID =
247 <<
"Unable to find sample patch " << mapper_.samplePatch()
248 <<
" in region " << mapper_.sampleRegion()
249 <<
" for patch " << patchField_.patch().name() <<
nl
253 const fieldType& nbrField = sampleField();
255 newValues = nbrField.boundaryField()[nbrPatchID];
256 mapper_.distribute(newValues);
264 const fieldType& nbrField = sampleField();
266 forAll(nbrField.boundaryField(), patchI)
269 nbrField.boundaryField()[patchI];
274 allValues[faceStart++] = pf[faceI];
278 mapper_.distribute(allValues);
279 newValues.transfer(allValues);
286 <<
"Unknown sampling mode: " << mapper_.mode()
294 gSum(patchField_.patch().magSf()*newValues)
295 /
gSum(patchField_.patch().magSf());
297 if (
mag(averagePsi)/
mag(average_) > 0.5)
299 newValues *=
mag(average_)/
mag(averagePsi);
303 newValues += (average_ - averagePsi);
320 os.
writeKeyword(
"interpolationScheme") << interpolationScheme_
const Type average_
Average value the mapped field is adjusted to maintain if.
label findPatchID(const word &patchName) const
Find patch index given a name.
A class for handling words, derived from string.
mappedPatchFieldBase(const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const word &fieldName, const bool setAverage, const Type average, const word &interpolationScheme)
Construct from components.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
const fvPatchField< Type > & patchField_
Underlying patch field.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual Type interpolate(const vector &position, const label cellI, const label faceI=-1) const =0
Interpolate field to the given point in the given cell.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual tmp< Field< Type > > mappedField() const
Map sampleField onto *this patch.
Type gSum(const FieldField< Field, Type > &f)
dimensioned< scalar > mag(const dimensioned< Type > &)
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
Uses the cell value for any point in the cell.
word fieldName_
Name of field to sample.
scalarField samples(nIntervals, 0)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Class containing processor-to-processor mapping information.
const polyMesh & mesh() const
Return the mesh reference.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
Abstract base class for interpolation.
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
A list of keyword definitions, which are a keyword followed by any number of values (e....
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
word interpolationScheme_
Interpolation scheme to use for nearestcell mode.
virtual void write(Ostream &) const
Write.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
static int & msgType()
Message tag of standard messages.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const mappedPatchBase & mapper_
Mapping engine.
Traits class for primitives.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
label start() const
Return start label of this patch in the polyMesh face list.
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
const fvPatch & patch() const
Return patch.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Generic GeometricField class.
const GeometricField< Type, fvPatchField, volMesh > & sampleField() const
Field to sample. Either on my or nbr mesh.
const bool setAverage_
If true adjust the mapped field to maintain average value average_.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)