|
[Sponsors] |
May 16, 2013, 05:17 |
probe a line
|
#1 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
Hi all,
I wrote a little python script that allows me to probe a line. Actually, I state the start and the end of the line as well as the number of points and my script generates a probesDict containing the defined points. Have a look at it and if you find my nasty bit of code useful, feel free to use it, or even improve it. The script assumes a file named "probeLineDict" to reside in the system directory. The script itself needs to be executed from the case directory. However, you can change the paths inside the script to get a different behaviour. |
|
May 21, 2013, 00:13 |
|
#2 |
Senior Member
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18 |
I believe that the 'sample' utility can do this as well. Give a start point, and end point, fields to sample, and number of sample points, it will extract the data requested.
http://www.openfoam.org/docs/user/sample.php |
|
May 21, 2013, 03:43 |
|
#3 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
You are right. However, if I use the probe function to do the job, I get a good time resolution.
I use sample as well, but in some cases I fell the need for higher time resolution. And writing everything to disk at a short interval and running sample afterwards is simply a waste of space. |
|
May 21, 2013, 05:37 |
|
#4 |
New Member
Gerrit Laube
Join Date: Feb 2013
Posts: 5
Rep Power: 13 |
Hi Gerhard,
I think in Line 25 it should be 'filename' instead of 'filenameW'. And just to make things clear for future visitors of this thread: This file does not probe anything itselve, as one might expect from the title, but writes line coordinates to a probesDict, that is used by the 'native' OpenFOAM probeLocation application. As far as I know, you have to run this in advance of the processing itselve. I never used the probe application, so Gerhard, maybe you could tell us a little more about the overall process: run Script -> run Solver -> find values in ./probes/-folder? Or is there anything else to consider? Do you have to modify the controlDict as well? Thanks for the script! I hope that future generations of OpenFOAM will have a probe-application as good as the sample-app, but so far, this is a good workaround. |
|
May 21, 2013, 05:54 |
|
#5 | |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
Quote:
The script reads probeLineDict and generates entries for the regular probe function object. However, defining (start, end, nPoints) is much easier than writing 50 points along a line manually into probesDict. The script overwrites probesDict. However, you can change the name of the file into which the script writes. If you are already using probes, make sure they do not collide. The variable filename is the name of the file which contains the definition of the line to be probed. The variable filenameW is the name of the file into which the generated dictionary for probes is written. The definition of the probe function object in controlDict must make use of an external file for the definition of the probes, otherwise, the generated file would be useless. I let the script write a seperate file in order to prevent it from messing up the controlDict. The usage follow this procedure. Put the probeLineDict into the system directory. Run probeLine.py from the case directory Run the solver The controlDict contains this code: Code:
functions { probes1 { type probes; functionObjectLibs ("libsampling.so"); dictionary probesDict; } probes2 { type probes; functionObjectLibs ("libsampling.so"); dictionary probesDict2; } } |
||
May 21, 2013, 06:12 |
|
#6 | |
New Member
Gerrit Laube
Join Date: Feb 2013
Posts: 5
Rep Power: 13 |
Thanks for the explanation!
Quote:
Copied from your zip-file, line 23 to 25: Code:
filename = './system/' + probesDict #filenameW = probesDict mywfile = open(filenameW,'w') Code:
Traceback (most recent call last): File "Y:\Home\laubeg\SharedFolder\Fehlman1\Fehlman2D_4\probeLine.py", line 25, in <module> mywfile = open(filenameW,'w') NameError: name 'filenameW' is not defined |
||
May 21, 2013, 07:04 |
|
#7 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
Hi, sorry for posting a buggy script. Mea culpa.
The code Code:
filename = './system/' + probesDict #filenameW = probesDict Code:
filenameW = './system/' + probesDict #filenameW = probesDict |
|
June 5, 2013, 10:56 |
|
#8 | |
New Member
jiujiumin
Join Date: May 2013
Posts: 9
Rep Power: 13 |
Quote:
|
||
June 10, 2013, 00:45 |
The probesDict file where can i find?????
|
#9 | |
New Member
jiujiumin
Join Date: May 2013
Posts: 9
Rep Power: 13 |
Quote:
The probesDict file where can i find????? The probesDict file where can i find????? The probesDict file where can i find????? |
||
June 10, 2013, 04:27 |
|
#10 |
New Member
Gerrit Laube
Join Date: Feb 2013
Posts: 5
Rep Power: 13 |
Hi,
sorry for being rude, but did you even try to find a solution for one of your problems? Here is one for running the python script: http://www.google.com And one for the probesDict: Read the thread from the beginning or try the former solution! This is a forum, not a google search. Regards! |
|
June 11, 2013, 10:13 |
sorry at the time i am very anxious
|
#11 | |
New Member
jiujiumin
Join Date: May 2013
Posts: 9
Rep Power: 13 |
Quote:
At the same time I have another question how do I set the probeLine.py file to probe many lines at the same time? such as two lines at a time. thanks |
||
June 11, 2020, 16:36 |
|
#12 | |
Senior Member
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7 |
Quote:
I ll remain hopeful to get your reply. |
||
June 13, 2020, 22:09 |
|
#13 |
Senior Member
Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7 |
Anyone from the forum can I get a response. I m in serious need. Please I ll remain hopeful.
|
|
July 11, 2020, 15:08 |
|
#14 | |
New Member
Marc
Join Date: Oct 2017
Posts: 11
Rep Power: 9 |
Quote:
I have just started to look at using this script myself, and have not yet tested it. However, to answer your question, I believe the "probeLine.py" file should go into the main case directory, and the "probeLineDict" file should go into the "system/" sub-directory. This is shown on line 17 of the python script: Code:
filename = './system/' + probeLineDictName |
||
July 11, 2020, 15:13 |
|
#15 |
New Member
Marc
Join Date: Oct 2017
Posts: 11
Rep Power: 9 |
In regards to your question about the controlDict, this was answered earlier in Gerhard's post:
|
|
Tags |
probe, probes, runtime postprocessing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] Problem with Gmsh | nishant_hull | OpenFOAM Meshing & Mesh Conversion | 23 | August 5, 2015 03:09 |
8x icoFoam speed up with Cufflink CUDA solver library | kmooney | OpenFOAM Running, Solving & CFD | 42 | November 6, 2012 12:37 |
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 | flakid | OpenFOAM Installation | 16 | December 28, 2010 09:48 |
Regarding FoamX running Kindly help out | hariya03 | OpenFOAM Pre-Processing | 0 | April 18, 2008 05:26 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |