about the use of dS

Asked by Dupront on 2013-05-26

Hello
 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
 examples.

 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)
interactive()

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
2013-05-26
Last reply:
2013-05-27
Jan Blechta (blechta) said : #1

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.