Loading...
Searching...
No Matches
mappedPatchFieldBase< Type > Class Template Reference

Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sampled field, optionally scaled to maintain an area-weighted average. More...

#include <mappedPatchFieldBase.H>

Inheritance diagram for mappedPatchFieldBase< Type >:
Collaboration diagram for mappedPatchFieldBase< Type >:

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.
 mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const dictionary &dict)
 Construct from dictionary.
 mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const dictionary &dict, const Field< Type > &fld)
 Construct from dictionary and initial field value.
 mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField)
 Construct empty.
 mappedPatchFieldBase (const mappedPatchFieldBase< Type > &mapper)
 Construct copy.
 mappedPatchFieldBase (const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const mappedPatchFieldBase< Type > &base)
 Construct copy, resetting patch and field.
virtual ~mappedPatchFieldBase ()=default
 Destructor.
template<class T>
const GeometricField< T, fvPatchField, volMesh > & sampleField (const word &fieldName) 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.
virtual tmp< Field< Type > > mappedField () const
 Map sampleField onto *this patch.
virtual tmp< Field< Type > > mappedInternalField () const
 Map internal of sampleField onto *this patch.
virtual tmp< scalarFieldmappedWeightField () const
 Map optional weightField onto *this patch. Default is deltaCoeffs.
virtual void mappedWeightField (const word &weightFieldName, tmp< scalarField > &thisWeights, tmp< scalarField > &nbrWeights) const
 Map optional weightField (given by name) onto *this patch.
virtual void write (Ostream &os) const
 Write.
template<class T>
void distribute (const word &fieldName, Field< T > &newValues) const
 Wrapper for mapDistribute::distribute that knows about dabase mapping.
template<class Type2>
const Foam::GeometricField< Type2, Foam::fvPatchField, Foam::volMesh > & sampleField (const word &fieldName) const

Static Public Member Functions

static const mappedPatchBasemapper (const fvPatch &p, const DimensionedField< Type, volMesh > &iF)
 Check that patch is of correct type.

Protected Member Functions

template<class T>
void initRetrieveField (const objectRegistry &obr, const word &region, const word &patch, const labelListList &map, const word &fieldName, const Field< T > &fld) const
 Construct field from registered elements.
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.
template<class T>
void initRetrieveField (const word &fieldName, const Field< T > &fld) const
 Initialise field to retrieve (e.g. when value read from dictionary).
template<class T>
void storeField (const objectRegistry &obr, const word &region, const word &patch, const label myComm, const labelListList &procToMap, const word &fieldName, const Field< T > &fld) const
 Store elements of field onto (sub) registry.
template<class T>
bool retrieveField (const bool allowUnset, const objectRegistry &obr, const word &region, const word &patch, const label myComm, const labelListList &procToMap, const word &fieldName, Field< T > &fld) const
 Construct field from registered elements.

Protected Attributes

const mappedPatchBasemapper_
 Mapping engine.
const fvPatchField< Type > & patchField_
 Underlying patch field.
word fieldName_
 Name of field to sample.
const bool setAverage_
 If true adjust the mapped field to maintain average value average_.
const Type average_
 Average value the mapped field is adjusted to maintain if setAverage_ is set true.
word interpolationScheme_
 Interpolation scheme to use for nearestcell mode.

Detailed Description

template<class Type>
class Foam::mappedPatchFieldBase< Type >

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
Source files

Definition at line 101 of file mappedPatchFieldBase.H.

Constructor & Destructor Documentation

◆ mappedPatchFieldBase() [1/6]

template<class Type>
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 313 of file mappedPatchFieldBase.C.

References Foam::average(), and mapper().

Referenced by mappedFieldFvPatchField< Type >::mappedFieldFvPatchField(), mappedFieldFvPatchField< Type >::mappedFieldFvPatchField(), mappedFieldFvPatchField< Type >::mappedFieldFvPatchField(), mappedFieldFvPatchField< Type >::mappedFieldFvPatchField(), mappedFieldFvPatchField< Type >::mappedFieldFvPatchField(), mappedFieldFvPatchField< Type >::mappedFieldFvPatchField(), mappedFixedValueFvPatchField< Type >::mappedFixedValueFvPatchField(), mappedFixedValueFvPatchField< Type >::mappedFixedValueFvPatchField(), mappedFixedValueFvPatchField< Type >::mappedFixedValueFvPatchField(), mappedFixedValueFvPatchField< Type >::mappedFixedValueFvPatchField(), mappedFixedValueFvPatchField< Type >::mappedFixedValueFvPatchField(), mappedMixedFieldFvPatchField< Type >::mappedMixedFieldFvPatchField(), mappedMixedFieldFvPatchField< Type >::mappedMixedFieldFvPatchField(), mappedMixedFieldFvPatchField< Type >::mappedMixedFieldFvPatchField(), mappedMixedFieldFvPatchField< Type >::mappedMixedFieldFvPatchField(), mappedMixedFieldFvPatchField< Type >::mappedMixedFieldFvPatchField(), mappedMixedFvPatchField< Type >::mappedMixedFvPatchField(), mappedMixedFvPatchField< Type >::mappedMixedFvPatchField(), mappedMixedFvPatchField< Type >::mappedMixedFvPatchField(), mappedMixedFvPatchField< Type >::mappedMixedFvPatchField(), mappedMixedFvPatchField< Type >::mappedMixedFvPatchField(), mappedPatchFieldBase(), mappedPatchFieldBase(), and mappedPatchFieldBase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mappedPatchFieldBase() [2/6]

template<class Type>
mappedPatchFieldBase ( const mappedPatchBase & mapper,
const fvPatchField< Type > & patchField,
const dictionary & dict )

Construct from dictionary.

Definition at line 333 of file mappedPatchFieldBase.C.

References dict, fieldName_, mapper(), mapper_, and patchField_.

Here is the call graph for this function:

◆ mappedPatchFieldBase() [3/6]

template<class Type>
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 389 of file mappedPatchFieldBase.C.

References dict, fld(), if(), mappedPatchFieldBase(), mapper(), mapper_, and mappedPatchBase::NEARESTPATCHFACEAMI.

Here is the call graph for this function:

◆ mappedPatchFieldBase() [4/6]

template<class Type>
mappedPatchFieldBase ( const mappedPatchBase & mapper,
const fvPatchField< Type > & patchField )

Construct empty.

Definition at line 427 of file mappedPatchFieldBase.C.

References average_, fieldName_, Foam::GlobalIOList< Tuple2< scalar, vector > >::typeName, interpolationScheme_, mapper(), mapper_, Foam::name(), patchField_, setAverage_, and Foam::Zero.

Here is the call graph for this function:

◆ mappedPatchFieldBase() [5/6]

template<class Type>
mappedPatchFieldBase ( const mappedPatchFieldBase< Type > & mapper)
explicit

Construct copy.

Definition at line 443 of file mappedPatchFieldBase.C.

References average_, fieldName_, interpolationScheme_, mappedPatchFieldBase(), mapper(), mapper_, patchField_, and setAverage_.

Here is the call graph for this function:

◆ mappedPatchFieldBase() [6/6]

template<class Type>
mappedPatchFieldBase ( const mappedPatchBase & mapper,
const fvPatchField< Type > & patchField,
const mappedPatchFieldBase< Type > & base )

Construct copy, resetting patch and field.

Definition at line 458 of file mappedPatchFieldBase.C.

References average_, fieldName_, interpolationScheme_, mappedPatchFieldBase(), mapper(), mapper_, patchField_, and setAverage_.

Here is the call graph for this function:

◆ ~mappedPatchFieldBase()

template<class Type>
virtual ~mappedPatchFieldBase ( )
virtualdefault

Destructor.

Member Function Documentation

◆ initRetrieveField() [1/2]

template<class Type>
template<class T>
void initRetrieveField ( const objectRegistry & obr,
const word & region,
const word & patch,
const labelListList & map,
const word & fieldName,
const Field< T > & fld ) const
protected

Construct field from registered elements.

Definition at line 193 of file mappedPatchFieldBase.C.

Referenced by initRetrieveField().

Here is the caller graph for this function:

◆ storeAndRetrieveField()

template<class Type>
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
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 244 of file mappedPatchFieldBase.C.

References fld(), forAll, mapper_, patchField_, retrieveField(), UList< T >::size(), storeField(), and Foam::Zero.

Referenced by distribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initRetrieveField() [2/2]

template<class Type>
template<class T>
void initRetrieveField ( const word & fieldName,
const Field< T > & fld ) const
protected

Initialise field to retrieve (e.g. when value read from dictionary).

Definition at line 960 of file mappedPatchFieldBase.C.

References fld(), initRetrieveField(), mapper_, mappedPatchBase::NEARESTPATCHFACE, and patchField_.

Here is the call graph for this function:

◆ storeField()

template<class Type>
template<class T>
void storeField ( const objectRegistry & obr,
const word & region,
const word & patch,
const label myComm,
const labelListList & procToMap,
const word & fieldName,
const Field< T > & fld ) const
protected

Store elements of field onto (sub) registry.

Definition at line 46 of file mappedPatchFieldBase.C.

References Foam::endl(), Foam::flatOutput(), fld(), forAll, mapper_, Foam::Pout, UPstream::procID(), UList< T >::size(), mappedPatchBase::storeField(), and mappedPatchBase::subRegistry().

Referenced by distribute(), and storeAndRetrieveField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ retrieveField()

template<class Type>
template<class T>
bool retrieveField ( const bool allowUnset,
const objectRegistry & obr,
const word & region,
const word & patch,
const label myComm,
const labelListList & procToMap,
const word & fieldName,
Field< T > & fld ) const
protected

Construct field from registered elements.

Returns
true if successful

Definition at line 97 of file mappedPatchFieldBase.C.

References fld(), forAll, mapper_, UPstream::procID(), UList< T >::size(), and mappedPatchBase::subRegistry().

Referenced by distribute(), and storeAndRetrieveField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sampleField() [1/3]

template<class Type>
template<class T>
const GeometricField< T, fvPatchField, volMesh > & sampleField ( const word & fieldName) const

Field to sample. Either on my or nbr mesh.

References os(), and p.

Referenced by mappedField(), mappedInternalField(), sampleField(), and mappedFixedInternalValueFvPatchField< Type >::updateCoeffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sampleField() [2/3]

template<class Type>
const Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > & sampleField ( ) const

Field to sample. Either on my or nbr mesh.

Definition at line 508 of file mappedPatchFieldBase.C.

References fieldName_, and sampleField().

Here is the call graph for this function:

◆ mappedField()

◆ mappedInternalField()

template<class Type>
Foam::tmp< Foam::Field< Type > > mappedInternalField ( ) const
virtual

Map internal of sampleField onto *this patch.

Definition at line 813 of file mappedPatchFieldBase.C.

References distribute(), fieldName_, UPstream::incrMsgType(), mapper_, UPstream::msgType(), Foam::New(), patchField_, and sampleField().

Referenced by mappedMixedFieldFvPatchField< Type >::updateCoeffs(), and mappedMixedFvPatchField< Type >::updateCoeffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mappedWeightField() [1/2]

template<class Type>
Foam::tmp< Foam::scalarField > mappedWeightField ( ) const
virtual

Map optional weightField onto *this patch. Default is deltaCoeffs.

Definition at line 847 of file mappedPatchFieldBase.C.

References distribute(), fieldName_, UPstream::incrMsgType(), mapper_, UPstream::msgType(), tmp< T >::New(), patchField_, and Foam::refCast().

Referenced by mappedMixedFieldFvPatchField< Type >::updateCoeffs(), and mappedMixedFvPatchField< Type >::updateCoeffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mappedWeightField() [2/2]

template<class Type>
void mappedWeightField ( const word & weightFieldName,
tmp< scalarField > & thisWeights,
tmp< scalarField > & nbrWeights ) const
virtual

Map optional weightField (given by name) onto *this patch.

Definition at line 882 of file mappedPatchFieldBase.C.

References distribute(), fieldName_, UPstream::incrMsgType(), mapper_, UPstream::msgType(), patchField_, tmp< T >::ref(), and Foam::refCast().

Here is the call graph for this function:

◆ write()

◆ mapper()

template<class Type>
const Foam::mappedPatchBase & mapper ( const fvPatch & p,
const DimensionedField< Type, volMesh > & iF )
static

◆ distribute()

◆ sampleField() [3/3]

template<class Type>
template<class Type2>
const Foam::GeometricField< Type2, Foam::fvPatchField, Foam::volMesh > & sampleField ( const word & fieldName) const

Definition at line 479 of file mappedPatchFieldBase.C.

Member Data Documentation

◆ mapper_

◆ patchField_

◆ fieldName_

◆ setAverage_

template<class Type>
const bool setAverage_
protected

If true adjust the mapped field to maintain average value average_.

Definition at line 133 of file mappedPatchFieldBase.H.

Referenced by mappedField(), mappedPatchFieldBase(), mappedPatchFieldBase(), mappedPatchFieldBase(), and write().

◆ average_

template<class Type>
const Type average_
protected

Average value the mapped field is adjusted to maintain if setAverage_ is set true.

Definition at line 139 of file mappedPatchFieldBase.H.

Referenced by mappedField(), mappedPatchFieldBase(), mappedPatchFieldBase(), mappedPatchFieldBase(), and write().

◆ interpolationScheme_

template<class Type>
word interpolationScheme_
protected

Interpolation scheme to use for nearestcell mode.

Definition at line 144 of file mappedPatchFieldBase.H.

Referenced by mappedField(), mappedPatchFieldBase(), mappedPatchFieldBase(), mappedPatchFieldBase(), and write().


The documentation for this class was generated from the following files: