 # How to mark boundaries to a circle and change solution from cartesian to polar?

Hello! I have a solution on the boundary of a circle in Cartesian coordinates. I want to change it to polar coordinates. But before that I need to solve one more issue to create a minimal working example with a built-in mesh. Since I always import my mesh from gmsh with physical tags attached, I am having trouble defining the markers to my domain which is simply a circle of radius 3 created through the Python script. Any help would be appreciated.

``````from mshr import *
from ufl import *
from dolfin import *
import matplotlib.pyplot as plt

from dolfin import *
import meshio
from dolfin import Mesh, XDMFFile, File, MeshValueCollection, cpp

# Optimization options for the form compiler
parameters["form_compiler"]["cpp_optimize"] = True
ffc_options = {"optimize": True, \
"eliminate_zeros": True, \
"precompute_basis_const": True, \
"precompute_ip_const": True}

mesh = generate_mesh(Circle(Point(0,0),3), 50) # Generating mesh for the domain
bmesh = BoundaryMesh(mesh,"exterior") # Generating mesh for the boundary

boundary_markers = MeshFunction("size_t", mesh, mesh.topology().dim()-1, 0)

bndry=bmesh()
bndry.mark(boundary_markers, 1)

V = FunctionSpace(mesh, "Lagrange", 1)

# Define boundary condition
G , mu = 1, 0.1
u_D=Constant(0.0)

bc = DirichletBC(V, u_D, 1)

# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(-G/mu) # f=-G/mu
a = dot(grad(u), grad(v))*dx
L = -f*v*dx

# Compute solution
usol = Function(V)
solve(a == L, usol, bc)
``````

The error reads:

``````bndry=bmesh()
TypeError: 'dolfin.cpp.mesh.BoundaryMesh' object is not callable``````

you can just import the mesh from gmsh and then in Fenics can create boundary markers. See one of my previous post (Occlude a cylinder with suction pressure), where I first imported a 3D cylinder mesh and then defined the boundary marker in Fenics.

I already have the solution to this problem in Cartesian coordinate form by importing the mesh and its physical tags from gmsh. But for people to reproduce the code, a built-in mesh is the preferred option. So I was trying to create a built-in mesh.

But the main question is that how to convert the solution (usol) to a polar reference frame?