mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: wallBoundedStreamLine: -store one value per location -optional tracklength specification
This commit is contained in:
@ -74,7 +74,14 @@ functions
|
||||
// Steps particles can travel before being removed
|
||||
lifeTime 10000;
|
||||
|
||||
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
|
||||
//- Specify either absolute length of steps (trackLength) or a number
|
||||
// of subcycling steps per cell (nSubCycle)
|
||||
|
||||
// Size of single track segment [m]
|
||||
//trackLength 1e-3;
|
||||
|
||||
// Number of steps per cell (estimate). Set to 1 to disable
|
||||
// subcycling.
|
||||
nSubCycle 5;
|
||||
|
||||
// Cloud name to use
|
||||
|
||||
@ -108,6 +108,10 @@ functions
|
||||
// Steps particles can travel before being removed
|
||||
lifeTime 100;
|
||||
|
||||
// Optional absolute length of steps (trackLength)
|
||||
// Size of single track segment [m]
|
||||
//trackLength 1e-3;
|
||||
|
||||
// Cloud name to use
|
||||
cloudName particleTracks;
|
||||
|
||||
|
||||
@ -408,6 +408,7 @@ void Foam::wallBoundedStreamLine::track()
|
||||
vvInterp,
|
||||
UIndex, // index of U in vvInterp
|
||||
trackForward_, // track in +u direction?
|
||||
trackLength_, // fixed track length
|
||||
isWallPatch, // which faces are to follow
|
||||
|
||||
allTracks_,
|
||||
@ -518,6 +519,14 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
trackLength_ = VGREAT;
|
||||
if (dict.found("trackLength"))
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
Info<< type() << " : fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
|
||||
@ -98,6 +98,9 @@ class wallBoundedStreamLine
|
||||
//- Maximum lifetime (= number of cells) of particle
|
||||
label lifeTime_;
|
||||
|
||||
//- Track length
|
||||
scalar trackLength_;
|
||||
|
||||
//- Optional specified name of particles
|
||||
word cloudName_;
|
||||
|
||||
|
||||
@ -651,6 +651,8 @@ Foam::scalar Foam::wallBoundedStreamLineParticle::trackToEdge
|
||||
{
|
||||
// Reached endpoint
|
||||
//checkInside();
|
||||
diagEdge_ = -1;
|
||||
meshEdgeStart_ = -1;
|
||||
return trackFraction;
|
||||
}
|
||||
|
||||
@ -797,7 +799,24 @@ Foam::vector Foam::wallBoundedStreamLineParticle::interpolateFields
|
||||
|
||||
const tetIndices ti = currentTetIndices();
|
||||
|
||||
const vector U = td.vvInterp_[td.UIndex_].interpolate
|
||||
(
|
||||
position,
|
||||
ti, //cellI,
|
||||
faceI
|
||||
);
|
||||
|
||||
// Check if at different position
|
||||
if
|
||||
(
|
||||
!sampledPositions_.size()
|
||||
|| magSqr(sampledPositions_.last()-position) > Foam::sqr(SMALL)
|
||||
)
|
||||
{
|
||||
// Store the location
|
||||
sampledPositions_.append(position);
|
||||
|
||||
// Store the scalar fields
|
||||
sampledScalars_.setSize(td.vsInterp_.size());
|
||||
forAll(td.vsInterp_, scalarI)
|
||||
{
|
||||
@ -812,23 +831,29 @@ Foam::vector Foam::wallBoundedStreamLineParticle::interpolateFields
|
||||
);
|
||||
}
|
||||
|
||||
// Store the vector fields
|
||||
sampledVectors_.setSize(td.vvInterp_.size());
|
||||
forAll(td.vvInterp_, vectorI)
|
||||
{
|
||||
sampledVectors_[vectorI].append
|
||||
(
|
||||
td.vvInterp_[vectorI].interpolate
|
||||
vector positionU;
|
||||
if (vectorI == td.UIndex_)
|
||||
{
|
||||
positionU = U;
|
||||
}
|
||||
else
|
||||
{
|
||||
positionU = td.vvInterp_[vectorI].interpolate
|
||||
(
|
||||
position,
|
||||
ti, //cellI,
|
||||
faceI
|
||||
)
|
||||
);
|
||||
}
|
||||
sampledVectors_[vectorI].append(positionU);
|
||||
}
|
||||
}
|
||||
|
||||
const DynamicList<vector>& U = sampledVectors_[td.UIndex_];
|
||||
|
||||
return U.last();
|
||||
return U;
|
||||
}
|
||||
|
||||
|
||||
@ -837,7 +862,6 @@ Foam::vector Foam::wallBoundedStreamLineParticle::sample
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
sampledPositions_.append(position());
|
||||
vector U = interpolateFields(td, position(), cell(), tetFace());
|
||||
|
||||
if (!td.trackForward_)
|
||||
@ -979,7 +1003,7 @@ bool Foam::wallBoundedStreamLineParticle::move
|
||||
|
||||
--lifeTime_;
|
||||
|
||||
// Update sampled velocity and fields if position changed
|
||||
// Get sampled velocity and fields. Store if position changed.
|
||||
vector U = sample(td);
|
||||
|
||||
// !user parameter!
|
||||
@ -991,6 +1015,12 @@ bool Foam::wallBoundedStreamLineParticle::move
|
||||
}
|
||||
|
||||
|
||||
if (td.trackLength_ < GREAT)
|
||||
{
|
||||
dt = td.trackLength_;
|
||||
}
|
||||
|
||||
|
||||
scalar fraction = trackToEdge(td, position() + dt*U);
|
||||
dt *= fraction;
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@ public:
|
||||
const PtrList<interpolation<vector> >& vvInterp_;
|
||||
const label UIndex_;
|
||||
const bool trackForward_;
|
||||
const scalar trackLength_;
|
||||
|
||||
const PackedBoolList& isWallPatch_;
|
||||
|
||||
@ -90,6 +91,7 @@ public:
|
||||
const PtrList<interpolation<vector> >& vvInterp,
|
||||
const label UIndex,
|
||||
const bool trackForward,
|
||||
const scalar trackLength,
|
||||
const PackedBoolList& isWallPatch,
|
||||
|
||||
DynamicList<List<point> >& allPositions,
|
||||
@ -105,6 +107,7 @@ public:
|
||||
vvInterp_(vvInterp),
|
||||
UIndex_(UIndex),
|
||||
trackForward_(trackForward),
|
||||
trackLength_(trackLength),
|
||||
isWallPatch_(isWallPatch),
|
||||
|
||||
allPositions_(allPositions),
|
||||
|
||||
@ -114,7 +114,7 @@ void Foam::patchSeedSet::calcSamples
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "In random mode : selected " << patchFaces
|
||||
Pout<< "In random mode : selected " << patchFaces.size()
|
||||
<< " faces out of " << sz << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user