Hello everybody,
I want to solve the following variational formulatiion using fenics:
$$\sum\limits_{i \in {h,s,b}} \int_{\Omega_i}\rho c_v \frac{\partial{\theta}}{\partial{t}}\,v\,dx - \int_{\Omega_i} \frac{\kappa_{r i}}{r} \frac{\partial \theta}{\partial r} \cdot v dx + \int_{\Omega_i} \kappa_{r i} \frac{\partial \theta}{\partial r} \frac{\partial v}{\partial r}+\frac{\kappa_{\phi i}}{r^2} \frac{\partial \theta}{\partial \phi} \frac{\partial v}{\partial \phi} \, dx$$
$$+ \int_{r=r_b}\alpha_b(\theta-\theta_{atm})\,v \, dS = 0$$
where $\Omega_{h,s,b}$ are some subdomains of a circle. My results with fenics are not like I expected them. While I was trying to look for mistakes, I wondered if I even use the right UFL-formulation? Is the following code the correct translation of the weak formulation into UFL-language, especially is this the right way to treat the
$\frac{1}{r}$?
V = FiniteElement("Lagrange", triangle, 1)
V_kappa = FiniteElement("DG", triangle, 1)
u = TrialFunction(V)
v = TestFunction(V)
dt = Constant(triangle)
u0 = Coefficient(V)
f = Coefficient(V)
rho = Coefficient(V_kappa)
cv = Coefficient(V_kappa)
kappa_r = Coefficient(V_kappa)
kappa_phi = Coefficient(V_kappa)
alpha = Constant(triangle)
u_atm = Constant(triangle);
x = triangle.x
Define bilinear and linear forms
a = rho * cv * (1/dt) * inner(u, v) * dx + alpha * u * v * ds(1) + (kappa_r * Dx(u,0) * Dx(v,0) + kappa_phi * 1/x[0] * Dx(u,1)* 1/x[0] * Dx(v,1)) * dx - kappa_r * 1/x[0] * Dx(u,0) * v * dx
L = rho * cv * (1/dt) * inner(u0, v) * dx + inner(f, v) * dx + alpha * (u_atm) * v * ds(1)
I am just trying to exclude possible error sources :)
Thanks!