Cylindrical Coordinates and the jacobian

Hi Kevin,

I think the Jacobian is included in this example (the factor “*x”)
If this can be of any help, below I put another example (for spherical coordinates)

/**************************************************/
/*   Coordinate dependant differential operators  */
/**************************************************/
/* Spherical coordinates in the (r,theta) plane   */
/*                                                */
/*   r     --> x  in [0,infty]                    */
/*   theta --> y  in [0,pi]                       */
/*   phi   --> not                                */
/*                                                */
/*    Jacobian determinant                        */
/*    The det(J) = r^2*sin(theta) --> x^2*sin(y)  */
macro Jac()(x^2*sin(y) )  // /*                   */
/* The gradient operator in spherical coordinates */
/*                                                */
/*            d/dr                                */
/*   grad =   1/r*d/dtheta                        */
/*            1/(r*sin(theta))*d/dphi             */
/*                                                */
  macro Grad(u) [dx(u),dy(u)/x]	    // /*         */
  macro Lap(u,v) (Grad(u)'*Grad(v)) // /*     ')  */
/**************************************************/
 macro Source()(exp(-x^2)*(6-4*x^2) )  //

Vh u,v;
problem Poisson(u,v) = int2d(Th)( Jac*Lap(u,v) )
-int2d(Th)(Jac*Source*v)
+on(3,u=1)
+on(1,u=0)  ;

Poisson;
plot(u,fill=1,value=1,wait=1);

I’ll put also some brief notes I had some time ago, if this can be of any help.
It is for kind of Laplace-Beltrami operator…Here I use the conventions from
field theory/general relativity (raising indices with the metric)

Let me know if this makes sense to you.
Hope this helps,
Julien

1 Like