ENH: minor update of particle methods

This commit is contained in:
Mark Olesen
2022-07-04 15:43:02 +02:00
parent b4a482751b
commit 71246b94b7
21 changed files with 206 additions and 524 deletions

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef DTRMParticle_H #ifndef Foam_DTRMParticle_H
#define DTRMParticle_H #define Foam_DTRMParticle_H
#include "particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
@ -50,12 +50,13 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class DTRMParticle; class DTRMParticle;
using namespace Foam::radiation;
// Forward declaration of friend functions
Ostream& operator<<(Ostream&, const DTRMParticle&); Ostream& operator<<(Ostream&, const DTRMParticle&);
using namespace Foam::radiation;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class DTRMParticle Declaration Class DTRMParticle Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -130,7 +131,7 @@ public:
); );
// Member functions // Member Functions
inline const interpolationCell<scalar>& aInterp() const; inline const interpolationCell<scalar>& aInterp() const;
inline const interpolationCell<scalar>& eInterp() const; inline const interpolationCell<scalar>& eInterp() const;
@ -232,37 +233,34 @@ public:
// Access // Access
//- Return const access to the initial position //- Return const access to the initial position
inline const point& p0() const; const point& p0() const noexcept { return p0_; }
//- Return const access to the target position //- Return const access to the target position
inline const point& p1() const; const point& p1() const noexcept { return p1_; }
//- Return const access to the initial intensity //- Return const access to the initial intensity
inline scalar I0() const; scalar I0() const noexcept { return I0_; }
//- Return const access to the current intensity //- Return const access to the current intensity
inline scalar I() const; scalar I() const noexcept { return I_; }
//- Return const access dA //- Return const access dA
inline scalar dA() const; scalar dA() const noexcept { return dA_; }
// Edit // Edit
//- Return access to the target position //- Return access to the target position
inline point& p1(); point& p1() noexcept { return p1_; }
//- Return access to the initial intensity //- Return access to the initial intensity
inline scalar& I0(); scalar& I0() noexcept { return I0_; }
//- Return access to the current intensity //- Return access to the current intensity
inline scalar& I(); scalar& I() noexcept { return I_; }
//- Return access to dA //- Return access to dA
inline scalar& dA(); scalar& dA() noexcept { return dA_; }
//- Return access to reflectedId
inline label& reflectedId();
// Tracking // Tracking

View File

@ -107,58 +107,4 @@ inline Foam::scalar& Foam::DTRMParticle::trackingData::Q(label celli)
} }
inline const Foam::point& Foam::DTRMParticle::p0() const
{
return p0_;
}
inline const Foam::point& Foam::DTRMParticle::p1() const
{
return p1_;
}
inline Foam::scalar Foam::DTRMParticle::I0() const
{
return I0_;
}
inline Foam::scalar Foam::DTRMParticle::I() const
{
return I_;
}
inline Foam::scalar Foam::DTRMParticle::dA() const
{
return dA_;
}
inline Foam::scalar& Foam::DTRMParticle::dA()
{
return dA_;
}
inline Foam::point& Foam::DTRMParticle::p1()
{
return p1_;
}
inline Foam::scalar& Foam::DTRMParticle::I0()
{
return I0_;
}
inline Foam::scalar& Foam::DTRMParticle::I()
{
return I_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef passivePositionParticle_H #ifndef Foam_passivePositionParticle_H
#define passivePositionParticle_H #define Foam_passivePositionParticle_H
#include "passiveParticle.H" #include "passiveParticle.H"
@ -130,7 +130,9 @@ public:
}; };
const point& cachedPosition() const // Member Functions
const point& cachedPosition() const noexcept
{ {
return cachedPosition_; return cachedPosition_;
} }

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef functionObjects_eulerianParticle_H #ifndef Foam_functionObjects_eulerianParticle_H
#define functionObjects_eulerianParticle_H #define Foam_functionObjects_eulerianParticle_H
#include "label.H" #include "label.H"
#include "scalar.H" #include "scalar.H"
@ -49,7 +49,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class Istream; class Istream;
class Ostream; class Ostream;
@ -71,10 +71,9 @@ namespace functionObjects
class eulerianParticle class eulerianParticle
{ {
public: public:
// Public data // Public Data
//- Index of face in faceZone that this particle hits. Also used to //- Index of face in faceZone that this particle hits. Also used to
// identify the index of the coarse face of the surface agglomeration // identify the index of the coarse face of the surface agglomeration
@ -95,7 +94,7 @@ public:
scalar time; scalar time;
//- Constructor //- Default construct
eulerianParticle(); eulerianParticle();

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef findCellParticle_H #ifndef Foam_findCellParticle_H
#define findCellParticle_H #define Foam_findCellParticle_H
#include "particle.H" #include "particle.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -102,17 +102,11 @@ public:
{} {}
// Member functions // Member Functions
labelListList& cellToData() labelListList& cellToData() noexcept { return cellToData_; }
{
return cellToData_;
}
List<List<point>>& cellToEnd() List<List<point>>& cellToEnd() noexcept { return cellToEnd_; }
{
return cellToEnd_;
}
}; };
@ -130,8 +124,8 @@ public:
const label data const label data
); );
//- Construct from a position and a cell, searching for the rest of the //- Construct from a position and a cell,
// required topology //- searching for the rest of the required topology
findCellParticle findCellParticle
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -182,40 +176,22 @@ public:
// Member Functions // Member Functions
//- Point to track from //- Point to track from
const point& start() const const point& start() const noexcept { return start_; }
{
return start_;
}
//- Point to track from //- Point to track from
point& start() point& start() noexcept { return start_; }
{
return start_;
}
//- Point to track to //- Point to track to
const point& end() const const point& end() const noexcept { return end_; }
{
return end_;
}
//- Point to track to //- Point to track to
point& end() point& end() noexcept { return end_; }
{
return end_;
}
//- Transported label //- Transported label
label data() const label data() const noexcept { return data_; }
{
return data_;
}
//- Transported label //- Transported label
label& data() label& data() noexcept { return data_; }
{
return data_;
}
// Tracking // Tracking

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef streamLineParticle_H #ifndef Foam_streamLineParticle_H
#define streamLineParticle_H #define Foam_streamLineParticle_H
#include "particle.H" #include "particle.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -48,8 +48,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators // Forward Declarations
class streamLineParticle; class streamLineParticle;
class streamLineParticleCloud; class streamLineParticleCloud;

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef wallBoundedParticle_H #ifndef Foam_wallBoundedParticle_H
#define wallBoundedParticle_H #define Foam_wallBoundedParticle_H
#include "particle.H" #include "particle.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -49,8 +49,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators // Forward Declarations
class wallBoundedParticle; class wallBoundedParticle;
Ostream& operator<<(Ostream&, const wallBoundedParticle&); Ostream& operator<<(Ostream&, const wallBoundedParticle&);
@ -72,15 +71,14 @@ public:
: :
public particle::trackingData public particle::trackingData
{ {
public: public:
const bitSet& isWallPatch_; const bitSet& isWallPatch_;
// Constructors // Constructors
template <class TrackCloudType> template<class TrackCloudType>
inline trackingData trackingData
( (
const TrackCloudType& cloud, const TrackCloudType& cloud,
const bitSet& isWallPatch const bitSet& isWallPatch
@ -94,7 +92,7 @@ public:
protected: protected:
// Protected data // Protected Data
//- Particle position is updated locally as opposed to via track //- Particle position is updated locally as opposed to via track
// functions of the base Foam::particle class // functions of the base Foam::particle class
@ -212,19 +210,13 @@ public:
// Member Functions // Member Functions
// Access // Access
//- -1 or label of mesh edge //- The mesh edge label or -1
inline label meshEdgeStart() const label meshEdgeStart() const noexcept { return meshEdgeStart_; }
{
return meshEdgeStart_;
}
//- -1 or diagonal edge //- The diagonal edge label or -1
inline label diagEdge() const label diagEdge() const noexcept { return diagEdge_; }
{
return diagEdge_;
}
// Track // Track

View File

@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef wallBoundedStreamLineParticle_H #ifndef Foam_wallBoundedStreamLineParticle_H
#define wallBoundedStreamLineParticle_H #define Foam_wallBoundedStreamLineParticle_H
#include "wallBoundedParticle.H" #include "wallBoundedParticle.H"
#include "autoPtr.H" #include "autoPtr.H"
@ -50,12 +50,9 @@ SourceFiles
namespace Foam namespace Foam
{ {
class wallBoundedStreamLineParticleCloud; // Forward Declarations
// Forward declaration of friend functions and operators
class wallBoundedStreamLineParticle; class wallBoundedStreamLineParticle;
class wallBoundedStreamLineParticleCloud;
Ostream& operator<<(Ostream&, const wallBoundedStreamLineParticle&); Ostream& operator<<(Ostream&, const wallBoundedStreamLineParticle&);
@ -68,7 +65,6 @@ class wallBoundedStreamLineParticle
: :
public wallBoundedParticle public wallBoundedParticle
{ {
public: public:
//- Class used to pass tracking data to the trackToEdge function //- Class used to pass tracking data to the trackToEdge function
@ -76,10 +72,8 @@ public:
: :
public wallBoundedParticle::trackingData public wallBoundedParticle::trackingData
{ {
public: public:
const PtrList<interpolation<scalar>>& vsInterp_; const PtrList<interpolation<scalar>>& vsInterp_;
const PtrList<interpolation<vector>>& vvInterp_; const PtrList<interpolation<vector>>& vvInterp_;
const label UIndex_; const label UIndex_;
@ -92,7 +86,7 @@ public:
// Constructors // Constructors
template <class TrackCloudType> template<class TrackCloudType>
trackingData trackingData
( (
TrackCloudType& cloud, TrackCloudType& cloud,
@ -107,11 +101,7 @@ public:
List<DynamicList<vectorList>>& allVectors List<DynamicList<vectorList>>& allVectors
) )
: :
wallBoundedParticle::trackingData wallBoundedParticle::trackingData(cloud, isWallPatch),
(
cloud,
isWallPatch
),
vsInterp_(vsInterp), vsInterp_(vsInterp),
vvInterp_(vvInterp), vvInterp_(vvInterp),
UIndex_(UIndex), UIndex_(UIndex),
@ -128,7 +118,7 @@ public:
protected: protected:
// Protected data // Protected Data
//- Track with +U or -U //- Track with +U or -U
bool trackForward_; bool trackForward_;

View File

@ -84,7 +84,7 @@ Foam::Cloud<ParticleType>::Cloud
geometryType_(cloud::geometryType::COORDINATES) geometryType_(cloud::geometryType::COORDINATES)
{ {
checkPatches(); checkPatches();
polyMesh_.oldCellCentres(); (void)polyMesh_.oldCellCentres();
// Ask for the tetBasePtIs to trigger all processors to build // Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then // them, otherwise, if some processors have no particles then
@ -322,8 +322,8 @@ void Foam::Cloud<ParticleType>::autoMap(const mapPolyMesh& mapper)
// Ask for the tetBasePtIs to trigger all processors to build // Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then // them, otherwise, if some processors have no particles then
// there is a comms mismatch. // there is a comms mismatch.
polyMesh_.tetBasePtIs(); (void)polyMesh_.tetBasePtIs();
polyMesh_.oldCellCentres(); (void)polyMesh_.oldCellCentres();
const vectorField& positions = globalPositionsPtr_(); const vectorField& positions = globalPositionsPtr_();

View File

@ -155,7 +155,7 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
// Ask for the tetBasePtIs to trigger all processors to build // Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then // them, otherwise, if some processors have no particles then
// there is a comms mismatch. // there is a comms mismatch.
polyMesh_.tetBasePtIs(); (void)polyMesh_.tetBasePtIs();
} }
@ -177,8 +177,8 @@ Foam::Cloud<ParticleType>::Cloud
{ {
checkPatches(); checkPatches();
polyMesh_.tetBasePtIs(); (void)polyMesh_.tetBasePtIs();
polyMesh_.oldCellCentres(); (void)polyMesh_.oldCellCentres();
initCloud(checkClass); initCloud(checkClass);
} }

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef indexedParticle_H #ifndef Foam_indexedParticle_H
#define indexedParticle_H #define Foam_indexedParticle_H
#include "particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
@ -55,7 +55,7 @@ class indexedParticle
: :
public particle public particle
{ {
// Private data // Private Data
label index_; label index_;
@ -121,15 +121,9 @@ public:
// Member Functions // Member Functions
label index() const label index() const noexcept { return index_; }
{
return index_;
}
label& index() label& index() noexcept { return index_; }
{
return index_;
}
}; };

View File

@ -41,8 +41,8 @@ SeeAlso
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef injectedParticle_H #ifndef Foam_injectedParticle_H
#define injectedParticle_H #define Foam_injectedParticle_H
#include "particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
@ -53,7 +53,7 @@ SeeAlso
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
class injectedParticle; class injectedParticle;
Ostream& operator<<(Ostream&, const injectedParticle&); Ostream& operator<<(Ostream&, const injectedParticle&);
@ -67,7 +67,7 @@ class injectedParticle
{ {
protected: protected:
// Protected data // Protected Data
// Particle properties // Particle properties
@ -184,37 +184,37 @@ public:
// Member Functions // Member Functions
// Access // Access
//- Return const access to the tag //- Return const access to the tag
inline label tag() const; label tag() const noexcept { return tag_; }
//- Return const access to the start of injection //- Return const access to the start of injection
inline scalar soi() const; scalar soi() const noexcept { return soi_; }
//- Return const access to diameter //- Return const access to diameter
inline scalar d() const; scalar d() const noexcept { return d_; }
//- Return const access to velocity //- Return const access to velocity
inline const vector& U() const; const vector& U() const noexcept { return U_; }
// Edit // Edit
//- Return the tag //- Return the tag
inline label& tag(); label& tag() noexcept { return tag_; }
//- Return the start of injection //- Return the start of injection
inline scalar& soi(); scalar& soi() noexcept { return soi_; }
//- Return access to diameter //- Return access to diameter
inline scalar& d(); scalar& d() noexcept { return d_; }
//- Return access to velocity //- Return access to velocity
inline vector& U(); vector& U() noexcept { return U_; }
// I-O // I-O
//- Read fields //- Read fields
static void readFields(Cloud<injectedParticle>& c); static void readFields(Cloud<injectedParticle>& c);

View File

@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::injectedParticle::injectedParticle inline Foam::injectedParticle::injectedParticle
@ -64,52 +63,4 @@ inline Foam::injectedParticle::injectedParticle
{} {}
inline Foam::label Foam::injectedParticle::tag() const
{
return tag_;
}
inline Foam::scalar Foam::injectedParticle::soi() const
{
return soi_;
}
inline Foam::scalar Foam::injectedParticle::d() const
{
return d_;
}
inline const Foam::vector& Foam::injectedParticle::U() const
{
return U_;
}
inline Foam::label& Foam::injectedParticle::tag()
{
return tag_;
}
inline Foam::scalar& Foam::injectedParticle::soi()
{
return soi_;
}
inline Foam::scalar& Foam::injectedParticle::d()
{
return d_;
}
inline Foam::vector& Foam::injectedParticle::U()
{
return U_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -276,10 +276,9 @@ void Foam::particle::changeFace(const label tetTriI)
// Find the face in the same cell that shares the edge, and the // Find the face in the same cell that shares the edge, and the
// corresponding tetrahedra point // corresponding tetrahedra point
tetPti_ = -1; tetPti_ = -1;
forAll(mesh_.cells()[celli_], cellFaceI) for (const label newFaceI : mesh_.cells()[celli_])
{ {
const label newFaceI = mesh_.cells()[celli_][cellFaceI]; const Foam::face& newFace = mesh_.faces()[newFaceI];
const class face& newFace = mesh_.faces()[newFaceI];
const label newOwner = mesh_.faceOwner()[newFaceI]; const label newOwner = mesh_.faceOwner()[newFaceI];
// Exclude the current face // Exclude the current face
@ -374,10 +373,9 @@ void Foam::particle::changeToMasterPatch()
{ {
label thisPatch = patch(); label thisPatch = patch();
forAll(mesh_.cells()[celli_], cellFaceI) for (const label otherFaceI : mesh_.cells()[celli_])
{ {
// Skip the current face and any internal faces // Skip the current face and any internal faces
const label otherFaceI = mesh_.cells()[celli_][cellFaceI];
if (facei_ == otherFaceI || mesh_.isInternalFace(otherFaceI)) if (facei_ == otherFaceI || mesh_.isInternalFace(otherFaceI))
{ {
continue; continue;
@ -386,8 +384,8 @@ void Foam::particle::changeToMasterPatch()
// Compare the two faces. If they are the same, chose the one with the // Compare the two faces. If they are the same, chose the one with the
// lower patch index. In the case of an ACMI-wall pair, this will be // lower patch index. In the case of an ACMI-wall pair, this will be
// the ACMI, which is what we want. // the ACMI, which is what we want.
const class face& thisFace = mesh_.faces()[facei_]; const Foam::face& thisFace = mesh_.faces()[facei_];
const class face& otherFace = mesh_.faces()[otherFaceI]; const Foam::face& otherFace = mesh_.faces()[otherFaceI];
if (face::compare(thisFace, otherFace) != 0) if (face::compare(thisFace, otherFace) != 0)
{ {
const label otherPatch = const label otherPatch =
@ -442,12 +440,12 @@ void Foam::particle::locate
// Loop all cell tets to find the one containing the position. Track // Loop all cell tets to find the one containing the position. Track
// through each tet from the cell centre. If a tet contains the position // through each tet from the cell centre. If a tet contains the position
// then the track will end with a single trackToTri. // then the track will end with a single trackToTri.
const class cell& c = mesh_.cells()[celli_]; const Foam::cell& c = mesh_.cells()[celli_];
scalar minF = VGREAT; scalar minF = VGREAT;
label minTetFacei = -1, minTetPti = -1; label minTetFacei = -1, minTetPti = -1;
forAll(c, cellTetFacei) forAll(c, cellTetFacei)
{ {
const class face& f = mesh_.faces()[c[cellTetFacei]]; const Foam::face& f = mesh_.faces()[c[cellTetFacei]];
for (label tetPti = 1; tetPti < f.size() - 1; ++tetPti) for (label tetPti = 1; tetPti < f.size() - 1; ++tetPti)
{ {
coordinates_ = barycentric(1, 0, 0, 0); coordinates_ = barycentric(1, 0, 0, 0);
@ -735,10 +733,7 @@ Foam::scalar Foam::particle::trackToStationaryTri
if (debug) if (debug)
{ {
vector o, b, v1, v2; Pout<< "Tet points: " << currentTetIndices().tet(mesh_) << endl
stationaryTetGeometry(o, b, v1, v2);
Pout<< "Tet points o=" << o << ", b=" << b
<< ", v1=" << v1 << ", v2=" << v2 << endl
<< "Tet determinant = " << detA << endl << "Tet determinant = " << detA << endl
<< "Start local coordinates = " << y0 << endl; << "Start local coordinates = " << y0 << endl;
} }

View File

@ -106,7 +106,7 @@ public:
// Constructor // Constructor
template <class TrackCloudType> template<class TrackCloudType>
trackingData(const TrackCloudType& cloud) trackingData(const TrackCloudType& cloud)
{} {}
}; };
@ -177,15 +177,6 @@ private:
// Tetrahedra functions // Tetrahedra functions
//- Get the vertices of the current tet
inline void stationaryTetGeometry
(
vector& centre,
vector& base,
vector& vertex1,
vector& vertex2
) const;
//- Get the transformation associated with the current tet. This //- Get the transformation associated with the current tet. This
// will convert a barycentric position within the tet to a // will convert a barycentric position within the tet to a
// Cartesian position in the global coordinate system. The // Cartesian position in the global coordinate system. The
@ -292,7 +283,7 @@ private:
protected: protected:
// Patch interactions // Patch Interactions
//- Read particle from stream. Optionally (for old format) return //- Read particle from stream. Optionally (for old format) return
// read position. Used by construct-from-Istream // read position. Used by construct-from-Istream

View File

@ -31,31 +31,11 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::particle::stationaryTetGeometry
(
vector& centre,
vector& base,
vector& vertex1,
vector& vertex2
) const
{
const triFace triIs(currentTetIndices().faceTriIs(mesh_));
const vectorField& ccs = mesh_.cellCentres();
const pointField& pts = mesh_.points();
centre = ccs[celli_];
base = pts[triIs[0]];
vertex1 = pts[triIs[1]];
vertex2 = pts[triIs[2]];
}
inline Foam::barycentricTensor Foam::particle::stationaryTetTransform() const inline Foam::barycentricTensor Foam::particle::stationaryTetTransform() const
{ {
vector centre, base, vertex1, vertex2; const tetPointRef tet = currentTetIndices().tet(mesh_);
stationaryTetGeometry(centre, base, vertex1, vertex2);
return barycentricTensor(centre, base, vertex1, vertex2); return barycentricTensor(tet.a(), tet.b(), tet.c(), tet.d());
} }
@ -247,10 +227,8 @@ inline Foam::Pair<Foam::scalar> Foam::particle::stepFractionSpan() const
return Pair<scalar>(tFrac, dtFrac); return Pair<scalar>(tFrac, dtFrac);
} }
else
{ return Pair<scalar>(0, 1);
return Pair<scalar>(0, 1);
}
} }
@ -274,10 +252,8 @@ inline Foam::barycentricTensor Foam::particle::currentTetTransform() const
{ {
return movingTetTransform(0)[0]; return movingTetTransform(0)[0];
} }
else
{ return stationaryTetTransform();
return stationaryTetTransform();
}
} }
@ -354,10 +330,7 @@ void Foam::particle::patchData(vector& n, vector& U) const
} }
else else
{ {
vector centre, base, vertex1, vertex2; n = currentTetIndices().faceTri(mesh_).unitNormal();
stationaryTetGeometry(centre, base, vertex1, vertex2);
n = triPointRef(base, vertex1, vertex2).unitNormal();
U = Zero; U = Zero;
} }

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef passiveParticle_H #ifndef Foam_passiveParticle_H
#define passiveParticle_H #define Foam_passiveParticle_H
#include "particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
@ -55,7 +55,6 @@ class passiveParticle
: :
public particle public particle
{ {
public: public:
// Constructors // Constructors

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef solidParticle_H #ifndef Foam_solidParticle_H
#define solidParticle_H #define Foam_solidParticle_H
#include "particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
@ -53,12 +53,11 @@ namespace Foam
{ {
// Forward Declarations // Forward Declarations
class solidParticleCloud;
class solidParticle; class solidParticle;
class solidParticleCloud;
Ostream& operator<<(Ostream&, const solidParticle&); Ostream& operator<<(Ostream&, const solidParticle&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class solidParticle Declaration Class solidParticle Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -99,25 +98,41 @@ public:
// Constructors // Constructors
inline trackingData trackingData
( (
const solidParticleCloud& spc, const solidParticleCloud& cld,
const interpolationCellPoint<scalar>& rhoInterp, const interpolationCellPoint<scalar>& rhoInterp,
const interpolationCellPoint<vector>& UInterp, const interpolationCellPoint<vector>& UInterp,
const interpolationCellPoint<scalar>& nuInterp, const interpolationCellPoint<scalar>& nuInterp,
const vector& g const vector& g
); )
:
particle::trackingData(cld),
rhoInterp_(rhoInterp),
UInterp_(UInterp),
nuInterp_(nuInterp),
g_(g)
{}
// Member functions // Member Functions
inline const interpolationCellPoint<scalar>& rhoInterp() const; const interpolationCellPoint<scalar>& nuInterp() const noexcept
{
return nuInterp_;
}
inline const interpolationCellPoint<vector>& UInterp() const; const interpolationCellPoint<vector>& UInterp() const noexcept
{
return UInterp_;
}
inline const interpolationCellPoint<scalar>& nuInterp() const; const interpolationCellPoint<scalar>& rhoInterp() const noexcept
{
return rhoInterp_;
}
inline const vector& g() const; const vector& g() const noexcept { return g_; }
}; };
@ -132,15 +147,20 @@ public:
//- Construct from a position and a cell //- Construct from a position and a cell
// Searches for the rest of the required topology. // Searches for the rest of the required topology.
// Other properties are zero initialised. // Other properties are zero initialised.
inline solidParticle solidParticle
( (
const polyMesh& mesh, const polyMesh& mesh,
const vector& position, const vector& position,
const label celli = -1 const label celli = -1
); )
:
particle(mesh, position, celli),
d_(0),
U_(Zero)
{}
//- Construct from components //- Construct from components
inline solidParticle solidParticle
( (
const polyMesh& mesh, const polyMesh& mesh,
const barycentric& coordinates, const barycentric& coordinates,
@ -149,7 +169,12 @@ public:
const label tetPti, const label tetPti,
const scalar d, const scalar d,
const vector& U const vector& U
); )
:
particle(mesh, coordinates, celli, tetFacei, tetPti),
d_(d),
U_(U)
{}
//- Construct from Istream //- Construct from Istream
solidParticle solidParticle
@ -187,19 +212,19 @@ public:
// Member Functions // Member Functions
// Access // Access
//- Return diameter //- Return diameter
inline scalar d() const; scalar d() const noexcept { return d_; }
//- Return velocity //- Return velocity
inline const vector& U() const; const vector& U() const noexcept { return U_; }
// Tracking // Tracking
//- Move //- Move
bool move(solidParticleCloud&, trackingData&, const scalar); bool move(solidParticleCloud&, trackingData&, const scalar);
// Patch interactions // Patch interactions
@ -249,10 +274,6 @@ template<> struct is_contiguous<solidParticle> : std::true_type {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "solidParticleI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,118 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::solidParticle::trackingData::trackingData
(
const solidParticleCloud& spc,
const interpolationCellPoint<scalar>& rhoInterp,
const interpolationCellPoint<vector>& UInterp,
const interpolationCellPoint<scalar>& nuInterp,
const vector& g
)
:
particle::trackingData(spc),
rhoInterp_(rhoInterp),
UInterp_(UInterp),
nuInterp_(nuInterp),
g_(g)
{}
inline Foam::solidParticle::solidParticle
(
const polyMesh& mesh,
const vector& position,
const label celli
)
:
particle(mesh, position, celli),
d_(0),
U_(Zero)
{}
inline Foam::solidParticle::solidParticle
(
const polyMesh& mesh,
const barycentric& coordinates,
const label celli,
const label tetFacei,
const label tetPti,
const scalar d,
const vector& U
)
:
particle(mesh, coordinates, celli, tetFacei, tetPti),
d_(d),
U_(U)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::interpolationCellPoint<Foam::scalar>&
Foam::solidParticle::trackingData::rhoInterp() const
{
return rhoInterp_;
}
inline const Foam::interpolationCellPoint<Foam::vector>&
Foam::solidParticle::trackingData::UInterp() const
{
return UInterp_;
}
inline const Foam::interpolationCellPoint<Foam::scalar>&
Foam::solidParticle::trackingData::nuInterp() const
{
return nuInterp_;
}
inline const Foam::vector& Foam::solidParticle::trackingData::g() const
{
return g_;
}
inline Foam::scalar Foam::solidParticle::d() const
{
return d_;
}
inline const Foam::vector& Foam::solidParticle::U() const
{
return U_;
}
// ************************************************************************* //

View File

@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef trackedParticle_H #ifndef Foam_trackedParticle_H
#define trackedParticle_H #define Foam_trackedParticle_H
#include "bitSet.H" #include "bitSet.H"
#include "particle.H" #include "particle.H"
@ -64,7 +64,7 @@ class trackedParticle
: :
public particle public particle
{ {
// Private data // Private Data
//- Start point to track from //- Start point to track from
point start_; point start_;
@ -141,8 +141,8 @@ public:
const label k const label k
); );
//- Construct from a position and a cell, searching for the rest of the //- Construct from a position and a cell,
// required topology //- searching for the rest of the required topology
trackedParticle trackedParticle
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -193,52 +193,28 @@ public:
// Member Functions // Member Functions
//- Point to track from //- Point to track from
point& start() point& start() noexcept { return start_; }
{
return start_;
}
//- Point to track to //- Point to track to
point& end() point& end() noexcept { return end_; }
{
return end_;
}
//- Transported label //- Transported label
label i() const label i() const noexcept { return i_; }
{
return i_;
}
//- Transported label //- Transported label
label& i() label& i() noexcept { return i_; }
{
return i_;
}
//- Transported label //- Transported label
label j() const label j() const noexcept { return j_; }
{
return j_;
}
//- Transported label //- Transported label
label& j() label& j() noexcept { return j_; }
{
return j_;
}
//- Transported label //- Transported label
label k() const label k() const noexcept { return k_; }
{
return k_;
}
//- Transported label //- Transported label
label& k() label& k() noexcept { return k_; }
{
return k_;
}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef passivePositionParticle_H #ifndef Foam_passivePositionParticle_H
#define passivePositionParticle_H #define Foam_passivePositionParticle_H
#include "particle.H" #include "particle.H"
#include "IOstream.H" #include "IOstream.H"
@ -82,7 +82,6 @@ public:
location_(position()) location_(position())
{} {}
//- Construct from components (supplied location) //- Construct from components (supplied location)
passivePositionParticle passivePositionParticle
( (
@ -98,7 +97,6 @@ public:
location_(position) location_(position)
{} {}
//- Construct from Istream //- Construct from Istream
passivePositionParticle passivePositionParticle
( (
@ -165,39 +163,39 @@ public:
// Member Functions // Member Functions
//- Return current particle position //- The cached particle position
inline const point& location() const const point& location() const noexcept
{
return location_;
}
//- Write the particle position and cell id
// Uses cached location() instead of calculated position()
virtual void writePosition(Ostream& os) const
{
if (os.format() == IOstream::ASCII)
{ {
return location_; os << location() << token::SPACE << cell();
}
else
{
positionsCompat1706 p;
const size_t s =
(
offsetof(positionsCompat1706, facei)
- offsetof(positionsCompat1706, position)
);
p.position = location();
p.celli = cell();
os.write(reinterpret_cast<const char*>(&p.position), s);
} }
//- Write the particle position and cell id // Check state of Ostream
virtual void writePosition(Ostream& os) const os.check(FUNCTION_NAME);
{ }
// Use cached location() instead of calculated position()
if (os.format() == IOstream::ASCII)
{
os << location() << token::SPACE << cell();
}
else
{
positionsCompat1706 p;
const size_t s =
(
offsetof(positionsCompat1706, facei)
- offsetof(positionsCompat1706, position)
);
p.position = location();
p.celli = cell();
os.write(reinterpret_cast<const char*>(&p.position), s);
}
// Check state of Ostream
os.check(FUNCTION_NAME);
}
}; };