39 if (obr_.foundObject<vf>(fieldName))
52 const word& fieldName,
58 if (obr_.foundObject<vf>(fieldName))
60 return filterField(obr_.lookupObject<vf>(fieldName));
66 <<
"Field " << fieldName <<
" not found in database" 87 result =
gSum(values);
90 case operationType::weightedSum:
92 result =
gSum(weightField*values);
102 result =
gSum(values)/nCells();
105 case operationType::weightedAverage:
107 result =
gSum(weightField*values)/
gSum(weightField);
110 case operationType::volAverage:
112 result =
gSum(V*values)/this->V();
115 case operationType::weightedVolAverage:
117 result =
gSum(weightField*V*values)/
gSum(weightField*V);
120 case operationType::volIntegrate:
122 result =
gSum(V*values);
125 case operationType::weightedVolIntegrate:
127 result =
gSum(weightField*V*values);
132 result =
gMin(values);
137 result =
gMax(values);
140 case operationType::CoV:
142 Type meanValue =
gSum(values*V)/this->V();
152 res =
sqrt(
gSum(V*
sqr(vals - mean))/this->V())/mean;
157 case operationType::none:
170 const word& fieldName
173 const bool ok = validField<Type>(fieldName);
177 Field<Type> values(setFieldValues<Type>(fieldName));
181 if (weightFieldName_ !=
"none")
183 weightField = setFieldValues<scalar>(weightFieldName_,
true);
186 Type result = processValues(values, V, weightField);
188 if (Pstream::master())
191 resultDict_.add(fieldName, result,
true);
199 fieldName +
'_' + regionTypeNames_[regionType_]
200 +
'-' + volRegion::regionName_,
201 obr_.time().timeName(),
206 (weightField*values).ref()
213 Log <<
" " << operationTypeNames_[operation_]
214 <<
"(" << volRegion::regionName_ <<
") of " << fieldName
215 <<
" = " << result <<
endl;
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
tmp< Field< Type > > setFieldValues(const word &fieldName, const bool mustGet=false) const
Insert field values into values list.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
Generic GeometricField class.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
Type gSum(const FieldField< Field, Type > &f)
Pre-declare SubField and related Field type.
bool validField(const word &fieldName) const
Return true if the field name is valid.
A class for handling words, derived from string.
tmp< Field< Type > > filterField(const Field< Type > &field) const
Filter a field according to cellIds.
Type processValues(const Field< Type > &values, const scalarField &V, const scalarField &weightField) const
Apply the 'operation' to the values.
errorManip< error > abort(error &err)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define Log
Report write to Foam::Info if the local log switch is true.
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
A class for managing temporary objects.
bool writeValues(const word &fieldName)
Templated helper function to output field values.
label & setComponent(label &l, const direction)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A primitive field of type <T> with automated input and output.
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh > &df)