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

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:

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

Thank you so much!

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

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

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

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

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


Best regards,

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


        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)

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