Commit f27490b7 authored by Andrew Heather's avatar Andrew Heather
Browse files

updates to radiation and lagrangian libraries

parent 0438a98c
......@@ -3,6 +3,5 @@ set -x
wmake libso basic
wmake libso solidParticle
wmake libso basic
wmake libso intermediate
wmake libso dieselSpray
......@@ -43,7 +43,6 @@ Foam::Cloud<ParticleType>::Cloud
cloud(pMesh),
IDLList<ParticleType>(particles),
polyMesh_(pMesh),
cloudName_("defaultCloud"),
allFaces_(pMesh.faces()),
points_(pMesh.points()),
cellFaces_(pMesh.cells()),
......@@ -65,7 +64,6 @@ Foam::Cloud<ParticleType>::Cloud
cloud(pMesh, cloudName),
IDLList<ParticleType>(particles),
polyMesh_(pMesh),
cloudName_(cloudName),
allFaces_(pMesh.faces()),
points_(pMesh.points()),
cellFaces_(pMesh.cells()),
......
......@@ -26,7 +26,6 @@ Class
Foam::Cloud
Description
Foam::Cloud
SourceFiles
Cloud.C
......@@ -74,7 +73,6 @@ class Cloud
// Private data
const polyMesh& polyMesh_;
const word cloudName_;
const faceList& allFaces_;
const vectorField& points_;
const cellList& cellFaces_;
......@@ -152,12 +150,6 @@ public:
return polyMesh_;
}
//- Return the cloud name reference
const word& cloudName() const
{
return cloudName_;
}
//- Is this global face an internal face?
bool internalFace(const label facei) const
{
......@@ -213,6 +205,11 @@ public:
return IDLList<ParticleType>::end();
};
void clear()
{
return IDLList<ParticleType>::clear();
};
// Edit
......
......@@ -60,7 +60,6 @@ Foam::Cloud<ParticleType>::Cloud
:
cloud(pMesh),
polyMesh_(pMesh),
cloudName_("defaultCloud"),
allFaces_(pMesh.faces()),
points_(pMesh.points()),
cellFaces_(pMesh.cells()),
......@@ -83,7 +82,6 @@ Foam::Cloud<ParticleType>::Cloud
:
cloud(pMesh, cloudName),
polyMesh_(pMesh),
cloudName_(cloudName),
allFaces_(pMesh.faces()),
points_(pMesh.points()),
cellFaces_(pMesh.cells()),
......
......@@ -22,6 +22,8 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "IOPosition.H"
......
......@@ -39,7 +39,7 @@ template<class ParticleType>
Foam::labelList Foam::Particle<ParticleType>::findFaces
(
const vector& position
)
) const
{
const polyMesh& mesh = cloud_.polyMesh_;
const labelList& faces = mesh.cells()[celli_];
......@@ -69,7 +69,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
const vector& position,
const label celli,
const scalar stepFraction
)
) const
{
const polyMesh& mesh = cloud_.polyMesh_;
const labelList& faces = mesh.cells()[celli];
......@@ -94,11 +94,11 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::prepareForParallelTransfer
(
const label patchi,
TrackingData& td
TrackData& td
)
{
// Convert the face index to be local to the processor patch
......@@ -107,11 +107,11 @@ void Foam::Particle<ParticleType>::prepareForParallelTransfer
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::correctAfterParallelTransfer
(
const label patchi,
TrackingData& td
TrackData& td
)
{
const processorPolyPatch& ppp =
......@@ -156,7 +156,15 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
}
// Reset the face index for the next tracking operation
facei_ = -1;
if (stepFraction_ > (1.0 - SMALL))
{
stepFraction_ = 1.0;
facei_ = -1;
}
else
{
facei_ += ppp.start();
}
}
......@@ -181,11 +189,11 @@ Foam::Particle<ParticleType>::Particle
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
Foam::label Foam::Particle<ParticleType>::track
(
const vector& endPosition,
TrackingData& td
TrackData& td
)
{
facei_ = -1;
......@@ -200,6 +208,7 @@ Foam::label Foam::Particle<ParticleType>::track
}
template<class ParticleType>
Foam::label Foam::Particle<ParticleType>::track(const vector& endPosition)
{
......@@ -207,13 +216,12 @@ Foam::label Foam::Particle<ParticleType>::track(const vector& endPosition)
return track(endPosition, dummyTd);
}
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
Foam::scalar Foam::Particle<ParticleType>::trackToFace
(
const vector& endPosition,
TrackingData& td
TrackData& td
)
{
const polyMesh& mesh = cloud_.polyMesh_;
......@@ -301,8 +309,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
{
FatalErrorIn
(
"Particle::trackToFace"
"(const vector&, TrackingData&)"
"Particle::trackToFace(const vector&, TrackData&)"
)<< "addressing failure" << nl
<< abort(FatalError);
}
......@@ -389,7 +396,6 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
return trackFraction;
}
template<class ParticleType>
Foam::scalar Foam::Particle<ParticleType>::trackToFace
(
......@@ -400,7 +406,6 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
return trackToFace(endPosition, dummyTd);
}
template<class ParticleType>
void Foam::Particle<ParticleType>::transformPosition(const tensor& T)
{
......@@ -419,11 +424,11 @@ void Foam::Particle<ParticleType>::transformProperties(const vector&)
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::hitWedgePatch
(
const wedgePolyPatch& wpp,
TrackingData&
TrackData&
)
{
vector nf = wpp.faceAreas()[wpp.whichFace(facei_)];
......@@ -434,11 +439,11 @@ void Foam::Particle<ParticleType>::hitWedgePatch
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::hitSymmetryPatch
(
const symmetryPolyPatch& spp,
TrackingData&
TrackData&
)
{
vector nf = spp.faceAreas()[spp.whichFace(facei_)];
......@@ -449,11 +454,11 @@ void Foam::Particle<ParticleType>::hitSymmetryPatch
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::hitCyclicPatch
(
const cyclicPolyPatch& cpp,
TrackingData&
TrackData&
)
{
label patchFacei_ = cpp.whichFace(facei_);
......@@ -481,31 +486,31 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::hitProcessorPatch
(
const processorPolyPatch& spp,
TrackingData& td
TrackData& td
)
{}
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::hitWallPatch
(
const wallPolyPatch& spp,
TrackingData&
TrackData&
)
{}
template<class ParticleType>
template<class TrackingData>
template<class TrackData>
void Foam::Particle<ParticleType>::hitPatch
(
const polyPatch& spp,
TrackingData&
TrackData&
)
{}
......
......@@ -26,7 +26,6 @@ Class
Foam::Particle
Description
Foam::Particle
\*---------------------------------------------------------------------------*/
......@@ -79,6 +78,41 @@ class Particle
public IDLList<ParticleType>::link
{
public:
//- Class used to pass tracking data to the trackToFace function
class trackData
{
// Private data
//- Reference to the cloud containing this particle
Cloud<ParticleType>& cloud_;
public:
bool switchProcessor;
bool keepParticle;
// Constructors
inline trackData
(
Cloud<ParticleType>& cloud
);
// Member functions
//- Return a reference to the cloud
inline Cloud<ParticleType>& cloud();
};
private:
// Private data
//- Reference to the particle cloud
......@@ -108,7 +142,7 @@ class Particle
const vector& to,
const label facei,
const scalar stepFraction
);
) const;
//- Return the 'lambda' value for the position, p, on the face,
// where, p = from + lamda*(to - from)
......@@ -118,13 +152,13 @@ class Particle
const vector& from,
const vector& to,
const label facei
);
) const;
//- Return the faces between position and cell centre
labelList findFaces
(
const vector& position
);
) const;
//- Return the faces between position and cell centre
labelList findFaces
......@@ -132,80 +166,91 @@ class Particle
const vector& position,
const label celli,
const scalar stepFraction
);
) const;
protected:
// Patch interactions
//- Overridable function to handle the particle hitting a wedgePatch
template<class TrackingData>
template<class TrackData>
void hitWedgePatch
(
const wedgePolyPatch&,
TrackingData& td
TrackData& td
);
//- Overridable function to handle the particle hitting a symmetryPatch
template<class TrackingData>
//- Overridable function to handle the particle hitting a
// symmetryPatch
template<class TrackData>
void hitSymmetryPatch
(
const symmetryPolyPatch&,
TrackingData& td
TrackData& td
);
//- Overridable function to handle the particle hitting a cyclicPatch
template<class TrackingData>
template<class TrackData>
void hitCyclicPatch
(
const cyclicPolyPatch&,
TrackingData& td
TrackData& td
);
//- Overridable function to handle the particle hitting a processorPatch
template<class TrackingData>
//- Overridable function to handle the particle hitting a
// processorPatch
template<class TrackData>
void hitProcessorPatch
(
const processorPolyPatch&,
TrackingData& td
TrackData& td
);
//- Overridable function to handle the particle hitting a wallPatch
template<class TrackingData>
template<class TrackData>
void hitWallPatch
(
const wallPolyPatch&,
TrackingData& td
TrackData& td
);
//- Overridable function to handle the particle hitting a general patch
template<class TrackingData>
//- Overridable function to handle the particle hitting a
// general patch
template<class TrackData>
void hitPatch
(
const polyPatch&,
TrackingData& td
TrackData& td
);
// Transformations
//- Transform the position the particle
// according to the given transformation tensor
void transformPosition(const tensor& T);
virtual void transformPosition(const tensor& T);
//- Transform the physical properties of the particle
// according to the given transformation tensor
void transformProperties(const tensor& T);
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
void transformProperties(const vector& separation);
virtual void transformProperties(const vector& separation);
// Parallel transfer
//- Convert global addressing to the processor patch
// local equivalents
template<class TrackingData>
void prepareForParallelTransfer(const label patchi, TrackingData& td);
template<class TrackData>
void prepareForParallelTransfer(const label patchi, TrackData& td);
//- Convert processor patch addressing to the global equivalents
// and set the celli to the face-neighbour
template<class TrackingData>
void correctAfterParallelTransfer(const label patchi, TrackingData& td);
template<class TrackData>
void correctAfterParallelTransfer(const label patchi, TrackData& td);
public:
......@@ -217,36 +262,6 @@ public:
TypeName("Particle");
//- Class used to pass tracking data to the trackToFace function
class trackData
{
// Private data
//- Reference to the cloud containing this particle
Cloud<ParticleType>& cloud_;
public:
bool switchProcessor;
bool keepParticle;
// Constructors
inline trackData
(
Cloud<ParticleType>& cloud
);
// Member functions
inline Cloud<ParticleType>& cloud();
};
// Constructors
//- Construct from components
......@@ -265,7 +280,8 @@ public:
bool readFields = true
);
//- Factory class to read-construct particles used for parallel transfer
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
......@@ -288,7 +304,7 @@ public:
};
// Destructor
//- Destructor
virtual ~Particle()
{}
......@@ -299,7 +315,7 @@ public:
// Access
//- Return true if particle is in cell
inline bool inCell();
inline bool inCell() const;
//- Return true if position is in cell i
inline bool inCell
......@@ -307,7 +323,7 @@ public:
const vector& position,
const label celli,
const scalar stepFraction
);
) const;
//- Return current particle position
inline const vector& position() const;
......@@ -337,7 +353,11 @@ public:
inline label patch(const label facei) const;
//- Which face of this patch is this particle on
inline label patchFace(const label patchi, const label facei) const;
inline label patchFace
(
const label patchi,
const label facei
) const;
//- The nearest distance to a wall that
// the particle can be in the n direction
......@@ -359,14 +379,14 @@ public:
// the fraction of the time-step completed.
// Returns the boundary face index if the track stops at the
// boundary, -1 otherwise.
template<class TrackingData>
template<class TrackData>
label track
(
const vector& endPosition,
TrackingData& td
TrackData& td
);
//- Calls the templated track with dummy TrackingData
//- Calls the templated track with dummy TrackData
label track(const vector& endPosition);
//- Track particle to a given position and returns 1.0 if the
......@@ -375,17 +395,18 @@ public:
// completed.
// on entry 'stepFraction()' should be set to the fraction of the
// time-step at which the tracking starts.
template<class TrackingData>
template<class TrackData>
scalar trackToFace
(
const vector& endPosition,
TrackingData& td
TrackData& td
);
//- Calls the templated trackToFace with dummy TrackingData
//- Calls the templated trackToFace with dummy TrackData
scalar trackToFace(const vector& endPosition);
//- Return the index of the face to be used in the interpolation routine
//- Return the index of the face to be used in the interpolation
// routine
inline label faceInterpolation() const;
......
......@@ -40,7 +40,7 @@ inline scalar Particle<ParticleType>::lambda
const vector& to,
const label facei,
const scalar stepFraction
)
) const
{
const polyMesh& mesh = cloud_.polyMesh_;
bool movingMesh = mesh.moving();
......@@ -71,7 +71,6 @@ inline scalar Particle<ParticleType>::lambda
// for a moving mesh we need to reconstruct the old
// Sf and Cf from oldPoints (they aren't stored)
// NN.
const vectorField& oldPoints = mesh.oldPoints();
......@@ -100,7 +99,7 @@ inline scalar Particle<ParticleType>::lambda
// find center of rotation
vector omega = Sf0 ^ Sf;
scalar magOmega = mag(omega);
omega /= magOmega+SMALL;
omega /= magOmega + SMALL;
vector n0 = omega ^ Sf0;
scalar lam = ((Cf - Cf0) & Sf)/(n0 & Sf);
vector r0 = Cf0 + lam*n0;
......@@ -188,7 +187,7 @@ inline scalar Particle<ParticleType>::lambda
const vector& from,
const vector& to,
const label facei
)