Variational Formulation in Polar Coordinates

Hi all, I am interested in solving a problem similar to reaction-diffusion with a circular disk in solution and symmetry in theta.

I am using FreeFem++ to solve this problem, and I’ve noticed that the example in the documentation for a cylinder ( https://doc.freefem.org/tutorials/thermalConduction.html ) does not include the additional r (written as x) factor included due to the jacobian with polar coordinates. Does anyone know why that is?

The difference between normal reaction diffusion and my system is that there is another, variable “y” that represents local orientation (similar to that in liquid crystals), but that should be easy to include if I make the equation correct and include periodicity in the y direction.

For some reason, no matter if I formulate the problem their way or the way I used to do it with the r (written as x) included in the integrals, my solution is not matching with what I expect. In fact, the only way I can get it to come close to the right form is to integrate by parts with that extra x factor, and then magically remove a factor of x from everything.

Essentially, my equation in strong form looks like

x*dx(u)*cos(y) = x*dy^2(u) + a*dx(x*dx(x))

Which would normally give me in variational form

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.

But this is not giving me correct results.

If I neglect the jacobian as they do for that problem, my solution looks like

0 = int2d(Th)(x*(a*dx(u)*dx(v) + dy(u)*dy(v) )) // bilinear form 
	+ int2d(Th)( (x*cos(y)*dx(u)*v))  // linear form
 + boundary conditions

But this still gives the wrong results.

The only solution that even comes close to the answer I am looking for is to include the cos(y)vu term found in the first block into the second block.

I can include my full code if it helps below

mesh Th=square(100,50,[xmin + (xmax-xmin)*x,0 + 2*pi*y]);
fespace Vh(Th,P2,periodic=[[3,x],[1,x]]); 
	Vh u, v; 
	real a = 0.5;
problem solu(u,v) = // definion of the problem

	int2d(Th)(x*(a*dx(u)*dx(v) + dy(u)*dy(v) )) // bilinear form 
	+ int2d(Th)( (x*cos(y)*dx(u)*v))  // linear form


	// Boundary Conditions
	+ int1d(Th, 4)(x*cos(y)*u*v)  // Robin BC at surface
	+ on(2, prob= 1/(2*pi)) // Dirichlet BC at infinitely far away
	
	;
solu; // solve the problem

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.