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

On 18 March 2017 at 17:29, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Hello,

I want to define my mesh to be a circle.  In Fenics I know there is a command called CircleMesh that makes this very easy. 

Q1) Is there a simple way of doing this in Firedrake?

I looked around and see how circlemanifoldmesh can do this with help for ExtrudedMesh.  I found some code that can make a ring and I tried running it myself and defining a function on that mesh.  Unfortunately, I get an error, see below.

Q2) If one needs to use CircleManifoldMesh is there something else one needs to do to use a circular geometry as your mesh?

Below are the lines that I tried and the error
>>> from firedrake import *
>>> m    = CircleManifoldMesh(20, radius=2)
>>> mesh = ExtrudedMesh(m, 5, extrusion_type='radial')
>>> x    = SpatialCoordinate(mesh)
>>> V    = FunctionSpace(mesh,'CG',1)
>>> U    = Function(V).interpolate(-(pow(x[0]-0.5,2) + pow(x[1]-0.5,2)))
>>> plot(U);
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/plot.py", line 308, in plot
    **kwargs)
  File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/plot.py", line 502, in two_dimension_plot
    num_sample_points)
  File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/plot.py", line 457, in _two_dimension_triangle_func_val
    raise RuntimeError("Unsupported Functionality")
RuntimeError: Unsupported Functionality


------------------
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