sparta / sparta

Public development project of the SPARTA DSMC software package http://sparta.github.io
GNU General Public License v2.0
151 stars 83 forks source link

Implicit Surfaces written to a surface file using "write_surf" cannot be read back into SPARTA using "read_surf" #525

Open mgosma opened 1 week ago

mgosma commented 1 week ago

Summary

Explicit surface geometry files generated from implicit surfaces via the "write_surf" command cannot be read back into SPARTA as-is using the "read_surf" command due to non-sequential surf_id values.

Type of Issue

Bug Report

SPARTA Version (Bug Report)

4Sep2024

Expected Behavior (Bug Report)

From the manual for the write_surf command: "Write a surface file in text format describing the currently defined surface elements, whether they be explicit or implicit surfaces. See the read_surf and read_isurf commands for a definition of surface elements and how they are defined and used by SPARTA. The surface file can be used for later input to a new simulation or for post-processing and visualization."

Actual Behavior (Bug Report)

When the write_surf command is called, the code currently writes out the stored surf_id as the index for a surface triangle (or assumably the surface line segment in 2D) in the generated explicit surface file. However, for implicit surfaces, these surf_ids do not appear to be assigned sequentially, or with an initial value of 1, as expected by the "read_surf" command, resulting in an error. Manually changing the triangle IDs in the surface file to begin with a value of 1 and increase sequentially to n = # of total triangles causes the geometry to load correctly.

Steps to Reproduce (Bug Report)

Place the modified in.ablate.3D input file in the "ablate" example directory and run it to generate a surface file. Running explicit_read.txt should then return the following error: "ERROR: Read_surf minimum surface ID is 1101 (../read_surf.cpp:1999)". Tested with both spa_serial and spa_mpi.

Further Information, Files, and Links

explicit_read.txt in.ablate.3d.txt

mgosma commented 1 week ago

Unrelatedly, I also experience errors with cut3D if I change the cell grid from that of the original implicit simulation, but that is probably unavoidable given the complexity of the geometry (similar to this: https://github.com/sparta/sparta/issues/370).