Go to the documentation of this file.
56 const word& fieldName,
58 const bool applyOrientation
64 if (source_ != stSampledSurface && obr_.foundObject<
sf>(fieldName))
66 return filterField(obr_.lookupObject<
sf>(fieldName), applyOrientation);
68 else if (obr_.foundObject<vf>(fieldName))
70 const vf&
fld = obr_.lookupObject<vf>(fieldName);
72 if (surfacePtr_.valid())
74 if (surfacePtr_().interpolate())
81 const faceList& faces = surfacePtr_().faces();
90 const face&
f = faces[faceI];
93 avg[faceI] += intFld[
f[fp]];
95 avg[faceI] /=
f.size();
102 return surfacePtr_().sample(
fld);
107 return filterField(
fld, applyOrientation);
114 <<
"Field " << fieldName <<
" not found in database"
135 result =
gSum(values);
146 <<
"Operation " << operationTypeNames_[operation_]
147 <<
" not available for values of type "
154 case opSumDirectionBalance:
157 <<
"Operation " << operationTypeNames_[operation_]
158 <<
" not available for values of type "
168 result =
gSum(values)/(scalar(
n) + ROOTVSMALL);
171 case opWeightedAverage:
178 gSum(weightField*values)/(
gSum(weightField) + ROOTVSMALL);
183 result =
gSum(values)/(scalar(
n) + ROOTVSMALL);
191 result =
gSum(magSf*values)/
gSum(magSf);
194 case opWeightedAreaAverage:
201 result =
gSum(weightField*magSf*values)/
gSum(magSf*weightField);
205 result =
gSum(magSf*values)/
gSum(magSf);
209 case opAreaIntegrate:
213 result =
gSum(magSf*values);
218 result =
gMin(values);
223 result =
gMax(values);
230 const scalar gSumMagSf =
gSum(magSf);
232 Type meanValue =
gSum(values*magSf)/gSumMagSf;
244 /(mean + ROOTVSMALL);
267 return processSameTypeValues(values, Sf, weightField);
277 const word& fieldName,
282 const bool ok = validField<Type>(fieldName);
286 Field<Type> values(setFieldValues<Type>(fieldName,
true, orient));
289 if (surfacePtr_.valid())
292 Sf = surfacePtr_().Sf();
297 Sf = filterField(
mesh().Sf(),
true);
301 if (surfaceWriterPtr_.valid())
304 combineFields(allValues);
309 if (surfacePtr_.valid())
311 combineSurfaceGeometry(faces,
points);
315 combineMeshGeometry(faces,
points);
321 baseFileDir()/name_/
"surface"/obr_.time().timeName();
323 surfaceWriterPtr_->write
326 word(sourceTypeNames_[source_]) +
"_" + sourceName_,
337 values *= scaleFactor_;
339 Type result = processValues(values, Sf, weightField);
341 file()<<
tab << result;
344 <<
" " << operationTypeNames_[operation_]
345 <<
"(" << sourceName_ <<
") for " << fieldName
346 <<
" = " << result <<
endl;
349 const word& opName = operationTypeNames_[operation_];
350 word resultName = opName +
'(' + sourceName_ +
',' + fieldName +
')';
351 this->setResult(resultName, result);
362 const bool applyOrientation
370 label faceI = faceId_[i];
371 label patchI = facePatchId_[i];
379 <<
type() <<
" " << name_ <<
": "
380 << sourceTypeNames_[source_] <<
"(" << sourceName_ <<
"):"
382 <<
" Unable to process internal faces for volume field "
387 if (applyOrientation)
391 values[i] *= faceSign_[i];
403 const bool applyOrientation
411 label faceI = faceId_[i];
412 label patchI = facePatchId_[i];
419 values[i] = field[faceI];
423 if (applyOrientation)
427 values[i] *= faceSign_[i];
label & setComponent(label &l, const direction)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A class for handling words, derived from string.
A class for handling file names.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
dimensioned< scalar > mag(const dimensioned< Type > &)
bool validField(const word &fieldName) const
Return true if the field name is valid.
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Type processValues(const Field< Type > &values, const vectorField &Sf, const scalarField &weightField) const
Apply the 'operation' to the values. Wrapper around.
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
tmp< Field< Type > > setFieldValues(const word &fieldName, const bool mustGet=false, const bool applyOrientation=false) const
Return field values by looking up field name.
errorManip< error > abort(error &err)
volScalarField sf(fieldObject, mesh)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool master(const label communicator=0)
Am I the master process.
tmp< Field< Type > > filterField(const GeometricField< Type, fvsPatchField, surfaceMesh > &field, const bool applyOrientation) const
Filter a surface field according to faceIds.
sourceType source_
Source type.
bool foundObject(const word &name) const
Is the named Type found?
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type processSameTypeValues(const Field< Type > &values, const vectorField &Sf, const scalarField &weightField) const
Apply the 'operation' to the values. Operation has to.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
Traits class for primitives.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
Type gMin(const FieldField< Field, Type > &f)
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Generic GeometricField class.
bool writeValues(const word &fieldName, const scalarField &weightField, const bool orient)
Templated helper function to output field values.
Type gMax(const FieldField< Field, Type > &f)
const objectRegistry & obr_
Database this class is registered to.