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

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:

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

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

if

else

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?