38namespace functionObjects
59 setWriterPtr_(nullptr)
72 dict.readEntry(
"field", fieldName_);
74 max_ =
dict.getOrDefault<scalar>(
"max", -GREAT);
75 min_ =
dict.getOrDefault<scalar>(
"min", GREAT);
76 dict.readEntry(
"nBins", nBins_);
81 <<
"Number of histogram bins = " << nBins_
82 <<
" cannot be negative or zero."
91 dict.subOrEmptyDict(
"formatOptions").optionalSubDict(writeType)
113 Log <<
" Looking up field " << fieldName_ <<
endl;
117 Log <<
" Reading field " << fieldName_ <<
endl;
123 mesh_.time().timeName(),
131 const auto&
field = tfield();
133 scalar histMax = max_;
134 scalar histMin = min_;
145 Log <<
" Determined histogram bounds from field"
146 <<
" min/max(" << fieldName_ <<
") = "
147 << histMin <<
' ' << histMax <<
endl;
149 else if (min_ == GREAT)
156 const scalar
delta = (histMax - histMin)/nBins_;
159 scalar
x = histMin + 0.5*
delta;
173 const label bini = (
field[celli] - histMin)/
delta;
174 if (bini >= 0 && bini < nBins_)
176 dataNormalized[bini] += V[celli];
186 const scalar sumData =
sum(dataNormalized);
190 dataNormalized /= sumData;
192 const coordSet coords(fieldName_,
"x", xBin,
mag(xBin));
194 auto&
writer = *setWriterPtr_;
205 Log <<
" Writing histogram of " << fieldName_
209 writer.write(fieldName_, dataNormalized);
210 writer.write(fieldName_ +
"Count", dataCount);
Various functions to operate on Lists.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word suffix(const word &fldName, const word &fileExt=word::null)
Name suffix based on fieldName (underscore separator)
Holds list of sampling positions.
const word & name() const noexcept
The coord-set name.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
Watches for presence of the named trigger file in the case directory and signals a simulation stop (o...
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Computes the volume-weighted histogram of an input volScalarField.
virtual bool execute()
Execute (effectively no-op)
virtual bool write()
Calculate the histogram and write.
virtual bool read(const dictionary &)
Read the histogram data.
Computes the magnitude of an input field.
Base class for writing single files from the function objects.
fileName baseTimeDir() const
Return the base directory for the current time value.
splitCell * master() const
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.