Hi,
I have written the following code for the formulation of a DG problem. The discretisation of the diffusion part of the equation is the SIP method, and the convection part is discretized by upwinding. The result for the solution that I get is -nan, which is very unphysical.
Thanks for your help!
b = Expression(('gamma_in*(vbar_in-x[0])', '(beta_in-alpha_in*x[1])'), gamma_in = gamma, vbar_in =vbar, beta_in = beta, alpha_in = alpha_1)
f = Constant(-1.0)
n = FacetNormal(mesh)
h = CellSize(mesh)
of = Function(V_dg)
kappa = Constant(-1.0)
alpha = 32.0
#bilinear form B(u,v) with both SIP DG diffusion term and convection term
#diffusion part
a_convection = +dot(grad(v), dot(kappa, grad(u)))*dx + v*inner(b, grad(u))*dx \
-kappa*dot(jump(v, n), avg(grad(u)) )*dS \
-kappa*dot(avg(grad(v)), jump(u, n))*dS \
-kappa*dot(inner(v, n), grad(u))*ds \
-kappa*dot(grad(v), inner(u, n))*ds \
+kappa*alpha/h('+')*dot(jump(v, n), jump(u, n))*dS \
+kappa*alpha/h*v*u*ds
#convection part
#exterior
- dot(b, n)*(u('+'))*v('+')*ds\
#interior
- dot(b, n)*(u('+') - u('-'))*v('+')*dS\
L = f*v*dx
# Solution function
solution = Function(V_dg)