CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   SU2 (https://www.cfd-online.com/Forums/su2/)
-   -   parallel_computation.py not working (https://www.cfd-online.com/Forums/su2/188162-parallel_computation-py-not-working.html)

omdemircan May 24, 2017 07:21

parallel_computation.py not working
 
Everytime I try to run a parallel simulation using "/usr/local/bin/parallel_computation.py" I get the following error:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 112, in <module>
main()
File "/usr/local/bin/parallel_computation.py", line 63, in main
options.compute )
File "/usr/local/bin/parallel_computation.py", line 90, in parallel_computation
info = SU2.run.CFD(config)
File "/usr/local/bin/SU2/run/interface.py", line 89, in CFD
auto_diff = konfig.MATH_PROBLEM == 'DISCRETE_ADJOINT'
File "/usr/local/bin/SU2/io/config.py", line 130, in __getattr__
raise AttributeError , 'Config parameter not found'
AttributeError: Config parameter not found

I call the script as following on the terminal window:
python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4

I wonder what am I doing wrong here?
I also tried sudo python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4 but this time get:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 36, in <module>
sys.path.append(os.environ['SU2_RUN'])
File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
raise KeyError(key)
KeyError: 'SU2_RUN'

Haowang May 25, 2017 22:23

Quote:

Originally Posted by omdemircan (Post 650099)
Everytime I try to run a parallel simulation using "/usr/local/bin/parallel_computation.py" I get the following error:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 112, in <module>
main()
File "/usr/local/bin/parallel_computation.py", line 63, in main
options.compute )
File "/usr/local/bin/parallel_computation.py", line 90, in parallel_computation
info = SU2.run.CFD(config)
File "/usr/local/bin/SU2/run/interface.py", line 89, in CFD
auto_diff = konfig.MATH_PROBLEM == 'DISCRETE_ADJOINT'
File "/usr/local/bin/SU2/io/config.py", line 130, in __getattr__
raise AttributeError , 'Config parameter not found'
AttributeError: Config parameter not found

I call the script as following on the terminal window:
python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4

I wonder what am I doing wrong here?
I also tried sudo python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4 but this time get:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 36, in <module>
sys.path.append(os.environ['SU2_RUN'])
File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
raise KeyError(key)
KeyError: 'SU2_RUN'

Hi there,
Please change your MATH_PROBLEM as "DIRECT", I guess you are using DISCRETE_ADJOINT.
Command: python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4

omdemircan May 26, 2017 09:25

Actually I am using "DIRECT". However, I have realized that I haven't enabled the python wrapper when I installed SU2. I am now trying to install the prerequisites swig and mpi4py.

Edit: I have successfully installed swig but mpi4py caused problems. The instructions on SU2 wiki aren't working anymore. Instead, I have downloaded mpi4py from github and installed it. I got the script working now. BUT, another problem is that parallel_computation only creates the first flow_00000.vtk file for an unsteady simulation, not even the last one. I need all of them in order to get the temporal statistics, is there a line that I should add in my config file before executing the script or there is another way of getting all the flow files?
Another question is how to restart an unsteady case, it asks me for a turbulent restart file.

nuaa_bird May 30, 2017 20:44

Quote:

Originally Posted by omdemircan (Post 650099)
Everytime I try to run a parallel simulation using "/usr/local/bin/parallel_computation.py" I get the following error:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 112, in <module>
main()
File "/usr/local/bin/parallel_computation.py", line 63, in main
options.compute )
File "/usr/local/bin/parallel_computation.py", line 90, in parallel_computation
info = SU2.run.CFD(config)
File "/usr/local/bin/SU2/run/interface.py", line 89, in CFD
auto_diff = konfig.MATH_PROBLEM == 'DISCRETE_ADJOINT'
File "/usr/local/bin/SU2/io/config.py", line 130, in __getattr__
raise AttributeError , 'Config parameter not found'
AttributeError: Config parameter not found

I call the script as following on the terminal window:
python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4

I wonder what am I doing wrong here?
I also tried sudo python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4 but this time get:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 36, in <module>
sys.path.append(os.environ['SU2_RUN'])
File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
raise KeyError(key)
KeyError: 'SU2_RUN'



hello!
Im new for SU2, and since your keyerror turned to be 'SU2_RUN', I guess you may not add SU2_RUN to your path.
good luck!

jitendraseregar@gmail.com June 13, 2017 00:02

Quote:

Originally Posted by omdemircan (Post 650377)
Actually I am using "DIRECT". However, I have realized that I haven't enabled the python wrapper when I installed SU2. I am now trying to install the prerequisites swig and mpi4py.

Edit: I have successfully installed swig but mpi4py caused problems. The instructions on SU2 wiki aren't working anymore. Instead, I have downloaded mpi4py from github and installed it. I got the script working now. BUT, another problem is that parallel_computation only creates the first flow_00000.vtk file for an unsteady simulation, not even the last one. I need all of them in order to get the temporal statistics, is there a line that I should add in my config file before executing the script or there is another way of getting all the flow files?
Another question is how to restart an unsteady case, it asks me for a turbulent restart file.

Hi Omdemircan,
I too have faced the problem. I didn`t get any solution files flow_0000.vtk. It generates only restart files. i am trying to run fsi problem. In local machine it generates all files at required intervals of time. But on cluster it is not writing any solution files for unsteady and fsi cases. Any help would be greatly appreciated/

omdemircan June 13, 2017 03:16

Hi jitendraseregar, I couldn't solve the problem directly. However, I have written a python script which calls SU2_SOL for each of the restart files. This is the only way I could get all of the flow files in a quick way. Note that you have to change the simulation to unsteady in your config file for this to work.

jitendraseregar@gmail.com June 13, 2017 03:57

I am solving unsteady flow (DUAL_TIME_STEPPING _2ND_ORDER). Is it possible to share python script of yours?. It would be of great help.

omdemircan June 13, 2017 07:41

Here you go:

#!/usr/bin/python
import fileinput
import sys
import os
ni = 0
nf = 10000
dn = 1000
for line in fileinput.input(inplace=True):
if line.startswith('UNSTEADY_SIMULATION'):
print('UNSTEADY_SIMULATION= NO')
else:
sys.stdout.write(line)
for n in range(ni, nf+1, dn):
for line in fileinput.input(inplace=True):
if line.startswith('SOLUTION_FLOW_FILENAME'):
print('SOLUTION_FLOW_FILENAME= restart_flow_%05d.dat' % n)
elif line.startswith('SURFACE_FLOW_FILENAME'):
print('SURFACE_FLOW_FILENAME= surface_flow_%05d' % n)
else:
sys.stdout.write(line)
os.system('SU2_SOL config_SOL.cfg')
os.system('mv flow.vtk flow_%05d.vtk' % n)

You may run this by saving it as <script.py> and calling it with your config file using following command on your terminal: python script.py config_SOL.cfg
Basically, it will edit your config file and run SU2_SOL for each iteration. This is the first script I wrote in python but it works for me, I hope it can be of some use to you as well.

jitendraseregar@gmail.com June 14, 2017 07:37

Thanks a lot.

Duter LEE April 2, 2018 05:50

How to add SU2_RUN to path?
 
Quote:

Originally Posted by nuaa_bird (Post 650972)
hello!
Im new for SU2, and since your keyerror turned to be 'SU2_RUN', I guess you may not add SU2_RUN to your path.
good luck!


How to add SU2_RUN to path?

Duter LEE April 3, 2018 05:13

Quote:

Originally Posted by omdemircan (Post 650099)
Everytime I try to run a parallel simulation using "/usr/local/bin/parallel_computation.py" I get the following error:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 112, in <module>
main()
File "/usr/local/bin/parallel_computation.py", line 63, in main
options.compute )
File "/usr/local/bin/parallel_computation.py", line 90, in parallel_computation
info = SU2.run.CFD(config)
File "/usr/local/bin/SU2/run/interface.py", line 89, in CFD
auto_diff = konfig.MATH_PROBLEM == 'DISCRETE_ADJOINT'
File "/usr/local/bin/SU2/io/config.py", line 130, in __getattr__
raise AttributeError , 'Config parameter not found'
AttributeError: Config parameter not found

I call the script as following on the terminal window:
python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4

I wonder what am I doing wrong here?
I also tried sudo python /usr/local/bin/parallel_computation.py -f filename.cfg -n 4 but this time get:

Traceback (most recent call last):
File "/usr/local/bin/parallel_computation.py", line 36, in <module>
sys.path.append(os.environ['SU2_RUN'])
File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
raise KeyError(key)
KeyError: 'SU2_RUN'

With regard to the parallel problem, have you solved it now? How is it solved?

omdemircan April 3, 2018 07:27

Regarding the use of the python script provided by SU2, the problem that I had encountered was due to my installation. I probably didn't install the py wrapper correctly since, after I reinstalled the code, I didn't encounter the same errors. The script ran correctly.


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