36 inline void Foam::functionObjects::fieldValues::surfaceFieldValue::combineField
49 field = ListListOps::combine<Field<Type>>
52 accessOp<Field<Type>>()
68 selectionType_ != selectionTypes::sampledSurface
90 if (selectionType_ == selectionTypes::sampledSurface)
97 if (surfacePtr_().interpolate())
105 const faceList& faces = surfacePtr_().faces();
110 const face&
f = faces[facei];
113 avg[facei] += intFld[
f[fp]];
115 avg[facei] /=
f.size();
122 return surfacePtr_().sample(
fld);
128 <<
"Surface field " << fieldName
129 <<
" cannot be sampled onto surface " << surfacePtr_().name()
130 <<
". Only vol fields can be sampled onto surfaces."
140 return filterField(
fld);
146 return filterField(
fld);
151 <<
"Field " << fieldName <<
" not found in database"
158 template<
class Type,
class ResultType>
182 return processValuesTypeType(values, signs, weights, Sf, result);
198 case operationType::minMag:
203 case operationType::maxMag:
232 result =
gSum(weights*values);
240 case operationType::orientedSum:
242 result =
gSum(signs*weights*values);
252 case operationType::areaAverage:
256 gSum(weights*magSf*values)
260 case operationType::areaIntegrate:
263 result =
gSum(weights*magSf*values);
268 result =
gMin(values);
273 result =
gMax(values);
276 case operationType::CoV:
280 const Type meanValue =
gSum(values*magSf)/
gSum(magSf);
287 const scalar mean =
component(meanValue, d);
299 case operationType::UI:
303 const Type meanValue =
gSum(values*magSf)/
gSum(magSf);
310 const scalar mean =
component(meanValue, d);
339 const word& fieldName,
351 #define writeValuesFieldType(fieldType, none) \
355 const bool typeOk = \
356 processValues(values, signs, weights, Sf, result); \
361 resultDict_.add(fieldName, result, true); \
364 if (Pstream::master()) \
366 file() << tab << result; \
368 Log << " " << operationTypeNames_[operation_] \
369 << "(" << selectionName_.c_str() << ") of " \
370 << fieldName << " = " << result << endl; \
377 #undef writeValuesFieldType
382 <<
"Operation " << operationTypeNames_[operation_]
383 <<
" not available for values of type "
403 const label facei = faceId_[i];
414 << selectionTypeNames[selectionType_]
415 <<
"(" << selectionName_.c_str() <<
"):"
417 <<
" Unable to process internal faces for volume field "
438 const label facei = faceId_[i];
447 values[i] = field[facei];
#define forAll(list, i)
Loop across all elements in list.
Pre-declare SubField and related Field type.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static bool master(const label communicator=0)
Am I the master process.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
A face is a list of labels corresponding to mesh vertices.
void writeValues(const word &fieldName, const Field< Type > &values, const scalarField &signs, const scalarField &weights, const vectorField &Sf)
Templated helper function to output field values.
tmp< Field< Type > > getFieldValues(const word &fieldName) const
Return field values by looking up field name.
bool processValuesTypeType(const Field< Type > &values, const scalarField &signs, const scalarField &weights, const vectorField &Sf, Type &result) const
Apply a Type -> Type operation to the values.
bool validField(const word &fieldName) const
Return true if the field name is valid.
bool processValues(const Field< Type > &values, const scalarField &signs, const scalarField &weights, const vectorField &Sf, ResultType &result) const
Apply the operation to the values, and return true if successful.
tmp< Field< Type > > filterField(const SurfaceField< Type > &field) const
Filter a surface field according to faceIds.
Piecewise-linear interpolation method. Uses volPointInterpolation to create values on the points....
Traits class for primitives.
Motion of the mesh specified as a list of pointMeshMovers.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Type gMin(const UList< Type > &f, const label comm)
Scalar protectedDivide(const Scalar a, const Scalar b)
Divide two numbers and protect the result from overflowing.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
label & setComponent(label &l, const direction)
errorManip< error > abort(error &err)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< scalar, GeoMesh, Field > > stabilise(const DimensionedField< scalar, GeoMesh, PrimitiveField > &dsf, const dimensioned< scalar > &ds)
Type gSum(const UList< Type > &f, const label comm)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void component(GeometricField< typename GeometricField< Type, GeoMesh, PrimitiveField1 >::cmptType, GeoMesh, PrimitiveField1 > &gcf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf, const direction d)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Type gMax(const UList< Type > &f, const label comm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< Type, GeoMesh, Field > > cmptMag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
#define writeValuesFieldType(fieldType, none)