# Boundary conditions the diffusion equation for a porous medium

Consider a sponge in contact with water from one side, and all the other sides are insulated. For the sake of simplicity, imagine that the porosity is uniform. What will be the boundary and initial conditions for solving the diffusion equation

$$\frac{\partial c}{\partial t} = D \frac{\partial^2 c}{\partial x^2}$$

• Quick guess: impose reflecting boundary conditions on the insulated sides, non zero boundary conditions on the side touching water. The initial condition (inside the sponge) would depend on how much water has already diffused in the sponge. – Ton Mar 23 '18 at 15:55
• @Ton The boundary condition for the insulated sides is obviously Neumann, $\frac{\partial c}{\partial x}=0$. The initial condition is zero water in the sponge. BUT, how to set the water concentration at the diffusing side, and how to consider the porosity factor? – Yoria Mar 23 '18 at 15:59
• Porosity factor depends on coefficients, the main option in the linear case is to impose time-space dependency of $D=D(t,x)$ (where high values of $D(t,x)$ correspond to high diffusivity at $(t,x)$). A more sophisticated option would be to consider fractional derivatives in space and/or time. I would set the water concentration at the diffusing side by imposing non-zero boundary condition, i.e. $\phi=c> 0$ on $\partial \text{Sponge}\cap\text{Water}.$ – Ton Mar 23 '18 at 16:11
• @Ton your boundary condition makes sense, but how to implement it for solving the PDE? – Yoria Mar 23 '18 at 16:17
• Solving it analytically? (for $D$ positive constant) I would guess that if the PDE is wellposed in some sense, the solution can be written as $c(t,x)=\mathbb E[\phi(|B|^x(t\wedge \tau_{\partial}(x)))]$, where $|B|^x(s)$ is a Brownian motion run at $2D$-speed started at $x\in\text{Sponge}$ reflected at the boundary $\partial\text{Sponge}\cap \text{Water}^c$, and $\tau_{\partial}(x)$ is the first time $|B|^x$ hits $\partial\text{Sponge}\cap \text{Water}$, where $\phi$ is your initial condition on $\text{Sponge}\cup\partial\text{Sponge}\cap \text{Water}$. – Ton Mar 23 '18 at 16:39