Setting up parasite drag analysis via API

36 views
Skip to first unread message

Jeyadave Nuntha Kumar

unread,
Jul 19, 2024, 3:14:31 AM (2 days ago) Jul 19
to OpenVSP
Hi,

I'd like to know whether the way I'm setting up my parasitic drag solver through the API is consistent with how I would do it through the GUI.

I have attached a screenshot of the GUI where the solver is fully set up with the conditions I want. The solver has also been executed with the conditions shown.

Here is a relevant section of my Python code:
# Run parasite drag solver
PD_analysis = "ParasiteDrag"
vsp.SetAnalysisInputDefaults(PD_analysis)
vsp.SetIntAnalysisInput(PD_analysis, "RecomputeGeom", (0,)) # do not recompute

vsp.SetIntAnalysisInput(PD_analysis, "LengthUnit", (2,)) # meters
vsp.SetDoubleAnalysisInput(PD_analysis, "Sref", (Sref,))


vsp.SetIntAnalysisInput(PD_analysis, "FreestreamPropChoice", (5,)) # Re/L + Mach control
vsp.SetDoubleAnalysisInput(PD_analysis, "SpecificHeatRatio", (gamma_PD,))
vsp.SetDoubleAnalysisInput(PD_analysis, "Re_L", (Re_l_PD,))
vsp.SetDoubleAnalysisInput(PD_analysis, "Mach", (Machinf_PD,))

vsp.PrintAnalysisInputs(PD_analysis)

vsp.Update()

PD_results = vsp.ExecAnalysis(PD_analysis)
#vsp.PrintResults(PD_results)
vsp.WriteResultsCSVFile(PD_results, fname_csvdata_PD)

cD_tot = vsp.GetDoubleResults(PD_results, "Total_CD_Total", 0)
print(f"\nCD_tot = {cD_tot[0]}\n")

I'm expecting CD_total = 0.00672 as is displayed in the GUI, but when running through the code, I get CD_total = 0.00652. Slight difference, but unsure where it's coming from. 

I also get a warning that some geometry was not included in Parasite Drag calculation. Note sure why that is. Before this piece of code runs, the earlier parts of my code runs CompGeom followed by the Panel solver. And only after all that am I executing the Parasite Drag solver, so I thought to just allow the geometry set to be chosen by default and opt to not recompute geometry. 

I appreciate your any assistance you can provide.

Sincerely,
Jeyadave
PD_GUI_iwant.png

Brandon Litherland

unread,
Jul 19, 2024, 8:04:38 AM (2 days ago) Jul 19
to OpenVSP
I'd start by verifying that the API inputs match what you see in the GUI.  Then confirm that all of the component parasite drag parms are the same.  Individual PD parms belong to the component and not the solver.  These values are found in the "ParasiteDragProps" group for each component.
Write out or confirm that all input values and results match between the GUI and API.  Chances are, if the inputs are the same, there is an issue with the computed wetted area.

Jeyadave Nuntha Kumar

unread,
Jul 19, 2024, 12:34:36 PM (2 days ago) Jul 19
to OpenVSP
Hi Brandon, thanks for your reply. 

It seems the issue I'm having is that SpecificHeatRatio, Re_L, and Mach are not among the solver inputs, yet they are under the group "ParasiteDrag". The 3 inputs also don't show when I try to print the analysis inputs. 

Additionally, by changing "FreestreamPropChoice" to option 5, I'm expecting to be in Re/L + Mach Control mode where those 3 settings are relevant. Please let me know if I'm doing that correctly or not.

Jeyadave

Rob McDonald

unread,
Jul 19, 2024, 2:57:48 PM (2 days ago) Jul 19
to OpenVSP
I'm not sure why those parameters were overlooked, but I've added them and they will be in the next release -- hopefully later today.

Rob

Jeyadave Nuntha Kumar

unread,
Jul 19, 2024, 9:21:59 PM (2 days ago) Jul 19
to OpenVSP
I understand, thank you for looking into this.

Jeyadave Nuntha Kumar

unread,
Jul 20, 2024, 3:24:44 PM (16 hours ago) Jul 20
to OpenVSP
I can verify that I get the same results now from GUI and code with the recent release. This made my day, thank you again!
Reply all
Reply to author
Forward
0 new messages