58 for (
int i = 0; i < pTraits<Type>::nComponents; ++i)
88 writePropertyName<Type>(
os,
name, delim);
123 writePropertyName<Type>(
os, tag, delim);
134 os << delim << values;
139template<
class TrackCloudType>
142 const bool valid = c.size();
149 c.checkFieldIOobject(c, origProcId);
156 c.checkFieldIOobject(c, origId);
161 p.origProc_ = origProcId[i];
162 p.origId_ = origId[i];
169template<
class TrackCloudType>
172 const label np = c.size();
173 const bool valid = np;
175 if (writeLagrangianCoordinates)
180 else if (!writeLagrangianPositions)
183 <<
"Must select coordinates and/or positions" <<
nl
188 if (writeLagrangianPositions)
212 origProc[i] =
p.origProc_;
213 origId[i] =
p.origId_;
218 origProc.
write(valid);
223template<
class CloudType>
230 const label np = c.size();
231 const label newNp = (positionPtr ? positionPtr->size() : 0);
234 for (label i = newNp; i < np; ++i)
236 parcelType*
p = c.last();
238 c.deleteParticle(*
p);
243 const auto& position = *positionPtr;
245 const auto& origProcId = cloud::lookupIOField<label>(
"origProc", obr);
246 const auto& origId = cloud::lookupIOField<label>(
"origId", obr);
249 for (label i = np; i < newNp; ++i)
251 c.addParticle(
new parcelType(c.pMesh(), position[i], -1));
257 p.origProc_ = origProcId[i];
258 p.origId_ = origId[i];
263 p.relocate(position[i]);
272template<
class CloudType>
275 const label np = c.size();
277 auto& origProc = cloud::createIOField<label>(
"origProc", np, obr);
278 auto& origId = cloud::createIOField<label>(
"origId", np, obr);
279 auto& position = cloud::createIOField<point>(
"position", np, obr);
284 origProc[i] =
p.origProc_;
285 origId[i] =
p.origId_;
286 position[i] =
p.position();
293template<
class TrackCloudType>
296 const vector& displacement,
297 TrackCloudType&
cloud,
301 typename TrackCloudType::particleType&
p =
302 static_cast<typename TrackCloudType::particleType&
>(*this);
303 typename TrackCloudType::particleType::trackingData& ttd =
304 static_cast<typename TrackCloudType::particleType::trackingData&
>(td);
306 if (!
p.hitPatch(
cloud, ttd))
308 const polyPatch& patch = mesh_.boundaryMesh()[
p.patch()];
310 if (isA<wedgePolyPatch>(patch))
312 p.hitWedgePatch(
cloud, ttd);
314 else if (isA<symmetryPlanePolyPatch>(patch))
316 p.hitSymmetryPlanePatch(
cloud, ttd);
318 else if (isA<symmetryPolyPatch>(patch))
320 p.hitSymmetryPatch(
cloud, ttd);
322 else if (isA<cyclicPolyPatch>(patch))
324 p.hitCyclicPatch(
cloud, ttd);
326 else if (isA<cyclicACMIPolyPatch>(patch))
328 p.hitCyclicACMIPatch(
cloud, ttd, displacement);
330 else if (isA<cyclicAMIPolyPatch>(patch))
332 p.hitCyclicAMIPatch(
cloud, ttd, displacement);
334 else if (isA<processorPolyPatch>(patch))
336 p.hitProcessorPatch(
cloud, ttd);
338 else if (isA<wallPolyPatch>(patch))
340 p.hitWallPatch(
cloud, ttd);
350template<
class TrackCloudType>
353 const vector& displacement,
354 TrackCloudType&
cloud,
362 else if (onInternalFace())
366 else if (onBoundaryFace())
370 changeToMasterPatch();
372 hitBoundaryFace(displacement,
cloud, td);
377template<
class TrackCloudType>
381 const scalar fraction,
382 TrackCloudType&
cloud,
392template<
class TrackCloudType>
399template<
class TrackCloudType>
403 <<
"Hitting a wedge patch should not be possible."
406 hitSymmetryPatch(
cloud, td);
410template<
class TrackCloudType>
413 TrackCloudType&
cloud,
417 hitSymmetryPatch(
cloud, td);
421template<
class TrackCloudType>
424 const vector nf = normal();
426 transformProperties(
I - 2.0*nf*nf);
430template<
class TrackCloudType>
436 const label receiveFacei = receiveCpp.
whichFace(facei_);
440 celli_ = mesh_.faceOwner()[facei_];
442 tetPti_ = mesh_.faces()[tetFacei_].size() - 1 - tetPti_;
454 : receiveCpp.
forwardT()[receiveFacei]
456 transformProperties(
T);
466 transformProperties(-
s);
471template<
class TrackCloudType>
476 const vector& displacement
484 const label sendFacei = cpp.
whichFace(facei_);
485 const label receiveFacei = cpp.
pointFace(sendFacei, displacement,
pos);
487 if (receiveFacei < 0)
494 <<
" patches " << cpp.
name() <<
" and " << receiveCpp.
name()
495 <<
" at position " <<
pos <<
endl;
499 facei_ = tetFacei_ = receiveFacei + receiveCpp.
start();
502 vector displacementT = displacement;
515 mesh_.faceOwner()[facei_],
518 " patches " + cpp.
name() +
" and " + receiveCpp.
name() +
519 " to a location outside of the mesh."
533 : receiveCpp.
forwardT()[receiveFacei]
535 transformProperties(
T);
545 transformProperties(-
s);
570template<
class TrackCloudType>
573 TrackCloudType&
cloud,
575 const vector& displacement
581 const label localFacei = cpp.
whichFace(facei_);
585 const scalar mask = cpp.
mask()[localFacei];
586 bool couple = mask >= 1 - cpp.
tolerance();
587 bool nonOverlap = mask <= cpp.
tolerance();
592 if (!couple && !nonOverlap)
595 couple = cpp.
pointFace(localFacei, displacement,
pos) >= 0;
596 nonOverlap = !couple;
601 hitCyclicAMIPatch(
cloud, td, displacement);
610 hitBoundaryFace(displacement,
cloud, td);
615template<
class TrackCloudType>
620template<
class TrackCloudType>
Templated base class for dsmc cloud.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Generic templated field type.
A primitive field of type <T> with automated input and output.
Helper IO class to read and write particle coordinates (positions).
virtual bool write(const bool valid=true) const
Write using setting from DB.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
A cloud is a registry collection of lagrangian particles.
static const IOField< point > * findIOPosition(const objectRegistry &obr)
Locate the "position" IOField within object registry.
virtual bool separated() const
Are the planes separated.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual const vectorField & separation() const
If the planes are separated the separation vector.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
const scalarField & mask() const
Mask field where 1 = overlap(coupled), 0 = no-overlap.
static scalar tolerance()
Overlap tolerance.
Cyclic patch for Arbitrary Mesh Interface (AMI)
label pointFace(const label facei, const vector &n, point &p) const
scalar fraction() const
Particle fraction increase between AMI pathces.
virtual void reverseTransformDirection(vector &d, const label facei) const
Transform a patch-based direction from this side to.
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
label transformGlobalFace(const label facei) const
const cyclicPolyPatch & neighbPatch() const
void writeFields() const
Write fields.
Reads fields from the time directories and adds them to the mesh database for further post-processing...
Allows specification of different writing frequency of objects registered to the database.
Registry of regIOobjects.
A traits class, which is primarily used for primitives.
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
static void writeProperty(Ostream &os, const word &name, const Type &value, const bool nameOnly, const word &delim, const wordRes &filters=wordRes::null())
void hitCyclicACMIPatch(TrackCloudType &, trackingData &, const vector &)
Overridable function to handle the particle hitting a.
void hitFace(const vector &direction, TrackCloudType &cloud, trackingData &td)
Hit the current face. If the current face is internal than this.
void hitBoundaryFace(const vector &direction, TrackCloudType &cloud, trackingData &td)
Dispatch function for boundary face interaction. Calls one of.
void hitCyclicPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a cyclicPatch.
void hitProcessorPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
bool hitPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a patch.
void hitCyclicAMIPatch(TrackCloudType &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicAMIPatch.
void hitSymmetryPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a symmetryPatch.
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
void hitSymmetryPlanePatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a.
void hitWedgePatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a wedgePatch.
void trackToAndHitFace(const vector &direction, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Convenience function. Combines trackToFace and hitFace.
void hitWallPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
static void writePropertyName(Ostream &os, const word &name, const word &delim)
Write the name representation to stream.
const word & name() const noexcept
The patch name.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label l) const
Return label of face in patch from global face label.
label start() const
Return start label of this patch in the polyMesh face list.
virtual bool write(const bool valid=true) const
Write using setting from DB.
A List of wordRe with additional matching capabilities.
bool match(const std::string &text, bool literal=false) const
Smart match as literal or regex, stopping on the first match.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
dimensionedScalar pos(const dimensionedScalar &ds)
static const Identity< scalar > I
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
static const char *const typeName
The type name used in ensight case files.