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

Trouble with PyFoamPrepareCase.py

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 24, 2019, 07:59
Post Trouble with PyFoamPrepareCase.py
  #1
New Member
 
Join Date: May 2019
Posts: 1
Rep Power: 0
LCammiade is on a distinguished road
Hello,

I am currently working on a python script that is supposed to automate case generation by writing the individual data for boundary conditions. I have thus created a default.parameters file as per the pyFoam Tutorial which has the following form:

Air{
description "properties of air";
values{
massFracInletAir{
description "Mass fraction of air at inlet";
default %%AirIn%%;
}
massFracWallAir{
description "Mass fraction of air at condensing wall";
default %%AirWall%%;
}
}
}

H2O{
description "properties of H2O";
values{
massFracInletH2O{
description "Mass fraction of water at inlet";
default %%H2OIn%%;
}
massFracWallH2O{
description "Mass fraction of water at condensing wall";
default %%H2OWall%%;
}
}
}
Temperature{
description "Temperatures at different points in the domain";
values{
inletTemp{
description "Temperature at inlet";
default %%TempIn%%;
}
wallTemp{
description "Temperature at condensing wall";
default %%TempWall%%;
}
approxTemp{
description "Approximated outlet temperature";
default %%ApproxOut%%;
}
}
}
Inclination{
description "Influence of the inclination angle";
values{
velocityVector{
description "3-d velocity vector";
default %%uVector%%;
}
gVector{
description "3-d gravity vector";
default %%gVector%%;
}
velocityOut{
description "vector for inletOutlet BC";
default %%inletOutlet%%;
}
}
}
System{
description "Parameters to be modified in the controlDict.";
values{
endTime{
description "Time at which the simulation will terminate.";
default 30;
}
purgeWrite{
description "Number of time-step dictionaries that will be kept.";
default 1;
}
writeIntervall{
description "Intervalls after which data will be written to file.";
default 10000;
}
deltaT{
description "Time step width.";
default 1e-2;
}
}
}

Addendum: All strings wrapped in %%xxx%% are replaced by the script with the values desired for each specific case. I have tested for a possible influence of the target strings formatting but found no connection. Erroneous values such as vectors separated by commata cause the compilation to abort immediately pointing to bad formatting.

As soon as I run pyFoamPrepareCase.py I receive an error that the file default.parameters.gz could not be found.


The full error reads:

Warning in /usr/local/OpenFOAM/PyFoam/bin/pyFoamPrepareCase.py : Case default does not have a 'system' directory
Looking for template values default
Reading values from default.parameters
Traceback (most recent call last):
File "/usr/local/OpenFOAM/PyFoam/bin/pyFoamPrepareCase.py", line 5, in <module>
PrepareCase()
File "/usr/local/OpenFOAM/python/lib/python2.7/site-packages/PyFoam-0.6.9-py2.7.egg/PyFoam/Applications/PrepareCase.py", line 128, in __init__
**kwargs)
File "/usr/local/OpenFOAM/python/lib/python2.7/site-packages/PyFoam-0.6.9-py2.7.egg/PyFoam/Applications/PyFoamApplication.py", line 495, in __init__
result=self.run()
File "/usr/local/OpenFOAM/python/lib/python2.7/site-packages/PyFoam-0.6.9-py2.7.egg/PyFoam/Applications/PrepareCase.py", line 593, in run
self.prepare(sol,cName=cName)
File "/usr/local/OpenFOAM/python/lib/python2.7/site-packages/PyFoam-0.6.9-py2.7.egg/PyFoam/Applications/PrepareCase.py", line 798, in prepare
doMacroExpansion=True).getValueDict())
File "/usr/local/OpenFOAM/python/lib/python2.7/site-packages/PyFoam-0.6.9-py2.7.egg/PyFoam/RunDictionary/ParsedParameterFile.py", line 85, in __init__
self.readFile()
File "/usr/local/OpenFOAM/python/lib/python2.7/site-packages/PyFoam-0.6.9-py2.7.egg/PyFoam/RunDictionary/FileBasis.py", line 98, in readFile
self.openFile()
File "/usr/local/OpenFOAM/python/lib/python2.7/site-packages/PyFoam-0.6.9-py2.7.egg/PyFoam/RunDictionary/FileBasis.py", line 84, in openFile
self.fh=gzip.open(self.name+".gz",mode)
File "/usr/lib64/python2.7/gzip.py", line 34, in open
return GzipFile(filename, mode, compresslevel)
File "/usr/lib64/python2.7/gzip.py", line 94, in __init__
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: [Errno 2] No such file or directory: '/home/generic/path/to/caseDirectory/default/default.parameters.gz'



Please note that I have redacted the path names as I cannot disclose the specific project while having left the path structure unchanged.


Does anybody have a suggestion as to why this error is being caused?

Kind regards.

Last edited by LCammiade; June 25, 2019 at 01:08. Reason: Addition of error text
LCammiade is offline   Reply With Quote

Reply

Tags
pyfoam, pyfoampreparecase.py


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
[waves2Foam] Having a lot of trouble for a short wavelengths arieljeds OpenFOAM Community Contributions 1 January 2, 2024 13:10
Trouble with rotating wall boundary condition king1989 OpenFOAM Running, Solving & CFD 7 July 29, 2016 13:44
Trouble with sampleDict syntax for OpenFOAM 2.3.1 rawdoggity OpenFOAM Post-Processing 1 February 1, 2015 05:24
[ICEM] trouble with mesh quality from ICEM in CFX Solver escher25 ANSYS Meshing & Geometry 0 February 28, 2011 07:38
[GAMBIT] Trouble meshing complex VOF geometry RPJones ANSYS Meshing & Geometry 2 February 14, 2011 18:54


All times are GMT -4. The time now is 07:12.