92 parcelSelect_.clear();
103 Info<<
"applying to clouds:" <<
nl;
106 Info<<
" " << cldName <<
nl;
111 parcelSelect_ =
dict.subOrEmptyDict(
"selection");
113 verbose_ =
dict.getOrDefault(
"verbose",
false);
114 onExecute_ =
dict.getOrDefault(
"sampleOnExecute",
false);
118 Info<<
"no clouds to be processed" <<
nl <<
endl;
125 writeFileHeader(files(cloudi));
136 if (!request ||
names().empty())
144 label nTotParcels = 0;
145 scalar totMass = 0, Dmax = 0, D10 = 0, D32 = 0;
146 bool applyFilter =
false;
150 const auto* kinCloudPtr = obr_.cfindObject<kinematicCloud>(
cloudName);
158 const auto& kinCloud = *kinCloudPtr;
159 const auto* plainCloudPtr =
isA<cloud>(kinCloud);
161 if (!parcelSelect_.empty() && plainCloudPtr)
163 const auto& plainCloud = *plainCloudPtr;
167 objectRegistry obrTmp
172 obr_.time().constant(),
180 plainCloud.writeObjects(obrTmp);
183 applyFilter = calculateFilter(obrTmp,
log);
186 const auto* diamFldPtr = obrTmp.cfindObject<IOField<scalar>>(
"d");
187 const auto* rhoFldPtr = obrTmp.cfindObject<IOField<scalar>>(
"rho");
188 const auto* nParticleFldPtr =
189 obrTmp.cfindObject<IOField<scalar>>(
"nParticle");
194 #define doLocalCode(FldPtr, FldName) \
195 if (applyFilter && !FldPtr) \
198 << "Missing \"" << #FldName \
199 << "\" field - disabling filter" << nl; \
200 applyFilter = false; \
215 const auto& diams = *diamFldPtr;
216 const auto& rhos = *rhoFldPtr;
217 const auto& nParts = *nParticleFldPtr;
219 FixedList<scalar, 4> Dsums(
Zero);
221 for (
const label particlei : parcelAddr_)
225 const scalar d = diams[particlei];
226 const scalar
rho = rhos[particlei];
227 const scalar np = nParts[particlei];
234 Dsums[2] += np*(
sqr(d));
235 Dsums[3] += np*(
pow3(d));
238 reduce(nTotParcels, sumOp<label>());
239 reduce(totMass, sumOp<scalar>());
240 reduce(Dmax, maxOp<scalar>());
241 reduce(Dsums, sumOp<scalar>());
246 D10 = Dsums[1]/(
max(Dsums[0], VSMALL));
247 D32 = Dsums[3]/(
max(Dsums[2], VSMALL));
254 nTotParcels =
returnReduce(kinCloud.nParcels(), sumOp<label>());
255 totMass =
returnReduce(kinCloud.massInSystem(), sumOp<scalar>());
257 Dmax = kinCloud.Dmax();
258 D10 = kinCloud.Dij(1, 0);
259 D32 = kinCloud.Dij(3, 2);
263 <<
" number of parcels : " << nTotParcels <<
nl
264 <<
" mass in system : " << totMass <<
nl
265 <<
" maximum diameter : " << Dmax <<
nl
266 <<
" D10 diameter : " << D10 <<
nl
267 <<
" D32 diameter : " << D32 <<
nl
270 if ((request & ACTION_WRITE) && writeToFile())
272 auto&
os = files(cloudi);
274 writeCurrentTime(
os);
302 return performAction(ACTION_ALL);
Inter-processor communication reduction functions.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const word cloudName(propsDict.get< word >("cloud"))
bitSet parcelAddr_
The filtered parcel addressing. Eg, for the current cloud.
bool calculateFilter(const objectRegistry &obrTmp, const bool log=true)
Calculate parcel selection filter.
dictionary parcelSelect_
The filtered parcel addressing. Eg, for the current cloud.
A 1D vector of objects of type <T> with a fixed length <N>.
A primitive field of type <T> with automated input and output.
@ NO_REGISTER
Do not request registration (bool: false).
@ 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,...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
Outputs Lagrangian cloud information to a file.
bool performAction(unsigned request)
Perform operation report/write.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
bool verbose_
Additional verbosity.
cloudInfo(const cloudInfo &)=delete
No copy construct.
virtual void writeFileHeader(Ostream &os) const
File header information.
bool onExecute_
Perform sample actions on execute as well.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged...
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
PtrList< OFstream > & files()
Return access to the files.
Computes the natural logarithm of an input volScalarField.
Specialization of Foam::functionObject for a region and providing a reference to the region Foam::obj...
const objectRegistry & obr_
Reference to the region objectRegistry.
regionFunctionObject(const regionFunctionObject &)=delete
No copy construct.
virtual bool read(const dictionary &dict)
Read optional controls.
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
virtual bool read(const dictionary &dict)
Read.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
virtual bool writeToFile() const
Flag to allow writing to file.
Virtual abstract base class for templated KinematicCloud.
Registry of regIOobjects.
const Type * cfindObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
#define doLocalCode(FieldType, Variable)
constexpr scalar pi(M_PI)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
List< word > wordList
List of word.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
bool read(const char *buf, int32_t &val)
Same as readInt32.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar pow3(const dimensionedScalar &ds)
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.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
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.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.