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 
         + dt * D_A * (dot(grad(u_1), grad(v_1)) * r**2 * dx)


F_diffusion_BE2 = (
    # Contribution from u_1
    (u_1 - u_m1) * v_1 * r**2 * dx
    + dt * D_A * (dot(grad(u_1), grad(v_1)) * r**2 * dx)
    + dt * D_A * (2 * dot(grad(u_1), grad(v_1)) * r * dx)

I may be reading the post completely wrong, but why do you expect mass (I guess, integral of u) to be conserved when you have a diffusion term?

It’s initially not constant in the domain hence it will diffuse in the domain until reach constant in space but the total mass is conserved as there is no flux in and out the sphere.

I think I may find the reason as we need to times r^2 in every term in the variational form hence the final variational form should only contain the first term hence the formulation of F_diffusion_BE1 should be correct which perserve the total mass of u ?