Issue with CFD Mesh using Python API

129 views
Skip to first unread message

Tim MacDonald

unread,
Nov 26, 2016, 8:33:58 PM11/26/16
to OpenVSP

I'm having a problem with the API CFD Mesh feature. I am constructing a vehicle and setting CFD Mesh values through the Python API. When I run vsp.ComputeCFDMesh, it computes for a while, then gives a seg fault ("Segmentation fault (core dumped)"). However, if I save the vehicle with vsp.WriteVSPFile after setting the various CFD values and open in the VSP GUI, then run the meshing tool, it completes successfully. I'm able to compute a mesh through the API with other settings, so this doesn't seem to be an issue with how I'm calling the meshing routine in general. Any idea what might be causing the seg fault?

Rob McDonald

unread,
Nov 27, 2016, 3:47:04 PM11/27/16
to ope...@googlegroups.com
Tim,

Hard to say -- but my first guess would be that you haven't called
Update() since you finished setting parameters.

When building/changing a geometry from the API, we don't automatically
update the model (doing so after every parameter change would be
slow). Instead, you must call Update() manually before you do
something like CFDMesh.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "OpenVSP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to openvsp+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Tim MacDonald

unread,
Nov 27, 2016, 9:07:15 PM11/27/16
to OpenVSP
I tried adding Update() just before the CFD call but the issue is still there. Do you have any others ideas on where I could look to debug this?

Rob McDonald

unread,
Nov 28, 2016, 10:40:32 AM11/28/16
to ope...@googlegroups.com
Write out the file from the script (you've done this).

Then, write another short script to read in that file and generate the CFDMesh.

These processes should be identical (GUI vs. script) but perhaps it
will make something show.

Can you tell how far it gets in the meshing process? How far before it crashes?

Rob

Tim MacDonald

unread,
Nov 28, 2016, 3:08:25 PM11/28/16
to OpenVSP
Here's the code I'm using:

import vsp

vsp
.ReadVSPFile('mesh_test_vehicle.vsp3')

file_type
= vsp.CFD_STL_TYPE + vsp.CFD_KEY_TYPE
set_int  
= vsp.SET_ALL

vsp
.ComputeCFDMesh(set_int,file_type)


The Tagged STL flag is set as well.

I can't tell exactly how far, but I believe it gets near completion because of how long it takes. Is there a way to output the information that shows up in the GUI?

Rob McDonald

unread,
Nov 28, 2016, 3:49:59 PM11/28/16
to ope...@googlegroups.com
From a visual inspection, that should work.

Could you try it with a very simple geometry -- say nothing but a default pod?

You are correct, CFDMesh doesn't output anything to the console when
run in batch/API mode. There is no easy way to get it to dump output.

Rob

Tim MacDonald

unread,
Nov 28, 2016, 7:11:57 PM11/28/16
to OpenVSP
The pod works. I was originally able to mesh the full vehicle with slightly different parameters as well. The seg fault appeared when I was playing with the global growth ratio for the mesh. Specifically it happened when I reduced it to 1.1, but it works fine with the default value of 1.3, and with 1.15. The pod runs fine with 1.1 and a half far field mesh.

Rob McDonald

unread,
Nov 29, 2016, 1:24:32 AM11/29/16
to ope...@googlegroups.com
Ahh, that is really interesting.

Does 1.1 work with that geometry from the GUI?

Usually, the problems in CFDMesh are tied to the details of the
geometry and the intersect step. Changing any of the mesh resolution
parameters doesn't change that. So, the 'hard' part is working for
you.

1.1 will cause a fine mesh to be _really_ fine. It could be an out of
memory issue. Are you on Windows, Mac, or Linux? How big is the mesh
if you run at 1.15? Can you watch the memory usage as it runs?

If you can share the file, I may be able to trace the crash.

Rob
Reply all
Reply to author
Forward
0 new messages