|
[Sponsors] |
[PyFoam] First discussion thread about PyFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 3, 2009, 10:32 |
|
#141 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
A better example that does not depend on third-party-stuff is on slide 48 of this presentation: http://www.openfoamworkshop.org/2009...der_PyFoam.pdf The problem is, this is from pre-1.6 times and the current PVSnapshot-Utility doesn not work with paraview 3.6 I'm currently in the process of fixing this and once I've got it sorted out I will release a new version of pyFoam which will also have this example fixed Bernhard |
||
September 4, 2009, 01:41 |
|
#142 |
New Member
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 25
Rep Power: 17 |
Dear Bernhard,
Thanks for your solution. It all works nicely now (I didn't worry about the mass and pressure utilities). I have couple of questions/comments: 1) I am intrigued that paraFoam can find all the cases in the archive without the "time" directories appearing explicitly. Could you explain how this works? 2) I would like to use the parameter variation with groovyBC (which is great) where I set the maximum velocity in a paraboloidal flow field (instead of the uniform one as used in your doInletVariations.py script). Is such a thing possible? Thanks again, Peter. |
|
September 4, 2009, 08:04 |
|
#143 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
For PyFoam the general answer is that the SolutionDirectory-class has some special methods that make it look like "a list of TimeDirectories" (making it possible to write a natural iteration "for t in sol:" over all the time-steps in Python). TimeDirectory in turn is a "list of SolutionFiles" Quote:
Bernhard |
|||
September 6, 2009, 20:45 |
PyFoamPlotWatcher is not working
|
#144 |
New Member
Arvind
Join Date: Mar 2009
Posts: 13
Rep Power: 17 |
I want to watch residuals.....so i have installed PyFoam- 0.5.2.... but...... while executing pyFoamPlotWatcher ......it says
File "/usr/local/bin/pyFoamPlotWatcher.py", line 3, in <module> from PyFoam.Applications.PlotWatcher import PlotWatcher File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PlotWatcher.py", line 6, in <module> from PyFoam.Execution.GnuplotRunner import GnuplotWatcher File "/usr/local/lib/python2.6/dist-packages/PyFoam/Execution/GnuplotRunner.py", line 86 with="steps", ^ SyntaxError: invalid syntax I am using UBUNTU-9.0.4 AND OF-1.6 please spare some time to give ur suggestions Thanks in Advance |
|
September 7, 2009, 14:32 |
|
#145 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
September 16, 2009, 23:29 |
|
#146 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
Hi, just a thought, is there a way to merge the two log files to one. I happened to get my computer restarted during my parallel computation.
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
|
September 17, 2009, 06:47 |
|
#147 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
For the time being I'd recommend clipping all the "unused" timesteps from the old log, clipping the header from the new log and appendign them with cat to a new file. The resulting log can then be treated with the PlotWatcher. You might see some funny restart-effects in the residuals though Bernhard |
||
October 22, 2009, 20:44 |
pyFoam and transient simulations
|
#149 |
New Member
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 25
Rep Power: 17 |
I have successfully managed to run some parameter variation studies using pyFoam for steady state simulations. Using lastToArchive moves the final converged result to an archive directory.
My question is: can I do something similar with transient simulations? I wish to run a parameter variation study for transient problems. For each parameter I need to run the simulation over several cycles to remove any initial transients. So after these cycles have completed, is there a way within pyFoam to move all the saved time steps to an archive directory? I can probably do this in raw python, but was wondering if there was some simple way in pyFoam. Thanks very much, Peter Johnston. |
|
October 23, 2009, 05:41 |
|
#150 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
def addBackup(self,pth): """add file to list of files that are to be copied to the archive""" BTW: if sol is a SolutionDirectory then Code:
for t in sol: print "t=",t.baseName() Bernhard |
||
October 29, 2009, 03:01 |
|
#151 |
New Member
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 25
Rep Power: 17 |
Dear Bernhard,
Thanks for that. Much better than the klutzy piece of python that I wrote . Regards, Peter. |
|
October 29, 2009, 04:44 |
|
#152 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
||
November 10, 2009, 13:34 |
New Release 0.5.3 of PyFoam
|
#153 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
I just uploaded a new release of PyFoam. A list of most changes can be found at http://openfoamwiki.net/index.php/Co...PyFoam#History but the most important differences are
|
|
November 14, 2009, 04:47 |
Parameter variation
|
#155 |
Member
Thomas Wolfanger
Join Date: Mar 2009
Location: South West Germany
Posts: 62
Rep Power: 17 |
Hello,
I have two more questions regarding pyFoam: 1) I tried to read a binary U filed into a ParsedParameterFile to do some changes in it; but reading resulted in an error. Is this due to a misuse or can this class handle only ascii and compressed ascii files? 2) I also tried to do the parameter variation as described in the OF wiki section 2.2 and was really happy that changing the condition on a filed called "inlet" worked well; but to my big big surprise, changing the value of a field called "outlet" did not work! The value was just added, but the old one was not commented out. I noticed that the type of m in the source code was of type string while for "inlet", it is of some other type resulting in using another code line in the if- expression which is responsible for writing the new value to the file. Did anyone experience similar behaviour? I'm really stuck at this point and have no idea where to do research in the code as I'm quite new to pyFoam (which is a very useful piece of software). Best regards, -Thomas |
|
November 14, 2009, 12:47 |
|
#156 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
Is the file you're working on ASCII or Binary? I'm afraid the SolutionFile-class that is used in that example is not aware of Binary-files either Thanks |
|||
November 14, 2009, 16:05 |
|
#157 | |
Member
Thomas Wolfanger
Join Date: Mar 2009
Location: South West Germany
Posts: 62
Rep Power: 17 |
Quote:
For the second question: sorry for being unclear; the thing about m is to be found in the source code of the replaceBoundary routine (line 89) of the SolutionFile class of pyFoam. The line I use in my python script is actually the same as in the wiki apart from the name of the field and some formatting; it works on T and U for a field named "inlet" but not on p for a field named "outlet". The p file I'm experiencing this strange behaviour on is ascii. It seems to me that in replaceBoundary, the wrong place is found, but I have no clue why this could be the case, because it works well for the name "inlet". Thank you for any input, Best regards, -Thomas I tried the following: I took a p file which was output by pyFoam and used this as base file to make the changes on. On the first try this didn't work either, so I edited the file and uncommented the first line which started with "//pyFoam added"; and now, replacing worked! More information on m which might help to track down the problem (with the non-working file): I get this output when adding a line "print m, type(m), l, l.line" on line 88 of SolutionFile.py outlet } <type 'str'> <PyFoam.Basics.LineReader.LineReader object at 0x297a910> } Thanks, -Thomas Last edited by anger; November 16, 2009 at 03:32. Reason: Additional info/workaround |
||
November 16, 2009, 06:53 |
|
#158 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Yep. That is handled transparently.
Quote:
BTW: The problem occurs with a "plain" file or is there some binary data in it? Bernhard |
||
November 16, 2009, 07:06 |
EGR Flow rate calculation
|
#159 |
Member
Venkat
Join Date: Nov 2009
Posts: 35
Rep Power: 17 |
Hi everyone,
I'm a new registered user in CFD-Online. I would like to calculate theoretically the mass flow rate of air that pass through EGR Valve at different Valve seats positioningi.e. 1mm, 2mm, 3mm, 4mm, 5mm.. As i understand, the flow rate would increase gradually as the valve lift increases. I have the experimental data i.e. at 1mm valve lift, the mass flow rate is observed to be 6 - 8 kg/hr and at 7mm, flow rate is observed to be 10 kg/hr. My client wants to compare the theoretical calculation. Moreover, the flow is assumed to be incompressible as the density is constant with time. Known values - Pressure drop (2 kpa), valve lift position (1mm to 7mm), Exhaust temperature 20 C, EGR Dia - 30 mm Mass flow rate to be calculated : ? I'm looking for an incompressible flow rate equation using which we could calculate flow rate. Please do the neeful |
|
November 16, 2009, 08:10 |
|
#160 | |
Member
Thomas Wolfanger
Join Date: Mar 2009
Location: South West Germany
Posts: 62
Rep Power: 17 |
Quote:
yes, it is a plain ascii file. The reason for using SolutionFile is that my first trial with PPF was on a binary file which failed so I thought this class could not be used for my task. Best regards, -Thomas |
||
|
|
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 |