# GridapGmsh "GmshDiscreteModel" load error

**URL:** <https://discourse.julialang.org/t/gridapgmsh-gmshdiscretemodel-load-error/65084>\
**Category:** General Usage\
**Tags:** gridap, gmsh\
**Created:** [July 22, 2021, 4:08am UTC](https://discourse.julialang.org/t/gridapgmsh-gmshdiscretemodel-load-error/65084 "2021-07-22T04:08:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyber](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@Cyber](https://discourse.julialang.org/u/Cyber)\
**Post date:** [July 22, 2021, 4:08am UTC](https://discourse.julialang.org/t/gridapgmsh-gmshdiscretemodel-load-error/65084/1 "2021-07-22T04:08:23Z")

</div>

Hello all,

I encountered some problems when I would like to follow the Gridap tutorials to create a json file.

I have generated a msh file from Gmsh by clicking save\_mesh button in it. And I exactly copy the right path and name of the msh file. But here is a LoadError: Msh file not found. This is what I would to mesh:

 ![Original](https://global.discourse-cdn.com/julialang/original/3X/4/f/4f4e97d2be9667f13b3c5ee52b87eb44e4cf3679.png)

However, I am not certain whether the msh file is correct since it looks empty without any mesh if I open it from Gmsh directly.

 ![Msh](https://global.discourse-cdn.com/julialang/original/3X/8/4/84ead67c892b16e2f843817ea57bad12e01cfcf0.png)

Here is my code:

```julia
using Gridap
using Gridap.Io 
using GridapGmsh

model = GmshDiscreteModel("<U+202A>C:/Users/15271/Downloads/gmsh-4.8.4-Windows64/gmsh-4.8.4-Windows64/test3.msh")

fn = "model.json"
to_json_file(model,fn)

```

[Reference](https://discourse.julialang.org/t/ann-gridap-jl-a-feature-rich-finite-element-ecosystem-100-in-julia/42824/18)

And if I use

```julia
model = DiscreteModelFromFile("<U+202A>C:/Users/15271/Downloads/gmsh-4.8.4-Windows64/gmsh-4.8.4-Windows64/test3.msh")

```

There is: LoadError: This function is not yet implemented

Could any one give some suggestions?  
Thank you very much!

---

<div class="post-metadata">

**Author:** ![fverdugo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fverdugo/32/9446_2.png) [@fverdugo](https://discourse.julialang.org/u/fverdugo)\
**Post date:** [July 22, 2021, 5:55am UTC](https://discourse.julialang.org/t/gridapgmsh-gmshdiscretemodel-load-error/65084/2 "2021-07-22T05:55:51Z")

</div>

Hi @Cyber!

`DiscreteModelFromFile` only supports `json` for now, not `msh` files. Use `GmshDiscreteModel` instead.

In summary, you have two options:

```julia
DiscreteModelFromFile("model.json")

```

or

```julia
GmshDiscreteModel("model.msh")

```

this one

```julia
DiscreteModelFromFile("model.msh")

```

is not yet implemented, but introducing it should be a matter of a couple of minutes. Just add

```julia
function Gridap.DiscreteModelFromFile(filename::AbstractString,::Val{:msh})
  model = GmshDiscreteModel(filename)
  model
end

```

here [https://github.com/gridap/GridapGmsh.jl/blob/4ce1b20399be6f0baaea137f130fe046482b485e/src/GmshDiscreteModels.jl#L30](https://github.com/gridap/GridapGmsh.jl/blob/4ce1b20399be6f0baaea137f130fe046482b485e/src/GmshDiscreteModels.jl#L30)  
and a test here [https://github.com/gridap/GridapGmsh.jl/blob/4ce1b20399be6f0baaea137f130fe046482b485e/test/GmshDiscreteModelsTests.jl#L71](https://github.com/gridap/GridapGmsh.jl/blob/4ce1b20399be6f0baaea137f130fe046482b485e/test/GmshDiscreteModelsTests.jl#L71)  
and open a PR.

---

<div class="post-metadata">

**Author:** ![Cyber](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@Cyber](https://discourse.julialang.org/u/Cyber)\
**Post date:** [July 22, 2021, 6:24am UTC](https://discourse.julialang.org/t/gridapgmsh-gmshdiscretemodel-load-error/65084/3 "2021-07-22T06:24:45Z")

</div>

Ah! Cool! Thank you kindly! Going to check it out!
