I'd like to create a surface triangular mesh of a non-manifold geometry and pass to the exodus file the information that describes for each triangle that lies on an interface of volumes, to which volume of the interface does it point to. What is the best strategy to do this task?

What I've tried to do so far is: after creating the geometry and merging all the surfaces, then I scan each pair of volumes and create the corresponding groups (Let's say that we have 5 volumes. The command: group 5 add surface in volume 1 except surface in volume 2 3 4 with is_merged. This command will add to group 5 the surfaces that lie on the boundary of volumes 1 and 5). Consequently, I define the orientation of the group (for example: surface in group 5 normal volume 1) and eventually I create a block for each group. Therefore I can finally write to the exodus file as an attribute the two volumes that each mesh triangle lies on the interface of as well as its orientation.

So just to clarify, you would like:1. Each surface that is shared between volumes to be its own block.2. Each block needs to also have a attribute indicating which volume the elements in the block reference in a forward sense? (element normals and surface normals point in the same direction)

The attached script should do what you need. You may want sidesets in addition to blocks. Sidesets reference the 'sides' of elements and in the case of surfaces on two volumes, you have the options of using the 'wrt' option: