|
[Sponsors] |
[PyFoam] First discussion thread about PyFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 29, 2020, 16:26 |
|
#321 | |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 |
Quote:
Thanks a lot for your detailed response. Much appreciated. Best Regards |
||
March 30, 2020, 13:18 |
|
#322 |
New Member
Join Date: Mar 2020
Posts: 1
Rep Power: 0 |
@miguel.delasheras
Hi Miguel, I'm in the same exact situation, with a docker type installation and the same warnings that I'm not able to resolve. Have you been able to understand the issue? Last edited by Kasperr; March 30, 2020 at 13:23. Reason: lost the quoted message |
|
October 29, 2020, 11:29 |
derivedParameters.py error when only one variable
|
#323 |
New Member
David Blacher
Join Date: Jun 2020
Location: Vienna, Austria
Posts: 3
Rep Power: 6 |
Hi everybody,
It seems that pyFoamPrepareCase.py throws the following error if only one variable is derived using a 'derivedParameters.py' script: Code:
Traceback (most recent call last): File "/home/david/.local/bin/pyFoamPrepareCase.py", line 5, in <module> PrepareCase() File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/PrepareCase.py", line 143, in __init__ **kwargs) File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 495, in __init__ result=self.run() File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/PrepareCase.py", line 664, in run self.prepare(sol,cName=cName) File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/PrepareCase.py", line 955, in prepare max(*[len(k) for k in derived])) Code:
if Re < 2000: turbulence = 'laminar' else: turbulence = 'RAS' Then everything seems to work fine, even if more than one variable is derived. python 3.6.9 pyFoam-Version: 0.6.11 Some more info on my version in the attached file. I'm relatively new to pyFoam so maybe this is no bug, but due to my incorrect usage. Has somebody else come across this issue? Regards, david |
|
October 30, 2020, 06:04 |
error when not removing 0 directory
|
#324 |
New Member
David Blacher
Join Date: Jun 2020
Location: Vienna, Austria
Posts: 3
Rep Power: 6 |
Hi everybody,
Another issue I found happens when I run the command: Code:
pyFoamRunParameterVariation.py elbow-2D-snappy ../geometry.variation --every-variant-one-case-execution --progress --auto-create-database Since I neither require a "0" nor a "0.org" directory, the original case does not contain them. Now the first variation runs fine, but during the second this shows up: Code:
Clearing /mnt/c/Users/BlacherD/programming/OpenFOAM/david-7/run/foam-elbow/elbow2D/snappy/geometry.variation_00001_elbow-2D-snappy PyFoam WARNING on line 685 of file /home/david/.local/lib/python3.6/site-packages/PyFoam/RunDictionary/SolutionDirectory.py : The first timestep in /mnt/c/Users/BlacherD/programming/OpenFOAM/david-7/run/foam-elbow/elbow2D/snappy/geometry.variation_00001_elbow-2D-snappy is None not a number. Doing nothing Writing parameters to /mnt/c/Users/BlacherD/programming/OpenFOAM/david-7/run/foam-elbow/elbow2D/snappy/geometry.variation_00001_elbow-2D-snappy/PyFoamPrepareCaseParameters Writing report to /mnt/c/Users/BlacherD/programming/OpenFOAM/david-7/run/foam-elbow/elbow2D/snappy/geometry.variation_00001_elbow-2D-snappy/PyFoamPrepareCaseParameters.rst Not going to clean '0' Traceback (most recent call last): File "/home/david/.local/bin/pyFoamRunParameterVariation.py", line 5, in <module> RunParameterVariation() File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/RunParameterVariation.py", line 84, in __init__ **kwargs) File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/PrepareCase.py", line 143, in __init__ **kwargs) File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 495, in __init__ result=self.run() File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/RunParameterVariation.py", line 351, in run self.prepare(workCase,overrideParameters=usedVals) File "/home/david/.local/lib/python3.6/site-packages/PyFoam/Applications/PrepareCase.py", line 1123, in prepare self.opts.cleanDirectories.remove("0") ValueError: list.remove(x): x not in list Consequently, it tries to remove 0" from the list of directories that need to be cleaned (excerpt starting at line 1121): Code:
if not hasOrig or self.opts.keepZero: self.info("Not going to clean '0'") self.opts.cleanDirectories.remove("0") cleanZero=False I fixed it for now by adding an if-condition: Code:
if "0" in self.opts.cleanDirectories: self.opts.cleanDirectories.remove("0") Maybe "0" is initially in the list of to-be-removed-directories, is then striked from that list during the first variation and then cannot be deleted from the list in any subsequent variations? Not sure if this is the right place, but I couldn't find a better one to report bugs. gschaider, where and how would you like me to report future bugs fixes or problems I might find? Cheers, david |
|
November 1, 2020, 17:44 |
|
#325 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Definitve place to report such things would be https://sourceforge.net/p/openfoam-e...ticketspyfoam/ As openening a fork and making a pull request on https://sourceforge.net/p/openfoam-e.../default/tree/ would probably be an overkill for this one-line fix (that does NOT mean that I don't appreciate the effort to come up with a solution) I'll add it to my local development version to make sure that it goes into the next release (with mention in the release notes unless you wish to remain anonymous)
__________________
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 |
||
November 1, 2020, 17:59 |
|
#326 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
OK. This one is embarrassing. Seems that in all the years I never wrote a derivedParamters.py that defined only one parameter because then I would have noticed it I THINK the reason why I wrote it like this was that ancient Python-Versions did only do max as a function on numbers (not as a function of a single iterable). Your fix seems to work at least with Python 2.7 and up but I want to check for older versions before adding it to my codebase
__________________
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 |
||
November 2, 2020, 01:08 |
|
#327 |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 |
Hi, I have a 2D geometry (x-y plane) and work with multiphase solver. I want to get the x-weighted average of phase fraction at each level of y (e.g. could reach to hundreds of y levels). Then, I want to repeat that for every time step. So, the output I am looking for is .csv or .txt files for each time step containing the averaged phase fraction data for all y levels.
I would appreciate any hints on how I can do that with swak4foam. Thanks |
|
November 2, 2020, 19:21 |
|
#328 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
I think the function object you look for is swakExpressionAverageDistribution. A description can be found here (approximately after slide 198) https://openfoamwiki.net/images/7/7a...icTraining.pdf
__________________
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 |
||
November 3, 2020, 13:45 |
|
#329 | |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 |
Quote:
Also, what would be the proper way to call this function after the results are out, as a postProcessing? Edit: the answer is that it does not work properly as a post-processing tool. The output I am looking for is an averaged phase fraction in the x direction for each y level of the domain. Does 'swakExpressionAverageDistribution' outputs a table with a column for the x-averaged quantity and the corresponding y level in another column? Edit: yes it does, but it has to run on the fly with the simulation. I apologize if the questions above may be trivial, but I am quite new to swak4Foam. Thanks. Last edited by Bodo1993; November 19, 2020 at 22:21. |
||
November 17, 2020, 16:48 |
Stress tensor
|
#330 |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 |
Hi, I am wondering if there is a way to extract the stress field (normal + shear) using swak4Foam. Thanks in advance.
Last edited by Bodo1993; November 19, 2020 at 22:20. |
|
November 19, 2020, 22:23 |
|
#331 | |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 |
Quote:
I would appreciate any assistance. |
||
January 12, 2021, 07:34 |
populate database of variation
|
#332 |
New Member
David Blacher
Join Date: Jun 2020
Location: Vienna, Austria
Posts: 3
Rep Power: 6 |
Hi all, dear gschaider,
I want to use pyFoamRunParameterVariation.py to start multiple jobs on our cluster. However, I didn't have the time to configure pyFoam in the correct way for it to be able to submit jobs to the pbs queue itself for meshing and solving. Instead, I put suitable 'qsub' commands in the script 'caseSetup.sh.template' which are executed by pyFoam. I first run a parameter variation for meshing only, then I have another variation with new directories which copy the mesh from the previously run cases. I use the options '--no-execute-solver --no-server-process --no-mesh-create --every-variant-one-case-execution --create-database' This all works fine, but the database contains only little usefull information. I guess, this is because pyFoam does not execute the solver itself and therefore doesn't read the logfiles during the runs. Is there a command I can execute after the jobs are finished to populate the database? Also, the '.analyzed' directory only contains the pickledPlots. Is there a way to gather and pickle the data for each case automatically? Thank you for your help! |
|
January 20, 2021, 12:54 |
pyFoam-2020.5 installation issue on OFv2012 Ubuntu 20.04 WSL2
|
#333 |
New Member
Join Date: Dec 2020
Posts: 26
Rep Power: 6 |
Hello,
I followed the installation guide here below https://openfoamwiki.net/index.php/C...m#Installation I'm on Ubuntu 20.04 WSL2 with OFv2012. First I notice that I am not able to use pip but pip3 instead. Then I did the checking with python3 which was not succesfull for the last step: >>> print PyFoam.FoamInformation.foamTutorials() File "<stdin>", line 1 print PyFoam.FoamInformation.foamTutorials() ^ SyntaxError: invalid syntax then I did >>> print (sys.path) ['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/oml_400/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/local/lib/python3.8/dist-packages/PyFoam-2020.5-py3.8.egg', '/usr/lib/python3/dist-packages'] I also gave a try to start a run with pyFoamPlotRunner.py but this failed and returned the following: Traceback (most recent call last): File "/usr/local/bin/pyFoamPlotRunner.py", line 4, in <module> __import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamPlotRunner.py') File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1452, in run_script raise ResolutionError( pkg_resources.ResolutionError: Script 'scripts/pyFoamPlotRunner.py' not found in metadata at '/home/oml_400/.local/lib/python3.8/site-packages/PyFoam-2020.5.dist-info' it looks that the installation has partially failed but I can't find the issue Would anyone get an idea how to fix this ? Many thanks |
|
February 23, 2021, 11:34 |
PyFoam using WSL bash environment variables are not recognised
|
#334 |
New Member
Vera Stevers
Join Date: Feb 2021
Posts: 1
Rep Power: 0 |
Hi all, I'm new to CFD and Linux for that matter...
So far I've used WSL2 (so on a windows computer) to run OpenFoam which is working fine, and if I run python script using PyFoam from WSL there also seems to be no proglem. However I tried running this script from PyCharm on windows, because I find it works better, using the WSL python installation as the interpreter. (So basically running the exact same script, using the same python interpreter but from a different location). The script runs, and it works fine mostly, like I can import pyfoam packages and such, so that is not the problem. However it doesnt seem to recognise some of the OpenFoam commands, like the name of the solver and such. So I get messages like: /bin/sh: 1: simpleFoam: not found I think this is because the bash environment variables are not recognised in Windows, it doesn't seem to start the .bashrc script. Also, it seems unable to open some folders, as if I don't have the rights to be in that folder maybe? Like: Can't open /bin/tools/CleanFunctions I've been trying to get it to work but no luck so far. Anyone else experienced something similar or has an idea how to fix this? Thanks a lot! |
|
March 16, 2022, 10:03 |
|
#335 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
Hi
I compiled calcPressureDifference utility https://openfoamwiki.net/index.php/C...sureDifference and I ran the case from Wiki https://openfoamwiki.net/index.php/C...eter_Variation but I got such error: Code:
Inlet velocity: 0.0 Last Time = 0 Getting LinuxMem: [Errno 2] No such file or directory: '/proc/3715953/status' Traceback (most recent call last): File "doInletVariation.py", line 47, in <module> deltaP=pUtil.get("deltaP")[0] TypeError: 'NoneType' object has no attribute '__getitem__' Getting LinuxMem: [Errno 2] No such file or directory: '/proc/3715968/status' Does anybody know how to fix it?
__________________
best regards pblasiak |
|
March 16, 2022, 19:35 |
|
#336 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Problem probably is that the line Code:
pUtil.add("deltaP","Pressure at .* Difference .*\] (.+)")
__________________
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 |
||
March 17, 2022, 09:48 |
|
#337 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
Hi Bernhard,
I am sorry for that. I should read the log files first. Everything is ok with the example code. I had two mistakes: 1) I did not build mesh with blockMesh 2) I did not have calcPressureDifferenceDict file in the system directory. After doing these, the code runs well. Thank you for help. I only get in each time such a line Code:
PyFoam WARNING on line 66 of file /usr/local/lib/python2.7/dist-packages/PyFoam-0.6.6-py2.7.egg/PyFoam/LogAnalysis/ExecutionTimeLineAnalyzer.py : 9.73 s ClockTime = 9 is not a valid number I have also the second question: what this line basically do? Code:
pUtil.add("deltaP","Pressure at .* Difference .*\] (.+)")
__________________
best regards pblasiak |
|
March 17, 2022, 13:47 |
|
#338 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
No. That means that an expression matched "9.73 s ClockTime = 9" which it can't convert to a number (probably it should have matched only 9.73). Reason is probably that the output of OF was changed since the example was written Quote:
The second argument is a so called regular expression (google it). When a line matches then the part between the () is converted to a number and added as deltaP
__________________
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 |
|||
March 17, 2022, 15:05 |
|
#339 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
__________________
best regards pblasiak |
|
|
|
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 |