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

[PyFoam] writeFile problem with PyFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 1, 2012, 12:14
Default writeFile problem with PyFoam
  #1
Member
 
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16
ganeshv is on a distinguished road
I'm trying to set boundary conditions on a decomposed case. I'm assuming the ParsedParameterFile should work on decomposed solution files as well. I installed the latest version of PyFoam from the svn repo. I was debugging this case for a long time thinking something was wrong in the way I was setting boundary conditions using PyFoam when I realised that PyFoam couldn't just open and close the file without modifying anything. Could someone tell me what's wrong?

Quote:
Python 2.7.1 (r271:86832, Feb 9 2011, 08:44:16)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
>>> f = ParsedParameterFile('processor5/0/nuSgs')
>>> f.writeFile()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/users/5/guv106/OpenFOAM/PyFoam/lib/python2.7/site-packages/PyFoam/RunDictionary/FileBasis.py", line 91, in writeFile
self.fh.write(str(self))
File "/usr/users/5/guv106/OpenFOAM/PyFoam/lib/python2.7/site-packages/PyFoam/RunDictionary/ParsedParameterFile.py", line 124, in __str__
string+=generator.makeString(firstLevel=True)
File "/usr/users/5/guv106/OpenFOAM/PyFoam/lib/python2.7/site-packages/PyFoam/Basics/FoamFileGenerator.py", line 41, in makeString
result+=self.strDict(self.data,firstLevel=firstLev el)
File "/usr/users/5/guv106/OpenFOAM/PyFoam/lib/python2.7/site-packages/PyFoam/Basics/FoamFileGenerator.py", line 102, in strDict
s+=self.strDict(v,indent+2)
File "/usr/users/5/guv106/OpenFOAM/PyFoam/lib/python2.7/site-packages/PyFoam/Basics/FoamFileGenerator.py", line 102, in strDict
s+=self.strDict(v,indent+2)
File "/usr/users/5/guv106/OpenFOAM/PyFoam/lib/python2.7/site-packages/PyFoam/Basics/FoamFileGenerator.py", line 125, in strDict
s+=" "+str(v)+";"+end
File "/usr/users/5/guv106/OpenFOAM/PyFoam/lib/python2.7/site-packages/PyFoam/Basics/DataStructures.py", line 27, in __str__
result+="nonuniform "+self.name+" "
TypeError: cannot concatenate 'str' and 'int' objects
ganeshv is offline   Reply With Quote

Old   August 6, 2012, 18:27
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by ganeshv View Post
I'm trying to set boundary conditions on a decomposed case. I'm assuming the ParsedParameterFile should work on decomposed solution files as well. I installed the latest version of PyFoam from the svn repo. I was debugging this case for a long time thinking something was wrong in the way I was setting boundary conditions using PyFoam when I realised that PyFoam couldn't just open and close the file without modifying anything. Could someone tell me what's wrong?
Not quite sure. Could you give me the file in question and I'll have a look
gschaider is offline   Reply With Quote

Old   August 17, 2012, 16:30
Default
  #3
Member
 
Ganesh Vijayakumar
Join Date: Jan 2010
Posts: 44
Rep Power: 16
ganeshv is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Not quite sure. Could you give me the file in question and I'll have a look

Sorry for the late reply. I figured out what the problem was and a temporary fix around it. My installation of PyFoam could not parse

Quote:
value nonuniform 0();
This seems to be generated in decomposed cases, whenever a boundary is not located on a particular processor. A work around to this is


Quote:
sed 's/nonuniform 0()/uniform 0/' processor2/0/nut
or whatever file you want to work with pyFoam later. You may also have to change it to

Quote:
sed 's/nonuniform 0()/uniform (0 0 0)/' processor2/0/U
for a vectorField.

Bernard, I really want to file a bug report this time. Could you just point me where?

ganesh
ganeshv is offline   Reply With Quote

Old   August 20, 2012, 17:07
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by ganeshv View Post
Sorry for the late reply. I figured out what the problem was and a temporary fix around it. My installation of PyFoam could not parse



This seems to be generated in decomposed cases, whenever a boundary is not located on a particular processor. A work around to this is




or whatever file you want to work with pyFoam later. You may also have to change it to



for a vectorField.

Bernard, I really want to file a bug report this time. Could you just point me where?

ganesh
Seems like the parser can't handle fields of length 0. I'll fix that for the next release

Reporting is described at
http://openfoamwiki.net/index.php/Co...#Bug_reporting
(in your case the info from pyFoamVersion.py is not needed)
gschaider is offline   Reply With Quote

Reply

Tags
pyfoam, writefile


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[PyFoam] Using pyFoamPlotWatcher.py To Plot Residuals m_ridzon OpenFOAM Community Contributions 22 January 26, 2021 18:48
Heat Transfert, mixing problem Wazdq CFX 8 November 7, 2016 05:44
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13


All times are GMT -4. The time now is 05:41.