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

Python Script for complete lift polar

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By rktchip

Reply
 
LinkBack Thread Tools Display Modes
Old   April 23, 2013, 14:06
Exclamation Python Script for complete lift polar
  #1
Member
 
Join Date: Nov 2010
Posts: 52
Rep Power: 4
taxalian is on a distinguished road
Hi SU2 users,
Is there already python script exists that automatically takes the converged solution of the current angle of attack as restart solution to compute the next angle of attack and so on ... to complete the lift polar. Instead of always doing this process manually to do the polars.

Thanks and regards.
taxalian is offline   Reply With Quote

Old   April 24, 2013, 02:28
Default Inelegant but effective...
  #2
New Member
 
dtucker's Avatar
 
David Tucker
Join Date: Jan 2013
Posts: 15
Rep Power: 2
dtucker is on a distinguished road
Quote:
Originally Posted by taxalian View Post
Hi SU2 users,
Is there already python script exists that automatically takes the converged solution of the current angle of attack as restart solution to compute the next angle of attack and so on ... to complete the lift polar. Instead of always doing this process manually to do the polars.

Thanks and regards.
I'm willing to bet someone has come up with something a little more elegant than this...but I setup a c-shell script to take care of the leg-work. It would be a prime candidate for a loop call, but this does the trick!

...I'm also not worried about space, so I just copy/paste a run directory to the next run (each AoA is a sub-directory of that) and run the script. Since I'm running on a KRAKEN Cray 5 system, I also need a submit script.

As I say...not terribly sophisticated, and I am currently "tail"ing each output file one by one and transferring the CL and CD values. If you get anything more slick I'd be interested in taking a look!

Good Luck!
Dave
Attached Files
File Type: doc SubmitJobsScript.doc (35.0 KB, 6 views)
dtucker is offline   Reply With Quote

Old   May 2, 2013, 13:31
Default Example Code
  #3
Member
 
Trent Lukaczyk
Join Date: Feb 2011
Location: Stanford, CA
Posts: 33
Rep Power: 4
rktchip is on a distinguished road
This is a good example to try with the new SU2 python package! Here's an example python script -

Code:
#!/usr/bin/env python 

# imports
import SU2
import numpy as np
import pylab as plt
from copy import deepcopy

# load config, start state
config = SU2.io.Config('inv_NACA0012.cfg')
state  = SU2.io.State()

# prepare config
config.NUMBER_PART = 2
config.EXT_ITER    = 99999
config.RESTART_SOL = 'YES'

# find solution files if they exist
state.find_files(config)

# angles to run
angles = np.linspace(-10.,10.,7)

# start results data
results = SU2.util.bunch()
results.AoA  = angles
results.DRAG = []
results.LIFT = []

# iterate angles
for angle in angles:
    
    # local config and state
    konfig = deepcopy(config)
    ztate  = deepcopy(state)
    
    # set angle of attack
    konfig.AoA = angle
    print 'AoA = ' , konfig.AoA
    
    # run su2
    drag = SU2.eval.func('DRAG',konfig,ztate)
    lift = SU2.eval.func('LIFT',konfig,ztate)
    
    # append results
    results.DRAG.append(drag)
    results.LIFT.append(lift)
    
#: for each angle

# plotting
plt.figure()
plt.plot( results.AoA , results.DRAG )
plt.show()    

# save data
SU2.io.save_data('results.pkl',results)
dtucker likes this.
rktchip is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 09:36
paraView in shell mode (python script running) Prosiaczek OpenFOAM 2 March 19, 2012 08:54
[ParaView] SurfaceFlow filter in python script yohey ParaView 2 March 18, 2012 08:43
Script for an airfoil polar plots computation maddalena OpenFOAM 5 June 9, 2010 13:55
Thin foil analsis (sail) - Lift Coeff Problem Kelvin CFX 3 December 22, 2008 16:22


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