62 cloudName_(
"unknown-cloudName"),
63 tagFieldName_(
"none"),
86 dict.subOrEmptyDict(
"formatOptions").optionalSubDict(
setFormat)
115 <<
"Unable to find cloud " << cloudName_
116 <<
" in the mesh database. Available clouds include:"
122 const cloud& c = *cloudPtr;
128 scopedName(
"CloudRegistry"),
129 mesh_.time().timeName(),
137 c.writeObjects(cloudObr);
142 tagFieldName_ !=
"none"
150 const label tagMax = tagMap.size();
155 label newTag = tagMap[tag[i]];
156 tagAddr[newTag].
append(i);
161 forAll(nameVsBinWidth_, i)
165 processField<scalar>(cloudObr, i, tagAddr)
166 || processField<vector>(cloudObr, i, tagAddr)
167 || processField<tensor>(cloudObr, i, tagAddr)
168 || processField<sphericalTensor>(cloudObr, i, tagAddr)
169 || processField<symmTensor>(cloudObr, i, tagAddr)
170 || processField<tensor>(cloudObr, i, tagAddr)
176 <<
"Unable to find field " << nameVsBinWidth_[i].first()
177 <<
" in the " << cloudName_ <<
" cloud database" <<
endl;
187 const word& fieldName,
189 const scalar binWidth,
198 word fldName(fieldName);
204 distributionModels::general distribution
211 Field<scalar> distX(distribution.x());
212 Field<scalar> distY(distribution.y());
217 const coordSet coords(fldName,
"x", std::move(xBin), std::move(distX));
219 writerPtr_->open(coords, baseTimeDir() / fldName);
220 fileName outFile = writerPtr_->write(fldName, distY);
221 writerPtr_->close(
true);
223 Log <<
" Wrote distribution of " << fieldName
224 <<
" to " << time_.relativePath(outFile) <<
endl;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
word setFormat(propsDict.getOrDefault< word >("setFormat", "vtk"))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
A primitive field of type <T> with automated input and output.
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &val)
Append an element at the end of the list.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
A cloud is a registry collection of lagrangian particles.
static const word prefix
The prefix to local: lagrangian.
static autoPtr< coordSetWriter > New(const word &writeFormat)
Return a reference to the selected writer.
Holds list of sampling positions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Particle-size distribution model wherein random samples are drawn from a given arbitrary probability ...
Accumulating histogram of values. Specified bin resolution automatic generation of bins.
A class for handling file names.
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
word scopedName(const word &name) const
Return a scoped (prefixed) name.
virtual const word & type() const =0
Runtime type information.
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Computes the natural logarithm of an input volScalarField.
Generates a particle distribution for lagrangian data at a given time.
word cloudName_
Cloud name.
List< Tuple2< word, scalar > > nameVsBinWidth_
List of field name vs. bin width.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
bool processField(const objectRegistry &obr, const label fieldi, const List< DynamicList< label > > &addr)
void generateDistribution(const word &fieldName, const scalarField &field, const scalar binWidth, const label tag=-1)
Generate the distribution.
autoPtr< coordSetWriter > writerPtr_
Writer.
Random rndGen_
Random number generator - used by distribution models.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
word tagFieldName_
Tag field name - used to filter the particles into groups.
particleDistribution(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
const Time & time_
Reference to the time database.
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
virtual bool read(const dictionary &dict)
Read.
fileName baseTimeDir() const
Return the base directory for the current time value.
Registry of regIOobjects.
bool foundObject(const word &name, const bool recursive=false) const
Contains the named Type?
const Type * cfindObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define WarningInFunction
Report a warning using Foam::Warning.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0).
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.