How to implement upwind scheme


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.

See for instance the advection diffusion demo

Thank you. Is there any additional documentation for this example?

Consider for instance:

Cool. Thank you. I hope I get the match from method to FEniCS implementation.

By working through the advection-diffusion demo some questions come up (By the way: it currently doesn’t work for my application).

Why u_mid instead of u is applied? My current weak formulation is

F    =   rhoU*u*v*dx \
       - rhoU*u_n*v*dx \
       + E_dt*rhoU*dot(E_w,grad(u))*v*dx \
       + E_dt*lambdaU*dot(grad(cpiU*u),grad(v))*dx \
       + sum(integrals_R) + sum(integrals_N)

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?

Meanwhile the SUPG works - there was a term missing as I adopted it.