43 namespace functionObjects
53 void Foam::functionObjects::layerAverage::calcLayers()
56 DynamicList<label> startFaces;
57 DynamicList<layerInfo> startFacesInfo;
63 startFaces.append(pp.start() + j);
64 startFacesInfo.append(layerInfo(0, -1));
72 startFaces.append(fz[j]);
73 startFacesInfo.append(layerInfo(0, fz.flipMap()[j] ? -1 : +1));
80 FaceCellWave<layerInfo>
wave
95 if (allCellLayerInfo[celli].
valid(
wave.data()))
97 const label layeri = allCellLayerInfo[celli].cellLayer();
98 nLayers_ =
max(nLayers_, layeri + 1);
99 cellLayer_[celli] = layeri;
102 reduce(nLayers_, maxOp<label>());
117 tmp<volScalarField> cellLayer =
124 cellLayer.ref().primitiveFieldRef() =
List<scalar>(cellLayer_);
125 cellLayer.ref().write();
129 layerVolume_ = sum<scalar>(
mesh_.
V());
132 layerCentre_ = sum<vector>(
mesh_.
V()*
mesh_.
C())/layerVolume_;
137 layerCentre_.
setSize(nLayers_/2);
143 Foam::functionObjects::layerAverage::weight()
const
145 if (weightFields_.empty())
147 return tmp<VolInternalField<scalar>>();
150 tmp<VolInternalField<scalar>> tresult =
160 const VolInternalField<scalar>& weightField =
161 mesh_.lookupObject<VolInternalField<scalar>>(weightFields_[i]);
163 tresult.ref() *= weightField;
172 Foam::functionObjects::layerAverage::symmetricCoeff<Foam::vector>()
const
187 <<
"Symmetric layer average requested with "
189 <<
"averaging is only possible along coordinate axes."
202 Foam::functionObjects::layerAverage::symmetricCoeff<Foam::symmTensor>()
const
204 return sqr(symmetricCoeff<vector>());
210 Foam::functionObjects::layerAverage::symmetricCoeff<Foam::tensor>()
const
212 return symmetricCoeff<symmTensor>();
241 patchIndices_ = mesh_.poly().boundary().patchSet(
dict,
true).toc();
247 mesh_.faceZones().toc()
250 if (patchIndices_.empty() && zoneIndices_.empty())
253 <<
"No patches or zones specified" <<
endl;
256 symmetric_ =
dict.lookupOrDefault<
bool>(
"symmetric",
false);
271 dict.found(
"weightFields")
273 :
dict.found(
"weightField")
288 result.
append(weightFields_);
325 cannotFindObject(fields_[fieldi]);
330 #define DeclareTypeValueSets(Type, nullArg) \
331 PtrList<Field<Type>> Type##ValueSets(fieldNames.size());
333 #undef DeclareTypeValueSets
338 #define CollapseTypeFields(Type, nullArg) \
339 if (mesh_.foundObject<VolInternalField<Type>>(fieldName)) \
341 const VolInternalField<Type>& field = \
342 mesh_.lookupObject<VolInternalField<Type>>(fieldName); \
344 Type##ValueSets.set \
347 average<Type>(weight, layerWeight, field) \
351 #undef CollapseTypeFields
367 for (
label i = 1; i < layerCentre_.size(); ++ i)
370 layerDistance[i-1] +
mag(layerCentre_[i] - layerCentre_[i-1]);
411 if (&map.
mesh() == &mesh_)
420 if (&map.
mesh() == &mesh_)
432 if (&map.
mesh() == &mesh_)
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
void append(const T &)
Append an element at the end of the list.
void setSize(const label)
Reset size of List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
Holds list of sampling positions.
static const NamedEnum< axisType, 6 > axisTypeNames_
String representation of axis enums.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
A class for handling file names.
Abstract base-class for Time/database functionObjects.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
This function object writes graphs of cell values, volume-averaged in the layers of cells in the mesh...
virtual wordList fields() const
Return the list of fields required.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
layerAverage(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual bool execute()
Do nothing.
virtual bool write()
Calculate and write the graphs.
virtual ~layerAverage()
Destructor.
virtual bool read(const dictionary &)
Read the field average data.
static const word outputPrefix
Directory prefix.
const volVectorField & C() const
Return cell centres.
const DimensionedField< scalar, fvMesh > & V() const
Return cell volumes.
const polyMesh & poly() const
Return reference to polyMesh.
label nTotalCells() const
Return total number of cells in decomposed mesh.
Motion of the mesh specified as a list of pointMeshMovers.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const polyMesh & mesh() const
Return polyMesh.
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
const globalMeshData & globalData() const
Return parallel info.
const faceZoneList & faceZones() const
Return face zones.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const
Return polyMesh.
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
A class for managing temporary objects.
bool valid() const
Is this temporary object valid,.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static List< word > fieldNames
#define FoundTypeField(Type, nullArg)
#define DeclareTypeValueSets(Type, nullArg)
#define TypeValueSetsParameter(Type, nullArg)
#define CollapseTypeFields(Type, nullArg)
#define WarningInFunction
Report a warning using Foam::Warning.
bool valid(const PtrList< ModelType > &l)
const dimensionSet dimless
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
label wave(const fvMesh &mesh, const List< labelPair > &changedPatchAndFaces, const label nCorrections, GeometricField< scalar, GeoMesh > &distance, TrackingData &td, GeometricField< DataType, GeoMesh > &... data)
Wave distance (and maybe additional) data from faces. If nCorrections is.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Ostream & endl(Ostream &os)
Add newline and flush stream.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
typename VolField< Type >::Internal VolInternalField
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)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Ostream & indent(Ostream &os)
Indent stream.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.