diff --git a/src/postProcessing/functionObjects/field/streamLine/controlDict b/src/postProcessing/functionObjects/field/streamLine/controlDict index 63b6d1d1d2b34760363a1aacb7306768fd158db3..06b3235d8458a6cdc5118f369c6cc7c781d46770 100644 --- a/src/postProcessing/functionObjects/field/streamLine/controlDict +++ b/src/postProcessing/functionObjects/field/streamLine/controlDict @@ -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; diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/controlDict b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/controlDict index 4a3f4fe29c407c9526ce20dc3bdd03eae0b0c9c2..e7366e4445ac69ba03e89936cd3f77d43a20fd14 100644 --- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/controlDict +++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/controlDict @@ -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; diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C index 9089749eefea47f22c62df6a295e2397d5357a1e..822465edff311653574b498bfa8466f67e8cee50 100644 --- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C +++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C @@ -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 diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H index 6a39d25b37da1948004ddf1973c8cc1cb78b2b3e..bb130b985d855b61f96e3536009bfbcce7db39b2 100644 --- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H +++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H @@ -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_; diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C index cd7605a56edd2c0b27eb172a48a9e0e060ec70cc..0cdb3664f9c5e86f7b3ffe23f17b4f999a17afa9 100644 --- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C +++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C @@ -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 - ( - position, - ti, //cellI, - faceI - ) - ); - } + // Store the location + sampledPositions_.append(position); - sampledVectors_.setSize(td.vvInterp_.size()); - forAll(td.vvInterp_, vectorI) - { - sampledVectors_[vectorI].append - ( - td.vvInterp_[vectorI].interpolate + // 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 + ) + ); + } - const DynamicList<vector>& U = sampledVectors_[td.UIndex_]; + // 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); + } + } - 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; diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H index c0e19dd090a55e559f54e9b9d1e0d2562a307e05..a70311c4cfc592250a4ea02a1fe1340485f9a005 100644 --- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H +++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H @@ -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), diff --git a/src/sampling/sampledSet/patchSeed/patchSeedSet.C b/src/sampling/sampledSet/patchSeed/patchSeedSet.C index bbd8cf0a3c1a207af99e3dcaa5cbe4884e854b30..0393b5a85a919cdd241086183b873822e384a953 100644 --- a/src/sampling/sampledSet/patchSeed/patchSeedSet.C +++ b/src/sampling/sampledSet/patchSeed/patchSeedSet.C @@ -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; } }