# 1d supg scheme

I am trying to reproduce the 1d SUPG advec-diff example in ch. 2 of "Finite element for flow problems" by Donea & Huerta, however I can't recover their solution. The problem is to solve the equation

a*u_x - nu*u_xx = s, where s = 5.0*exp(

I am assuming order 1 CG elements and so the second derivative term in the stabalization is dropped and the element by element summation of the stablizing integral is replaced by an integral over the entire domain. My FEniCS implementation is as follows (compare to fig 2.13 in Donea & Huerta):

a = 1.0 # vel coef (1d a vector = scalar)

nu = 0.01 # diff. coef => Pe = 5.0

# domain setup

mesh = UnitInterval(10)

V = FunctionSpace(mesh, "CG", 1)

def u0_boundary(x, on_boundary):

return on_boundary

bc = DirichletBC(V, 0.0, u0_boundary)

u = TrialFunction(V)

w = TestFunction(V)

# stabilization coeficient, tau

h = mesh.hmin() # uniform mesh

Pe = a*h/2.0/nu; beta = 1.0/numpy.tanh(Pe) - 1/Pe

nu2 = beta*a*h/2.0; tau = nu2/(a*a)

# variational forms

s = Expression(

a_ = w*dot(a, nabla_grad(u))*dx + inner(nabla_

L_ = w*s*dx

# stabilization term

Lu_ = dot(a, nabla_grad(u)) # linear elem => div(nabla_grad(u)) == 0

Pw_ = dot(a, nabla_grad(w)) # stabal. operator

# stabilized forms

a_ += tau*Pw_*Lu_*dx

L_ += tau*Pw_*s*dx

# solve

u = Function(V)

solve(a_ == L_, u, bc)

plot(

The value I calculate on the 0.2 node is 0.44, where as in the implentation in Donea & Huerta is ~ 0.5. I've clearly mis-understood somthing here.

I've searched for SUPG on the form and got no results and I've gone through the Ca2+ example in the FEniCS book, but it seems to be a bit over kill for this simple problem. Any help/suggestions would be very much appricated.

Derek

## Question information

- Language:
- English Edit question

- Status:
- Solved

- Assignee:
- No assignee Edit question

- Solved by:
- Martin Sandve Alnæs

- Solved:

- Last query:

- Last reply: