# Gridap.jl: Add tags to faces of 3D models

**URL:** https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526
**Category:** General Usage
**Tags:** gridap
**Created:** [July 6, 2025, 9:17pm UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526 "2025-07-06T21:17:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Van\_Sy\_Tnut](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/van_sy_tnut/32/217602_2.png) [@Van\_Sy\_Tnut](https://discourse.julialang.org/u/Van_Sy_Tnut)
#### Post date: [July 6, 2025, 9:17pm UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526/1 "2025-07-06T21:17:24Z")

</div>

Hello everyone,  
I am new to Gridap.jl. I am creating a 3D model of a cantilever beam to apply a distributed load on the right face, and the left face is fixed.  
Do you know how to add tags to LEFT and RIGHT faces ?  
Here is my code:

```julia
using Gridap

L = 1 # Length of 3D cantilever beam
W = 0.2 # Width of 3D cantilever beam

domain = (0,L,0,W,0,W)
partition = (20,6,6)
model = CartesianDiscreteModel(domain,partition) # Mesh
writevtk(model,"model_3D")

add_tag_from_tags!(labels,"left",....) # How to add tag to LEFT face ?
add_tag_from_tags!(labels,"right",....) # How to add tag to RIGHT face ?

Ω = Triangulation(model)
Γ = Boundary(Ω,tags="right") # I want to a load on this face
reffe = ReferenceFE(lagrangian,Float64,1)
Vₕ = TestFESpace(Ω,reffe,dirichlet_tags="left") # This face is fixed

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/9/b9850c94921955442e11e78243ce8f467a3a7270.jpeg)

Thank you so much!

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [July 7, 2025, 12:06am UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526/2 "2025-07-07T00:06:48Z")

</div>

> [@Van\_Sy\_Tnut](#):
>
> Do you know how to add tags to LEFT and RIGHT faces ?

We’ve usually used Gmsh to generate meshes for Gridap, and Gmsh is pretty flexible in allowing you to tag different features.

---

<div class="post-metadata">

### Author: ![marteaua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marteaua/32/214927_2.png) [@marteaua](https://discourse.julialang.org/u/marteaua)
#### Post date: [July 7, 2025, 12:21am UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526/3 "2025-07-07T00:21:38Z")

</div>

You can visualize the entity to which tags are affected in the cartesian discrete model in Paraview:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/0/a05f063833624cfa10faa833ab12f2f3c94b21d4.png)

---

<div class="post-metadata">

### Author: ![Van\_Sy\_Tnut](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/van_sy_tnut/32/217602_2.png) [@Van\_Sy\_Tnut](https://discourse.julialang.org/u/Van_Sy_Tnut)
#### Post date: [July 7, 2025, 1:26pm UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526/5 "2025-07-07T13:26:23Z")

</div>

Thank you. Yes, this method will be more flexible compared to manual tagging in Paraview.

---

<div class="post-metadata">

### Author: ![Van\_Sy\_Tnut](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/van_sy_tnut/32/217602_2.png) [@Van\_Sy\_Tnut](https://discourse.julialang.org/u/Van_Sy_Tnut)
#### Post date: [July 7, 2025, 1:27pm UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526/6 "2025-07-07T13:27:28Z")

</div>

Thank you!  
Following your suggestion and this post: [Add tags to faces of 3D models using CartesianDiscreteModel() · gridap/Gridap.jl · Discussion #1127 · GitHub](https://github.com/gridap/Gridap.jl/discussions/1127)  
I found the solution. We need to include 09 tags for each side.  
Here is my final code and the result.

```julia
using Gridap
L = 1.0 # Length
W = 0.2 # Width
domain = (0,L, 0,W, 0,W)
partition = (40,12,12)
model = CartesianDiscreteModel(domain, partition)
labels = get_face_labeling(model)
# Tag the left face (x = 0)
add_tag_from_tags!(labels,"left",[1,3,5,7,13,15,17,19,25]) # left face: corners (1,3,5,7); edges (13,15,17,19); others (25)

# Tag the right face (x = L)
add_tag_from_tags!(labels, "right", [2,4,6,8,14,16,18,20,26]) # Right face: corners (2,4,6,8); edges (14,16,18,20); others (26)

writevtk(model,"3D_Problem")

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/d/1d0b906db1224355d81b7de8188b0b2955a6a59f.jpeg)  
Best regards,

---

<div class="post-metadata">

### Author: ![tam724](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@tam724](https://discourse.julialang.org/u/tam724)
#### Post date: [July 7, 2025, 6:05pm UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526/7 "2025-07-07T18:05:30Z")

</div>

At some point I was also looking for the default tags in `CartesianDiscreteModel`. Now I regularly go back to this txt file:

```julia

        3 --- 10 --- 4
     19 | 20 |
   / 13 / 14
 7 --- 12 --- 8 |
 | | | |
15 1 ----| 9 -- 2
 | 17 16 18 ^ y+
 | / | / |
 5 --- 11 --- 6 | x+
                                   / ------>
                                  /
        3 ---------- 4 v z+
      / | / |          
   / | 24 / | <-- 21 (back)
 7 ---------- 8 |
 | | | 26 |
 | 25 1 ----|----- 2
 | / 22 | /
 | / | /
 5 ---------- 6

       ^
       |
      23 (bottom)

```

(I think this is not documented in Gridap.jl)

---

<div class="post-metadata">

### Author: ![Van\_Sy\_Tnut](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/van_sy_tnut/32/217602_2.png) [@Van\_Sy\_Tnut](https://discourse.julialang.org/u/Van_Sy_Tnut)
#### Post date: [July 7, 2025, 6:48pm UTC](https://discourse.julialang.org/t/gridap-jl-add-tags-to-faces-of-3d-models/130526/8 "2025-07-07T18:48:38Z")

</div>

Thanks for sharing. It makes more sense to me now to understand the way Gridap numbers the tags.
