# GridapGmsh error loading .msh file when line and surface elements are used

**URL:** <https://discourse.julialang.org/t/gridapgmsh-error-loading-msh-file-when-line-and-surface-elements-are-used/93922>\
**Category:** General Usage\
**Tags:** gridap, gmsh\
**Created:** [February 2, 2023, 12:44pm UTC](https://discourse.julialang.org/t/gridapgmsh-error-loading-msh-file-when-line-and-surface-elements-are-used/93922 "2023-02-02T12:44:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jav/32/46548_2.png) [@jav](https://discourse.julialang.org/u/jav)\
**Post date:** [February 2, 2023, 12:44pm UTC](https://discourse.julialang.org/t/gridapgmsh-error-loading-msh-file-when-line-and-surface-elements-are-used/93922/1 "2023-02-02T12:44:09Z")

</div>

Hello all,

for a task, one model contains shells (surface elements) and beams (line elements). The goal was to get a simple working model. Please see the picture:

 ![GridapGmsh](https://global.discourse-cdn.com/julialang/original/3X/b/4/b41352d73bca701b50c58f2b03c348e5f549d321.png)

If this is loaded with GridapGmsh an error message occurs - does anyone know how to use Gridap with two different dimensional entities, i.e. line and surface elements?

```julia
using Gridap
using GridapGmsh

model = GmshDiscreteModel("test.msh")

```

error message:  
Info : Reading ‘Code/Meshes/Data/0\_MSH/beam\_7.msh’…  
Info : 13 entities  
Info : 422 nodes  
Info : 814 elements  
Info : Done reading ‘Code/Meshes/Data/0\_MSH/beam\_7.msh’  
ERROR: BoundsError: attempt to access 1129-element Vector{Int64} at index [0]  
Stacktrace:  
[1] setindex!  
@ ./array.jl:966 [inlined]  
[2] setindex!  
@ ./multidimensional.jl:674 [inlined]  
[3] \_apply\_offset\_for\_faces!(face\_to\_label::Vector{Int64}, gface\_to\_entity::Vector{Int64}, gface\_to\_face::Vector{Int32}, offset::Int64)  
@ GridapGmsh ~/.julia/packages/GridapGmsh/Q8ZwW/src/GmshDiscreteModels.jl:604  
[4] \_fill\_dim\_to\_face\_to\_label!(node\_to\_vertex::UnitRange{Int64}, dim\_to\_face\_to\_label::Vector{Vector{Int64}}, grid\_topology::Gridap.Geometry.UnstructuredGridTopology{2, 3, Float64, Gridap.Geometry.NonOriented}, dim\_to\_gface\_to\_nodes::Vector{Any}, dim\_gface\_to\_entity::Vector{Any}, dim\_to\_offset::Vector{Int64})  
@ GridapGmsh ~/.julia/packages/GridapGmsh/Q8ZwW/src/GmshDiscreteModels.jl:576  
[5] \_setup\_face\_labels(vertex\_to\_node::UnitRange{Int64}, node\_to\_vertex::UnitRange{Int64}, grid\_topology::Gridap.Geometry.UnstructuredGridTopology{2, 3, Float64, Gridap.Geometry.NonOriented}, dim\_to\_gface\_to\_nodes::Vector{Any}, dim\_gface\_to\_entity::Vector{Any}, dim\_to\_offset::Vector{Int64}, dim\_to\_group\_to\_entities::Vector{Vector{Vector{Int64}}}, dim\_to\_group\_to\_name::Vector{Vector{String}}, node\_to\_label::Vector{Int64})  
@ GridapGmsh ~/.julia/packages/GridapGmsh/Q8ZwW/src/GmshDiscreteModels.jl:531  
[6] \_setup\_labeling(gmsh::Module, grid::Gridap.Geometry.UnstructuredGrid{2, 3, Float64, Gridap.Geometry.NonOriented, Gridap.Arrays.LazyArray{FillArrays.Fill{typeof(Gridap.Fields.constant\_field), 1, Tuple{Base.OneTo{Int64}}}, Gridap.Fields.ConstantField{VectorValue{3, Float64}}, 1, Tuple{Vector{VectorValue{3, Float64}}}}}, grid\_topology::Gridap.Geometry.UnstructuredGridTopology{2, 3, Float64, Gridap.Geometry.NonOriented}, cell\_to\_entity::Vector{Int64}, vertex\_to\_node::UnitRange{Int64}, node\_to\_vertex::UnitRange{Int64})  
@ GridapGmsh ~/.julia/packages/GridapGmsh/Q8ZwW/src/GmshDiscreteModels.jl:414  
[7] GmshDiscreteModel(mshfile::String; renumber::Bool)  
@ GridapGmsh ~/.julia/packages/GridapGmsh/Q8ZwW/src/GmshDiscreteModels.jl:24  
[8] GmshDiscreteModel(mshfile::String)  
@ GridapGmsh ~/.julia/packages/GridapGmsh/Q8ZwW/src/GmshDiscreteModels.jl:6  
[9] top-level scope  
@ ~/Schreibtisch/Javed/1\_Projekte/1\_K2H2/6\_Tasks/1\_FEM/6\_Meshing/2\_Meshes\_Jl/Code/First\_Steps/Gm\_1st.jl:
