Reading sampler plugin points from .txt or .csv file

Hi, I am currently running the new PyFRv2.0.0 on a case where I need a higher frequency output and hence using sampler plugin. The sampler plugin work well with amount of points I have defined and generates them to a single csv file. However, considering the number of sample points I am using, I am wondering if we can define the sampler plugin to read from a txt file or csv files with sample points rather than defining them within the configuration file itself??
(current)
[soln-plugin-sampler]
samp-pts = [lots and lots of points]

(ideally)
[soln-plugin-sampler]
samp-pts = sampler_points.csv (just an example)

The best place for the sampler points is inside the config file. This ensures that you can restart a simulation given just a solution and associated mesh file. If you want to clean up the contents of the file itself—albeit at the cost of adding some fragility—you can take advantage of the fact that PyFR allows configuration items to be environment variables.

For example:

[soln-plugin-sampler]
samp-pts = $MYPTS

then before you run PyFR can do

export MYPTS=`cat points.txt`

where points.txt contains the points in the same format as PyFR would expect them [(x, y, z), (x, y, z), ...]

Regards, Freddie.

2 Likes

Brilliant. Thank you Freddie!