CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

PyFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   November 16, 2009, 11:42
Default
  #161
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by enr_venkat View Post
Hi everyone,

I'm a new registered user in CFD-Online.
No offense: are you sure you're in the right Forum (OpenFOAM)? I don't see the relevance of your posting to the Thread you posted it in

Quote:
Originally Posted by enr_venkat View Post
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
gschaider is offline   Reply With Quote

Old   November 16, 2009, 11:46
Default
  #162
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by anger View Post
Hello Bernhard,

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.
Plus that the example on the Wiki was done using ancient technology (SolutionFile). I'll have to rewrite that one of these days. Or somebody else will feel like it

Bernhard
gschaider is offline   Reply With Quote

Old   November 16, 2009, 23:49
Default Please direct me to right thread
  #163
Member
 
Venkat
Join Date: Nov 2009
Posts: 35
Rep Power: 9
enr_venkat is on a distinguished road
Hi every one,

Please direct me to right thread where my theoritical problem solving question fits. I thought i replied to CFD WiKi. But I'm not sure after checking replies from others. Please do guide me at the earliest.

Many thanks
enr_venkat is offline   Reply With Quote

Old   December 15, 2009, 10:07
Default
  #164
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 488
Rep Power: 12
bastil is on a distinguished road
Hi Bernhard,

how can I try using matplotlib instead of gnuplot with pyFoamPlotWatcher.py from 0.5.3, please? Thanks.

BastiL
bastil is offline   Reply With Quote

Old   December 15, 2009, 12:05
Default
  #165
Member
 
Thomas Wolfanger
Join Date: Mar 2009
Location: South West Germany
Posts: 60
Rep Power: 9
anger is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Yep. That is handled transparently.



I'll have a look. The problem is that SolutionFile is a legacy class that existed before ParsedParameterFile. These days I do most of this stuff with PPF. SolutionFile only has a performance advantage if you're handling files with large non-uniform fields, in all other case PPF is preferred because it is much more flexible and robust

BTW: The problem occurs with a "plain" file or is there some binary data in it?

Bernhard
Hello Bernhard,

I think the error was that I used ancient syntax:
value 101300 instead of
value uniform 101300.

Regards,
-Thomas
anger is offline   Reply With Quote

Old   December 15, 2009, 12:09
Default
  #166
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bastil View Post
Hi Bernhard,

how can I try using matplotlib instead of gnuplot with pyFoamPlotWatcher.py from 0.5.3, please? Thanks.
Use the flag --implementation=matplotlib

If it works for you, could you extend the Wiki-page so that future generations will benefit from it. Thanks
gschaider is offline   Reply With Quote

Old   December 17, 2009, 08:42
Default
  #167
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 488
Rep Power: 12
bastil is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Use the flag --implementation=matplotlib

If it works for you, could you extend the Wiki-page so that future generations will benefit from it. Thanks
Does not work for me. What versions of matplotlib are know to work?
bastil is offline   Reply With Quote

Old   December 17, 2009, 09:08
Default
  #168
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bastil View Post
Does not work for me.
Could you be a little bit more specific

Quote:
Originally Posted by bastil View Post
What versions of matplotlib are know to work?
With 0.99.1.1 on my MacBook I get windows (and hardcopies). With 0.98.5.3 on my CentOS/RedHat-machines only hardcopies (try that switch) work

Bernhard
gschaider is offline   Reply With Quote

Old   December 17, 2009, 09:53
Default
  #169
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 488
Rep Power: 12
bastil is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Could you be a little bit more specific
We currelty have matplotlib 0.98.5.2 running. I get:
Code:
  PyFoam FATAL ERROR on line 44 of file /opt/PyFoam/PyFoam-0.5.3//lib64/python2.4/site-packages/PyFoam/Basics/MatplotlibTimelines.py : Matplotlib not installed
on your master node even though I can import matplotlib from within python without any problems..
On my local machine this changes to:
Code:
PyFoam WARNING on line 42 of file /opt/PyFoam/PyFoam-0.5.3//lib64/python2.4/sit
e-packages/PyFoam/Basics/MatplotlibTimelines.py : Matplotlib-Version does not support SubplotHost
Regards
bastil is offline   Reply With Quote

Old   December 17, 2009, 19:26
Default
  #170
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bastil View Post
We currelty have matplotlib 0.98.5.2 running. I get:
Code:
  PyFoam FATAL ERROR on line 44 of file /opt/PyFoam/PyFoam-0.5.3//lib64/python2.4/site-packages/PyFoam/Basics/MatplotlibTimelines.py : Matplotlib not installed
on your master node even though I can import matplotlib from within python without any problems..
Have a look whether
import matplotlib.pyplot as plt
works there. That is the second package that is imported in that module


Quote:
Originally Posted by bastil View Post
On my local machine this changes to:
Code:
PyFoam WARNING on line 42 of file /opt/PyFoam/PyFoam-0.5.3//lib64/python2.4/sit
e-packages/PyFoam/Basics/MatplotlibTimelines.py : Matplotlib-Version does not support SubplotHost
Regards
This is OK. It says that on my Linux-machine, too. That (SubPlotHost) is a feature that obviously only exists in 0.99.

The only thing that in my experience works with 0.98 is hardcopies with the hardcopy-option (you won't see any "live" windows)

Bernhard
gschaider is offline   Reply With Quote

Old   December 28, 2009, 07:55
Default pyFoamWriteDictionary
  #171
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 11
braennstroem is on a distinguished road
Hi,

I try to adjust the inlet turbulent kinetic energy in the changeDictionaryDict with pyFoamWriteDictionary:

pyFoamWriteDictionary.py system/changeDictionaryDict "dictionaryReplacement['k']['boundaryField']['inlet']['value']" "uniform 100"

This command works fine, except, that I get thos quotes in my dictionary file, which I do not want... maybe there is a way to access the 'uniform' value directly or an option to prevent pyFoam from printing those quotes into the dictionary? Would be nice!

Fabian
braennstroem is offline   Reply With Quote

Old   January 3, 2010, 19:06
Default
  #172
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by braennstroem View Post
Hi,

I try to adjust the inlet turbulent kinetic energy in the changeDictionaryDict with pyFoamWriteDictionary:

pyFoamWriteDictionary.py system/changeDictionaryDict "dictionaryReplacement['k']['boundaryField']['inlet']['value']" "uniform 100"

This command works fine, except, that I get thos quotes in my dictionary file, which I do not want... maybe there is a way to access the 'uniform' value directly or an option to prevent pyFoam from printing those quotes into the dictionary? Would be nice!

Fabian
Hi Fabian!

See https://sourceforge.net/apps/mantisb.../view.php?id=5 for news on this bug.

Bernhard

PS: In the future bugs that are reported via Mantis will get priority treatment (it is hard to keep track whether there is another problem hidden in this thread as it is getting rather long)
gschaider is offline   Reply With Quote

Old   January 4, 2010, 02:11
Default
  #173
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 11
braennstroem is on a distinguished road
Hi Bernhard,

thanks, I did not know this.

Fabian
braennstroem is offline   Reply With Quote

Old   January 4, 2010, 04:25
Default
  #174
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 11
braennstroem is on a distinguished road
Hi Bernhard,

me again :-)
For preprocessing I am using your pyFoamCreateBoundaryPatches tool. It seems, that it does not work in parallel for snappyHexMesh-paralllel-created meshes!? Would be nice, if this works!

Fabian
braennstroem is offline   Reply With Quote

Old   January 4, 2010, 05:36
Default
  #175
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by braennstroem View Post
Hi Bernhard,

thanks, I did not know this.
You can't (have known). The bug-tracker is only in operation for a week and was not properly announced

Bernhard
gschaider is offline   Reply With Quote

Old   January 4, 2010, 05:48
Default
  #176
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by braennstroem View Post
For preprocessing I am using your pyFoamCreateBoundaryPatches tool. It seems, that it does not work in parallel for snappyHexMesh-paralllel-created meshes!? Would be nice, if this works!
As I said above: Report an issue at http://sourceforge.net/apps/mantisbt...e_status_id=90 (Severity=feature) and it might be considered

Bernhard
gschaider is offline   Reply With Quote

Old   January 4, 2010, 05:52
Default
  #177
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 11
braennstroem is on a distinguished road
Yes, was not sure, if this feature is available.

Fabian
braennstroem is offline   Reply With Quote

Old   January 14, 2010, 12:45
Default
  #178
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 11
braennstroem is on a distinguished road
Hi Bernhard,

I am trying to read the boundary files using pyFoam. This works quite nice with this simple script:

Quote:
import fnmatch
from PyFoam.RunDictionary.BoundaryDict import BoundaryDict
from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory

case="."
case2="processor0"
#proc="processor0"
# pfile=SolutionDirectory(case, archive=None, paraviewLink=False).boundaryDict(time="constant",p rocessor=proc)
# print pfile

pfile=BoundaryDict(case2)
for p in pfile.patches():
if (fnmatch.fnmatch(p, 'IN*') or fnmatch.fnmatch(p, 'in*')):
print "Inlet: ", p
if fnmatch.fnmatch(p, 'OUT*'):
print "Outlet: ", p
if fnmatch.fnmatch(p, 'cyc-*'):
print "Cyclic Boundary: ", p
if fnmatch.fnmatch(p, 'sym-*'):
print "SymmetryPlane: ", p
if fnmatch.fnmatch(p, 'w-*'):
print "Wall: " ,p

bfile=BoundaryDict(case)
for b in bfile.patches():
print b
Unfortunately, I have no idea, how I could read the boundary file in a time directory without the 'needed' constant directory!?
Would be nice, if you have a hint!
Fabian
braennstroem is offline   Reply With Quote

Old   January 14, 2010, 16:16
Default
  #179
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,972
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by braennstroem View Post
Hi Bernhard,

I am trying to read the boundary files using pyFoam. This works quite nice with this simple script:



Unfortunately, I have no idea, how I could read the boundary file in a time directory without the 'needed' constant directory!?
Would be nice, if you have a hint!
Fabian
I don't understand the question. You're working with a moving mesh and want to access the boundary file for a specific time, right? The parameter time="constant" is not needed in the usual case as a default is defined for that. To get the boundary-File case/666/polyMesh/boundary the option time="666" should be sufficient

Bernhard
gschaider is offline   Reply With Quote

Old   January 15, 2010, 01:18
Default
  #180
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 11
braennstroem is on a distinguished road
Hi Bernhard,
yes, you are right. Though, where do I set the option? Using:

pfile=BoundaryDict(case2,time="10")

I get: TypeError: __init__() got an unexpected keyword argument 'time'

Thanks for your help!
Fabian
braennstroem is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PyFoam library seb62 OpenFOAM Post-Processing 52 September 30, 2011 08:28


All times are GMT -4. The time now is 08:44.