(CGNS) Is it possible to load boundary patches from a CGNS file?

Greetings to all people of this forum!

For the past few days I have been searching for a way to display flow properties on boundary patches defined in the CGNS file, unfortunately to no avail.

I found a relevant thread, but has zero responses:

I also found a plugin that was written for older ParaView versions (it lists 4.3.1 on Git log), but does not work for current versions (I am on 5.9).

I think the plugin loads correctly, since I am able to have the new “Load Boundary Elements (Unstructured Grid)” option.
However, I am not able to get the relevant info in the Multi-block inspector; inside the doc/ directory on the plugin Git repo there is a picture that shows the boundary patches loaded on Paraview. My “patches” family has 0 entries instead.

In addition, I think when multiple element sections are present, ParaView displays only the first.
Maybe this has something to do with not being able to view the relevant boundary patches?

The cgns file used in the plugin examples is an example cgns file from the cgns site:

It is the yf17 file from the unstructured examples.

I tried to read the plugin and try to find what’s wrong with it and maybe fix it, but unfortunately I am not experienced with ParaView plugins.

A last note: When a cgns file with ZoneBC info is read, I think ParaView load boundary patches since it displays warnings if an unknown BC type is read. So I think it does something with the info at least.

Is there anything I can try?

I’m afraid this is not supported by ParaView yet.

Well, it kinda sucks that this is the case…
What format would support boundary patches though?
Maybe I can write a CGNS converter to do what I want to.

boundary patches is just another geometry for ParaView, so any geometrical format would support it, eg vtu.

Well, I’m afraid I did not phrase my question correctly…

I know that ParaView can support any geometric format.
I have worked with legacy vtk, xml vtu, tec, and cgns files.
ParaView can read anything and will display things accordingly.

However, what I am looking for is having all geometric/element entities (volume mesh and surface patches) in a single file and being able to toggle them on and off.

If I want to have a separate file for each element entity, I can just use cgns_to_vtk on my cgns file and get a file for each element entity.
What I want though is having them written on a single file while having the option to focus on the entity I want (kinda like zones in tecplot).

Is there any format that can support this functionality?

Any multiblock based format support that, including cgns.

I meant a format that can support this functionality in ParaView.
CGNS supports multiblock entities but, as per your first reply in this thread, ParaView cannot display the entities.

ParaView CGNS supports reading patches, but it does not support reading the specific types of patches you are using in your file (BCFarfield and BCSymmetryPlane).

Maybe you can try using more standard type of patches ?

Here is an example file:

I tried the example file and checked it with ParaView and cgnsview.
It indeed displays boundary entities, but it is not what I’m looking for since it uses multiple bases and multiple zones for different element entities.
I was, hopefully, looking for some way to extract/use this information from a single zone and base.

The example file you sent has one 3D base and one 2D base.
The 3D base has the Volume elements (interior) while the 2D base has multiple zones, one for each Surface element entity.

I am aware this is a way to display both Surface and Volume elements, however this approach has multiple shortcomings:

  • The whole array of node coordinates is written for each and every zone, which is not optimal
  • In my case (vertex based solution) I have to either repeat the full solution on every zone or interpolate the solution on face elements or rebuild the boundary node mapping in order to not have the full array of nodes

I was aware of this approach but it is unfortunately not suited to what I want to do.

Sorry for the late reply. If you are trying to display ZoneBC of a CGNS file it should be possible without creating a separate CGNS Base.
Indeed if you are using a multiblock structured grid, toggle the small wheel and activate load patch. The ZoneBC must be define with FamilySpecied and have a FamilyName
If you are using, an unstructured grid (CGNS 4 compliant) just do the same thing as previously.
Note that if you want to store data on the ZoneBC patch you will need to use BCDataSet in your CGNS file unless you just want to extract values at vertices from the 3D solution.

Hey Michael, thanks for replying!

I was more than glad to read your answer and was eager to give it a try today.
I used the first file from the CGNS examples:
I was more than happy to find an example CGNS file with Family_t before trying to code it myself.

However, it still does not provide the functionality I’m looking for, or I’m missing something…

It can indeed display patches, they are available in the “Families” section of the CGNS file hierarchy.
They take “ispatch” values accordingly, as they should.
The “Bases” node must always be on to display them, though.
Therefore, the volume mesh is always displayed.
Thus, one cannot display only a surface patch without the volume mesh.
If you try to close the volume mesh by closing the Base node, nothing is displayed (which, given the CGNS hierarchy, makes sense).

Am I missing something?
What I’m looking for is a functionality kinda like OpenFOAM, where the user is provided with all boundaries plus the InternalMesh, and can toggle on and off.

In addition, I see that the plugin I linked to in my original post was from your repository!
So you are the creator!
Unfortunately, I haven’t been able to compile it in more recent Linux systems.
Any chance we can get it to work?
Based on your screenshots in the repo, this is exactly what I’m looking for.

Which version of ParaView are you using ?
If you are able to see the “isPatch”, I think that through the multiblock inspector you can desactivate the internal blocks to keep only patches visible. It is not very easy but it is possible.
Maybe a python script would be better to only keep the patches blocks after loading everything.

The plugin is what is running now as the official CGNS Reader of ParaView so you won’t have any differences with a modern ParaView.

You are correct, that’s the part I was missing.
I was searching for some Filter/Option that would disable Volume Elements and only show Patches, but I didn’t think about the Multiblock Inspector.
It indeed does work!

The example file from the CGNS site is kinda cumbersome because it contains many blocks, however my files are reconstructed from the parallel solution into a single block.
Therefore, enabling/disabling the volume mesh would only take a couple of clicks.

Thanks a bunch!