Sref Function in wave drag analysis scripting

56 views
Skip to first unread message

Mohith r

unread,
Jul 26, 2022, 6:35:18 AM7/26/22
to OpenVSP
Hello Rob and Brandon,
I am repeating the question as I could not find the solution yet. For Wave drag analysis through scripting, the Sref command does not seem to be working as it gave an error and has not changed the value, is there any alternative for it?
    array<double> area = GetDoubleAnalysisInput ( "WaveDrag", "Sref" );
    area[0]= 186.5;
    SetDoubleAnalysisInput( "WaveDrag", "Sref", area );

Regards,
Mohith

Rob McDonald

unread,
Jul 26, 2022, 8:16:06 PM7/26/22
to OpenVSP
Perhaps you can share the error you are getting.

Rob McDonald

unread,
Jul 26, 2022, 8:22:17 PM7/26/22
to OpenVSP
I just checked, the wave drag analysis does not use Sref as an input.  The only inputs are:

"Set"
"NumSlices"
"NumRotSects"
"Mach"
"SSFlow_vec"
"SymmFlag"

This is an oversight.

The S_ref used by the Wave drag analysis is in
Container: WaveDragSettings
Group: WaveDrag
Parm: Sref

You should be able to set it like other Parameters.

I would recommend you just set it to 1.0 and then interpret the results as D/q.

Rob

On Tuesday, July 26, 2022 at 3:35:18 AM UTC-7 mohit...@gmail.com wrote:

Mohith r

unread,
Jul 27, 2022, 7:09:36 AM7/27/22
to OpenVSP
Hello Rob,
After executing the script, all the other inputs are being taken properly except for Sref for some reason,
However, I got the following error, even after trying with 1.0 value,
Error Code: 5, Desc: GetDoubleAnalysisInput::Can't Find Name Sref
An exception 'Index out of bounds' occurred
I am attaching the file as well for reference. Thank you so much.

Regards,
Mohith

26th_wave_sref.vspscript
Message has been deleted

Mohith r

unread,
Jul 27, 2022, 7:17:23 AM7/27/22
to OpenVSP
May I request you to let me know,
If there is any default sref value which is taken by the wave drag solver as we are not able to script the command as an input? So that I can take that value and multiply with that value and divide by the original sref to get the actual CDw. 
Or is there any method to input the Sref in the script to directly get the Cdw value?
Thank you so much.

Regards,
Mohith

Jose De La Pena

unread,
Mar 13, 2023, 4:10:15 PM3/13/23
to OpenVSP

Hello, I am running into a similar issue with this through the Python API! I have tried the above mentioned solutions by Rob, and I am running into the same issues as Mohith mentioned. Is there a fix for this or does anyone know of a way around the issue? 

Best,

Jose De La Pena 

Brandon Litherland

unread,
Mar 13, 2023, 4:43:19 PM3/13/23
to OpenVSP
Rob has mentioned in other posts that you are able to adjust the default values of an analysis such as VSPAERO by saving the vsp3 model with the values as desired.  You could set the Sref in the model, save, and then run a sweep of Mach numbers.  Or you could try setting the value with SetParmVal() using the WaveDragSettings container, Sref parm, and WaveDrag group.  If you can't directly obtain the container for the wave drag settings try the snippet of code below written in AngelScript.  

void main()
{
    string wds_id = FindContainer( "WaveDragSettings", 0);
    SetParmVal(wds_id, "Sref", "WaveDrag", 100.0);
          Update();
}

Reply all
Reply to author
Forward
0 new messages