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 =
248 "void mappedPatchFieldBase<Type>::updateCoeffs()" 249 )<<
"Unable to find sample patch " << mapper_.samplePatch()
250 <<
" in region " << mapper_.sampleRegion()
251 <<
" for patch " << patchField_.patch().name() <<
nl 255 const fieldType& nbrField = sampleField();
257 newValues = nbrField.boundaryField()[nbrPatchID];
258 mapper_.distribute(newValues);
266 const fieldType& nbrField = sampleField();
268 forAll(nbrField.boundaryField(), patchI)
271 nbrField.boundaryField()[patchI];
276 allValues[faceStart++] = pf[faceI];
280 mapper_.distribute(allValues);
289 "mappedPatchFieldBase<Type>::updateCoeffs()" 290 )<<
"Unknown sampling mode: " << mapper_.mode()
298 gSum(patchField_.patch().magSf()*newValues)
299 /
gSum(patchField_.patch().magSf());
301 if (
mag(averagePsi)/
mag(average_) > 0.5)
303 newValues *=
mag(average_)/
mag(averagePsi);
307 newValues += (average_ - averagePsi);
324 os.
writeKeyword(
"interpolationScheme") << interpolationScheme_
const Type average_
Average value the mapped field is adjusted to maintain if.
Mesh data needed to do the Finite Volume discretisation.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const labelListList &constructMap, List< T > &, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for Pstream::scheduled.
void transfer(List< Type > &)
Transfer the contents of the argument List into this list.
dimensioned< scalar > mag(const dimensioned< Type > &)
mappedPatchFieldBase(const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const word &fieldName, const bool setAverage, const Type average, const word &interpolationScheme)
Construct from components.
word interpolationScheme_
Interpolation scheme to use for nearestcell mode.
Class containing processor-to-processor mapping information.
Uses the cell value for any point in the cell.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Abstract base class for interpolation.
void size(const label)
Override size to be inconsistent with allocated storage.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const mappedPatchBase & mapper_
Mapping engine.
Type gSum(const FieldField< Field, Type > &f)
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
void setSize(const label)
Reset size of List.
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.
word fieldName_
Name of field to sample.
virtual tmp< Field< Type > > mappedField() const
Map sampleField onto *this patch.
static int & msgType()
Message tag of standard messages.
virtual void write(Ostream &) const
Write.
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Pre-declare SubField and related Field type.
errorManip< error > abort(error &err)
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Generic GeometricField class.
Traits class for primitives.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const polyMesh & mesh() const
Return the mesh reference.
const bool setAverage_
If true adjust the mapped field to maintain average value average_.
const fvPatchField< Type > & patchField_
Underlying patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
scalarField samples(nIntervals, 0)
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
const GeometricField< Type, fvPatchField, volMesh > & sampleField() const
Field to sample. Either on my or nbr mesh.
label findPatchID(const word &patchName) const
Find patch index given a name.
const fvPatch & patch() const
Return patch.
label start() const
Return start label of this patch in the polyMesh face list.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.