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>());
107 Info<<
" Detected " << nLayers_ <<
" layers" <<
nl <<
endl;
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>();
243 patchIndices_ = patchSet(
dict,
true).toc();
249 mesh_.faceZones().toc()
252 if (patchIndices_.empty() && zoneIndices_.empty())
255 <<
"No patches or zones specified" <<
endl;
258 symmetric_ =
dict.lookupOrDefault<
bool>(
"symmetric",
false);
273 dict.found(
"weightFields")
275 :
dict.found(
"weightField")
290 result.
append(weightFields_);
327 cannotFindObject(fields_[fieldi]);
332 #define DeclareTypeValueSets(Type, nullArg) \
333 PtrList<Field<Type>> Type##ValueSets(fieldNames.size());
335 #undef DeclareTypeValueSets
340 #define CollapseTypeFields(Type, nullArg) \
341 if (mesh_.foundObject<VolInternalField<Type>>(fieldName)) \
343 const VolInternalField<Type>& field = \
344 mesh_.lookupObject<VolInternalField<Type>>(fieldName); \
346 Type##ValueSets.set \
349 average<Type>(weight, layerWeight, field) \
353 #undef CollapseTypeFields
369 for (
label i = 1; i < layerCentre_.size(); ++ i)
372 layerDistance[i-1] +
mag(layerCentre_[i] - layerCentre_[i-1]);
414 if (&map.
mesh() == &mesh_)
424 if (&map.
mesh() == &mesh_)
437 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, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, 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 keyword definitions, which are a keyword followed by any number of values (e....
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.
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, volMesh > & V() const
Return cell volumes.
label nTotalCells() const
Return total number of cells in decomposed mesh.
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 globalMeshData & globalData() const
Return parallel info.
const faceZoneList & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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,.
A class for handling words, derived from string.
static const word null
An empty word.
#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)
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
label wave(const fvMesh &mesh, const List< labelPair > &changedPatchAndFaces, const label nCorrections, GeometricField< scalar, PatchField, GeoMesh > &distance, TrackingData &td, GeometricField< DataType, PatchField, 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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
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.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimless
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)
dimensioned< scalar > mag(const dimensioned< Type > &)
typename VolField< Type >::Internal VolInternalField
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.