Retrieve VSPAERO results (.polar) by exectuting analysis whith API python

264 views
Skip to first unread message

Adrien Vanneste

unread,
Sep 17, 2024, 5:05:12 AM9/17/24
to OpenVSP
Hi, 
Im trying to use API python to execute OPENVSP analysis. I have created my geom but When I execute my analysis
( with  vsp.SetAnalysisInputDefaults("VSPAERO")


vsp.SetParmVal("AnalysisMethod", 0)  
vsp.SetParmVal("Mach", 0.5)
vsp.SetParmVal("AlphaStart", 0.0)    
vsp.SetParmVal("AlphaEnd", 10)      
vsp.SetParmVal("AlphaNpts", 10)


vsp.ExecAnalysis("VSPAERO") )
I can't find results files ( I want to find the .polar file).

Someone can explain me why and how to find it ? 

Thanks !! 

Adrien 
Message has been deleted

Adrien Vanneste

unread,
Sep 19, 2024, 5:42:00 AM9/19/24
to OpenVSP
?

Le mercredi 18 septembre 2024 à 15:29:52 UTC+2, Adrien Vanneste a écrit :


---------- Message transféré ---------
De : Adrien Vanneste <Inconnu>
Date : mardi 17 septembre 2024 à 11:05:12 UTC+2
Objet : Retrieve VSPAERO results (.polar) by exectuting analysis whith API python
À : OpenVSP <Inconnu>

Brandon Litherland

unread,
Sep 19, 2024, 9:41:54 AM9/19/24
to OpenVSP
Self-replying will not get your post answered in less time.
Supporting this forum is done on personal time for the vast majority of responses and we will get to each as we have availability.  If your question requires a response in less than 24-48 hours, you waited too long to ask.

Brandon Litherland

unread,
Sep 19, 2024, 11:15:55 AM9/19/24
to OpenVSP
"VSPAERO" isn't an analysis name in the API.  To get the list of all analyses in the API, use vsp.ListAnlysis().  You want to use "VSPAEROSweep".  You also didn't assign a variable to the results so the code will just return the Results ID and move on.  In the script examples for automating VSPAERO, you'll see that any analysis will have the results assigned in this format:
res_id = vsp.ExecAnalysis("VSPAEROSweep")

VSPAERO produces lots of different results so you want to find the name and ID of the result that you care about.  In this case, you want "VSPAERO_Polar":
rid_polar = vsp.FindResultsID('VSPAERO_Polar')

All of the Polar results are Double type so to grab any particular result, let's say Alpha, you can do this:
vspaero_result_alpha = vsp.GetDoubleResults(rid_polar, 'Alpha')





On Thursday, September 19, 2024 at 5:42:00 AM UTC-4 ad.va...@gmail.com wrote:

Brandon Litherland

unread,
Sep 19, 2024, 11:24:25 AM9/19/24
to OpenVSP
Your code may have better luck if you run it this way:

# Must run compute geom first
analysis_name = "VSPAEROComputeGeometry"
vsp.SetAnalysisInputDefaults(analysis_name)
analysis_method = list(vsp.GetIntAnalysisInput(analysis_name, "AnalysisMethod" ))
analysis_method[0] = vsp.VORTEX_LATTICE
vsp.SetIntAnalysisInput(analysis_name, "AnalysisMethod", analysis_method)
res_id = vsp.ExecAnalysis( analysis_name )
# run vspaero sweep next
analysis_name = "VSPAEROSweep"
vsp.SetAnalysisInputDefaults(analysis_name)
vsp.SetDoubleAnalysisInput(analysis_name, "AlphaStart", (0,), 0)
vsp.SetDoubleAnalysisInput(analysis_name, "AlphaEnd", (10,), 0)
vsp.SetIntAnalysisInput(analysis_name, "AlphaNpts", (3,), 0)
vsp.Update()
res_id = vsp.ExecAnalysis(analysis_name)
rid_vec = vsp.GetStringResults(res_id, 'ResultsVec')


Adrien Vanneste

unread,
Sep 20, 2024, 3:00:19 AM9/20/24
to OpenVSP
Sorry I didn't want to be insisting, I just wanted to make sure my message was out there for everyone to see.
Thank you for your time. 
Reply all
Reply to author
Forward
0 new messages