fluiddyn / fluidfoam

OpenFoam postprocessing python tool
GNU General Public License v3.0
158 stars 50 forks source link

read probes error. #43

Closed scramjetFoam closed 1 year ago

scramjetFoam commented 1 year ago

Dear developer,

I am using the latest package of fluidfoam. But when I test the example of plot_3_postprocprobe.py, error occured. I also noticed the latest update changed probes_locU.

Reading file ../output_samples/ascii/postProcessing/probes/0/U 4 probes over 10 timesteps Traceback (most recent call last): File "/Users/seanwang/Dropbox/@NUS/run/myLES/5_postProcess/fluidfoam-master/examples/plot_3_postprocprobe.py", line 21, in <module> probes_locU, timeU, u = readprobes(sol, time_name = 'mergeTime', name = 'U') File "/Users/seanwang/Library/Python/3.10/lib/python/site-packages/fluidfoam/readpostpro.py", line 132, in readprobes time_vect, tab = readprobes(path, probes_name, timename, name) File "/Users/seanwang/Library/Python/3.10/lib/python/site-packages/fluidfoam/readpostpro.py", line 198, in readprobes return time_vect, tab UnboundLocalError: local variable 'time_vect' referenced before assignment

CyrilleBonamy commented 1 year ago

Hello @ShangWangNUST Thanks for your interest in fluidfoam :-) I am pretty sure you are using the example of the last release of fluidfoam, but the fluidfoam installed is not the last one (line 198 of readpostpro.py file doesn't correspond to "return time_vect, tab" in the last version). So please reinstall fluidfoam with : "python3 setup.py install" and try again

Thanks again for your interest,

Cyrille

scramjetFoam commented 1 year ago

Thanks for your reply. I will try later. I have used fluidfoam for fft and plot probe figures. Very useful! Besides, I am curious, after fluidfoam reads the data, can I cut slices at any location and draw the field contour? In addition, whether fluidfoam supports reading VTK data from OpenFOAM cuttingPlane? Thank you.

CyrilleBonamy commented 1 year ago

You can cut slice as explained in tutorials : https://fluidfoam.readthedocs.io/en/latest/auto_examples/unstructured/plot_contour_unstructured.html#sphx-glr-auto-examples-unstructured-plot-contour-unstructured-py

And no fluidfoam doesn't support reading VTK data from OpenFOAM cuttingPlane.

scramjetFoam commented 1 year ago

You can cut slice as explained in tutorials : https://fluidfoam.readthedocs.io/en/latest/auto_examples/unstructured/plot_contour_unstructured.html#sphx-glr-auto-examples-unstructured-plot-contour-unstructured-py

And no fluidfoam doesn't support reading VTK data from OpenFOAM cuttingPlane.

Got it. Thank you.