I’m struggling with a comparable high convection velocity in time-dependent convection-diffusion equation, that prevents larger timesteps. How is it possible to implement a stabilizing upwind scheme? I found expressions like w*u('-') but nowhere a description of the meaning. Nevertheless I think this might be the right approach.

Is u_mid following from time discretisation or part of SUPG? EDIT: Seems to be Crank-Nicolson time discretization, is it? Unfortunately convergence is destroyed using u_mid even without any other change in my working code.

Is the residual correction

# Residual
r = u - u0 + dt*(dot(velocity, grad(u_mid)) - c*div(grad(u_mid)) - f)
# Add SUPG stabilisation terms
vnorm = sqrt(dot(velocity, velocity))
F += (h/(2.0*vnorm))*dot(velocity, grad(v))*r*dx

still valid with Neumann and/or Robin boundary conditions?

What is the meaning of f = Constant(0.0)? If it is just the RHS of the homogeneous PDE?

And furthermore (problably a beginner problem): From other examples I usually do:

...
u = TrialFunction(Q)
v = TestFunction(Q)
F = ... u ... v ...
...
U = Function(Q)
...
solve(a == L, U, bcs)
...

If in the weak formulation there is used u and I call solve with U is then u replaced (logically) by U? But u_n and v are taken from the original formulation. How does FEniCS know what to replace?