36 if (mapperPtr_.valid())
41 if (isA<mappedInternalPatchBase>(this->patch().patch()))
43 return refCast<const mappedInternalPatchBase>(this->patch().patch());
47 <<
"Field " << this->internalField().name() <<
" on patch "
48 << this->patch().name() <<
" in file "
49 << this->internalField().objectPath()
50 <<
" has neither a mapper specified nor is the patch of "
51 << mappedInternalPatchBase::typeName <<
" type"
54 return NullObjectRef<mappedInternalPatchBase>();
70 fieldName_(
dict.lookupOrDefault<
word>(
"field", iF.
name())),
73 dict.lookupOrDefault<bool>(
"setAverage",
dict.
found(
"average"))
75 average_(setAverage_ ?
dict.lookup<Type>(
"average") :
Zero),
76 interpolationScheme_(
dict.lookup<
word>(
"interpolationScheme")),
97 fieldName_(ptf.fieldName_),
98 setAverage_(ptf.setAverage_),
99 average_(ptf.average_),
100 interpolationScheme_(ptf.interpolationScheme_),
103 ptf.mapperPtr_.
valid()
119 fieldName_(ptf.fieldName_),
120 setAverage_(ptf.setAverage_),
121 average_(ptf.average_),
122 interpolationScheme_(ptf.interpolationScheme_),
125 ptf.mapperPtr_.
valid()
143 if (mapperPtr_.valid())
145 mapperPtr_->clearOut();
158 if (mapperPtr_.valid())
160 mapperPtr_->clearOut();
178 const fvMesh& nbrMesh = refCast<const fvMesh>(this->mapper().nbrMesh());
181 this->mapper().sameRegion()
182 && this->fieldName_ == this->internalField().
name()
183 ? refCast<const VolField<Type>>(this->internalField())
184 : nbrMesh.template lookupObject<
VolField<Type>>(this->fieldName_);
196 interpolationScheme_,
203 const labelList& sampleCells = mapper().cellIndices();
206 pointField samplePoints(mapper().samplePoints());
207 mapper().map().reverseDistribute
217 if (sampleCells[i] != -1)
229 mapper().map().distribute(sampleValues);
234 sampleValues = mapper().distribute(nbrField);
240 const Type sampleAverageValue =
241 gSum(this->patch().magSf()*sampleValues)
242 /
gSum(this->patch().magSf());
244 if (
mag(sampleAverageValue)/
mag(average_) > 0.5)
246 sampleValues *=
mag(average_)/
mag(sampleAverageValue);
250 sampleValues += average_ - sampleAverageValue;
273 this->internalField().
name(),
282 writeEntry(os,
"interpolationScheme", interpolationScheme_);
284 if (mapperPtr_.valid())
286 mapperPtr_->write(os);
#define forAll(list, i)
Loop across all elements in list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Generic GeometricField class.
const word & name() const
Return name.
void resize(const label)
Alias for setSize(const label)
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static int & msgType()
Message tag of standard messages.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keyword definitions, which are a keyword followed by any number of values (e....
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Mesh data needed to do the Finite Volume discretisation.
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchField< Type > &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Uses the cell value for any point in the cell.
Abstract base class for interpolation.
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.
Engine which provides mapping from cells to patch faces.
This boundary condition maps the values from a internal cells to this patch.
virtual void write(Ostream &) const
Write.
mappedInternalValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchField< Type > &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
const mappedInternalPatchBase & mapper() const
Return the mapping engine.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool valid(const PtrList< ModelType > &l)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gSum(const FieldField< Field, Type > &f)
void writeEntryIfDifferent(Ostream &os, const word &entryName, const EntryType &value1, const EntryType &value2)
Helper function to write the keyword and entry only if the.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensioned< scalar > mag(const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.