Giter VIP home page Giter VIP logo

gmsh.jl's Introduction

Gmsh.jl

Gmsh.jl contains the Julia API for Gmsh: a three-dimensional finite element mesh generator. Using Gmsh.jl, it is possible to construct parametric solid models and/or perform automatic mesh generation.

The official Gmsh API can be accessed by first adding the package:

pkg> add Gmsh

and then loading it in Julia:

julia> import Gmsh: gmsh

gmsh.jl's People

Contributors

ahojukka5 avatar fredrikekre avatar gpeairs avatar juliatagbot avatar sebastiangrimberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gmsh.jl's Issues

revive this package

Hey there,
I think the purpose of this package is extremely valuable and instead of attaching it to one specific FE framework we should (IMHO) just ship gmsh binaries and access to the gmsh.jl. If julia FE Frameworks want to support conversion than they should be able to make a PR with given conversion functions. What do you think about this?

Directly download Gmsh SDK

Hi @ahojukka5, I just came across the slack fem channel and you mention the difficulty in compiling with BLAS. I was wondering if we could just directly download the SDK to alleviate the pain of compiling? I did a similar thing at here and it works so far fine.

Best,
Pengcheng

Cannot create circles with Gmsh binary bundled with package

Trying to use

gmsh.model.occ.addCircle(0.05, 0.15, 0, 0.01, 2)

gives

Error   : Gmsh requires OpenCASCADE to add circle
ERROR: LoadError: gmshModelOccAddCircle returned non-zero error code: 1

when using Gmsh. If I download the official Gmsh and use the gmsh.jl in the lib folder, everything works fine.

tutorial on using .geo files from Julia

It would be nice to have some more tutorial examples in this package, especially because the Gmsh API docs are so minimal.

For example, one common desire is to be able to use .geo files, but to programmatically set parameters from Julia, so that you get some of the ease-of-use of the gmsh GUI but the flexibility of a programmatic interface. It turns out that this is possible, but it took me a while to figure out.

The trick to using a "foo.geo" from Julia is to do something like:

gmsh.clear()
gmsh.parser.parse("foo.geo")
gmsh.model.geo.synchronize()
gmsh.model.mesh.generate(2)
gmsh.write("foo.msh")

which behaves exactly as if you had translated each line of "foo.geo" into Julia and pasted the translation right at the point where you ran parse("foo.geo").

The powerful thing here is that you can also set variables programmatically from within Julia. Suppose we have a variable lc as in the t1.geo tutorial file. The trick is to define your .geo variables with DefineConstant — for example, in the t1.geo file, do:

DefineConstant[ lc = 1e-2 ];

Then you can override the value of lc by either the -setnumber command-line option or by the equivalent in the Julia API:

gmsh.clear()
gmsh.parser.setNumber("lc", [5e-3])   # overrides subsequent DefineConstant variables
gmsh.parser.parse(geo)
gmsh.model.geo.synchronize()
gmsh.model.mesh.generate(2)
gmsh.write("foo.msh")

troubles in running occ functions

Hi,

I am having troubles using occ functions, for example I was trying to run the example t16 from here t16.jl but I got this error

import Gmsh: gmsh
gmsh.initialize()
gmsh.model.add("t16")
gmsh.model.occ.addBox(0,0,0, 1,1,1, 1)

gmshModelOccAddBox returned non-zero error code: 1

could you please help me finding out what am I doing wrong here?

many thanks,
Andrea

Gmsh fails on initial build in macOS (but not unsupported platform error)

When trying to build Gmsh for the first time on macOS, I get the following error:

(v1.1) pkg> add https://github.com/JuliaFEM/Gmsh.jl.git
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Cloning git-repo `https://github.com/JuliaFEM/Gmsh.jl.git`
  Updating git-repo `https://github.com/JuliaFEM/Gmsh.jl.git`
 Resolving package versions...
  Updating `~/.julia/environments/v1.1/Project.toml`
  [705231aa] + Gmsh v0.1.0 #master (https://github.com/JuliaFEM/Gmsh.jl.git)
  Updating `~/.julia/environments/v1.1/Manifest.toml`
  [705231aa] + Gmsh v0.1.0 #master (https://github.com/JuliaFEM/Gmsh.jl.git)
  Building Gmsh → `~/.julia/packages/Gmsh/9J8He/deps/build.log`
┌ Error: Error building `Gmsh`: 
│ ERROR: LoadError: MethodError: no method matching iterate(::Nothing)
│ Closest candidates are:
│   iterate(!Matched::Core.SimpleVector) at essentials.jl:568
│   iterate(!Matched::Core.SimpleVector, !Matched::Any) at essentials.jl:568
│   iterate(!Matched::ExponentialBackOff) at error.jl:199
│   ...
│ Stacktrace:
│  [1] indexed_iterate(::Nothing, ::Int64) at ./tuple.jl:66
│  [2] top-level scope at /Users/crashburnrepeat/.julia/packages/Gmsh/9J8He/deps/build.jl:24
│  [3] include at ./boot.jl:326 [inlined]
│  [4] include_relative(::Module, ::String) at ./loading.jl:1038
│  [5] include(::Module, ::String) at ./sysimg.jl:29
│  [6] include(::String) at ./client.jl:403
│  [7] top-level scope at none:0
│ in expression starting at /Users/crashburnrepeat/.julia/packages/Gmsh/9J8He/deps/build.jl:21
└ @ Pkg.Operations /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075

Looking through the source code, it seems only Linux is supported at the moment, and there is logic for catching build errors on unsupported platforms, but it seems that this error is a different type than the one anticipated. Does this logic need to be revised to show the correct error, assuming this is an unsupported platform problem? Even better, is there a chance that binaries can be built for OSs other than Linux?

If there's more information that I can provide, please let me know.

gmsh.model.mesh.generate crashes!

Hello,

I run the first example in Julia1.8.5 but I get this message and it quits from Julia REPL.

julia> using Gmsh: Gmsh, gmsh

julia>

julia> Gmsh.initialize()
true

julia>

julia> gmsh.model.add("t1")

julia>

julia> lc = 1e-2
0.01

julia> gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
1

julia> gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
2

julia> gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
3

julia>

julia> p4 = gmsh.model.geo.addPoint(0, .3, 0, lc)
4

julia>

julia> gmsh.model.geo.addLine(1, 2, 1)
1

julia> gmsh.model.geo.addLine(3, 2, 2)
2

julia> gmsh.model.geo.addLine(3, p4, 3)
3

julia> gmsh.model.geo.addLine(4, 1, p4)
4

julia>

julia> gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
1

julia> gmsh.model.geo.addPlaneSurface([1], 1)
1

julia>

julia> gmsh.model.geo.synchronize()

julia>

julia> gmsh.model.addPhysicalGroup(0, [1, 2], 1)
1

julia> gmsh.model.addPhysicalGroup(1, [1, 2], 2)
2

julia> gmsh.model.addPhysicalGroup(2, [1], 6)
6

julia>

julia> gmsh.model.setPhysicalName(2, 6, "My surface")

julia>

julia> gmsh.model.mesh.generate(2)
Info    : Meshing 1D...
Info    : [  0%] Meshing curve 1 (Line)
Info    : [ 30%] Meshing curve 2 (Line)
Info    : [ 50%] Meshing curve 3 (Line)
Info    : [ 80%] Meshing curve 4 (Line)
PS C:\Users\m.khorrami>

ERROR: LoadError: Your platform ("x86_64-w64-mingw32", parsed as "x86_64-w64-mingw32-gcc8-cxx11") is not supported by this package! #41

Error building Gmsh:
ERROR: LoadError: Your platform ("x86_64-w64-mingw32", parsed as "x86_64-w64-mingw32-gcc8-cxx11") is not supported by this package!
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] top-level scope
@ C:\Users\super.julia\packages\Gmsh\eZVOZ\deps\build.jl:26
[3] include(fname::String)
@ Base.MainInclude .\client.jl:444
[4] top-level scope
@ none:5
in expression starting at C:\Users\super.julia\packages\Gmsh\eZVOZ\deps\build.jl:22

Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:55
[2] (::Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec})()
@ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1044
[3] withenv(::Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, ::Pair{String, String}, ::Vararg{Pair{String, B} where B, N} where N)
@ Base .\env.jl:161
[4] (::Pkg.Operations.var"#109#113"{String, Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec})()
@ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1542
[5] with_temp_env(fn::Pkg.Operations.var"#109#113"{String, Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec}, temp_env::String)
@ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1444
[6] (::Pkg.Operations.var"#108#112"{Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
@ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1517
[7] mktempdir(fn::Pkg.Operations.var"#108#112"{Pkg.Operations.var"#82#87"{Bool, Pkg.Types.Context, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String)
@ Base.Filesystem .\file.jl:729
[8] mktempdir(fn::Function, parent::String) (repeats 2 times)
@ Base.Filesystem .\file.jl:727
[9] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project)
@ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1483
[10] build_versions(ctx::Pkg.Types.Context, uuids::Vector{Base.UUID}; verbose::Bool)
@ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1025
[11] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, verbose::Bool)
@ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:906
[12] build(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; verbose::Bool, kwargs::Base.Iterators.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
@ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:899
[13] build(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:79
[14] build(pkgs::Vector{Pkg.Types.PackageSpec})
@ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:77
[15] #build#71
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:75 [inlined]
[16] build
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:75 [inlined]
[17] #build#70
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:74 [inlined]
[18] build(pkg::String)
@ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:74
[19] top-level scope
@ In[21]:1
[20] eval
@ .\boot.jl:360 [inlined]
[21] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base .\loading.jl:1094

Cannot install Gmsh.jl with MUMPS.jl due to SCOTCH_jll version requirement

I need Gmsh.jl and MUMPS.jl to solve a FEM problem.

However, it is not possible to simultaneously install latest versions of Gmsh.jl and MUMPS.jl version 1.4:

  • Gmsh.jl requires gmsh_jll.jl that requires MMG_jll.jl that requires SCOTCH_jll.jl version 6
  • MUMPS.jl requires MUMPS_jll.jl that requires SCOTCH_jll.jl version 7

Is there any solution to fix this problem?

Gmsh is outdated

The current version of gmsh is 4.12.2, but the compatibility version in Gmsh.jl is 4.11.1. There are functions in gmsh which do not work with (the outdated) Gmsh.jl
Please update it.

Or remove the compatibility condition from Project.toml

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Hash mismatch for MacOS on Gmsh 4.4.1 update

The latest update to master causes a hash mismatch for MacOS. I found this on my personal machine, but it is also present on the Travis build for this commit. The relevant information from the build log is:

[ Info: Downloading https://github.com/ahojukka5/GmshBuilder/releases/download/v4.4.1/gmsh.v4.4.1.x86_64-apple-darwin14.tar.gz to /Users/travis/build/JuliaFEM/Gmsh.jl/deps/usr/downloads/gmsh.v4.4.1.x86_64-apple-darwin14.tar.gz...
133[17:19:20] ######################################################################## 100.0%
134ERROR: LoadError: Hash Mismatch!
135  Expected sha256:   fe750cdcc97b77279b452ae69cc4ba48bd82179879db8e60261bceb35a430975
136  Calculated sha256: a29d761a6826bbca16e500b195c1ddd22487fd62ae8be99930e3755a1e170c33
137Stacktrace:
138 [1] error(::String) at ./error.jl:33
139 [2] (::getfield(BinaryProvider, Symbol("##141#143")){Bool,String,String,String})(::IOStream) at /Users/travis/.julia/packages/BinaryProvider/TcAwt/src/Prefix.jl:571
140 [3] #open#310(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(BinaryProvider, Symbol("##141#143")){Bool,String,String,String}, ::String) at ./iostream.jl:375
141 [4] open at ./iostream.jl:373 [inlined]
142 [5] #verify#140(::Bool, ::Bool, ::String, ::Function, ::String, ::String) at /Users/travis/.julia/packages/BinaryProvider/TcAwt/src/Prefix.jl:557
143 [6] #verify at ./none:0 [inlined]
144 [7] #download_verify#90(::Bool, ::Bool, ::Bool, ::Function, ::String, ::String, ::String) at /Users/travis/.julia/packages/BinaryProvider/TcAwt/src/PlatformEngines.jl:569
145 [8] #download_verify at ./none:0 [inlined]
146 [9] #install#129(::Prefix, ::String, ::Bool, ::Bool, ::Bool, ::Function, ::String, ::String) at /Users/travis/.julia/packages/BinaryProvider/TcAwt/src/Prefix.jl:314
147 [10] (::getfield(BinaryProvider, Symbol("#kw##install")))(::NamedTuple{(:prefix, :force, :verbose),Tuple{Prefix,Bool,Bool}}, ::typeof(install), ::String, ::String) at ./none:0
148 [11] top-level scope at /Users/travis/build/JuliaFEM/Gmsh.jl/deps/build.jl:33
149 [12] include at ./boot.jl:326 [inlined]
150 [13] include_relative(::Module, ::String) at ./loading.jl:1038
151 [14] include(::Module, ::String) at ./sysimg.jl:29
152 [15] include(::String) at ./client.jl:403
153 [16] top-level scope at none:0
154in expression starting at /Users/travis/build/JuliaFEM/Gmsh.jl/deps/build.jl:31
155┌ Error: Error building `Gmsh`: 
156└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075
1577.68s$ julia --check-bounds=yes --color=yes -e "if VERSION < v\"0.7.0-DEV.5183\"; Pkg.test(\"${JL_PKG}\", coverage=true); else using Pkg; Pkg.test(coverage=true); end"

If there's anything I can provide beyond the Travis logs, please let me know.

export/save to .geo format

Hi,

is it possible to export or save the results in a .geo format in order to be able to visualize it in gmsh ?

thanks,
Andrea

Reduce binary size

It's now almost 60 MB, and it should be possible to reduce to maybe 25 MB, I guess.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.