Some problems in using openvsp

118 views
Skip to first unread message

Yifan Fu (be happy)

unread,
Apr 7, 2023, 10:35:08 AM4/7/23
to OpenVSP
hey,
I have recently been using OpenVSP software to implement an optimized aerodynamic shape design for a small propeller. But when I write python code to call OpenVSP to complete the propeller calculation, I encountered some problems. The code runs with errors and the control window shows that I may be missing some corresponding files. I would like to ask how to solve this problem?
My code is as follows

test.py
error.PNG

Rob McDonald

unread,
Apr 7, 2023, 2:36:31 PM4/7/23
to OpenVSP
The red messages are from OpenVSP -- they're telling you that it can't load the output files from VSPAERO because they don't exist.

The grey message is from VSPAERO -- it is telling you that it can't find the input files to read in before running.

Rob

Yifan Fu (be happy)

unread,
Apr 7, 2023, 10:31:26 PM4/7/23
to OpenVSP
Yes I think so too. So I can't run this code under a new empty file? Or am I missing some command  that would generate these files?
(PS:I copied the corresponding file from another folder to the new one, and when I ran the code, it was deleted and then the above error continued)

Tim Swait

unread,
Apr 8, 2023, 5:56:43 AM4/8/23
to OpenVSP
I'm not very familiar with this, but I think you might need to somehow create a OpenVSP file to be working with, or to open one that already exists. I found it easier to create a design in the GUI that was roughly along the lines of what I wanted and then to use the Python API to identify and modify the parms as required. The below code works for me if it doesn't for you (if you create a file with a simple wing, body and tail in it and point it at the right path, also run an analysis with VSPAERO through the GUI just to make sure it solves) then maybe it's an installation issue with VSPAERO. I'm not completely clear on how this API is actually working, but all the degen geom files etc all get dumped in the folder that the original file that's read in is based, so I think it's important that you have that original file.

path = '/home/timbo/AMRC/MACH_UAV/analysis/APItest/'
fname = 'apitest.vsp3'
vsp.VSPRenew()
errorMgr.PopErrorAndPrint(stdout)
vsp.ReadVSPFile((path+fname))
geoms = vsp.FindGeoms()
print("All geoms in Vehicle.")
print(geoms)

def analyseVLM(AoAStart, AoAEnd,AlphaNpts):
    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 )
    analysis_name = "VSPAEROSweep"
    vsp.SetAnalysisInputDefaults(analysis_name)
    vsp.SetDoubleAnalysisInput(analysis_name, "AlphaStart", (AoAStart,), 0)
    vsp.SetDoubleAnalysisInput(analysis_name, "AlphaEnd", (AoAEnd,), 0)
    vsp.SetIntAnalysisInput(analysis_name, "AlphaNpts", (AlphaNpts,), 0)
    vsp.Update()
    vsp.DeleteAllResults()
    res_id = vsp.ExecAnalysis(analysis_name)
    return res_id

Yifan Fu (be happy)

unread,
Apr 8, 2023, 10:55:25 AM4/8/23
to OpenVSP
Thank you for your advice.
I have tried to copy files from other folders to the current folder, but when running the code, I found that the files were automatically deleted (they are only deleted if the code is run in a specific folder). Then I tried to run my code in this specific folder, but my settings worked for the .vsp3 file, but not for the final result (which is completely different from the pull result of the .vsp3 file generated by running the code in the gui interface)
Reply all
Reply to author
Forward
0 new messages