I’m trying to solve a problem where the Dirichlet boundary condition in one domain depends on what is calculated in the other domain. In this sense, the dirichlet boundary condition not known a priori. This problem is slightly more complex than the Poisson periodic boundary condition demo.

As a MWE, consider calculating the pressure drop through two sequential columns packed with porous materials. The pressure drop is estimated using a Darcy-type equation as -dp_i/dx = k_i for bed i on a domain [0, 1].

The boundary conditions are p_0(x=0)=2, and p_1(x=1)=2*p_0(x=1). The friction coefficients are k_0 = 1 = -k_1.