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

[PyFoam] WriteParameterFile: Orders of entries

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   September 21, 2012, 12:31
Default WriteParameterFile: Orders of entries
  #1
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 16
Horus is on a distinguished road
Hello,

I use pyFoam's WriteParameterFile to write to the files in 0 directory (U, p, ...)

Code:
field_file = WriteParameterFile(field_name), className=_OF_units[field_name][1])
field_file["internalField"] = internalField
field_file["dimensions"] = dimensions

boundaryField = {}
# Fill boundaryField in a loop

field_file["boundaryField"] = boundaryField
field_file.writeFile()
My problem is that in thesulting field there is the boundaryField first and after that dimensions and internalField. Since I use $internalField as a value to several BCs this a problem since it can't be referenced before used. I also tried and changed the order in which I write I set the dictionaries entries in the field_file but it changed nothing.

Is there a way to change the order? It have to, cause the pyFoamCaseBuilder uses the "correct" order. (though python dictionaries do not have any order...)

Thanks!

Ok, kind of an addendum. I found that piece of code:

Code:
        if type(dic)==DictProxy:
            order=dic._order
        else:
            order=dic.keys()
            order.sort()
in PyFoam.Basics.FoamFileGenerator.FoamFileGenerator. strDict. So it seems to I need to use PyFoam DictProxy objects... Is that correct so far?
Horus is offline   Reply With Quote

 


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
[snappyHexMesh] Not all entries in refinementSurfaces dictionary were used will_ca OpenFOAM Meshing & Mesh Conversion 5 November 4, 2021 21:04
ill defined primitiveEntry starting at keyword 'value' on line 197 ChangeDictionary Struggle_Achieve OpenFOAM Pre-Processing 2 December 20, 2017 03:58
[Gmsh] different orders of mesh refinement using gmsh tjliang OpenFOAM Meshing & Mesh Conversion 0 August 14, 2016 12:38
How to divide all entries in 0/p by rho lentschi OpenFOAM 1 March 16, 2011 13:42
Accessing Individual entries in a post register sdwijeya STAR-CD 0 April 29, 2010 14:18


All times are GMT -4. The time now is 06:23.