## Upwinding method for convection terms in 2nd order PDE

I'm not sure if this belongs here or in the advanced applied math section, but here goes.

I'm trying to solve the equation

$\frac{\partial u}{\partial t} + \frac{\partial}{\partial x}\left(Cu\right) - \frac{\partial}{\partial x}\left(D\frac{\partial u}{\partial x}\right) = f(x,t)$

where C and D allow for linearity. I'm using a discontinuous Galerkin method in space and Backward Euler for the time-stepping. I currently have a working code for the equation WITHOUT the convection term:

$\frac{\partial u}{\partial t} - \frac{\partial}{\partial x}\left(D\frac{\partial u}{\partial x}\right) = f(x,t)$

However, I am unsure of how to properly implement the convection term. I currently have

$\int_{\Omega}\frac{\partial}{\partial x}(Cu)v = -\int_{\Omega}Cu\frac{\partial v}{\partial x} + \{Cu^{up}\}\left[v\right]$

where the { } indicate the average and the [ ] indicate the jump. My professor told me to implement the upwinding method like this:

if ${C} \ge 0$
$u^{up} = u(x^{-})$
else
$u^{up} = u(x^{+})$

I've implemented this as best as I can but it's already pretty terrible for the case when C = D = 1. I can get better accuracy with the plain old CG method for this case.

I know no one can help me with the code but is this scheme even correct?