Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sampled field, optionally scaled to maintain an area-weighted average. More...
Public Member Functions | |
mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const word &fieldName, const bool setAverage, const Type average, const word &interpolationScheme) | |
Construct from components. More... | |
mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const dictionary &dict) | |
Construct from dictionary. More... | |
mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const dictionary &dict, const Field< Type > &fld) | |
Construct from dictionary and initial field value. More... | |
mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField) | |
Construct empty. More... | |
mappedPatchFieldBase (const mappedPatchFieldBase< Type > &mapper) | |
Construct copy. More... | |
mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const mappedPatchFieldBase< Type > &base) | |
Construct copy, resetting patch and field. More... | |
virtual | ~mappedPatchFieldBase ()=default |
Destructor. More... | |
template<class T > | |
const GeometricField< T, fvPatchField, volMesh > & | sampleField (const word &fieldName) const |
Field to sample. Either on my or nbr mesh. More... | |
const GeometricField< Type, fvPatchField, volMesh > & | sampleField () const |
Field to sample. Either on my or nbr mesh. More... | |
virtual tmp< Field< Type > > | mappedField () const |
Map sampleField onto *this patch. More... | |
virtual tmp< Field< Type > > | mappedInternalField () const |
Map internal of sampleField onto *this patch. More... | |
virtual tmp< scalarField > | mappedWeightField () const |
Map optional weightField onto *this patch. Default is deltaCoeffs. More... | |
virtual void | mappedWeightField (const word &weightFieldName, tmp< scalarField > &thisWeights, tmp< scalarField > &nbrWeights) const |
Map optional weightField (given by name) onto *this patch. More... | |
virtual void | write (Ostream &os) const |
Write. More... | |
template<class T > | |
void | distribute (const word &fieldName, Field< T > &newValues) const |
template<class Type2 > | |
const Foam::GeometricField< Type2, Foam::fvPatchField, Foam::volMesh > & | sampleField (const word &fieldName) const |
Static Public Member Functions | |
static const mappedPatchBase & | mapper (const fvPatch &p, const DimensionedField< Type, volMesh > &iF) |
Check that patch is of correct type. More... | |
Protected Member Functions | |
template<class T > | |
void | initRetrieveField (const objectRegistry &obr, const word ®ion, const word &patch, const labelListList &map, const word &fieldName, const Field< T > &fld) const |
Construct field from registered elements. More... | |
template<class T > | |
bool | storeAndRetrieveField (const word &fieldName, const label myComm, const labelListList &subMap, const label constructSize, const labelListList &constructMap, const labelListList &address, const scalarListList &weights, Field< T > &fld) const |
Helper : storeField and retrieveField and interpolate. Leaves fld. More... | |
template<class T > | |
void | initRetrieveField (const word &fieldName, const Field< T > &fld) const |
Initialise field to retrieve (e.g. when value read from dictionary) More... | |
template<class T > | |
void | storeField (const objectRegistry &obr, const word ®ion, const word &patch, const label myComm, const labelListList &procToMap, const word &fieldName, const Field< T > &fld) const |
Store elements of field onto (sub) registry. More... | |
template<class T > | |
bool | retrieveField (const bool allowUnset, const objectRegistry &obr, const word ®ion, const word &patch, const label myComm, const labelListList &procToMap, const word &fieldName, Field< T > &fld) const |
Construct field from registered elements. More... | |
Protected Attributes | |
const mappedPatchBase & | mapper_ |
Mapping engine. More... | |
const fvPatchField< Type > & | patchField_ |
Underlying patch field. More... | |
word | fieldName_ |
Name of field to sample. More... | |
const bool | setAverage_ |
If true adjust the mapped field to maintain average value average_. More... | |
const Type | average_ |
word | interpolationScheme_ |
Interpolation scheme to use for nearestcell mode. More... | |
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sampled field, optionally scaled to maintain an area-weighted average.
Example usage:
{ field T; // default is same as fvPatchField setAverage false; average 1.0; // only if setAverage=true interpolationScheme cellPoint; // default is cell }
Property | Description | Required | Default | |
---|---|---|---|---|
field | name of field to be mapped | no | this field name | |
setAverage | use average value | no | false | |
average | average value to apply if setAverage = yes | partly | ||
interpolationScheme | interpolation scheme | partly | cell |
Definition at line 105 of file mappedPatchFieldBase.H.
mappedPatchFieldBase | ( | const mappedPatchBase & | mapper, |
const fvPatchField< Type > & | patchField, | ||
const word & | fieldName, | ||
const bool | setAverage, | ||
const Type | average, | ||
const word & | interpolationScheme | ||
) |
Construct from components.
Definition at line 320 of file mappedPatchFieldBase.C.
mappedPatchFieldBase | ( | const mappedPatchBase & | mapper, |
const fvPatchField< Type > & | patchField, | ||
const dictionary & | dict | ||
) |
Construct from dictionary.
Definition at line 340 of file mappedPatchFieldBase.C.
References dict, Foam::exit(), Foam::FatalError, FatalErrorInFunction, mappedPatchFieldBase< Type >::interpolationScheme_, mappedPatchFieldBase< Type >::mapper_, mappedPatchBase::mode(), mappedPatchBase::NEARESTCELL, mappedPatchBase::NEARESTPATCHFACE, mappedPatchBase::NEARESTPATCHFACEAMI, dictionary::readEntry(), mappedPatchBase::sampleDatabase(), and mappedPatchBase::sampleModeNames_.
mappedPatchFieldBase | ( | const mappedPatchBase & | mapper, |
const fvPatchField< Type > & | patchField, | ||
const dictionary & | dict, | ||
const Field< Type > & | fld | ||
) |
Construct from dictionary and initial field value.
(for when running in database mode)
Definition at line 396 of file mappedPatchFieldBase.C.
References mapDistributeBase::constructMap(), mappedPatchFieldBase< Type >::initRetrieveField(), mappedPatchBase::map(), mappedPatchFieldBase< Type >::mapper_, mappedPatchBase::mode(), mappedPatchBase::NEARESTPATCHFACE, mappedPatchBase::NEARESTPATCHFACEAMI, mappedPatchFieldBase< Type >::patchField_, mappedPatchBase::sampleDatabase(), mappedPatchBase::samplePatch(), and mappedPatchBase::sampleRegion().
mappedPatchFieldBase | ( | const mappedPatchBase & | mapper, |
const fvPatchField< Type > & | patchField | ||
) |
Construct empty.
Definition at line 434 of file mappedPatchFieldBase.C.
|
explicit |
Construct copy.
Definition at line 450 of file mappedPatchFieldBase.C.
mappedPatchFieldBase | ( | const mappedPatchBase & | mapper, |
const fvPatchField< Type > & | patchField, | ||
const mappedPatchFieldBase< Type > & | base | ||
) |
Construct copy, resetting patch and field.
Definition at line 465 of file mappedPatchFieldBase.C.
|
virtualdefault |
Destructor.
|
protected |
Construct field from registered elements.
Definition at line 200 of file mappedPatchFieldBase.C.
Referenced by mappedPatchFieldBase< Type >::mappedPatchFieldBase().
|
protected |
Helper : storeField and retrieveField and interpolate. Leaves fld.
unchanged (and returns false) if new values cannot be retrieved. Returns true otherwise.
Definition at line 251 of file mappedPatchFieldBase.C.
Initialise field to retrieve (e.g. when value read from dictionary)
Definition at line 980 of file mappedPatchFieldBase.C.
References fld(), and mappedPatchBase::NEARESTPATCHFACE.
|
protected |
Store elements of field onto (sub) registry.
Definition at line 53 of file mappedPatchFieldBase.C.
References Foam::endl(), Foam::flatOutput(), fld(), forAll, Foam::Pout, and UList< T >::size().
|
protected |
Construct field from registered elements.
Definition at line 104 of file mappedPatchFieldBase.C.
References forAll, and UList< T >::size().
const GeometricField< T, fvPatchField, volMesh > & sampleField | ( | const word & | fieldName | ) | const |
Field to sample. Either on my or nbr mesh.
const Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > & sampleField |
Field to sample. Either on my or nbr mesh.
Definition at line 515 of file mappedPatchFieldBase.C.
|
virtual |
Map sampleField onto *this patch.
Definition at line 613 of file mappedPatchFieldBase.C.
References Foam::abort(), polyMesh::boundaryMesh(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, polyBoundaryMesh::findPatchID(), fld(), forAll, Foam::gSum(), Foam::mag(), pTraits< complex >::max, polyBoundaryMesh::mesh(), UPstream::msgType(), primitiveMesh::nCells(), mappedPatchBase::NEARESTCELL, mappedPatchBase::NEARESTFACE, mappedPatchBase::NEARESTPATCHFACE, mappedPatchBase::NEARESTPATCHFACEAMI, Time::New(), Foam::New(), primitiveMesh::nFaces(), Foam::nl, mapDistribute::reverseDistribute(), samples(), List< T >::setSize(), UList< T >::size(), and Foam::Zero.
|
virtual |
Map internal of sampleField onto *this patch.
Definition at line 823 of file mappedPatchFieldBase.C.
References UPstream::msgType(), and tmp< T >::ref().
|
virtual |
Map optional weightField onto *this patch. Default is deltaCoeffs.
Definition at line 859 of file mappedPatchFieldBase.C.
References UPstream::msgType(), and tmp< T >::ref().
|
virtual |
Map optional weightField (given by name) onto *this patch.
Definition at line 896 of file mappedPatchFieldBase.C.
References UPstream::msgType(), and tmp< T >::ref().
|
virtual |
Write.
Reimplemented in mappedFieldFvPatchField< Type >, mappedMixedFieldFvPatchField< Type >, mappedFixedPushedInternalValueFvPatchField< Type >, mappedFixedValueFvPatchField< Type >, mappedMixedFvPatchField< Type >, thermalBaffleFvPatchScalarField, mappedFixedInternalValueFvPatchField< Type >, turbulentTemperatureCoupledBaffleMixedFvPatchScalarField, and turbulentTemperatureRadCoupledMixedFvPatchScalarField.
Definition at line 1007 of file mappedPatchFieldBase.C.
References mappedPatchBase::NEARESTCELL, os(), Ostream::writeEntry(), and Ostream::writeEntryIfDifferent().
|
static |
Check that patch is of correct type.
Definition at line 958 of file mappedPatchFieldBase.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, IOobject::name(), Foam::nl, IOobject::objectPath(), and p.
Referenced by turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs(), and turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs().
Wrapper for mapDistribute::distribute that knows about dabase mapping
Definition at line 523 of file mappedPatchFieldBase.C.
References mapDistributeBase::constructMap(), mapDistributeBase::constructSize(), fld(), mappedPatchBase::NEARESTPATCHFACEAMI, AMIInterpolation::srcAddress(), AMIInterpolation::srcMap(), AMIInterpolation::srcWeights(), mapDistributeBase::subMap(), AMIInterpolation::tgtAddress(), AMIInterpolation::tgtMap(), and AMIInterpolation::tgtWeights().
const Foam::GeometricField< Type2, Foam::fvPatchField, Foam::volMesh > & sampleField | ( | const word & | fieldName | ) | const |
Definition at line 486 of file mappedPatchFieldBase.C.
References polyMesh::boundaryMesh(), and polyBoundaryMesh::mesh().
|
protected |
Mapping engine.
Definition at line 118 of file mappedPatchFieldBase.H.
Referenced by mappedPatchFieldBase< Type >::mappedPatchFieldBase().
|
protected |
Underlying patch field.
Definition at line 121 of file mappedPatchFieldBase.H.
Referenced by mappedPatchFieldBase< Type >::mappedPatchFieldBase().
|
protected |
Name of field to sample.
Definition at line 124 of file mappedPatchFieldBase.H.
|
protected |
If true adjust the mapped field to maintain average value average_.
Definition at line 127 of file mappedPatchFieldBase.H.
|
protected |
Average value the mapped field is adjusted to maintain if setAverage_ is set true
Definition at line 131 of file mappedPatchFieldBase.H.
|
protected |
Interpolation scheme to use for nearestcell mode.
Definition at line 134 of file mappedPatchFieldBase.H.
Referenced by mappedPatchFieldBase< Type >::mappedPatchFieldBase().