Go to the documentation of this file.
58 for (
int i = 0; i < pTraits<Type>::nComponents; ++i)
80 if (!filters.empty() && !filters.
match(
name))
88 writePropertyName<Type>(os,
name, delim);
108 if (!filters.empty() && !filters.
match(
name))
123 writePropertyName<Type>(os, tag, delim);
139 template<
class TrackCloudType>
142 const bool valid =
c.size();
149 c.checkFieldIOobject(
c, origProcId);
161 p.origProc_ = origProcId[i];
169 template<
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);
223 template<
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]);
272 template<
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();
293 template<
class TrackCloudType>
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);
310 else if (onInternalFace())
314 else if (onBoundaryFace())
316 changeToMasterPatch();
318 if (!
p.hitPatch(
cloud, ttd))
322 if (isA<wedgePolyPatch>(
patch))
324 p.hitWedgePatch(
cloud, ttd);
326 else if (isA<symmetryPlanePolyPatch>(
patch))
328 p.hitSymmetryPlanePatch(
cloud, ttd);
330 else if (isA<symmetryPolyPatch>(
patch))
332 p.hitSymmetryPatch(
cloud, ttd);
334 else if (isA<cyclicPolyPatch>(
patch))
336 p.hitCyclicPatch(
cloud, ttd);
338 else if (isA<cyclicACMIPolyPatch>(
patch))
342 else if (isA<cyclicAMIPolyPatch>(
patch))
346 else if (isA<processorPolyPatch>(
patch))
348 p.hitProcessorPatch(
cloud, ttd);
350 else if (isA<wallPolyPatch>(
patch))
352 p.hitWallPatch(
cloud, ttd);
363 template<
class TrackCloudType>
367 const scalar fraction,
368 TrackCloudType&
cloud,
378 template<
class TrackCloudType>
385 template<
class TrackCloudType>
389 <<
"Hitting a wedge patch should not be possible."
392 hitSymmetryPatch(
cloud, td);
396 template<
class TrackCloudType>
399 TrackCloudType&
cloud,
403 hitSymmetryPatch(
cloud, td);
407 template<
class TrackCloudType>
410 const vector nf = normal();
412 transformProperties(
I - 2.0*nf*nf);
416 template<
class TrackCloudType>
422 const label receiveFacei = receiveCpp.
whichFace(facei_);
426 celli_ = mesh_.faceOwner()[facei_];
428 tetPti_ = mesh_.faces()[tetFacei_].size() - 1 - tetPti_;
440 : receiveCpp.
forwardT()[receiveFacei]
442 transformProperties(
T);
452 transformProperties(-
s);
457 template<
class TrackCloudType>
470 const label sendFacei = cpp.
whichFace(facei_);
473 if (receiveFacei < 0)
479 <<
"Particle lost across " << cyclicAMIPolyPatch::typeName
480 <<
" patches " << cpp.
name() <<
" and " << receiveCpp.
name()
481 <<
" at position " <<
pos <<
endl;
485 facei_ = tetFacei_ = receiveFacei + receiveCpp.
start();
494 mesh_.faceOwner()[facei_],
496 "Particle crossed between " + cyclicAMIPolyPatch::typeName +
497 " patches " + cpp.
name() +
" and " + receiveCpp.
name() +
498 " to a location outside of the mesh."
512 : receiveCpp.
forwardT()[receiveFacei]
514 transformProperties(
T);
524 transformProperties(-
s);
529 template<
class TrackCloudType>
532 TrackCloudType&
cloud,
540 const label localFacei = cpp.
whichFace(facei_);
544 const scalar mask = cpp.
mask()[localFacei];
545 bool couple = mask >= 1 - cpp.
tolerance();
546 bool nonOverlap = mask <= cpp.
tolerance();
551 if (!couple && !nonOverlap)
555 nonOverlap = !couple;
572 template<
class TrackCloudType>
577 template<
class TrackCloudType>
void hitProcessorPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
void hitCyclicAMIPatch(TrackCloudType &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicAMIPatch.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
virtual const vectorField & separation() const
If the planes are separated the separation vector.
A class for handling words, derived from Foam::string.
void hitCyclicPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a cyclicPatch.
A primitive field of type <T> with automated input and output.
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))
label transformGlobalFace(const label facei) const
label origId() const
Return the particle ID on the originating processor.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
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.
const cyclicPolyPatch & neighbPatch() const
virtual const tensorField & forwardT() const
Return face transformation tensor.
void hitWedgePatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a wedgePatch.
static scalar tolerance()
Overlap tolerance.
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAll(list, i)
Loop across all elements in list.
bool match(const std::string &text, bool literal=false) const
Smart match as literal or regex, stopping on the first match.
Registry of regIOobjects.
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
virtual bool parallel() const
Are the cyclic planes parallel.
bool hitPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a patch.
virtual bool separated() const
Are the planes separated.
void trackToAndHitFace(const vector &direction, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Convenience function. Combines trackToFace and hitFace.
Generic templated field type.
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
label pointFace(const label facei, const vector &n, point &p) const
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void hitCyclicACMIPatch(TrackCloudType &, trackingData &, const vector &)
Overridable function to handle the particle hitting a.
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
Helper IO class to read and write particle coordinates (positions).
Templated base class for dsmc cloud.
virtual bool write(const bool valid=true) const
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
errorManip< error > abort(error &err)
label start() const
Return start label of this patch in the polyMesh face list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A cloud is a registry collection of lagrangian particles.
static void writeProperty(Ostream &os, const word &name, const Type &value, const bool nameOnly, const word &delim, const wordRes &filters=wordRes::null())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label whichFace(const label l) const
Return label of face in patch from global face label.
const std::string patch
OpenFOAM patch number as a std::string.
Traits class for primitives.
virtual void reverseTransformDirection(vector &d, const label facei) const
Transform a patch-based direction from this side to nbr side.
void hitSymmetryPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a symmetryPatch.
A List of wordRe with additional matching capabilities.
void hitWallPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
void hitSymmetryPlanePatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a.
static const IOField< point > * findIOPosition(const objectRegistry &obr)
Locate the "position" IOField within object registry.
const dimensionedScalar c
Speed of light in a vacuum.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
static void writePropertyName(Ostream &os, const word &name, const word &delim)
Write the name representation to stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
void hitFace(const vector &direction, TrackCloudType &cloud, trackingData &td)
Hit the current face. If the current face is internal than this.
const scalarField & mask() const
Mask field where 1 = overlap(coupled), 0 = no-overlap.
const word & name() const
The patch name.
#define WarningInFunction
Report a warning using Foam::Warning.
static const Identity< scalar > I
dimensionedScalar pos(const dimensionedScalar &ds)
Cyclic patch for Arbitrary Mesh Interface (AMI)