41 namespace functionObjects
51 void Foam::functionObjects::layerAverage::calcLayers()
54 DynamicList<label> startFaces;
55 DynamicList<layerInfo> startFacesInfo;
58 const polyPatch& pp = mesh_.boundaryMesh()[patchIDs_[i]];
61 startFaces.append(pp.start() + j);
62 startFacesInfo.append(layerInfo(0, -1));
67 const faceZone& fz = mesh_.faceZones()[zoneIDs_[i]];
70 startFaces.append(fz[j]);
71 startFacesInfo.append(layerInfo(0, fz.flipMap()[j] ? -1 : +1));
76 List<layerInfo> allFaceLayerInfo(mesh_.nFaces());
77 List<layerInfo> allCellLayerInfo(mesh_.nCells());
78 FaceCellWave<layerInfo>
wave 85 mesh_.globalData().nTotalCells() + 1
90 cellLayer_ =
labelList(mesh_.nCells(), -1);
93 if (allCellLayerInfo[celli].valid(
wave.
data()))
95 const label layeri = allCellLayerInfo[celli].cellLayer();
96 nLayers_ =
max(nLayers_, layeri + 1);
97 cellLayer_[celli] = layeri;
100 reduce(nLayers_, maxOp<label>());
105 Info<<
" Detected " << nLayers_ <<
" layers" <<
nl <<
endl;
115 tmp<volScalarField> cellLayer =
122 cellLayer.ref().primitiveFieldRef() = List<scalar>(cellLayer_);
123 cellLayer.ref().write();
130 layerCentre_ =
sum(mesh_.cellCentres())/layerCount_;
135 layerCentre_.setSize(nLayers_/2);
142 Foam::functionObjects::layerAverage::symmetricCoeff<Foam::vector>()
const 157 <<
"Symmetric layer average requested with " 159 <<
"averaging is only possible along coordinate axes." 172 Foam::functionObjects::layerAverage::symmetricCoeff<Foam::symmTensor>()
const 174 return sqr(symmetricCoeff<vector>());
180 Foam::functionObjects::layerAverage::symmetricCoeff<Foam::tensor>()
const 182 return symmetricCoeff<symmTensor>();
214 mesh_.boundaryMesh().patchSet
223 mesh_.faceZones().names()
226 if (patchIDs_.empty() && zoneIDs_.empty())
229 <<
"No patches or zones specified" <<
endl;
281 fieldNames.
append(fields_[fieldi]);
285 cannotFindObject(fields_[fieldi]);
290 #define DeclareTypeValueSets(Type, nullArg) \ 291 PtrList<Field<Type>> Type##ValueSets(fieldNames.size()); 293 #undef DeclareTypeValueSets 294 forAll(fieldNames, fieldi)
296 #define CollapseTypeFields(Type, nullArg) \ 297 if (mesh_.foundObject<VolField<Type>>(fieldNames[fieldi])) \ 299 const VolField<Type>& field = \ 300 mesh_.lookupObject<VolField<Type>>(fieldNames[fieldi]); \ 302 Type##ValueSets.set \ 305 average(field.primitiveField()) \ 309 #undef CollapseTypeFields 317 outputPath = outputPath/mesh_.
name();
324 for (
label i = 1; i < layerCentre_.size(); ++ i)
327 layerDistance[i-1] +
mag(layerCentre_[i] - layerCentre_[i-1]);
332 outputPath/mesh_.time().timeName(),
344 #define TypeValueSetsParameter(Type, nullArg) , Type##ValueSets 346 #undef TypeValueSetsParameter 369 if (&map.
mesh() == &mesh_)
379 if (&map.
mesh() == &mesh_)
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Internal &, const PtrList< fvPatchField< scalar >> &)
Return a temporary field constructed from name,.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Generic GeometricField class.
Vector< scalar > vector
A scalar version of the templated Vector.
const dimensionSet dimless
const Type & data() const
#define DeclareTypeValueSets(Type, nullArg)
static const NamedEnum< axisType, 6 > axisTypeNames_
String representation of axis enums.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
#define TypeValueSetsParameter(Type, nullArg)
virtual bool read(const dictionary &)
Read the field average data.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static List< word > fieldNames
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
bool read(const char *, int32_t &)
Holds list of sampling positions.
layerAverage(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
static const word outputPrefix
Directory prefix.
A class for handling words, derived from string.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define FoundTypeField(Type, nullArg)
void append(const T &)
Append an element at the end of the list.
word name() const
Return file name (part beyond last /)
static const word null
An empty word.
List< label > labelList
A List of labels.
const polyMesh & mesh() const
Return polyMesh.
virtual bool execute()
Do nothing.
#define CollapseTypeFields(Type, nullArg)
virtual wordList fields() const
Return the list of fields required.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
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.
virtual bool write()
Calculate and write the graphs.
static const Vector< scalar > one
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
virtual ~layerAverage()
Destructor.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Templated 3D tensor derived from MatrixSpace adding construction from 9 components, element access using xx(), xy() etc. member functions and the inner-product (dot-product) and outer-product of two Vectors (tensor-product) operators.
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
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.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.