Connect 1D domains

Hello!

I would like to solve a problem involving three 1D domains connected with a T joint at coordinates (0,0):

  • Domain 1 is a line between (-1,0) and (0,0) where f1 is solve.
  • Domain 2 is a line between (0,0) and (1,0) where f2 is solve,
  • Domain 3 is a line between (0,0) and (0,1) where f3 is solve.

The equations on f1, f2 and f3 are not the same of the three domains. A condition is imposed on f1, f2 and f3 at the joint (0,0), for instance f1+f2+f3=0. My idea is to solve this by means of the DG method. For instance on the domain 1, I would like to impose a flux between f1 and an exterior trace defined as -f2-f3 on the boundary at (0,0). But is there a way to do something like that? Can I access the boundary values of f2 and f3 in a form written on domain 1?

Best,

Lucas

The way to do this is through the usage of submeshes (using dolfinx.fem.create_submesh) and create a mixed variational form for these.

See for instance:

or

(The latter link doesn’t cover the coupling from the first post, but it illustrates the idea with more documentation).

Thank you for your answer! It looks like what I want to do. I will dive into the problem more in details but if I understand correctly the big lines, I’ll have to create a 2D mesh that has edges (at the boundary or internal) that match exactly the three 1D domains?

If your mesh is a 1D mesh, I would make a 1D mesh that conforms to the boundaries you describe above.

Then you create a submesh for each of the domains create a function-space, test trial functions etc for each domain/eq and then couple them through dS integrals (either with DG-type methods or Lagrange multipliers)…

But the domain 3 is along y while the two other domains are along x. How can I create a 1D mesh containing these three domains?

It is quite straightforward:

from mpi4py import MPI
import ufl
import basix.ufl
import numpy as np
import dolfinx

c_el = basix.ufl.element("Lagrange", basix.CellType.interval, 1, shape=(2,))

N = 4
M = 7
L = 5
l0 = np.linspace(-1, 0, N)
l1 = np.linspace(0, 1, M)[1:]
l2 = np.linspace(0, 1, L)[1:]
nodes = np.zeros((N + M - 1 + L - 1, 2), dtype=np.float64)
nodes[:N, 0] = l0
nodes[N : N + M - 1, 1] = l1
nodes[N + M - 1 :, 0] = l2

connectivity = np.full(((N - 1 + M - 1 + L - 1), 2), -1, dtype=np.int64)
for i in range(N - 1):
    connectivity[i, 0] = i
    connectivity[i, 1] = i + 1
for j in range(N - 1, N + M - 2):
    connectivity[j, 0] = j
    connectivity[j, 1] = j + 1
connectivity[N + M - 2, 0] = N - 1
connectivity[N + M - 2, 1] = N + M - 1
for j in range(N + M - 1, N + M + L - 3):
    connectivity[j, 0] = j
    connectivity[j, 1] = j + 1

mesh = dolfinx.mesh.create_mesh(MPI.COMM_WORLD, connectivity, nodes, c_el)

with dolfinx.io.XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "w") as xdmf:
    xdmf.write_mesh(mesh)

yielding

1 Like

Thanks a lot, this is really helpful. I was not aware of this way of creating a 1D mesh.