Extracting surfacedata (name) from a Fluent-simulation via UDFs
I am currently trying to export Result-Surfaces (1x iso-surface and 1x iso-clip-surface) at the end of my fluent simulation as stl-data.
For this, I have set up the simulation via the GUI and created the Surface definition with a constant name (in my case, e.g. phase volumefraction >0.5 generates a iso-surface).
To get the Surface object (defined in cxiface.h) the following line of code may be used:
Surface *s = &(SurfaceList[sid]);
where "sid" denotes the ID of the surface manually gathered from Domain->Surface->Manage ->(click on surface of interest and read out ID on the lower right of the popup-window).
Since the Surface struct has access to all the nodes and faces of the Result-Surface, I could then loop over them and generate an acsii .stl file.
Now two problems arise.
Problem Nr.1: I need to be able to find out which "sid" is corresponding to my iso-surface/iso-clip-surface. Earlier in the setup, I gave both surfaces a descriptive name like "my-isosurface".
Sadly, the Surface struct does not contain a field for the surface name, so I would not know how to be sure, that I have the correct ID for my surface.
Problem Nr.2: Inside the Domain->Surface->Manage Popup-Window the surfaces only seem to get a valid number of facets, after thy have been displayed once in the Viewer. For this reason, I am unsure if Fluent must be started in GUI mode in order for be to be able to iterate over the surfaces facets.
Addendum to Problem 1: Seemingly the Fluent TUI-commands
(cxgetvar 'surfaces/groups) and
return a string with most of the needed information, but I am not sure how i would call a tui command from an UDF or if there is a predefined c-macro for reading out the surface name field.
I will attach a test.c udf macro.