CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Trouble with PyFoamPrepareCase.py (https://www.cfd-online.com/Forums/openfoam-pre-processing/218532-trouble-pyfoampreparecase-py.html)

LCammiade June 24, 2019 07:59

Trouble with PyFoamPrepareCase.py
 
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.


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