# Variational form of Diffusion Operator in spherical coordinate

Hi all,

I have a 3D diffusion problem in sphere with no flux in and out, due to spherical symmetry, it can be reduced to 1D radially symmetric problem. The weak varitional form related to the diffusion operator is only a function of r, so it seems can be written as
\int \nabla^2 u v dx =\int \frac{1}{r^2}\frac{\partial }{\partial r}(r^2\frac{\partial u}{\partial r})vdr = \int (\frac{\partial u^2}{\partial r^2} + \frac{2}{r}\frac{\partial u}{\partial r})vdr=\int -\nabla u \nabla vdr - \int \frac{2}{r}u \nabla vdr.

However when I have both terms in the variational form of the diffusion operator (F_diffusion_BE2), the mass is not conserved. However, if I get away the second term, mass is conserved. Is neglecting the second term correct in this case (F_diffusion_BE_1)?


# Define the domain and mesh
R = 10  # Radius of the sphere
mesh = IntervalMesh(1000, 0, R)
r = Expression("sqrt(x[0]*x[0])", degree=2)

F_diffusion_BE1 = ((u_1 - u_m1) * v_1 * r**2 * dx

F_diffusion_BE2 = (
# Contribution from u_1
(u_1 - u_m1) * v_1 * r**2 * dx