Changing analysis inputs through API

60 views
Skip to first unread message

MC

unread,
Jun 23, 2025, 5:25:42 PMJun 23
to OpenVSP
Hi,

I am learning to use the API (python in this case) and I want to make sure I understand correctly the behavior of setting the inputs for an analysis.

If I load a file using the GUI and open the VSPAERO GUI, I get the variables set to the values they have in the file. So far so good.

If I load a file using the API and check for the input values of an analysis with PrintAnalysisInputs, I see some preset values that do not correspond to the values in the file. If I, however, run SetAnalysisInputDefaults and then PrintAnalysisInputs, it seems like the values of the file are loaded, not some default/preset values.

The workflow for loading a file and changing some inputs would then be ReadVSPFile -> SetAnalysisInputDefaults -> SetXXAnalysisInput. Can you confirm that I'm understanding the behavior correctly?

Also, if I do some SetXXAnalysisInput and then WriteVSPFile, the analysis input values are not written into the file, correct? It would then be safe to write the file, without altering the analysis input values in it.

Regards,
Mikel

Rob McDonald

unread,
Jun 24, 2025, 10:50:16 AMJun 24
to OpenVSP
It sounds like you have it.

When VSP loads, it will run SetAnalysisInputDefaults automatically -- but since no model is loaded, it just loads the default defaults...

Then you load a *.vsp3 model.

If you want to get the analysis settings from the model, you use SetAnalysisInputDefaults.

Then you SetXXAnalysisInput to adjust whatever settings you like.

The changes made via SetXXAnalysisInput will not change the state of the model and will not get written to file with WriteVSPFile.

If you want to change the settings as stored in the model, most of them are Parms and you can change their values via SetParmVal.  You'll want to SetParmVal before SetAnalysisInputDefaults of course.  If you save after SetParmVal, you'll store those changed settings to the *.vsp3 file.

Rob

MC

unread,
Jun 25, 2025, 6:31:24 AMJun 25
to OpenVSP
Great, thanks for the clarification. It really helps me build robust scripts for analyses.

And thanks for making OpenVSP/VSPAERO available, and the great Ground School and the available examples. I have learned quite a bit so far but I will come back with more questions for sure.

Cheers

2025(e)ko ekainaren 24(a), asteartea (16:50:16 (UTC+2)); Rob McDonald erabiltzaileak hau idatzi zuen:
Reply all
Reply to author
Forward
0 new messages