41 namespace functionObjects
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);
293 return performAction(ACTION_ALL & ~ACTION_WRITE);
302 return performAction(ACTION_ALL);
Specialization of Foam::functionObject for a region and providing a reference to the region Foam::obj...
virtual bool execute()
Execute, currently does nothing.
defineTypeNameAndDebug(ObukhovLength, 0)
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
Inter-processor communication reduction functions.
dimensionedScalar log(const dimensionedScalar &ds)
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define doLocalCode(FldPtr, FldName)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ignore writing from objectRegistry::writeObject()
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
bool read(const char *buf, int32_t &val)
Same as readInt32.
#define forAll(list, i)
Loop across all elements in list.
virtual void writeFileHeader(Ostream &os) const
File header information.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
cloudInfo(const cloudInfo &)=delete
No copy construct.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const word cloudName(propsDict.get< word >("cloud"))
A class for handling words, derived from Foam::string.
virtual bool read(const dictionary &dict)
Read the controls.
constexpr scalar pi(M_PI)
virtual bool write()
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool read(const dictionary &dict)
Read.
bool performAction(unsigned request)
Perform operation report/write.
dimensionedScalar pow3(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
Do not request registration (bool: false)
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged...
static constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.