36 template<
class ParcelType>
41 template<
class ParcelType>
44 sizeof(KinematicParcel<ParcelType>)
45 - offsetof(KinematicParcel<ParcelType>, active_)
51 template<
class ParcelType>
98 readRawScalar(is, &
d_);
101 readRawScalar(is, &
rho_);
102 readRawScalar(is, &
age_);
103 readRawScalar(is, &
tTurb_);
119 template<
class ParcelType>
120 template<
class CloudType>
123 const bool readOnProc =
c.size();
132 c.checkFieldIOobject(
c, active);
139 c.checkFieldIOobject(
c, typeId);
146 c.checkFieldIOobject(
c, nParticle);
153 c.checkFieldIOobject(
c, d);
160 c.checkFieldIOobject(
c, dTarget);
167 c.checkFieldIOobject(
c,
U);
174 c.checkFieldIOobject(
c,
rho);
181 c.checkFieldIOobject(
c, age);
188 c.checkFieldIOobject(
c, tTurb);
195 c.checkFieldIOobject(
c, UTurb);
202 c.checkFieldIOobject(
c, UCorrect);
208 p.active_ = active[i];
209 p.typeId_ = typeId[i];
210 p.nParticle_ = nParticle[i];
212 p.dTarget_ = dTarget[i];
218 p.UCorrect_ = UCorrect[i];
225 template<
class ParcelType>
226 template<
class CloudType>
231 const label np =
c.size();
232 const bool writeOnProc =
c.size();
236 IOField<scalar> nParticle
252 for (
const KinematicParcel<ParcelType>&
p :
c)
254 active[i] =
p.active();
255 typeId[i] =
p.typeId();
256 nParticle[i] =
p.nParticle();
258 dTarget[i] =
p.dTarget();
262 tTurb[i] =
p.tTurb();
263 UTurb[i] =
p.UTurb();
264 UCorrect[i] =
p.UCorrect();
269 active.
write(writeOnProc);
270 typeId.write(writeOnProc);
271 nParticle.write(writeOnProc);
272 d.write(writeOnProc);
273 dTarget.write(writeOnProc);
274 U.write(writeOnProc);
275 rho.write(writeOnProc);
276 age.write(writeOnProc);
277 tTurb.write(writeOnProc);
278 UTurb.write(writeOnProc);
279 UCorrect.write(writeOnProc);
283 template<
class ParcelType>
292 ParcelType::writeProperties(
os, filters, delim, namesOnly);
295 #define writeProp(Name, Value) \ 296 ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters) 314 template<
class ParcelType>
315 template<
class CloudType>
322 ParcelType::readObjects(
c, obr);
324 if (!
c.size())
return;
326 const auto& active = cloud::lookupIOField<label>(
"active", obr);
327 const auto& typeId = cloud::lookupIOField<label>(
"typeId", obr);
328 const auto& nParticle = cloud::lookupIOField<scalar>(
"nParticle", obr);
329 const auto& d = cloud::lookupIOField<scalar>(
"d", obr);
330 const auto& dTarget = cloud::lookupIOField<scalar>(
"dTarget", obr);
331 const auto&
U = cloud::lookupIOField<vector>(
"U", obr);
332 const auto&
rho = cloud::lookupIOField<scalar>(
"rho", obr);
333 const auto& age = cloud::lookupIOField<scalar>(
"age", obr);
334 const auto& tTurb = cloud::lookupIOField<scalar>(
"tTurb", obr);
335 const auto& UTurb = cloud::lookupIOField<vector>(
"UTurb", obr);
336 const auto& UCorrect = cloud::lookupIOField<vector>(
"UCorrect", obr);
342 p.active_ = active[i];
343 p.typeId_ = typeId[i];
344 p.nParticle_ = nParticle[i];
346 p.dTarget_ = dTarget[i];
352 p.UCorrect_ = UCorrect[i];
359 template<
class ParcelType>
360 template<
class CloudType>
367 ParcelType::writeObjects(
c, obr);
369 const label np =
c.size();
371 auto& active = cloud::createIOField<label>(
"active", np, obr);
372 auto& typeId = cloud::createIOField<label>(
"typeId", np, obr);
373 auto& nParticle = cloud::createIOField<scalar>(
"nParticle", np, obr);
374 auto& d = cloud::createIOField<scalar>(
"d", np, obr);
375 auto& dTarget = cloud::createIOField<scalar>(
"dTarget", np, obr);
376 auto&
U = cloud::createIOField<vector>(
"U", np, obr);
377 auto&
rho = cloud::createIOField<scalar>(
"rho", np, obr);
378 auto& age = cloud::createIOField<scalar>(
"age", np, obr);
379 auto& tTurb = cloud::createIOField<scalar>(
"tTurb", np, obr);
380 auto&& UTurb = cloud::createIOField<vector>(
"UTurb", np, obr);
381 auto&& UCorrect = cloud::createIOField<vector>(
"UCorrect", np, obr);
385 for (
const KinematicParcel<ParcelType>&
p :
c)
387 active[i] =
p.active();
388 typeId[i] =
p.typeId();
389 nParticle[i] =
p.nParticle();
391 dTarget[i] =
p.dTarget();
395 tTurb[i] =
p.tTurb();
396 UTurb[i] =
p.UTurb();
397 UCorrect[i] =
p.UCorrect();
406 template<
class ParcelType>
410 const KinematicParcel<ParcelType>&
p 415 os << static_cast<const ParcelType&>(
p)
430 os << static_cast<const ParcelType&>(
p);
433 reinterpret_cast<const char*>(&
p.active_),
static void writeFields(const TrackCloudType &c)
Write.
DSMCCloud< dsmcParcel > CloudType
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const noexcept
Check if the scalar byte-size associated with the stream is the same as the given type...
virtual Ostream & write(const char c) override
Write character.
Kinematic parcel class with rotational motion (as spherical particles only) and one/two-way coupling ...
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
scalar tTurb_
Time spent in turbulent eddy [s].
#define writeProp(Name, Value)
virtual bool endRawRead()=0
End of low-level raw binary read.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
KinematicParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
scalar dTarget_
Target diameter [m].
virtual Istream & read(token &)=0
Return next token from stream.
scalar rho_
Density [kg/m3].
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
A class for handling words, derived from Foam::string.
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
label typeId_
Parcel type id.
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly=false) const
Write individual parcel properties to stream.
vector UTurb_
Turbulent velocity fluctuation [m/s].
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
A List of wordRe with additional matching capabilities.
static void readFields(TrackCloudType &c)
Read.
void writeFields(const fvMesh &mesh, const wordHashSet &selectedFields, const bool writeFaceFields)
static const std::size_t sizeofFields
Size in bytes of the fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
OBJstream os(runTime.globalPath()/outputName)
scalar nParticle_
Number of particles in Parcel.
label readRawLabel(Istream &is)
Read raw label from binary stream.
vector U_
Velocity of Parcel [m/s].
virtual bool beginRawRead()=0
Start of low-level raw binary read.
const dimensionedScalar c
Speed of light in a vacuum.
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const noexcept
Check if the label byte-size associated with the stream is the same as the given type.
Mesh consisting of general polyhedral cells.
label active_
Active flag - tracking inactive when active = false.
Registry of regIOobjects.
A class for handling character strings derived from std::string.
Templated base class for dsmc cloud.
A primitive field of type <T> with automated input and output.
streamFormat format() const noexcept
Get the current stream format.
vector UCorrect_
Velocity correction due to collisions MPPIC [m/s].
static constexpr const zero Zero
Global zero (0)