ENH: wallBoundedStreamLine: -store one value per location -optional tracklength specification

This commit is contained in:
mattijs
2012-02-07 11:35:18 +00:00
parent 18e2c53007
commit 0dbdea4781
7 changed files with 88 additions and 32 deletions

View File

@ -74,8 +74,15 @@ functions
// Steps particles can travel before being removed
lifeTime 10000;
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
nSubCycle 5;
//- 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
cloudName particleTracks;

View File

@ -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;

View File

@ -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

View File

@ -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_;

View File

@ -651,6 +651,8 @@ Foam::scalar Foam::wallBoundedStreamLineParticle::trackToEdge
{
// Reached endpoint
//checkInside();
diagEdge_ = -1;
meshEdgeStart_ = -1;
return trackFraction;
}
@ -797,38 +799,61 @@ Foam::vector Foam::wallBoundedStreamLineParticle::interpolateFields
const tetIndices ti = currentTetIndices();
const vector U = td.vvInterp_[td.UIndex_].interpolate
(
position,
ti, //cellI,
faceI
);
sampledScalars_.setSize(td.vsInterp_.size());
forAll(td.vsInterp_, scalarI)
// Check if at different position
if
(
!sampledPositions_.size()
|| magSqr(sampledPositions_.last()-position) > Foam::sqr(SMALL)
)
{
sampledScalars_[scalarI].append
(
td.vsInterp_[scalarI].interpolate
// Store the location
sampledPositions_.append(position);
// Store the scalar fields
sampledScalars_.setSize(td.vsInterp_.size());
forAll(td.vsInterp_, scalarI)
{
sampledScalars_[scalarI].append
(
position,
ti, //cellI,
faceI
)
);
td.vsInterp_[scalarI].interpolate
(
position,
ti, //cellI,
faceI
)
);
}
// Store the vector fields
sampledVectors_.setSize(td.vvInterp_.size());
forAll(td.vvInterp_, vectorI)
{
vector positionU;
if (vectorI == td.UIndex_)
{
positionU = U;
}
else
{
positionU = td.vvInterp_[vectorI].interpolate
(
position,
ti, //cellI,
faceI
);
}
sampledVectors_[vectorI].append(positionU);
}
}
sampledVectors_.setSize(td.vvInterp_.size());
forAll(td.vvInterp_, vectorI)
{
sampledVectors_[vectorI].append
(
td.vvInterp_[vectorI].interpolate
(
position,
ti, //cellI,
faceI
)
);
}
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;

View File

@ -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),

View File

@ -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;
}
}