CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   SU2 (https://www.cfd-online.com/Forums/su2/)
-   -   Calculate drag in su2 v7.0.0 (https://www.cfd-online.com/Forums/su2/223006-calculate-drag-su2-v7-0-0-a.html)

fabiox8 December 17, 2019 18:10

Calculate drag in su2 v7.0.0
 
Hello,

today I decided to switch from SU2 V6.0.0 to V7.0.0 and a problem occured.

I want to calculate the DRAG (or any other function like LIFT, SIDEFORCE, ...).
With SU2 V6.0.0 I use this python script to get the DRAG:

Code:

import SU2

config = SU2.io.Config("inv_ONERAM6_V6.cfg")
config.MATH_PROBLEM = "DIRECT"
config.RESTART_SOL = "NO"
config.NUMBER_PART = 4
config.NZONES = 1  # no multizone simulation
config.EXT_ITER = 1 # just for fast debugging
state = SU2.io.State()

info = SU2.run.direct(config)
state.update(info)

responseValue = SU2.eval.functions.function("DRAG", config, state)
print(responseValue)

However in SU2 V7.0.0 This does not work anymore.
I get this error message:
Quote:

Traceback (most recent call last):
File "a.py", line 21, in <module>
responseValue = SU2.eval.functions.function("DRAG", config, state)
File "/home/fabio/SU2/SU2_V7.0/bin/SU2/eval/functions.py", line 118, in function
func_out = state['FUNCTIONS'][func_name]
KeyError: 'DRAG'
It seems like info = SU2.run.direct(config) does not contain anything in info['FUNCTIONS'] and therefore SU2.eval.functions.function("DRAG", config, state) can not retrieve any information.

I would be happy to get suggestions on how to solve this problem.

Best

Fabio

talbring December 18, 2019 10:12

Hi Fabio,

you have to add the output group "AERO_COEFF" to the history output option.

e.g:

Code:

config["HISTORY_OUTPUT"].append("AERO_COEFF")
Regards,
Tim

fabiox8 December 18, 2019 16:31

Solved
 
Hi Tim,

this works. Thank's a lot!

Now that you explained it to me, I also found the new user guide

Best

Fabio


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