CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Meaning of sampleFrequency in particleTrackProperties?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 3, 2024, 17:29
Default Meaning of sampleFrequency in particleTrackProperties?
  #1
Member
 
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6
reverseila is on a distinguished road
Dear all,

In the particleTrackProperties there is one entry that I don't know what it is and/or what does it mean:
  • sampleFrequency 1;
There's no explanation in the documentations of OpenFOAM website, and in comments of the source code of particleTracks utility whatsoever. I guess this is one of those not so uncommon moments that one needs to RTFS! Read The Freaking Sourcecode. Now, the following is what I was able to find out about this entry so far:


According to the source code of the particleTracks utility, sampleFrequency must be a number greater than or equal to 1:
Code:
    sampleFrequency = max(1, sampleFrequency);  // sanity
and is used later on to set the sample rate for the track sampler (whatever it is):
Code:
    trackSampler.setSampleRate(sampleFrequency, maxPositions, maxTracks);
which it seems that it determines the number of tracks (nTracks_). This is, as its name suggests, the number of tracks. but what is a track anyway (I think I need to know a bit about the terminology OpenFOAM uses for lagrangian stuff).
Here's the source code for setSampleRate:
Code:
        //- Set the sampling stride, upper limits
        //  \return Number of tracks to generate
        label setSampleRate
        (
            const label sampleFreq, // sampleFrequency is passed as the argument to this parameter
            const label maxPositions,
            const label maxTracks = -1
        )
        {
             // numTracks = numParticles/stride

            // stride_: the sampling interval
            stride_ = max(1, sampleFreq);
            maxPositions_ = maxPositions;
            nTracks_ = (origParcelAddr_.totalSize()/stride_);

            if (maxTracks > 0)
            {
                nTracks_ = min(nTracks_, maxTracks);
            }

            return nTracks_;
        }
I'm not sure what the line in red means.


EDIT (ADDED)<<<
Note that the value of the sampleFrequency is ended up being stored in the stride_ if its greater than 1.

Further in the code there's this function that creates track fields:
Code:
template<class Type>
void Foam::particleTracksSampler::createTrackField
(
    const UList<Type>& values,
    List<DynamicList<Type>>& trackValues
) const
{
    List<Type> allValues(cloudGather_.gather(values));

    const label nTracks = trackValues.size();

    forAll(allValues, i)
    {
        const label globalId =
            origParcelAddr_.toGlobal(origProcIds_[i], origParcelIds_[i]);

        if (globalId % stride_ == 0)
        {
            const label trackId = globalId/stride_;

            if
            (
                trackId < nTracks
             && trackValues[trackId].size() < maxPositions_
            )
            {
                trackValues[trackId].append(allValues[i]);
            }
        }
    }
}
Although I don't understand what does the code in red do, I feel, sampleFrequency (or -stride as commandline argument to particleTracks) is used to calculate track data only for those time step labels that are divisible by sampleFrequency (the code in blue). Therefore, reducing some amount of computation by omitting some tracking data. That's my understanding thus far. Let me know if this is wrong or inaccurate.
>>>EDIT (ADDED) END.


There's also a maxPositions entry in the dictionary. According to the source code:
Quote:
//- Upper limit for number of track positions
As I don't know what the term track means, I don't know what maxPositions mean.

Last edited by reverseila; August 3, 2024 at 19:13.
reverseila is offline   Reply With Quote

Reply

Tags
lagrangian, particletracks, postprocess


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
meaning of this formula FluidKo Main CFD Forum 5 October 8, 2022 03:57
I want to know meaning of CFX Expression Language for numerical analysis of plasma. Won-Ho Lee CFX 4 March 13, 2020 03:16
What's the meaning of 'w' in 'wmake'? random_ran OpenFOAM Programming & Development 1 February 11, 2019 17:53
Meaning of values in combustion kane OpenFOAM Running, Solving & CFD 1 May 14, 2018 06:13
What's meaning of UDF FUNCTION zhaoxinyu Fluent UDF and Scheme Programming 0 March 31, 2010 09:04


All times are GMT -4. The time now is 14:13.