about the use of dS

Asked by Dupront

 I am trying to solve the Poisson equation in 2D using
 the discontinuous galerkin methode (DG).
 \delta (\kappa \delta T) = f
 Here I want to use an auxiliary variable
 q = \kappa \delta T

 It is not working. I include the script I am using.
 The CG method works and gives a nive solution. It is not
 the case with the DG method.

 Probably somebody familiar with this method could
 explain me what I am doing wrong. I am learning this
 kind of method and trying to make it work with simple

 Thanks a lot!


from dolfin import *

methode = "DG" # CG / DG

# Create mesh and define function space
mesh = UnitSquare(32, 32)
V_q = VectorFunctionSpace(mesh, methode, 2)
V_T = FunctionSpace (mesh, methode, 1)
W = V_q * V_T

# Define test and trial functions
(q, T) = TrialFunctions(W)
(w, v) = TestFunctions(W)

# Define mehs quantities: normal component, mesh size
n = FacetNormal(mesh)

# define right-hand side
f = Expression("500.0*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")

# Define parameters
kappa = 1.0

# Define variational problem
if methode == 'CG':
  a = dot(q,w)*dx \
       + T*div(kappa*w)*dx \
       + div(q)*v*dx

elif methode == 'DG':
  #modele = "IP"
  C11 = 1.

  a = dot(q,w)*dx + T*div(kappa*w)*dx \
      - kappa*avg(T)*dot(n('-'),w('-'))*dS \
      + dot(q,grad(v))*dx \
      - dot( avg(grad(T)) - C11 * jump(T,n) ,n('-'))*v('-')*dS

L = -v*f*dx

# Compute solution
qT = Function(W)
solve(a == L, qT)

# Project solution to piecewise linears
(q , T) = qT.split()

# Save solution to file
file = File("poisson.pvd")
file << T

# Plot solution
plot(T); plot(q)

Question information

English Edit question
DOLFIN Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Blechta (blechta) said :

This forum is closed now. For support check http://fenicsproject.org/support/.

Regarding your problem you might be intersted in http://fenicsproject.org/documentation/dolfin/1.2.0/cpp/demo/pde/mixed-poisson/cpp/documentation.html

Can you help with this problem?

Provide an answer of your own, or ask Dupront for more information if necessary.

To post a message you must log in.