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

**URL:** https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119
**Category:** ParaView Support
**Created:** [October 3, 2021, 7:07pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119 "2021-10-03T19:07:50Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [October 3, 2021, 7:07pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/1 "2021-10-03T19:07:50Z")

</div>

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:

> [@Viewing boundary patch in CGNS files](https://discourse.paraview.org/t/viewing-boundary-patch-in-cgns-files/7732):
>
> Hello, I have a CGNS file divided into 200 zones. Some of these zones have additional boundary patches, including possibly an “AIRFOIL” boundary patch. I only want to display the airfoil. In Ensight, this is easy. I load my file, I hide all parts, then search AIRFOIL parts only, select, and show. In Paraview, I load up my file, and look at properties. “Hierarchy”, “Grids”, and “Patches” only have the 200 zones listed. The Multiblock Inspector lets me see which zones have patches, but not what…

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).

> **[GitHub - MicK7/CGNSReader\_ParaView\_Plugin: small ParaView plugin to read cgns...](https://github.com/MicK7/CGNSReader_ParaView_Plugin)**
>
> small ParaView plugin to read cgns files. Contribute to MicK7/CGNSReader\_ParaView\_Plugin development by creating an account on GitHub.

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:  
[https://cgns.github.io/CGNSFiles.html](https://cgns.github.io/CGNSFiles.html)

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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 4, 2021, 9:06am UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/2 "2021-10-04T09:06:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [October 9, 2021, 4:33pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/3 "2021-10-09T16:33:48Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 11, 2021, 7:41am UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/4 "2021-10-11T07:41:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [October 11, 2021, 9:28am UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/5 "2021-10-11T09:28:08Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 11, 2021, 10:14am UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/6 "2021-10-11T10:14:02Z")

</div>

Any multiblock based format support that, including cgns.

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [October 11, 2021, 10:16am UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/7 "2021-10-11T10:16:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 11, 2021, 12:17pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/8 "2021-10-11T12:17:34Z")

</div>

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:  
[https://send.kitware.io/download.php?id=97&token=L9p7Ht81z99m42Bx1p8Jp5k4YlQ1PWic](https://send.kitware.io/download.php?id=97&token=L9p7Ht81z99m42Bx1p8Jp5k4YlQ1PWic)

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [October 11, 2021, 2:33pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/9 "2021-10-11T14:33:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![MicK7](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mick7/32/1374_2.png) [@MicK7](https://discourse.paraview.org/u/MicK7)
#### Post date: [February 10, 2022, 8:05pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/10 "2022-02-10T20:05:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [February 11, 2022, 5:50pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/11 "2022-02-11T17:50:43Z")

</div>

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:  
[https://cgns.github.io/CGNSFiles.html](https://cgns.github.io/CGNSFiles.html)  
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.

---

<div class="post-metadata">

### Author: ![MicK7](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mick7/32/1374_2.png) [@MicK7](https://discourse.paraview.org/u/MicK7)
#### Post date: [February 11, 2022, 6:26pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/12 "2022-02-11T18:26:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [February 11, 2022, 6:40pm UTC](https://discourse.paraview.org/t/cgns-is-it-possible-to-load-boundary-patches-from-a-cgns-file/8119/13 "2022-02-11T18:40:03Z")

</div>

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!
