[dune-fem] Periodic Boundary Conditions

Zac Candelaria A.Z.Candelaria at sms.ed.ac.uk
Fri Sep 11 10:12:23 CEST 2026


Hi,

My name is Zac, I'm trying to use the Dune Python API (dune-fempy, I believe) to solve a PDE on the unit square in which I have periodic boundary conditions on the left and right.

I saw that one of the methods for creating a mesh explicitly takes a "periodic" keyword argument - however, using the following

>from dune.grid import cartesianDomain, yaspGrid
>
># periodic=[0] makes the x-direction periodic; [0,1] makes both x and y periodic
>domain = cartesianDomain([0, 0], [L_x, L_y], [nx, ny], periodic=[True, False])
>mesh = yaspGrid(domain)

gives the following error message:

>Traceback (most recent call last):
>
> File ~/dune-env/lib/python3.12/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
>  exec(code, globals, locals)
>
>  File ~/duneFempyExamples/untitled0.py:305
>    collSolver = scipy.sparse.linalg.factorized(sysMatCollNumpy)
>
>  File ~/dune-env/lib/python3.12/site-packages/scipy/sparse/linalg/_dsolve/linsolve.py:653 in factorized
>    return splu(A).solve
>
>  File ~/dune-env/lib/python3.12/site-packages/scipy/sparse/linalg/_dsolve/linsolve.py:444 in splu
>    return _superlu.gstrf(N, A.nnz, A.data, indices, indptr,
>
>RuntimeError: Factor is exactly singular

Is there a different way to implement PBCs?

Best wishes,
Zac
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th' ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-fem/attachments/20260911/1b70978a/attachment.htm>


More information about the dune-fem mailing list