GridapGmsh.jl

Gmsh generated meshes for Gridap
Author gridap
Popularity
42 Stars
Updated Last
4 Months Ago
Started In
July 2019

GridapGmsh

Build Status Codecov

Demo

Solve a Poisson problem with Gridap on top of a Finite Element mesh generated by GMSH. The mesh includes two physical groups, "boundary1" and "boundary2", which are used to define boundary conditions. This is just a simple demo. Once the GMSH mesh is read, all the magic of Gridap can be applied to it.

using Gridap
using GridapGmsh
model = GmshDiscreteModel("demo/demo.msh")
order = 1
reffe = ReferenceFE(lagrangian,Float64,order)
V = TestFESpace(model,reffe,dirichlet_tags=["boundary1","boundary2"])
U = TrialFESpace(V,[0,1])
Ω = Triangulation(model)
dΩ = Measure(Ω,2*order)
a(u,v) = ( (v)(u) )dΩ
l(v) = 0
op = AffineFEOperator(a,l,U,V)
uh = solve(op)
writevtk(Ω,"demo",cellfields=["uh"=>uh])

Installation

GridapGmsh is a registered package in the official Julia package registry. Thus, the installation is done using the Julia's package manager. Open the Julia REPL, type ] to enter package mode, and install as follows

pkg> add GridapGmsh

Installation requirements

GridapGmsh requires GMSH. There are two possible ways to install the GMSH dependency:

  1. [Recommended] Do nothing (automatically installation). GridapGmsh will download a GMSH binary via BinaryBuilder, which then is installed to your ~/.julia/artifacts directory, this should work fine in the most cases.

  2. [Fallback] Set an environment variable called GMSHROOT containing the path to the location of the root folder of a GMSH-SDK installation. The GMSH Software Development Kit (SDK) available at gmsh.info. Make sure that: $GMSHROOT/bin/gmsh is the path of the GMSH binary and $GMSHROOT/lib/gmsh.jl is the path of the GMSH Julia API.

Gotchas

  • Gmsh does not allow to include entities of different dimension in the same physical group. In order to overcome this limitation, all physical groups defined in Gmesh with the same name will be merged in the same physical tag independently of their dimension.

  • Conceptually closed domains such as circles or sphere-shells may require explicit addition of the technical boundary to the physical group. Example: For a properly functioning 2D disk mesh with labelled circumference write

SetFactory("OpenCASCADE");
//+
Disk(1) = {0, 0, 0, 0.5, 0.5};
Physical Surface("disk", 3) = {1};
Physical Curve("boundary", 4) = {1};
Physical Point("boundary", 5) = {1};
  • Vertices are always assigned to the corresponding CAD entity. However, this is not true for higher dimensional objects (i.e., edges, faces, cells). The later objects are associated with the right CAD entity if and only if they are present in a physical group of the same dimension of the object. If the object does not belong to a physical group of the same dimension, but it belongs to the closure of a higher dimensional object appearing in a physical group, then the low dimensional object receives the CAD id of the high dimensional object. If several high dimensional objects fulfill this requirement, we choose one arbitrary of the lowest dimension possible. This ensures, that edges and faces are assigned to the right CAD entity if the are in the interior of the CAD entity. The same is not true if the object is on the boundary of the CAD entity. In this case, include the corresponding object in a physical group if the right CAD ids are required.

How to cite Gridap

In order to give credit to the Gridap contributors, we simply ask you to cite the reference below in any publication in which you have made use of Gridap packages:

@article{Badia2020,
  doi = {10.21105/joss.02520},
  url = {https://doi.org/10.21105/joss.02520},
  year = {2020},
  publisher = {The Open Journal},
  volume = {5},
  number = {52},
  pages = {2520},
  author = {Santiago Badia and Francesc Verdugo},
  title = {Gridap: An extensible Finite Element toolbox in Julia},
  journal = {Journal of Open Source Software}
}

Contact

Please, contact the project administrators, Santiago Badia and Francesc Verdugo, for further questions about licenses and terms of use.