about the use of dS
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 = VectorFunctionS
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(
# 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(
+ 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:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Dupront for more information if necessary.