This is a follow-up on How to handle discontinuity in diffusion coefficient?

Consider diffusion of $ u(t,x)$ on the domain $ x \in [0,2]$ with some simple boundary conditions such as $ u(0) = 2, u(1) = 1$ .

Our domain is split into two parts: $ [0,1)$ on the left and $ (1,2]$ on the right, with different diffusion coefficients, e.g. $ D^\text{left} = 1, D^\text{right} = 3$ .

The diffusion equation is: $ $ \partial_t u = \partial_x (D \partial_x u) $ $

**So far, this is the summary of the linked question.**

This time we also have a membrane at $ x=1$ , imposing the following condition on the fluxes at $ x=1$ : $ $ D^\text{left} \partial_x u^\text{left} = D^\text{right} \partial_x u^\text{right} = d^\text{membrane} (u^\text{right} – u^\text{left}) $ $

What is the cleanest way to model this with `NDSolve`

? Is there a way to preserve the sharp conditions at $ x=1$ ? Perhaps one approximation that could be used is to consider a membrane of finite thickness, having a very high diffusion coefficient of its own. However, this is really a hack. Is it possible to solve the equation on the two half-domains “separately” and couple the boundary conditions at $ x=1$ ?