# Cross coupling in DirichletCondition not supported -- conflict with documentation?

Mathematica 12.0.0.0 happily solves the trivial coupled differential system as follows:

NDSolve[{D[u[x], x] == 1, D[v[x], x] == 1, DirichletCondition[v[x] == 1, x == 0], DirichletCondition[u[x] == 0, x == 0]}, {u, v}, {x, 0, 1}]

but complains when given differently stated (but equivalent) boundary conditions:

NDSolve[{D[u[x], x] == 1, D[v[x], x] == 1, DirichletCondition[v[x] - u[x] == 1, x == 0], DirichletCondition[v[x] + u[x] == 1, x == 0]}, {u, v}, {x, 0, 1}]

NDSolve::fembdcc "Cross-coupling of dependent variables in DirichletCondition ... is not supported in this version"

The error message seems clear -- it does not like when u and v simultaneously appear in a Dirichlet condition. But why not? Indeed, the documentation of DirichletCondition seems to imply that a general equation is supported:

DirichletCondition[beqn,pred]: "In general, the boundary equation beqn needs to be affine linear in the dependent variables, i.e. h1 u1+ … = r, where hi and r can depend on any of the independent variables {x1,x2,…}."

DirichletCondition---Documentation

Without DirichletCondition NDSolve evaluates the solution:

{U, V} = NDSolveValue[{D[u[x], x] == 1, D[v[x], x] == 1,v - u == 1 , v + u == 1 }, {u, v}, {x, 0, 1}]
{V + U[0 ], V - U[0 ]}
(* {1,1} *)


Unfortunately using only one DirichletCondition DirichletCondition[v[x] - u[x] == 1 && v[x] + u[x], x == 0] doesn't work.

• Curious... thanks for this workaround. I think it may only work for ODEs. I tried the same thing with a PDE (with two independent variables), and unfortunately got the error again. With a PDE, Mathematica seems to generate a DirichletCondition internally. So it still seems useful to understand the behavior with DirichletCondition Aug 2, 2019 at 12:22
• For PDE you might use PeriodicBoundaries instead of coupled DirichletConditions: See 202645 and 202542 Aug 2, 2019 at 12:29
• thanks for the suggestion. I looked at the examples you sent, but although I can see how this method could allow you to "couple" a single dependent variable to itself (at different values of the independent variables) I'm not sure I see how PeriodicBoundaryCondition can be used to impose a Dirichlet condition, at least not in a straightforward manner. Aug 2, 2019 at 13:40
• Sorry für my misleading Suggestion. I think actual MMA can solve only explicit DirichletConditions. Aug 3, 2019 at 9:27
• Thanks nevertheless Ulrich! Aug 5, 2019 at 4:38