diff --git a/Project.toml b/Project.toml index fc7c0189..2ed571d6 100644 --- a/Project.toml +++ b/Project.toml @@ -22,9 +22,11 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" [weakdeps] FerriteGmsh = "4f95f4f8-b27c-4ae5-9a39-ea55e634e36b" +Meshes = "eacbb407-ea5a-433e-ab97-5258b1ca43fa" [extensions] FiniteElementMethodFerriteGmshExt = "FerriteGmsh" +FiniteElementMethodMeshesExt = "Meshes" [compat] ADTypes = "1.24" @@ -38,6 +40,7 @@ Gmsh = "0.3" LinearAlgebra = "1.10" ModelingToolkit = "11.34" LinearSolve = "5" +Meshes = "0.60" NonlinearSolveFirstOrder = "2.10" OrdinaryDiffEqBDF = "2.4.1" OrdinaryDiffEqNonlinearSolve = "2.9.4" @@ -59,6 +62,7 @@ AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" FerriteGmsh = "4f95f4f8-b27c-4ae5-9a39-ea55e634e36b" Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" +Meshes = "eacbb407-ea5a-433e-ab97-5258b1ca43fa" OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -67,4 +71,4 @@ SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["AllocCheck", "FerriteGmsh", "Gmsh", "LinearSolve", "OrdinaryDiffEqBDF", "OrdinaryDiffEqNonlinearSolve", "Random", "SafeTestsets", "SciMLTesting", "Test"] +test = ["AllocCheck", "FerriteGmsh", "Gmsh", "LinearSolve", "Meshes", "OrdinaryDiffEqBDF", "OrdinaryDiffEqNonlinearSolve", "Random", "SafeTestsets", "SciMLTesting", "Test"] diff --git a/docs/src/boundary_conditions.md b/docs/src/boundary_conditions.md index a518493e..3ac89999 100644 --- a/docs/src/boundary_conditions.md +++ b/docs/src/boundary_conditions.md @@ -39,7 +39,8 @@ Restrictions of this release: ## Geometries and coordinates The spatial domain is a `MeshDomain(grid)` of a `Ferrite.Grid`, for example one read from Gmsh -with `FerriteGmsh.togrid` or made with `Ferrite.generate_grid`. Boundary pieces are the grid's +with `FerriteGmsh.togrid`, made with `Ferrite.generate_grid` or converted from a Meshes.jl mesh +with [`ferrite_grid`](@ref). Boundary pieces are the grid's facet sets: `boundarypiece(Ω, :inlet)` is the facet set `"inlet"`. Pieces must be disjoint; a facet in two pieces that both carry conditions is an error naming the first shared facet, and a piece containing an interior facet (one shared by two cells) is an error, since a piece lies on @@ -65,6 +66,17 @@ add_boundary_pieces!(grid, :inlet => inlet_mesh, :wall => wall_mesh) A submesh cell that matches no facet of the parent, or only an interior facet, is an error that names the cell and where it is. The grid's own facet sets work as before. +With Meshes.jl loaded, a submesh may also be a Meshes.jl mesh, such as the rings of a polygon: + +```julia +using Meshes: Meshes +outer = Meshes.Ring((0.0, 0.0), (4.0, 0.0), (4.0, 4.0), (0.0, 4.0)) +hole = Meshes.Ring((1.0, 1.0), (1.0, 3.0), (3.0, 3.0), (3.0, 1.0)) +grid = ferrite_grid(Meshes.discretize(Meshes.Pgon(outer, hole))) +add_boundary_pieces!(grid, :outer => Meshes.discretize(outer), :hole => Meshes.discretize(hole)) +Ω = MeshDomain(grid) +``` + Coordinates are Cartesian. Their names and order come from the `(x, y) ∈ Ω` pairing (see [Coordinate binding](@ref)). A curvilinear operator, such as a radial Laplacian, is written out in Cartesian-coordinate form in the equation. diff --git a/docs/src/discretization.md b/docs/src/discretization.md index dc39f3ee..becd274b 100644 --- a/docs/src/discretization.md +++ b/docs/src/discretization.md @@ -1,6 +1,6 @@ # Discretization -`FEMDiscretization`, `Galerkin`, `SUPG` and `add_boundary_pieces!` are exported, as are the PDEBase names a model needs +`FEMDiscretization`, `Galerkin`, `SUPG`, `add_boundary_pieces!` and `ferrite_grid` are exported, as are the PDEBase names a model needs (`MeshDomain`, `Region`, `boundarypiece`, `boundarypieces`, `NormalDerivative`) and Ferrite's `Lagrange` and reference shapes. [Getting started](@ref) shows them in use. @@ -21,6 +21,12 @@ FiniteElementMethod.operators add_boundary_pieces! ``` +## Meshes from other packages + +```@docs +ferrite_grid +``` + `discretize(pdesys, disc)` returns the `DAEProblem` of the discretization (the `NonlinearProblem` of a steady one, see [Steady problems](@ref)). `symbolic_discretize(pdesys, disc)` returns `(sys, tspan)`, where `sys` is the array-residual `System` attached to that problem (see [`FiniteElementMethod.fem_system`](@ref)): one block equation per field over the diff --git a/ext/FiniteElementMethodMeshesExt.jl b/ext/FiniteElementMethodMeshesExt.jl new file mode 100644 index 00000000..59a9f6e5 --- /dev/null +++ b/ext/FiniteElementMethodMeshesExt.jl @@ -0,0 +1,46 @@ +module FiniteElementMethodMeshesExt + +using FiniteElementMethod: FiniteElementMethod +using Ferrite: Ferrite +using LinearAlgebra: cross, dot +using Meshes: Meshes + +function FiniteElementMethod.ferrite_grid(mesh::Meshes.Mesh) + Meshes.crs(mesh) <: Meshes.Cartesian || + throw(ArgumentError("ferrite_grid needs a mesh in Cartesian coordinates, got $(nameof(Meshes.crs(mesh)))")) + dim = Meshes.embeddim(mesh) + nodes = [Ferrite.Node(Ferrite.Vec{dim}(Tuple(Meshes.ustrip.(Meshes.to(p))))) for p in Meshes.vertices(mesh)] + x = [node.x for node in nodes] + cells = [_cell(Meshes.pltype(c), Meshes.indices(c), x) for c in Meshes.elements(Meshes.topology(mesh))] + return Ferrite.Grid(cells, nodes) +end + +# Ferrite needs cells with a positive Jacobian, while Meshes.jl allows either orientation. +function _cell(::Type{<:Meshes.Segment}, (i, j), x) + reversed = length(x[i]) == 1 && x[j][1] < x[i][1] + return Ferrite.Line(reversed ? (j, i) : (i, j)) +end +function _cell(::Type{<:Meshes.Triangle}, (i, j, k), x) + clockwise = length(x[i]) == 2 && _cross2(x[j] - x[i], x[k] - x[i]) < 0 + return Ferrite.Triangle(clockwise ? (i, k, j) : (i, j, k)) +end +function _cell(::Type{<:Meshes.Quadrangle}, (i, j, k, l), x) + clockwise = length(x[i]) == 2 && _cross2(x[k] - x[i], x[l] - x[j]) < 0 + return Ferrite.Quadrilateral(clockwise ? (i, l, k, j) : (i, j, k, l)) +end +function _cell(::Type{<:Meshes.Tetrahedron}, (i, j, k, l), x) + inverted = dot(cross(x[j] - x[i], x[k] - x[i]), x[l] - x[i]) < 0 + return Ferrite.Tetrahedron(inverted ? (i, j, l, k) : (i, j, k, l)) +end +function _cell(::Type{<:Meshes.Hexahedron}, v, x) + up = sum(x[v[n]] for n in 5:8) - sum(x[v[n]] for n in 1:4) + inverted = dot(cross(x[v[3]] - x[v[1]], x[v[4]] - x[v[2]]), up) < 0 + return Ferrite.Hexahedron(inverted ? (v[5], v[6], v[7], v[8], v[1], v[2], v[3], v[4]) : v) +end +function _cell(PL, inds, x) + throw(ArgumentError("ferrite_grid supports segments, triangles, quadrangles, tetrahedra and hexahedra, got a $(nameof(PL))")) +end + +_cross2(a, b) = a[1] * b[2] - a[2] * b[1] + +end # module diff --git a/src/FiniteElementMethod.jl b/src/FiniteElementMethod.jl index d8921880..09eb1685 100644 --- a/src/FiniteElementMethod.jl +++ b/src/FiniteElementMethod.jl @@ -47,7 +47,7 @@ using PDEBase.StrongForm: Weighted include("discretization.jl") include("frontend.jl") _is_normal_derivative(op) = op isa NormalDerivative -export FEMDiscretization, Galerkin, SUPG, add_boundary_pieces! +export FEMDiscretization, Galerkin, SUPG, add_boundary_pieces!, ferrite_grid export MeshDomain, Region, boundarypiece, boundarypieces, NormalDerivative # The integration-by-parts policy `ibp = Dict(eq => Weighted(w))` of `FEMDiscretization`. export Weighted diff --git a/src/mesh.jl b/src/mesh.jl index 26fae53e..6503082d 100644 --- a/src/mesh.jl +++ b/src/mesh.jl @@ -192,6 +192,24 @@ function _submesh_facets(grid::Ferrite.Grid{dim}, name, sub::Ferrite.Grid, atol, return facets end +""" + ferrite_grid(mesh) + +The `Ferrite.Grid` of `mesh`, a mesh from another Julia meshing package, for `MeshDomain` and +[`add_boundary_pieces!`](@ref). A package is supported by an extension that loads with it: + + - Meshes.jl (`using Meshes`): a mesh in Cartesian coordinates whose elements are segments, triangles, + quadrangles, tetrahedra or hexahedra. The nodes are the vertices of the mesh in its length unit, without + the unit. A cell with the other orientation, such as a clockwise triangle in 2D, has its nodes reordered, + since Ferrite needs cells with a positive Jacobian. + +A `Ferrite.Grid` is returned as it is. +""" +ferrite_grid(grid::Ferrite.Grid) = grid +function ferrite_grid(mesh) + throw(ArgumentError("ferrite_grid converts a Ferrite.Grid, or a Meshes.jl mesh after `using Meshes`; got a $(nameof(typeof(mesh)))")) +end + """ add_boundary_pieces!(grid, name => submesh, ...; atol = nothing) add_boundary_pieces!(grid, pieces::AbstractDict; atol = nothing) @@ -199,8 +217,9 @@ end Add a boundary piece to the `Ferrite.Grid` `grid` for each pair `name => submesh`: a facet set called `name` holding the facets of `grid` that the cells of `submesh` coincide with. `submesh` is a `Ferrite.Grid` of one dimension less than `grid`, in the coordinates of `grid`: the boundary mesh that Gmsh gives for a physical -group, or any grid whose cells are facets of `grid`. Afterwards `boundarypiece(MeshDomain(grid), name)` is the -piece, exactly as for any other facet set; `grid` is modified, as by `Ferrite.addfacetset!`, and returns. +group, or any grid whose cells are facets of `grid`. It may also be a mesh that [`ferrite_grid`](@ref) +converts, such as a Meshes.jl mesh. Afterwards `boundarypiece(MeshDomain(grid), name)` is the piece, exactly +as for any other facet set; `grid` is modified, as by `Ferrite.addfacetset!`, and returns. A submesh cell is matched to a facet of `grid` through the nodes: each node of the submesh is the node of `grid` within `atol > 0` of it (by coordinates, since the two grids number their nodes independently; the default `atol` @@ -218,7 +237,7 @@ function add_boundary_pieces!(grid::Ferrite.Grid, pieces::Pair...; atol = nothin throw(ArgumentError("the mesh already has a facet set $(repr(Symbol(name))); pick another name for the boundary piece")) end owners = _facet_owners(grid) - sets = [_submesh_facets(grid, Symbol(n), last(p), atol, owners) for (n, p) in zip(names, pieces)] + sets = [_submesh_facets(grid, Symbol(n), ferrite_grid(last(p)), atol, owners) for (n, p) in zip(names, pieces)] foreach((n, s) -> Ferrite.addfacetset!(grid, n, s), names, sets) return grid end diff --git a/test/Interface/README.md b/test/Interface/README.md index 13507adf..8e2a1bc4 100644 --- a/test/Interface/README.md +++ b/test/Interface/README.md @@ -82,6 +82,8 @@ boundary pieces are `boundarypiece.(Ω, (:left, :right, :bottom, :top))` in 2D a | `wave_first_order.jl` | 2D standing wave | wave as a first-order system | 2 | P2 | zero Dirichlet | | `mesh_domains.jl` | side split into two named pieces | heat | 2 | P2 | Dirichlet, Neumann and Robin on five pieces | | `mesh_domains.jl` | L-shaped Gmsh mesh read from a file | heat with parameters `k`, `α` | 2 | P2 | Dirichlet on inlet and wall, Robin on outlet | +| `mesh_domains.jl` | Meshes.jl polygon with a hole, rings as pieces | heat | 2 | P2 | Dirichlet on outer and hole | +| `mesh_domains.jl` | Meshes.jl grid of hexahedra and of tetrahedra | heat | 3 | P2 | Dirichlet on the whole boundary | | `curved_geometry.jl` | optimal rates on a quarter annulus with `QuadraticTriangle` cells | heat with source | 2 | P1, P2 | Dirichlet on the arcs, Neumann | | `parameters.jl` | `D`, `A`, `g` from `ps` for three parameter sets | heat with source | 2 | P2 | Dirichlet with parameter | | `parameters.jl` | Neumann flux `q` from `ps` | heat | 2 | P2 | Dirichlet and Neumann with parameter | @@ -103,7 +105,7 @@ boundary pieces are `boundarypiece.(Ω, (:left, :right, :bottom, :top))` in 2D a | `navier_stokes.jl` | Kovasznay flow, Taylor-Hood, rates 3 and 2 | steady incompressible Navier-Stokes | 2 | P2/P1 | Dirichlet velocity, Dirichlet pressure on one side | | `metadata_and_operators.jl` | `facet_dofs`, `dof_coordinates`, `cell_dofs` | heat | 2 | P1, P2 | zero Dirichlet | | `metadata_and_operators.jl` | `operators` gives the matrices for a hand-made steady solve | heat at its steady state | 2 | P2 | Dirichlet | -| `rejections.jl` | rejected boundary conditions, equations, options, domains, shared facets, SUPG with a nonlinear term, observed expressions, `operators` | heat and others | 1 to 2 | | | +| `rejections.jl` | rejected boundary conditions, equations, options, domains, shared facets, SUPG with a nonlinear term, observed expressions, `operators`, `ferrite_grid` | heat and others | 1 to 3 | | | ## Not covered diff --git a/test/Interface/mesh_domains.jl b/test/Interface/mesh_domains.jl index bd4fa11d..b5bac4b3 100644 --- a/test/Interface/mesh_domains.jl +++ b/test/Interface/mesh_domains.jl @@ -1,16 +1,19 @@ # Mesh domains with named boundary pieces. A `MeshDomain` takes its pieces from the facet sets of the Ferrite # grid: `boundarypiece(Ω, :name)` is the facet set "name". The sets come from `generate_grid`, from -# `Ferrite.addfacetset!` on a grid you build, or from the physical groups of a Gmsh mesh read with FerriteGmsh. +# `Ferrite.addfacetset!` on a grid you build, from the physical groups of a Gmsh mesh read with FerriteGmsh, or +# from submeshes added with `add_boundary_pieces!`. A Meshes.jl mesh becomes a grid with `ferrite_grid`. # Each piece then carries its own boundary condition. using FiniteElementMethod, ModelingToolkit, DomainSets, OrdinaryDiffEqBDF, Test using Ferrite: Ferrite, generate_grid, Triangle, Vec +using LinearAlgebra: Diagonal using FerriteGmsh: FerriteGmsh using Gmsh: Gmsh, gmsh +using Meshes: Meshes using ModelingToolkit: t_nounits as t @parameters k α -@variables x y u(..) -Dt, Dx, Dy = Differential(t), Differential(x), Differential(y) +@variables x y z u(..) +Dt, Dx, Dy, Dz = Differential(t), Differential(x), Differential(y), Differential(z) laplacian(f) = Dx(Dx(f)) + Dy(Dy(f)) # Writes a triangle mesh of the L-shape [0, 2]^2 minus (1, 2]^2 to `path` as a Gmsh .msh file, with the physical @@ -94,3 +97,69 @@ end @test isnan(sol(1.0, 1.5, 1.5; dv = u(t, x, y))) @test_throws "has no facet set :outflow; valid names are :inlet, :outlet, :wall" boundarypiece(Ω, :outflow) end + +# PDE: u_t = Δu +# Domain: the square [0, 4]^2 with the square hole [1, 3]^2, t in (0, 1), a Meshes.jl `Pgon` triangulated +# with `Meshes.discretize` and converted with `ferrite_grid`; P2; the pieces outer and hole are the two +# rings, each discretized into a mesh of segments and added with `add_boundary_pieces!` +# BCs: outer and hole: Dirichlet u = x^2 + y^2 + 4t; IC u(0, x, y) = x^2 + y^2 +# Exact: u = x^2 + y^2 + 4t, in the P2 space +# Shows: a Meshes.jl polygon becomes a domain whose pieces are its rings; the hole reads NaN. +@testset "a Meshes.jl polygon with a hole is solved with its two rings as pieces" begin + outer = Meshes.Ring((0.0, 0.0), (4.0, 0.0), (4.0, 4.0), (0.0, 4.0)) + hole = Meshes.Ring((1.0, 1.0), (1.0, 3.0), (3.0, 3.0), (3.0, 1.0)) + grid = ferrite_grid(Meshes.discretize(Meshes.Pgon(outer, hole))) + add_boundary_pieces!(grid, :outer => Meshes.discretize(outer), :hole => Meshes.discretize(hole)) + Ω = MeshDomain(grid) + @test length(boundarypieces(Ω)) == 2 + bcs = [[u(t, Γ) ~ x^2 + y^2 + 4t for Γ in boundarypiece.(Ω, (:outer, :hole))]; u(0, x, y) ~ x^2 + y^2] + @named pdesys = PDESystem([Dt(u(t, x, y)) ~ laplacian(u(t, x, y))], bcs, [(x, y) ∈ Ω, t ∈ Interval(0.0, 1.0)], [t, x, y], [u(t, x, y)], []) + sol = solve(discretize(pdesys, FEMDiscretization(Ω, t; spaces = Dict(u => Lagrange{RefTriangle, 2}()))), DFBDF(); abstol = 1.0e-10, reltol = 1.0e-10) + @test sol[u(t, x, y)][end, :] ≈ sol[x] .^ 2 .+ sol[y] .^ 2 .+ 4 atol = 1.0e-7 + @test sol(1.0, 0.5, 2.0; dv = u(t, x, y)) ≈ 0.25 + 4 + 4 atol = 1.0e-7 + @test isnan(sol(1.0, 2.0, 2.0; dv = u(t, x, y))) +end + +# Solves u_t = Δu on the grid of a Meshes.jl mesh in 1, 2 or 3 dimensions, with u = |x|^2 + 2 dim t on the whole +# boundary as one piece, and returns the largest nodal error at t = 1. +function meshes_heat_error(mesh, ref) + grid = ferrite_grid(mesh) + Ferrite.addboundaryfacetset!(grid, Ferrite.ExclusiveTopology(grid), "boundary", Returns(true)) + Ω = MeshDomain(grid) + X = (x, y, z)[1:Meshes.embeddim(mesh)] + exact = sum(abs2, X) + 2length(X) * t + bcs = [u(t, boundarypiece(Ω, :boundary)) ~ exact, u(0, X...) ~ sum(abs2, X)] + heat = Dt(u(t, X...)) ~ sum(ξ -> Differential(ξ)(Differential(ξ)(u(t, X...))), X) + @named pdesys = PDESystem([heat], bcs, [X ∈ Ω, t ∈ Interval(0.0, 1.0)], [t, X...], [u(t, X...)], []) + sol = solve(discretize(pdesys, FEMDiscretization(Ω, t; spaces = Dict(u => Lagrange{ref, 2}()))), DFBDF(); abstol = 1.0e-10, reltol = 1.0e-10) + return maximum(abs, sol[u(t, X...)][end, :] .- sum(ξ -> sol[ξ] .^ 2, X) .- 2length(X)) +end + +# The unit box in `dim` dimensions with 2 cells per side, and its mirror image x -> 1 - x, whose cells all have the +# other orientation. +box(dim) = Meshes.CartesianGrid(ntuple(Returns(0.0), dim), ntuple(Returns(1.0), dim); dims = ntuple(Returns(2), dim)) +function mirror(mesh) + dim = Meshes.embeddim(mesh) + A, b = Diagonal([-1; ones(dim - 1)]), [1; zeros(dim - 1)] + return Meshes.SimpleMesh(Meshes.vertices(mesh), Meshes.topology(mesh)) |> Meshes.Affine(A, b) +end + +# PDE: u_t = Δu +# Domain: the unit box, t in (0, 1), a Meshes.jl `CartesianGrid` with 2 cells per side, as segments, +# quadrangles, triangles, hexahedra or tetrahedra (`Meshes.simplexify`), and mirrored with a +# `Meshes.Affine` map; P2; one piece holds every boundary facet, added with `Ferrite.addboundaryfacetset!` +# BCs: Dirichlet u = |x|^2 + 2 dim t; IC u(0, x) = |x|^2 +# Exact: u = |x|^2 + 2 dim t, in the P2 space +# Shows: `ferrite_grid` gives every cell the orientation Ferrite needs, also when Meshes.jl has the other one. +@testset "a Meshes.jl grid of $name is solved exactly" for (name, mesh, ref) in ( + ("mirrored segments", mirror(box(1)), RefLine), + ("quadrangles", box(2), RefQuadrilateral), + ("mirrored quadrangles", mirror(box(2)), RefQuadrilateral), + ("mirrored triangles", Meshes.simplexify(mirror(box(2))), RefTriangle), + ("hexahedra", box(3), RefHexahedron), + ("mirrored hexahedra", mirror(box(3)), RefHexahedron), + ("tetrahedra", Meshes.simplexify(box(3)), RefTetrahedron), + ("mirrored tetrahedra", Meshes.simplexify(mirror(box(3))), RefTetrahedron), + ) + @test meshes_heat_error(mesh, ref) < 1.0e-7 +end diff --git a/test/Interface/rejections.jl b/test/Interface/rejections.jl index a2170c14..2b0276b3 100644 --- a/test/Interface/rejections.jl +++ b/test/Interface/rejections.jl @@ -5,6 +5,7 @@ using FiniteElementMethod, ModelingToolkit, DomainSets, OrdinaryDiffEqBDF, Test using Ferrite: Ferrite using Ferrite: generate_grid, Line, Triangle, Vec +using Meshes: Meshes using ModelingToolkit: t_nounits as t @variables x y u(..) v(..) @@ -120,3 +121,14 @@ end nonlinear = Dt(u(t, x)) ~ Dx(Dx(u(t, x))) - u(t, x)^3 @test_throws "operators returns linear operators only" FiniteElementMethod.operators(line_system(nonlinear), FEMDiscretization(Ω1, t)) end + +# Domain: Meshes.jl meshes that `ferrite_grid` cannot convert, and an input that is not a mesh of a supported package +# Shows: the message names what `ferrite_grid` needs. +@testset "meshes that ferrite_grid cannot convert are rejected with what it needs" begin + latlon = Meshes.SimpleMesh(Meshes.Point.(Meshes.LatLon.([0.0, 0.0, 1.0], [0.0, 1.0, 0.0])), [Meshes.connect((1, 2, 3))]) + @test_throws "needs a mesh in Cartesian coordinates, got GeodeticLatLon" ferrite_grid(latlon) + corners = [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 1.0), (0.0, 1.0, 1.0)] + wedge = Meshes.SimpleMesh(Meshes.Point.(corners), [Meshes.connect(Tuple(1:6), Meshes.Wedge)]) + @test_throws "supports segments, triangles, quadrangles, tetrahedra and hexahedra, got a Wedge" ferrite_grid(wedge) + @test_throws "converts a Ferrite.Grid, or a Meshes.jl mesh after `using Meshes`; got a Ring" ferrite_grid(Meshes.Ring((0.0, 0.0), (1.0, 0.0), (1.0, 1.0))) +end