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

DG + Periodic boundary conditions

+4 votes

Is it not possible to have periodic boundary conditions and DG elements?

I am trying to solve a bunch of advection-diffusion-reaction equations using 'DG' elements in one and two dimensions, and in a periodic domain (to begin with).

The following code

from dolfin import *

class PBC1D(SubDomain):
    def __init__(self, xmin=0, xmax=1):
        SubDomain.__init__(self)
        assert(xmax>xmin)
        self.xmin=xmin
        self.xmax=xmax
    def inside(self, x, on_boundary):
        return bool(near(x[0], self.xmin) and on_boundary)
    def map(self, x, y):
        y[0] = x[0] - self.xmax + self.xmin

mesh = UnitIntervalMesh(64)
pbc = PBC1D()
X = FunctionSpace(mesh, "DG", 1, constrained_domain=pbc)

generates this error

[turing:16366] *** Process received signal ***
[turing:16366] Signal: Segmentation fault (11)
[turing:16366] Signal code: Address not mapped (1)
[turing:16366] Failing at address: 0x7f2800000020
[turing:16366] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0xfbd0) [0x7f2880ac4bd0]
[turing:16366] [ 1] /usr/lib/libdolfin.so.1.2(_ZN6dolfin13DofMapBuilder32build_constrained_vertex_indicesERKNS_4MeshERKSt3mapIjSt4pairIjjESt4lessIjESaIS5_IKjS6_EEERSt6vectorImSaImEE+0x110) [0x7f287a2ea960]
[turing:16366] [ 2] /usr/lib/libdolfin.so.1.2(_ZN6dolfin13DofMapBuilder9build_ufcERNS_6DofMapERSt3mapIiiSt4lessIiESaISt4pairIKiiEEERKNS_4MeshEN5boost10shared_ptrIKS3_IjS3_IjS6_IjjES4_IjESaIS6_IKjSH_EEESI_SaIS6_ISJ_SM_EEEEENSG_IKNS_11RestrictionEEE+0x18f) [0x7f287a2edd3f]
[turing:16366] [ 3] /usr/lib/libdolfin.so.1.2(_ZN6dolfin13DofMapBuilder5buildERNS_6DofMapERKNS_4MeshEN5boost10shared_ptrIKSt3mapIjS8_IjSt4pairIjjESt4lessIjESaIS9_IKjSA_EEESC_SaIS9_ISD_SG_EEEEENS7_IKNS_11RestrictionEEE+0xfb) [0x7f287a2f00bb]
[turing:16366] [ 4] /usr/lib/libdolfin.so.1.2(_ZN6dolfin6DofMapC1EN5boost10shared_ptrIKN3ufc6dofmapEEERKNS_4MeshENS2_IKNS_9SubDomainEEE+0x678) [0x7f287a2cfb78]
[turing:16366] [ 5] /usr/lib/python2.7/dist-packages/dolfin/cpp/_fem.so(+0x7ce78) [0x7f285d254e78]
[turing:16366] [ 6] python(PyEval_EvalFrameEx+0x216a) [0x47d80a]
[turing:16366] [ 7] python(PyEval_EvalCodeEx+0x19a) [0x4e09aa]
[turing:16366] [ 8] python() [0x4e140a]
[turing:16366] [ 9] python() [0x4cabfe]
[turing:16366] [10] python() [0x49ebf4]
[turing:16366] [11] python() [0x4b1a1e]
[turing:16366] [12] python(PyEval_EvalFrameEx+0xafd) [0x47c19d]
[turing:16366] [13] python(PyEval_EvalCodeEx+0x19a) [0x4e09aa]
[turing:16366] [14] python() [0x4e140a]
[turing:16366] [15] python() [0x4cabfe]
[turing:16366] [16] python(PyEval_EvalFrameEx+0xafd) [0x47c19d]
[turing:16366] [17] python(PyEval_EvalCodeEx+0x19a) [0x4e09aa]
[turing:16366] [18] python() [0x4e153a]
[turing:16366] [19] python() [0x4cabfe]
[turing:16366] [20] python() [0x49ebf4]
[turing:16366] [21] python() [0x4b1a1e]
[turing:16366] [22] python(PyEval_EvalFrameEx+0xafd) [0x47c19d]
[turing:16366] [23] python(PyEval_EvalCodeEx+0x19a) [0x4e09aa]
[turing:16366] [24] python(PyEval_EvalCode+0x32) [0x540412]
[turing:16366] [25] python() [0x54088b]
[turing:16366] [26] python(PyRun_FileExFlags+0x92) [0x4658f6]
[turing:16366] [27] python(PyRun_SimpleFileExFlags+0x2d8) [0x465e26]
[turing:16366] [28] python(Py_Main+0xb4e) [0x466b9b]
[turing:16366] [29] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f287fdebea5]
[turing:16366] *** End of error message ***
Segmentation fault

Change the element to 'CG' and everything goes through smoothly. However neither DG0 nor DG1 seem to work.

I have no idea what is happening. Perhaps I am missing something which I do not understand.

Is there any demo code for solving a transient advection-diffusion equation using DG elements? In periodic domains?

asked Jul 9, 2013 by Vijay Murthy FEniCS Novice (960 points)

1 Answer

+3 votes
 
Best answer

Periodic bcs are are not presently supported for DG elements. The technical reasons for this are closely related to why DG elements are not presently supported in parallel. This limitation will likely be resolved in the next few months.

answered Jul 9, 2013 by Garth N. Wells FEniCS Expert (35,930 points)
selected Jul 10, 2013 by Vijay Murthy
Where to find what has been resolved in FEniCS?
...