|
[Sponsors] |
[PyFoam] First discussion thread about PyFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 14, 2010, 09:02 |
|
#201 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
line=open("filename").readlines()[-1] If you know that the line consists of floats separated by whitespaces you can get an array with the number with data=map(float,open("filename").readlines()[-1].split()) If furthermore you happen to know that the data will be "<time> <lift> <drag>" then time,lift,drag=map(float,open("filename").readline s()[-1].split()) will give you these numbers. But of course this expression is the easiest to break Bernhard |
||
June 14, 2010, 09:48 |
|
#202 | |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Ok, I know that this may be not "elegant", but this is the easiest way to get what I want!
Quote:
mad |
||
August 30, 2010, 08:50 |
Trying to use PyFOAM
|
#203 |
Senior Member
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20 |
Hi Bernhard,
I try to use PyFOAM for some time now and I have to say it is a great tool alowing me to do some changes in my files easily. However, I have one minor issue: I have written a Python-Skript using PyFOAM to modify some boundaries. Everything works fine except the fact that I get two files in my directory afterwards: PlyParser_FoamFileParser_parsetab.py and PlyParser_FoamFileParser_parsetab.pyc I guess these are temporal files generated by the ply-Parser but I don't really know why they are not deleted. As soon as I use one of the default PyFOAM scripts this does not occur. Do I have to do something like closing files? Thanks Bastian |
|
August 30, 2010, 12:34 |
|
#204 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
February 3, 2011, 03:40 |
pyFoamPlotWatcher - customRegExp
|
#205 |
Member
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15 |
Hy all,
does anybody know, why this expression in customRegExp . file doesn't work? This is how the string appears on the screen or log file respectively: volAverage(heatSource) for T = 293 And this is my expression: {"expr":"volAverage(heatSource) for T = (%f%)","name":"Source","title":["Temp"]} There is neither an error message nor a plot is being shown as I would expect it. Thank you in advance, Toni |
|
February 3, 2011, 09:34 |
|
#206 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The problem here is that for regular expressions (not PyFoams fault not even Pythons. That is the way god created regular expressions) the brackets () have a special meaning. So in order to match a ( you're got to write \( in your expression. Same goes for ) but is left to the reader as an exercise Bernhard |
||
February 4, 2011, 07:54 |
|
#207 |
Member
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15 |
ok thanx - now it works properly ;-)
one further question. how must the expression look like, if I want to plot more than one value from log file in the same plot-window? |
|
February 4, 2011, 10:51 |
|
#208 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
February 4, 2011, 11:00 |
|
#209 |
Member
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15 |
I'm still using the old format. As I understand this type: slave; issue is only possible by using the new "openFoam-like" format right?
I can't make out how to apply this to my old format... sorry for the inconvenience... |
|
February 4, 2011, 16:27 |
|
#210 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Won't work in the old format. Internally everything (old and new format) is converted to the same data structures but the young format knows more than the old format (that is where it differs from real life ). The good news (not exactly new: it is there since I moved to the new format and it was always "hidden" in the online help) is that every utility that uses customRegex has the option --dump-custom-regegex that prints out these data-structures in the new format. So run the PlotWatcher with this option on a case with the old format and replace the customRegex with the output. Story ends with "and he lived happily ever after with the new format"
|
|
May 11, 2011, 10:04 |
|
#211 | ||
New Member
Join Date: Mar 2011
Posts: 6
Rep Power: 15 |
Hello, I faced really annoying problem and will be very thankful if you help me =)
I'm using pyFoamCaseBuilder.py for generating cases from Star-ccm+. Everything works well until boundaries are not named using character '-', in this case pyFoamCaseBuilder.py complains Quote:
like: Quote:
thanks in advance |
|||
May 11, 2011, 10:24 |
|
#212 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Is there a longer stack-trace? Does pyFoamEchoDictionary.py work for the file in question? Please write a bug-report providing this information and if possible example files to reproduce it (you find a link to the Mantis at the Wiki-page of PyFoam) and I'll have a look at it |
||
May 11, 2011, 11:07 |
|
#213 | |
New Member
Join Date: Mar 2011
Posts: 6
Rep Power: 15 |
I'm using 0.5.5;
well, I figured out, that this is generally inappropriate name for a boundary that begins with a digit (So boundary name should be an identifier, it is not the same in Star-ccm+). Didn't know that since I have names for boundaries like "000-DOMAIN_INLET" pyFoamEchoDictionary.py complains Quote:
|
||
May 11, 2011, 18:31 |
|
#214 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
is this name accepted by the usual OF-utilities? Bernhard |
||
May 12, 2011, 06:40 |
|
#215 | ||||
New Member
Join Date: Mar 2011
Posts: 6
Rep Power: 15 |
Quote:
That is how I checked it yesterday: 1. copied pitzDaily tutorial 2. in the directory of copied tutorial pyFoamChangeBoundaryName.py . inlet 000-DOMAIN_INLET --time-step=03. simpleFoam Quote:
I'd note that although "pyFoamChangeBoundaryName.py . inlet 000-DOMAIN_INLET --time-step=0" done its work, after that I couldn't do, say: Quote:
Quote:
|
|||||
June 3, 2011, 09:55 |
|
#216 |
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25 |
Hello Bernhard,
A Good Day to you! Its been a while, and I hope everything is going great with you! I have been using PyFoam over the last few days to automate some post-processing of OpenFOAM Simulations, and have the following questions / observations: 1. I use a CIFS (Samba) share mounted on my Linux system as my Simulation folder. When using the "SolutionDictionary" class, the constructor quits with an error that the file-system does not support symbolic links. ..... I found out that I can prevent this by using the "paraviewLink=False" entry when calling the constructor, but maybe it would be more elegant if we detect this in the code and make a copy of controlDict to controlDict.foam instead of a symbolic link? 2. When using the "ParsedParameterFile" class, I noticed that the "macroExpansion" option assumes that the path to the "#include" files are relative to the location of the dictionary. .... There are a couple of issues in this case....: .... 2[a]. It is not always the case that a relative path is used when specifying the location of the file.... it could also be an absolute path, in which case, the line 511 in ParsedParameterFile.py would not provide a usable path. .... 2[b]. The path may contain environment variables.... in my case this might prove to be a little more difficult, because I used "$FOAM_CASE" which looks like is only valid when actually running the case. ..... However, in general, maybe the python function "os.path.expandvars" should be used on the specified include file before trying to open it. .... 2[c]. I am not exactly sure what to do in the case when the environment variable is "$FOAM_CASE"..... I was wondering if it makes sense for ParsedParameterFile to consider such special cases and put in the appropriate path.... what do you think? 3. When using pyFoamReadDictionary.py or pyFoamWriteDictionary.py, if the path to the file to be opened is "<case_root>/processor<n>/0/U" .... a processor directory of a parallel case, the script quits with an error.... I have come to the level where it looks like the error is coming from the "ParsedParameterFile" class, but I have not been able to figure out exactly what is causing the issue..... could you please look into this? Other than these points, I must say..... PyFoam really does a great job :-)! I somehow always stuck to bash scripts for post-processing, but I think thats going to change really fast now.... :-)! Thanks a lot for all the effort you and the other contributors have put into PyFoam.... Have a great weekend! Philippose |
|
June 6, 2011, 13:51 |
|
#217 | ||||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
But this can be done. Please write a bug-report at https://sourceforge.net/apps/mantisb...l_bug_page.php Quote:
Quote:
Quote:
|
|||||
June 6, 2011, 18:09 |
|
#218 |
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25 |
Hello Bernhard,
A Good Evening to you! Thanks a lot for your response. I just submitted two bug reports to the Mantis bug-tracker to cover the issues [1] and [2]. Before I submit a bug report for the issue [3] which I had mentioned in the post, I would like to look a little deeper into the actual error I get. I dont thing the information I currently have will be enough for a decent bug report. Let me know if you would like me to try any changes that you make, or if you want me to try and solve the issues in case you are too busy. One more question..... did you have a specific reason for using system shell commands for operations such as copy (cp) and delete (rm) instead of for example, the python "shutil" module? .... I was trying to think in terms of platform independence (Windows ports of OpenFOAM). I remember that a long time ago you had mentioned that platform independence was not part of the specifications of PyFoam.... are you considering going down the platform independence route in the future sometime? Have a great day! Philippose |
|
June 7, 2011, 07:54 |
|
#219 | |||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
Quote:
|
||||
June 25, 2011, 16:05 |
Problem with OF_2.0.x and pyFoamPlotWatcher.py
|
#220 |
New Member
Join Date: Oct 2009
Location: Germany
Posts: 20
Rep Power: 17 |
Hi,
the installation of the current pyFOAM version (0.5.5) as a regular user worked fine. I followed the Wiki (http://openfoamwiki.net/index.php/Co...m#Installation). With the new OF version 2.0.x I've got problems. SimpleFoam doesn't work at all with pitzDaily tutorial. I receive following message: "aurel@aurel-desktop:~/OpenFOAM/aurel-2.0.x/run/pitzDaily$ simpleFoam > log & pyFoamPlotWatcher.py log [1] 5283 Traceback (most recent call last): File "/home/aurel/OpenFOAM/PyFOAM/bin/pyFoamPlotWatcher.py", line 3, in <module> from PyFoam.Applications.PlotWatcher import PlotWatcher ImportError: No module named PyFoam.Applications.PlotWatcher aurel@aurel-desktop:~/OpenFOAM/aurel-2.0.x/run/pitzDaily$ " For assistance to find the error I would be very grateful. Best regards Marc |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Divergence detected in AMG solver: k when udf loaded | google9002 | Fluent UDF and Scheme Programming | 3 | November 8, 2019 00:34 |
udf problem | jane | Fluent UDF and Scheme Programming | 37 | February 20, 2018 05:17 |
Guide: Getting Started with the CFD Online Discussion Forums | pete | Site Help, Feedback & Discussions | 8 | July 29, 2016 06:00 |
Error messages | atg | enGrid | 7 | August 30, 2013 12:16 |
Phase locked average in run time | panara | OpenFOAM | 2 | February 20, 2008 15:37 |