# How can I extract a surface from the inside of a tetrahedral mesh with global connectivity?

**URL:** https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632
**Category:** ParaView Support
**Tags:** vtk
**Created:** [October 29, 2022, 8:32pm UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632 "2022-10-29T20:32:50Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Gening\_Dong](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gening_dong/32/10295_2.png) [@Gening\_Dong](https://discourse.paraview.org/u/Gening_Dong)
#### Post date: [October 29, 2022, 8:32pm UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/1 "2022-10-29T20:32:50Z")

</div>

Hi,

I have a tetrahedral mesh for CFD simulation. I want to add a boundary condition inside the geometry (eg. add a boundary condition in the valve region of a cardiac outflow tract). I used `Select Cell Through` and then `Extract Selection` then `Extract Surface` and saved it as a `vtkPolyData` file. However, when I checked the connectivity in the file, I found that the node(/element?) ID in the connectivity has changed, so the simulation cannot find the global element number. How can I extract the surface with the original global connectivity?  
See the screenshots below for more information.

 ![Screenshot 2022-10-29 162853](https://discourse.paraview.org/uploads/default/original/2X/5/5a11fdb27de43f5d6bfc6d97bdfe5b03309d4765.jpeg)  
 ![Screenshot 2022-10-29 162915](https://discourse.paraview.org/uploads/default/original/2X/f/f05e12beb426b72215bca327da1503eab18fcc82.jpeg)

I think this should be the connectivity and the three numbers in each column correspond to the global node ID for each node in a triangular element? But I don’t think the node ID is the original node ID since the extracted surface shouldn’t contain the first node (node ID 0).

 ![Screenshot 2022-10-29 163001](https://discourse.paraview.org/uploads/default/original/2X/8/8c751af33b005d5bf39bd329090007d8bc9f0cc6.jpeg)

Best,  
Gening

---

<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 31, 2022, 1:31am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/2 "2022-10-31T01:31:46Z")

</div>

Hi @Gening_Dong

You may want ot generate ids first using GenerateGlobalIds filter.

Best,

---

<div class="post-metadata">

### Author: ![Gening\_Dong](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gening_dong/32/10295_2.png) [@Gening\_Dong](https://discourse.paraview.org/u/Gening_Dong)
#### Post date: [October 31, 2022, 5:36pm UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/3 "2022-10-31T17:36:29Z")

</div>

Hi @mwestphal

Thanks for the suggestion. However it may not help. I used `Generate ID` first, then `Extract Selection` and then `Extract Surface` but I got nearly the same result.  
What else can I do?

Thanks,  
Gening  
 ![Screenshot 2022-10-31 133550](https://discourse.paraview.org/uploads/default/original/2X/3/3a3ef7bdf00442a4fdc8981202f26af00c59ccbb.jpeg)

---

<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: [November 1, 2022, 1:24am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/4 "2022-11-01T01:24:00Z")

</div>

Please share your dataset.

---

<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: [November 1, 2022, 11:54pm UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/6 "2022-11-01T23:54:34Z")

</div>

The extracted surface does contains the Original cell ids as cell data, so I dont see the issue there.

---

<div class="post-metadata">

### Author: ![Gening\_Dong](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gening_dong/32/10295_2.png) [@Gening\_Dong](https://discourse.paraview.org/u/Gening_Dong)
#### Post date: [November 2, 2022, 12:14am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/7 "2022-11-02T00:14:59Z")

</div>

Hi @mwestphal, thanks for the reply!  
The extracted surface indeed contains the original cell/node IDs. However, what I’m confused about is that under the Polygons section, it doesn’t contain the original node IDs. My understanding of this POLYGONS section should be the connectivity array, so n1, n2, … ,nn are the number of nodes for each element, followed by i11, i12, i1n1, which are the global node IDs for each node in the triangular element. Did I get it wrong?

POLYGONS nPolygons size  
n1 i11 i12 … i1n1  
n2 i21 i22 … i2n2  
…  
nn in1 in2 … innn

---

<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: [November 2, 2022, 12:16am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/8 "2022-11-02T00:16:49Z")

</div>

If you mean the polygon section in the written out .vtk file, then of course, the id are the new ones, thats just how VTK works, the id of the point and cells are related to that specific dataset.

But if you need to do some post processing related to the old IDs, you can access them as they are present as cell data.

What are you trying to do ?

---

<div class="post-metadata">

### Author: ![Gening\_Dong](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gening_dong/32/10295_2.png) [@Gening\_Dong](https://discourse.paraview.org/u/Gening_Dong)
#### Post date: [November 2, 2022, 12:28am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/9 "2022-11-02T00:28:36Z")

</div>

Thanks for the clarification. I totally mistook it.  
I’m trying to define the extracted surface as a “midplane” similar to an inlet/outlet face and apply specific boundary conditions to it. So I have to make sure the new dataset is related to the old IDs so that the solver can recognize them.

---

<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: [November 2, 2022, 12:32am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/10 "2022-11-02T00:32:57Z")

</div>

You have to tell your solver to use the cell data then.

---

<div class="post-metadata">

### Author: ![Gening\_Dong](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gening_dong/32/10295_2.png) [@Gening\_Dong](https://discourse.paraview.org/u/Gening_Dong)
#### Post date: [November 2, 2022, 12:43am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/11 "2022-11-02T00:43:52Z")

</div>

Thank you for the suggestion!  
Just a little more clarification. For example, the dataset is shown as following. So the first cell in the dataset has an old cell ID 34, and the three nodes in that cell has an old node ID 12, 45, 89, respectively. Am I understanding it correctly?

POLYGONS nPolygons size  
3 0 1 3  
3 2 1 4

CELL\_DATA nCells  
SCALARS float 1  
LOOKUP\_TABLE default  
34 25

POINT\_DATA nPoints  
SCALARS float 1  
LOOKUP\_TABLE default  
12 45 67 89 94

---

<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: [November 2, 2022, 12:45am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/12 "2022-11-02T00:45:07Z")

</div>

> Am I understanding it correctly?

Exactly.

---

<div class="post-metadata">

### Author: ![Gening\_Dong](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gening_dong/32/10295_2.png) [@Gening\_Dong](https://discourse.paraview.org/u/Gening_Dong)
#### Post date: [November 2, 2022, 12:46am UTC](https://discourse.paraview.org/t/how-can-i-extract-a-surface-from-the-inside-of-a-tetrahedral-mesh-with-global-connectivity/10632/13 "2022-11-02T00:46:54Z")

</div>

I get it now. Thanks so much for the help!
