GridapGmsh "GmshDiscreteModel" load error

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:

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.

Here is my code:

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

And if I use

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!

Hi @Cyber!

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

In summary, you have two options:

DiscreteModelFromFile("model.json")

or

GmshDiscreteModel("model.msh")

this one

DiscreteModelFromFile("model.msh")

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

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
and a test here https://github.com/gridap/GridapGmsh.jl/blob/4ce1b20399be6f0baaea137f130fe046482b485e/test/GmshDiscreteModelsTests.jl#L71
and open a PR.

1 Like

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