DG with Mixed FE question
I am learning DG through a book and thought I would try my hand at coding up some of the examples. The problem I am solving is heat transfer with a mixed formulation: (q = \nabla T and \nabla \cdot q = 0 ) and the internal penalty method with a coefficient of 1.0, i.e.
T_hat = avg(T)
and
q_hat = avg(grad(T)) - jump(T)
The error I am getting suggests that the facet normals must be restricted:
raise self._exception
ufl.log.
Any help is greatly appreciated.
Regards
Yaakoub
from dolfin import *
# Create mesh
mesh = UnitSquareMesh(32, 32)
n = FacetNormal(mesh)
h = CellSize(mesh)
h_avg = (h('+') + h('-'))/2
qSpace = VectorFunctionS
TSpace = FunctionSpace(
W = qSpace*TSpace
(q, T) = TrialFunctions(W)
(v_q,v_T) = TestFunctions(W)
zero = Constant(0.0)
# for internal (dS) faces:
# T_hat = avg(T)
# q_hat = avg(grad(T) - C11*jump(T,n)
# for external/boundary (ds) faces:
# T_hat = T
# q_hat = q
# This does not work
a = inner(q,v_q)*dx \
+ T*div(v_q)*dx \
- avg(T)*
- T*inner(v_q,n)*ds \
+ inner(q, grad(v_T))*dx \
- v_T*dot(
- v_T*inner(q,n)*ds
L = zero*v_T*dx
w = Function(W)
solve(a==L,w)
(u,p) = w.split()
plot(u, title="Velocity u", interactive=True)
plot(p, title="Pressure p", interactive=True)
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Yaakoub El Khamra
- Solved:
- Last query:
- Last reply: