Control mesh resolution on surface of imported STEP file - 3D mesh
Hi there,
I'm working on a CFD project and am using Gmsh for mesh generation. I have found it to be a very powerful tool and am enjoying the user experience so far. I have a question about controlling the mesh size on the surface of an imported body from a STEP file.
I am starting with a simple airplane model in CAD and exporting as a STEP, which I then read into Gmsh. I am studying the fluid volume surrounding the aircraft, so I add a Box geometry in Gmsh surrounding the aircraft and the perform a boolean subtraction between the Box and the aircraft model.
Then I begin the process of defining the mesh resolution prior to meshing. My goal is to control the mesh resolution on the aircraft surface and in the viscinity of the surface. I know there are multiple ways of defining the mesh size, using transfinite curves/surfaces, size fields, and size at given points. I am trying to reach something like this for the surface mesh:
The default aircraft surface mesh is coarser, and I'd like to have control over the resolution. Right now, I am doing this manually by specifying transfinite curves for each curve in the imported STEP file. While this has benefits of being able to refine in a progression (see the nose of the aircraft), it is very time consuming as I only need a uniform spacing the vast majority of the time. I tried implementing the transfinite surface, but it requires manual selection of the points which doesn't reduce the manual overhead.
Is there a better way to specify a mesh resolution on a given surface of the STEP file? One idea that I had, using a script, was to collect the curves in the model, find their lengths, and then automate the transfinite curve creation choosing the number of points along the curve as some coefficient times the length of the curve. However, this requires accessing the "distance" attribute of each curve from the API, which I don't believe is implemented yet (a similar question was asked here: #982 (closed)).
Lastly, it is a stretch, but is there a way to specify a distance function using the STEP geometry in order to say, control the resolution as a function of distance from the body? I know I could just apply a cylinder field surrounding the fuselage, but the former might be a more elegant approach.
Thanks!
------- Edit --------
I see at the bottom of the issue that I linked above, the distance output was implemented in commit 068b129a. Is this indeed the full length of the line, or is it the pythagorean distance between the two endpoints (different for non-linear curves)? If it is the former, then my proposed method of scripting the transfinite curves might work.