Feature: combining surfaces in a single file
Functionality to add/problem to solve
When using CFMesh all the surface regions should be specified in a single surface file. For ascii stl files, it is relatively easy to combine the files using the linux command ‘sed’. However, for binary stl files this is not possible. Secondly, it is not possible to add different file types. OpenFOAM comes with the surfaceAdd utility. However, it is cumbersome to add multiple surfaces and secondly the naming of the regions (patches) in the outputfile cannot be easily used for meshing. Therefore I would like to add the included surfaceListAdd utility. This is an extension to surfaceAdd, which allows for adding multiple surfaces and use the file names instead of generic patch names, when no region name is provided
Target audience
This is targeted at users who use CFMesh and have multiple surface files they want to use in meshing. Or SHM users who want to clean up their number of files.
Provided code
The code provided is an extension of the surfaceAdd script. It reads a list of surface files, loops over them and combines the points and tris. It renames the regions to the file name (with an index) if no region was given in the original surface file. Some CAD packages give a generic region name to the surface file, such as 'solid' or 'OpenSCAD_model'. To exclude these names a list of ignored region names can be added as an option. A last step is checking on possible duplicate regions in the output file and renaming these to a 'fileName.regionName' format. This ensures there are no duplicate regions in the output file.
Would it be possible to include this utility in OpenFOAM?
test case
I've included a few files for testing the script and a test.sh file for running the tests.surfaceListAdd.zip