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