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

Complicated mixed boundary conditions

+2 votes

I plan to abandon my own 2D FEM-solver and switch to FEniCS. However, the boundary conditions of the problem I intend to solve are beyond simple Dirichlet or Neumann, and hence I need to know for sure that it is possible in FEniCS. It is a mixed boundary condition in a sense that it relates the normal derivative on a point of the boundary to the values over all of that boundary.

For a unit box $(x, y) \in [0, 1] \times [0, 1]$ for example, this would be a boundary condition:

$$ \frac{\partial}{\partial x} u(0, y) = f(y) \int_0^1 f(y') u(0, y') y' dy'$$

Where f is a known function. Would this be difficult to achieve?

As a bonus: the actual boundary condition would be more like

$$ \frac{\partial}{\partial x} u(0, y) = \sum_i j f_i(y) \int_0^1 f_i^*(y') u(0, y') y' dy'$$

with j the imaginary unit. I see possible profit / problems in the following:

  • Both f and u are complex-valued functions. I read there is no support for this yet, so I would have to write it as two coupled PDE's, both for the real and imaginary part, with corresponding BC's?
  • The $f_i$ are itself a solution of a 1D boundary valued eigenproblem on $x = 0$. Is it possible to inherit this 1D mesh from the 2D one, and to use solutions $f_i$ from this 1D problem?

Any thoughts would be very welcome. Note that had a look in the FEniCS book to get familiar with the software, but I haven't found much related problems.

Thanks,

Maarten

asked Jan 26, 2015 by maartent FEniCS User (3,910 points)

As a small reference for whomever stumbles across this question:

  • It is possible to implement this kind of boundary condition in FEniCS. It requires some matrix manipulations on a lower level though, which I did using petsc4py. The following question provides a clue on how to solve it: http://fenicsproject.org/qa/7541/ufl-unsupported-operand-type-s-for-form-and-form

  • Yes, one has to separate a complex-valued function in a real and imaginary part

  • Inherit a 1D mesh from a 2D mesh is possible, search for BoundaryMesh and SubMesh. Using functions that only exist on the 1D boundary as boundary conditions for the 2D case is not trivial yet, but I was told this will be implemented soon.

...