This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Problem while using DG = 0

+1 vote

Hi FEniCS users,

I am coding a Discontinuous Galerkin scheme setting as piecewise constant:

W = VectorFunctionSpace(mesh,'DG', 0)
w = TestFunction(W)
m_ = Function(W)

Rm = inner(grad(w),grad(m_))*dx

it seems the terms grad(w) and grad(m_) are the ones which are causing the following error:

This integral is missing an integration domain.
Traceback (most recent call last):
File "dg_BNf.py", line 117, in
Rm = inner(grad(w),grad(m_))dx
File "/usr/lib/python2.7/dist-packages/ufl/measure.py", line 398, in rmul
error("This integral is missing an integration domain.")
File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 158, in error
raise self._exception_type(self._format_raw(
message))
ufl.log.UFLException: This integral is missing an integration domain.
Aborted (core dumped)

When I change to

W = VectorFunctionSpace(mesh,'DG', 1)

the issue disappear. Any idea about how to set this properly. I need to use DG = 0 so setting DG = 1 is not a solution.

Thanks for any help

asked Sep 25, 2016 by sapenacl FEniCS Novice (270 points)

Roughly speaking, grad of piecewise constant is zero, so the form Rm is not meaningful. Unless some jump terms are added, your DG scheme would not work.

2 Answers

+1 vote

Be careful with the DG elements and grad. You might need to include
jump and average terms as well. Have a look at the dg-poisson demo.
(The gradient of piecewise constants are zero, only jump terms do not vannish)

answered Sep 26, 2016 by Kent-Andre Mardal FEniCS Expert (14,380 points)
+1 vote

Hello,

When using DG, you always need to consider the "dS" terms, which represents the integrating over interior facets.

Considering this example, as mentioned on the other answer, your weak formulation will look somehow like this (i haven't tested it, so, there may be a problem still.. please double check...):

 Rm = inner(grad(w),grad(m_))*dx + inner(jump(m_, n), jump(w, n))*dS - dot(avg(grad(m_)), jump(w, n))*dS - dot(jump(m_, n), avg(grad(w)))*dS

Remember that you will also have to define n:

n = FacetNormal(mesh)

More useful info here and specially here (equations 3.3).

Equation 3.3:

$$\sum_{K\in\mathcal{T}_h}\int_{\partial K} q_K \cdot n_K \phi_K\,ds=\int_\Gamma [q] \cdot {\phi}\,ds + \int_{\Gamma^0} {q} \cdot [\phi]\,ds$$

where:

$$ q= TrialFunction $$

$$ \phi = TestFunction $$

Regards,
Leonardo

answered Sep 26, 2016 by lhdamiani FEniCS User (2,580 points)
...