Dear sir,
How to get cylindrical coordinates for the domain.
FEniCS is agnostic to the coordinate system. You can define the coordinate system as you like. Then you can write the appropriate variational forms. Just don’t forget to implement the corresponding vector calculus operations in UFL.
Consider the following example:
Let (x_1, x_2) \in \Omega = (0, 1)^2 be the coordinates of a 2D mesh.
To compute the Cartesian area we simply assign (x, y) = (x_1, x_2) and evaluate \int_\Omega \, \mathrm{d}x \, \mathrm{d}y = 1
To compute the volume of a cylinder of unit height and radius with azimuthal symmetry, we set (r, z) = (x_1, x_2) and evaluate \int_\Omega \, r \, \mathrm{d} r \, \mathrm{d} \theta \, \mathrm{d}z = \pi
Here is the corresponding code:
from dolfin import *
mesh = UnitSquareMesh(32, 32)
print(f"Cartesian area: {assemble(Constant(1.0)*dx(domain=mesh))}")
x = SpatialCoordinate(mesh)
print(f"Cylinder volume: {2*pi*assemble(Constant(1.0)*x[0]*dx(domain=mesh))}")
This same principle applies in the context of formulating finite element problems in arbitrary coordinate systems with FEniCS.