Thank you Andrew for your help. I am a bit sorry to see CircleMesh go away but if it only gave a structured mesh, then I can see the advantage to using gmsh. Also, I should really
learn how to use gmsh better, so this will force me to do just that.
I looked around for circle.geo but couldn't find it in the repo.
I found another version of circle.geo that seems to build a circle. It is copied here
L = 10;
dx = 1;
Point(1) = { 0, 0, 0, dx};
Point(2) = { L, 0, 0, dx};
Point(3) = {-L, 0, 0, dx};
Point(4) = { 0, L, 0, dx};
Point(5) = { 0,-L, 0, dx};
Circle(1) = {3,1,5};
Circle(2) = {5,1,2};
Circle(3) = {2,1,4};
Circle(4) = {4,1,3};
Line Loop(5) = {1,2,3,4};
Plane Surface(6) = {5};
I am not sure why the origin needs to be included but it does give the correct shape at least.
Unfortunately, when I try importing this in firedrake using
from firedrake import *
#gmsh -2 circle.geo
mesh = Mesh("circle.msh")
I get the error
Traceback (most recent call last):
File "test.py", line 7, in <module>
mesh = Mesh("circle.msh")
File "<decorator-gen-261>", line 2, in Mesh
File "/home/fpoulin/software/firedrake/src/PyOP2/pyop2/profiling.py", line 61, in wrapper
return f(*args, **kwargs)
File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/mesh.py", line 1259, in Mesh
topology = MeshTopology(plex, name=name, reorder=reorder, distribute=distribute)
File "<decorator-gen-259>", line 2, in __init__
File "/home/fpoulin/software/firedrake/src/PyOP2/pyop2/profiling.py", line 61, in wrapper
return f(*args, **kwargs)
File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/mesh.py", line 348, in __init__
dmplex.validate_mesh(plex)
File "firedrake/dmplex.pyx", line 1009, in firedrake.dmplex.validate_mesh (firedrake/dmplex.c:14063)
ValueError: Provided mesh has some entities not reachable by traversing cells (maybe rogue vertices?)
Can you point out what I'm doing wrong? Or where to find the circle.geo?
Also, I tried use gmsh in firedrake as commented above and that didn't work. Should gmsh work in the latest version?
Cheers, Francis
------------------
Francis Poulin
Associate Professor
Department of Applied Mathematics
University of Waterloo
email: fpoulin@uwaterloo.ca
Web: https://uwaterloo.ca/poulin-research-group/
Telephone: +1 519 888 4567 x32637
From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Andrew McRae [A.T.T.McRae@bath.ac.uk]
Sent: Sunday, March 19, 2017 8:07 AM
To: firedrake@imperial.ac.uk
Subject: Re: [firedrake] circles in firedrake?
We used to have a CircleMesh in Firedrake, but it was removed in
this commit. If I recall correctly, this is because we outsourced the creation of that mesh to gmsh, but the gmsh-from-Python packages are no longer available with newer versions of Ubuntu.
That commit has a small gmsh snippet (.geo). You could manually run this through gmsh to build a mesh (.msh), and load this in to your firedrake script: mesh = Mesh("circle.msh"). Note that this CircleMesh (and, IIRC, FEniCS's equivalent) give a "structured"
mesh with radial lines, and correspondingly small cells in the middle. If this is undesirable, you might be better off making a simple unstructured circle mesh in gmsh and loading it in.
Regarding the code you gave in your email, I think this has also worked just fine. However, the built-in Firedrake plotting functionality only seems to support 2D triangle and "unstructured" quadrilateral cells, rather than the "interval x interval" cells
created by an extruded mesh. (I suspect this was an accidental omission)
If you instead do File("temp.pvd").write(U) and open the result in Paraview, I'm sure it would look fine. Of course, if you use this to get a circular mesh, it will also have small cells at the centre.
Best,
Andrew