35 template<
class ParcelType>
39 template<
class ParcelType>
42 offsetof(CollidingParcel<ParcelType>, collisionRecords_)
43 - offsetof(CollidingParcel<ParcelType>, f_)
49 template<
class ParcelType>
60 angularMomentum_(
Zero),
96 template<
class ParcelType>
97 template<
class CloudType>
100 const bool readOnProc =
c.size();
105 c.checkFieldIOobject(
c,
f);
112 c.checkFieldIOobject(
c, angularMomentum);
119 c.checkFieldIOobject(
c, torque);
126 c.checkFieldFieldIOobject(
c, collisionRecordsPairAccessed);
132 "collisionRecordsPairOrigProcOfOther",
137 c.checkFieldFieldIOobject(
c, collisionRecordsPairOrigProcOfOther);
143 "collisionRecordsPairOrigIdOfOther",
148 c.checkFieldFieldIOobject(
c, collisionRecordsPairOrigProcOfOther);
155 c.checkFieldFieldIOobject(
c, collisionRecordsPairData);
162 c.checkFieldFieldIOobject(
c, collisionRecordsWallAccessed);
169 c.checkFieldFieldIOobject(
c, collisionRecordsWallPRel);
176 c.checkFieldFieldIOobject(
c, collisionRecordsWallData);
183 p.angularMomentum_ = angularMomentum[i];
184 p.torque_ = torque[i];
188 collisionRecordsPairAccessed[i],
189 collisionRecordsPairOrigProcOfOther[i],
190 collisionRecordsPairOrigIdOfOther[i],
191 collisionRecordsPairData[i],
192 collisionRecordsWallAccessed[i],
193 collisionRecordsWallPRel[i],
194 collisionRecordsWallData[i]
202 template<
class ParcelType>
203 template<
class CloudType>
208 const label np =
c.size();
209 const bool writeOnProc =
c.size();
213 IOField<vector> angMom
229 "collisionRecordsPairOrigProcOfOther",
261 for (
const CollidingParcel<ParcelType>&
p :
c)
264 angMom[i] =
p.angularMomentum();
265 torque[i] =
p.torque();
267 collisionRecordsPairAccessed[i] =
p.collisionRecords().pairAccessed();
268 collisionRecordsPairOrigProcOfOther[i] =
269 p.collisionRecords().pairOrigProcOfOther();
270 collisionRecordsPairOrigIdOfOther[i] =
271 p.collisionRecords().pairOrigIdOfOther();
272 collisionRecordsPairData[i] =
p.collisionRecords().pairData();
273 collisionRecordsWallAccessed[i] =
p.collisionRecords().wallAccessed();
274 collisionRecordsWallPRel[i] =
p.collisionRecords().wallPRel();
275 collisionRecordsWallData[i] =
p.collisionRecords().wallData();
280 f.write(writeOnProc);
281 angMom.write(writeOnProc);
282 torque.write(writeOnProc);
284 collisionRecordsPairAccessed.write(writeOnProc);
285 collisionRecordsPairOrigProcOfOther.write(writeOnProc);
286 collisionRecordsPairOrigIdOfOther.write(writeOnProc);
287 collisionRecordsPairData.write(writeOnProc);
288 collisionRecordsWallAccessed.write(writeOnProc);
289 collisionRecordsWallPRel.write(writeOnProc);
290 collisionRecordsWallData.write(writeOnProc);
294 template<
class ParcelType>
303 ParcelType::writeProperties(
os, filters, delim, namesOnly);
306 #define writeProp(Name, Value) \ 307 ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters) 310 writeProp(
"angularMomentum", angularMomentum_);
318 template<
class ParcelType>
319 template<
class CloudType>
326 ParcelType::readObjects(
c, obr);
328 if (!
c.size())
return;
330 const auto&
f = cloud::lookupIOField<vector>(
"f", obr);
331 const auto& angMom = cloud::lookupIOField<vector>(
"angularMomentum", obr);
332 const auto& torque = cloud::lookupIOField<vector>(
"torque", obr);
338 p.angularMomentum_ = angMom[i];
339 p.torque_ = torque[i];
346 template<
class ParcelType>
347 template<
class CloudType>
354 ParcelType::writeObjects(
c, obr);
356 const label np =
c.size();
358 auto&
f = cloud::createIOField<vector>(
"f", np, obr);
359 auto& angMom = cloud::createIOField<vector>(
"angularMomentum", np, obr);
360 auto& torque = cloud::createIOField<vector>(
"torque", np, obr);
363 for (
const CollidingParcel<ParcelType>&
p :
c)
366 angMom[i] =
p.angularMomentum();
367 torque[i] =
p.torque();
376 template<
class ParcelType>
380 const CollidingParcel<ParcelType>&
p 385 os << static_cast<const ParcelType&>(
p)
393 os << static_cast<const ParcelType&>(
p);
396 reinterpret_cast<const char*>(&
p.f_),
399 os <<
p.collisionRecords();
CompactIOField< labelField, label > labelFieldCompactIOField
Compact IO for a Field of labelField.
vector f_
Force on particle due to collisions [N].
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...
CollisionRecordList< vector, vector > collisionRecordList
vectorFieldCompactIOField pairDataFieldCompactIOField
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
virtual Ostream & write(const char c) override
Write character.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Wrapper around kinematic parcel types to add collision modelling.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
static const std::size_t sizeofFields
Size in bytes of the fields.
static void writeFields(const CloudType &c)
Write.
vectorFieldCompactIOField wallDataFieldCompactIOField
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.
collisionRecordList collisionRecords_
Particle collision records.
CompactIOField< vectorField, vector > vectorFieldCompactIOField
Compact IO for a Field of vectorField.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
virtual Istream & read(token &)=0
Return next token from stream.
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.
A List of wordRe with additional matching capabilities.
void writeFields(const fvMesh &mesh, const wordHashSet &selectedFields, const bool writeFaceFields)
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)
vector angularMomentum_
Angular momentum of Parcel in global reference frame [kg m2/s].
vector torque_
Torque on particle due to collisions in global.
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly) const
Write individual parcel properties to stream.
#define writeProp(Name, Value)
virtual bool beginRawRead()=0
Start of low-level raw binary read.
A Field of objects of type <T> with automated input and output using a compact storage. Behaves like IOField except when binary output in case it writes a CompactListList.
const dimensionedScalar c
Speed of light in a vacuum.
CollidingParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
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.
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.
static constexpr const zero Zero
Global zero (0)
static void readFields(CloudType &c)
Read.