Piecewise grids /1


Some new feature work on xSDF over the Easter long weekend.

I haven’t written anything about this project yet, but it is basically a signed distance function (SDF) generator, written in PyTorch for GPU acceleration. I wrote this a while back when I was trying to get custom geometries into JAXFLUIDS (something else I haven’t written about), which requires the geometry to be converted to an SDF for the solver’s levelset. I didn’t like what I could find for this conversion, and trimesh (python) was super slow, so I just wrote one.

Anyway, the point of this note is about supporting piecewise grids in xSDF. It can functionally create non-uniform grids already, but these are simple stretched grids starting from a specified center point and then stretched outward into the domain defined only by a min. grid spacing $x_{\min}$ and at a constant spacing ratio ($r_{max}$). Using the Ahmed body test case .stl file I pulled from the Ahmed dataset on huggingface, the current stretching mode is a bit lacking…

bl

At ˜230k cells and 5% stretching, the finest resolution (an smallest grid spacing) is only around the specified center-point, which means most of the highest resolution will be inside the body as the rest of the geometry immediately begins to inherit lower resolution as we propigate outward to the boundaries.

Support for piecewise will be a much better grid for a cartesian grid solver. I can have a fine and uniform grid close to the body and obtain a nice resolution of the geometry, then stretch the rest of the grid far-field to save some cell count (which was the original intension of implementing non-uniform grids in xSDF in the first place).

feature work on published branch, will PR merge later when validated