|
[Sponsors] |
[PyFoam] First discussion thread about PyFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 19, 2013, 13:45 |
|
#281 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Izna,
You apparently have not yet installed swak4Foam: http://openfoamwiki.net/index.php/Contrib/swak4Foam Best regards, Bruno
__________________
|
|
August 19, 2013, 13:57 |
|
#282 | |
Senior Member
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 13 |
Oh Brunos..
Again errors.. Quote:
|
||
August 21, 2013, 11:48 |
|
#283 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Izna,
That error does not seem to be PyFoam's nor swak4Foam's fault. Please start a new thread about this particular topic and please describe where you got those cases/scripts and how you ran the case and/or scripts. Best regards, Bruno
__________________
|
|
August 21, 2013, 11:52 |
|
#284 |
Senior Member
zaynah K.
Join Date: Jun 2012
Location: Mauritius
Posts: 138
Rep Power: 14 |
I will post one thing for this..
I have checked Hanan case, and i think there is soem errors.. i will post mne.. and we can aall compare |
|
April 8, 2014, 12:27 |
|
#285 |
Senior Member
Francois Beaubert
Join Date: Mar 2009
Location: Lille, France
Posts: 147
Rep Power: 17 |
Hi all,
I've an easy one: "How to tell pyFoam to use matplotlib instead of gnuplot by default ?" I've an already converged case and want to plot for example the residuals with matplotlib. What's the best procedure to achieve this ? Same kind of question for example for pyFoamSamplePlot.py. I'm sorry if it looks too trivial but I've tried to find some help in the forum and the doc without success. Thanks for your help. Regards François |
|
April 11, 2014, 10:02 |
|
#286 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
pyFoamSamplePlot.py only supports Gnuplot but you can write out the data to a CSV-file and then visualize it with whatever you like Also some utilities (but not SamplePlot) support reading the data and then dropping you to an interactive python-shell. See for instance http://openfoamwiki.net/staticPages/...tml#/sec-3-2-2 My current policy is "Support GNUplot by default because it is an order of magnitude faster than Matplotlib. Also is the API of matplotlib changing and what works on one version might stop working on another. Start offering the possibility to easily export data into the Numpy/Pandas/Matplotlib-stack and then everyone can visualize the way he likes"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
April 11, 2014, 10:10 |
|
#287 |
Senior Member
Francois Beaubert
Join Date: Mar 2009
Location: Lille, France
Posts: 147
Rep Power: 17 |
Thanks Bernhard for your exhaustive and helpful answer
It's clearer for me now Regards, François |
|
June 5, 2014, 06:09 |
Extracting the values from the patchAverage utility through python script
|
#288 | |
New Member
DAPHNE
Join Date: Apr 2014
Posts: 6
Rep Power: 12 |
Quote:
I tried to extract the values from the patchAverage utility through python script. I used patchAverage utility to find the pressure field of cavity case: ################################################## ########## tutorials/incompressible/icoFoam/cavity$ patchAverage p movingWall Create time Create mesh for time = 0 Time = 0 Reading volScalarField p Average of volScalarField over patch movingWall[0] = 0 Time = 0.1 Reading volScalarField p Average of volScalarField over patch movingWall[0] = 0.0597376 Time = 0.2 Reading volScalarField p Average of volScalarField over patch movingWall[0] = 0.0597292 Time = 0.3 Reading volScalarField p Average of volScalarField over patch movingWall[0] = 0.0597295 Time = 0.4 Reading volScalarField p Average of volScalarField over patch movingWall[0] = 0.0597294 Time = 0.5 Reading volScalarField p Average of volScalarField over patch movingWall[0] = 0.0597292 End ################################################## ################## The script I used is: ############################################### solver="icoFoam" case="cavity" pCmd="patchAverage" patch="movingWall" pUtil=UtilityRunner(argv=[pCmd,"p",patch],silent=True,logname="patchAverage1") pUtil.add("deltaPp","Average of volScalarField over patch movingWall[0](.+) =(%f%)",idNr=1) pUtil.start() deltaP=pUtil.get("deltaP",ID="movingWall[0]") [0] deltaPressure=pUtil.get("deltaP")[0] print deltaPressure ############################################ Error /ParameterVariation/cavity$ python utilityrunner.py Traceback (most recent call last): File "utilityrunner.py", line 22, in <module> deltaP=pUtil.get("deltaP")[0] TypeError: 'NoneType' object has no attribute '__getitem__' ################################################## ########## So I tried the following: ################################################## ######### from PyFoam.Execution.ConvergenceRunner import ConvergenceRunner from PyFoam.Execution.UtilityRunner import UtilityRunner from PyFoam.LogAnalysis.BoundingLogAnalyzer import BoundingLogAnalyzer from PyFoam.LogAnalysis.UtilityAnalyzer import UtilityAnalyzer solver="icoFoam" case="cavity" pCmd="patchAverage" patch="movingWall" pUtil=UtilityRunner(argv=[pCmd,"p",patch],silent=True,logname="patchAverage1") pUtil.add("volScalarFieldp","Average of volScalarField over patch movingWall[0](.+) =(%f%)",idNr=1) pUtil.start() deltaP=pUtil.get("volScalarFieldp",ID="movingWall" ) print UtilityRunner.get(pUtil,"volScalarField p") deltaPressure=pUtil.get("volScalarField") print deltaPressure ############################################## Output: None None ############################################## Still the values are not extracted.. Thank you. Regards, Daphne |
||
June 5, 2014, 06:28 |
|
#289 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
For your first steps with regular expressions try something like http://regex101.com/#python (mind: it will NOT understand the %f%. That is PyFoam-specific)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
June 5, 2014, 06:31 |
|
#290 | |
Senior Member
|
Hi,
Quote:
The same thing is in the second script. |
||
June 5, 2014, 06:48 |
|
#291 |
New Member
DAPHNE
Join Date: Apr 2014
Posts: 6
Rep Power: 12 |
Dear Bernhard and Alexeym,
Firstly, thank you so much for your quick reply. @Bernhard The link you suggested to try Regular expressions is much useful. I tried that and made changes as you suggested. But still the same error persisits. Will keep trying and update. @Alexeym Sorry for the inconvenience.[made mistake while copy and paste]By mistake I posted as pUtil.add("deltaPp","Average of volScalarField over patch movingWall[0](.+) =(%f%)",idNr=1) But actually I used only the following: pUtil.add("deltaP","Average of volScalarField over patch movingWall[0](.+) =(%f%)",idNr=1) |
|
June 5, 2014, 06:55 |
|
#292 |
New Member
DAPHNE
Join Date: Apr 2014
Posts: 6
Rep Power: 12 |
Hi Alexeym,
Here is the corrected version of the code I used: pUtil=UtilityRunner(argv=[pCmd,"p",patch],silent=True,logname="patchAverage1") pUtil.add("deltaP","Average of volScalarField over patch movingWall \[0\] (.+) =(%f%)",idNr=1) pUtil.start() deltaP=pUtil.get("deltaP") print UtilityRunner.get(pUtil,"deltaP") deltaPressure=pUtil.get("deltaP",ID="movingWall \[0\]") print deltaPressure Regards, Daphne |
|
June 12, 2014, 04:30 |
|
#293 |
New Member
DAPHNE
Join Date: Apr 2014
Posts: 6
Rep Power: 12 |
Hi All,
I managed to correct the code to extract the values from the patch Average utility. Code: pUtil1=UtilityRunner(argv=[pCmd,"p",patch],silent=True,logname="patchAverage") pUtil1.add("PressureDifference","Average of volScalarField over patch (.+)= (%f%)",idNr=1) pUtil1.start() a=UtilityRunner.get(pUtil1,"PressureDifference") print a Regards, Daphne |
|
June 11, 2015, 21:53 |
|
#294 |
New Member
Albert Yiamakis
Join Date: Jun 2015
Posts: 6
Rep Power: 11 |
Hello,
I am using pyFoam version 0.6.4 with python 3.4.3, which the wiki suggests is fine. It generally works, however I have encountered an error that I 'm almost certain is due to incompatibility between python versions. Line 291 of Benchmark.py reads Code:
args=string.split("%s %s %s %s" % (pre,workDir,caseDir,post)) (Line 293 suffers from the same problem) I have also encountered a couple more issues when parsing a dictionary with ParsedParameterFile that I haven't dug in to find the cause of: - the value "none" is incorrectly read as "no" and has to be manually fixed - whitespace is not parsed correctly, for example "(air in water)" when reading the phaseProperties of twoPhaseEulerFoam bubbleColumn tutorial: it results in a list rather than a dictionary. |
|
January 27, 2016, 08:33 |
|
#295 |
New Member
Jens
Join Date: Apr 2014
Posts: 28
Rep Power: 12 |
Hello,
I use fluent3DMeshToFoam and fluentDataToFoam to start my calculation from an initial solution (with nonuniform profiles on inlets). Then I apply a changeDictionaryDict to the case to set the right boundary conditions (probably also possible with pyFoam). One inlet condition for U is for example: Code:
farfield_inlet { type temperatureDirectedInletOutletVelocity; phi phi; T T; T0 uniform 255; inletDirection uniform (1 0 0); cylindricalCCS no; omega ( 0 0 0 ); value uniform (245 0 0); } Thanks in advance. Jens |
|
October 8, 2017, 03:58 |
pyfoam ( small ) bug
|
#296 | |||
Member
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 10 |
Hello
I am not sure where to report pyfoam bug so I do it here: pyfoam version 0.6.4 on top of python 2.7.12 and foam extend 4.0 The bug is: PyFoam change keyword value from "none" to "no" creating a subsequent solver error in the following situation: Initial pressure file p in 0 directory has an outlet value as : Quote:
Quote:
This is the ONLY change made on this file but after writeFile(), the boundary condition has been overwritten with: Quote:
If I did not miss something obvious, It looks like a parser bug as "no" are the first 2 letter of "none" obviously... easy to change afterward so a small bug in any case. ( with congratulation and thanks to the developper(s) for this amazing piece of software) JF |
||||
October 8, 2017, 18:07 |
|
#297 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The best way for you to fix this quickly is to go to PyFoam/Basics/DataStructures.py look for the FalseStrings-list and comment out "none" as well. That way "none" should be parsed as the word "none". I'll think of a permanent solution (that will probably be the same thing + praying that it doesn't break too many other cases)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
October 9, 2017, 00:20 |
|
#298 | ||
Member
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 10 |
Quote:
I will keep that in mind if this has a broader impact on my scripts down the road and a real fix appear impractical or difficult. For the time being, I just added Quote:
JF |
|||
October 9, 2017, 08:37 |
|
#299 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
I'll remove "none" from the list of possible "false"-representations. I don't think that anyone is even aware that this is possible (OF specifies 6 different ways to write false ) and it breaks valid cases
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
January 16, 2018, 10:58 |
|
#300 |
New Member
Khomenko Maxim
Join Date: Aug 2015
Posts: 18
Rep Power: 11 |
Dear Bernard!
I'm trying to make GUI for my OpenFoam solver with PyFoam supposed to be used for parsing dictionaries. I thought to use the ParsedParameterFile function for taking data from GUI edit-boxes and writing it to the dictionary. The thing that stopped me was that ParsedParameterFile function cant understand dimensioned scalars in the dictionary. I have written here about this problem, but haven't got any answers. Could you please give me a hint of where to look for. How do you think maybe OpenFOAM classes like IOdictionary is more suitable for that? |
|
|
|
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 |