I have poisson equations written in weak form in polar coordinates. How do I implement this in fenics in polar coordinates with dirichlet BCs in cartesian coordinates? I am a fenics newbie
I think you must express the boundary conditions in polar coordinates in order to implement it. If you show the physical problem maybe I can help you.
FEniCS is agnostic to the coordinate system. Clearly a Cartesian model is straightforward; however, you can define the orthogonal coordinates of a mesh to be whatever you like. For example in an azimuthally symmetric cylindrical coordinate system you could set (x_1, x_2) = (r, z) where (x_1, x_2) are the orthogonal coordinates of a 2D FEniCS mesh. You would just have to be careful about vector calculus operations and integral measures. See for example Axisymmetric formulation for elastic structures of revolution — Numerical tours of continuum mechanics using FEniCS master documentation.
Dear @nate, is there a dolfinx/fenicsx example code, that defines vector-calculus operations and differential operators, as well as integral measures for curvilinear (e.g. polar) coordinates?
If i want to write down the weak form of a problem on the unit-ball, \Omega=\{(x,y)\in \mathbb{R}^2: x^2+y^2 < 1\}, I could also define the domain differently as \{(r,\phi)\in \mathbb{R}^2: r\in (0,1), \phi\in (0,2\pi)\}, with the usual definition of r,\phi. The gradient in the orthonormal e_r,e_\phi basis is then \nabla=(\partial_r, 1/r \partial_\phi), and the integral measure is dA=rdrd\phi.
Does fenicsx provide dA and \nabla like this? If not, whats the easiest way to implement this?
See for instance Axisymmetric formulation for elastic structures of revolution — Computational Mechanics Numerical Tours with FEniCSx
There’s also an old example provided by @kamilova-maths for Stokes in a cylindrical coordinate system: Stokes equations from Cartesian to Cylindrical, results mismatch - #5 by kamilova-maths
Thank you very much for your answer.
Thank you very much for your response.