# Cylindrical Coordinates and the jacobian

**URL:** https://community.freefem.org/t/cylindrical-coordinates-and-the-jacobian/393
**Category:** General Discussion
**Created:** [May 5, 2020, 10:19pm UTC](https://community.freefem.org/t/cylindrical-coordinates-and-the-jacobian/393 "2020-05-05T22:19:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kevinmo08](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/kevinmo08/32/217_2.png) [@kevinmo08](https://community.freefem.org/u/kevinmo08)
#### Post date: [May 5, 2020, 10:19pm UTC](https://community.freefem.org/t/cylindrical-coordinates-and-the-jacobian/393/1 "2020-05-05T22:19:20Z")

</div>

Hi everyone,

I have a question about the tutorial discussing the thermal conduction of a rod with a circular section. [https://doc.freefem.org/tutorials/thermalConduction.html#axisymmetry-3d-rod-with-circular-section](https://doc.freefem.org/tutorials/thermalConduction.html#axisymmetry-3d-rod-with-circular-section)

In the tutorial, they get the equation in the strong form and then implement it into FreeFem and show the code. However, I noticed that they do not include the jacobian r\*dr in their weak form.

I am simulating a problem similar to that, although without the time dependence. I am confused why the integral does not include that r term.

Thanks,  
Kevin

---

<div class="post-metadata">

### Author: ![julienG](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/julieng/32/222_2.png) [@julienG](https://community.freefem.org/u/julienG)
#### Post date: [May 7, 2020, 7:56am UTC](https://community.freefem.org/t/cylindrical-coordinates-and-the-jacobian/393/2 "2020-05-07T07:56:56Z")

</div>

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)

 ![equation](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/b386ac2b8102d11f410500fac73af1b704fdcacd.jpeg)

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

---

<div class="post-metadata">

### Author: ![kevinmo08](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/kevinmo08/32/217_2.png) [@kevinmo08](https://community.freefem.org/u/kevinmo08)
#### Post date: [May 8, 2020, 4:56am UTC](https://community.freefem.org/t/cylindrical-coordinates-and-the-jacobian/393/3 "2020-05-08T04:56:44Z")

</div>

Thank you Julien.

That does help, though I think your last screenshot is over my head a bit.

And I realize sheepishly that it does include the Jacobian now that I went through it again.

I think my confusion stems from the fact that I am trying to run FEM simulations in a sort of weird coordinate system with an equation that I believe is correct. But I am getting strange results that are unphysical when I try to switch from a problem involving cartesian coordinates plus an extra one to one involving polar coordinates plus an extra one, and so I thought maybe the error came from there.  
Which I mention here.

> [@Variational Formulation in Polar Coordinates](https://community.freefem.org/t/variational-formulation-in-polar-coordinates/395/2):
>
> I’m realizing now that the solution in the example does have the jacobian in it, but for some reason my correct equation below is still not working. Are there other issues with polar coordinates I am not aware of? 0 = int2d(Th)(x^2\*(a\*dx(u)\*dx(v) + dy(u)\*dy(v) )) // bilinear form + int2d(Th)( (x^2\*cos(y)\*dx(u)\*v + x\*cos(y)\*v\*u) // linear form + any boundary conditions.

Anyway. Thanks Again!
