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

How to extract Cl, Cd value through python for 2D airfoil simulation?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By bigfootedrockmidget
  • 1 Post By bigfootedrockmidget

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 2, 2022, 07:45
Default How to extract Cl, Cd value through python for 2D airfoil simulation?
  #1
New Member
 
Vishnu_iitb
Join Date: Oct 2020
Location: Mumbai
Posts: 16
Rep Power: 6
Vishnu Sankar is on a distinguished road
Hello there,

Using Python, I would like to directly extract the coefficient of lift and drag from a naca 0012 airfoil simulation, which is exactly same as the case in Quick Start . So I ran the Quick case by using the subprocess package in Python (code is attached below). I can see that the SCREEN_OUTPUT prints CL and CD values, but it seems the values are not stored anywhere. I want to know how can I directly extract the value of CL, CD from the solver using python. If not is there a way to save the CL, CD values to a .csv file directly? Any help is much appreciated.

Note: I tried out the pySU2 package, but I am running into an error and not sure how to proceed further. The issue is elaborated here

Code:
import subprocess
subprocess.run(' SU2_CFD inv_NACA0012.cfg', shell=True)
Vishnu Sankar is offline   Reply With Quote

Old   November 2, 2022, 08:43
Default
  #2
Senior Member
 
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 676
Rep Power: 21
bigfootedrockmidget is on a distinguished road
You can find the values for lift and drag in the history output file:

https://su2code.github.io/docs_v7/Cu...history-output

You can use either the field name or the group output name

Code:
HISTORY_OUTPUT= ITER RMS_RES AERO_COEFF
Vishnu Sankar likes this.
bigfootedrockmidget is offline   Reply With Quote

Old   November 3, 2022, 02:20
Default
  #3
New Member
 
Vishnu_iitb
Join Date: Oct 2020
Location: Mumbai
Posts: 16
Rep Power: 6
Vishnu Sankar is on a distinguished road
Thanks a lot for your speedy response! I have another question: Is it not directly possible to extract the aerodynamic coefficients from the SU2 solver instead of writing it to an output file and then reading it? The reason why I am asking this is while performing a multidisciplinary optimization it is desirable for the optimizer to have a 'direct memory access' instead of using input/output files as the former savessignificant time,minimizes potential loss of accuracy and reduces storage space in disks.
Vishnu Sankar is offline   Reply With Quote

Old   November 3, 2022, 06:51
Default
  #4
Senior Member
 
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 676
Rep Power: 21
bigfootedrockmidget is on a distinguished road
There are a couple of examples for the pywrapper in TestCases/py_wrapper, you can first run them to make sure that everything is working properly on your local machine (if you haven't done so already)
Vishnu Sankar likes this.
bigfootedrockmidget is offline   Reply With Quote

Reply


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
CFX/Fluent- Underprediction of Lift Coeffcient in 2D Airfoil Simulation DanielBarreiro Main CFD Forum 4 September 2, 2021 03:16
Airfoil 2D cfd simulation Cocorito90 OpenFOAM Running, Solving & CFD 14 December 19, 2016 04:43
airfoil 2D simulation: position of lift force on the airfoil Koenieboy Main CFD Forum 2 March 13, 2012 07:44
NO STAGNATION POINT FOR AIRFOIL SIMULATION Rif Main CFD Forum 6 February 4, 2008 08:33
Airfoil Simulation for Validation Purposes Angela Bong Main CFD Forum 7 September 13, 2006 14:04


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