# Compressible flow through a porous medium with a variable inlet concentration

I'm trying to solve the transient behaviour of a compressible flow through a porous medium (porosity is $\epsilon$) where the fraction of B in A ($\phi$) changes with time. The equations that I found are the following:

• continuity: $\frac{\partial \rho} {\partial t}+\frac{1}{\epsilon}\frac{\partial \rho u} {\partial x}=0$
• fraction of component B $\frac{\partial \rho \phi} {\partial t}+\frac{1}{\epsilon}\frac{\partial \rho u \phi} {\partial x}=0$
• equation of state: $P = \rho \cdot R \cdot T \cdot Z(P,\phi)$
• Darcy: $u = -\frac{k}{\mu} \frac{\partial P} {\partial x}$

The imposed boundary conditions are: $\phi=\phi(t)$, $P(x=L)=P_{back}$ and

$P(x=0)=P_{inlet}$ or $u(x=0)=u_{inlet}$

How should I proceed with this problem using a finite differences approach? Filling the third equation in the fourth yields an expression of $u$ as function of $\rho$ which can be used in the first two equations. So one would get:

• continuity: $\frac{\partial \rho} {\partial t}+K\frac{\partial \rho \frac{\partial \rho \cdot Z} {\partial x}} {\partial x}=0$
• fraction of component B: $\frac{\partial \rho \phi} {\partial t}+K\frac{\partial \rho \phi \frac{\partial \rho \cdot Z}{\partial x}} {\partial x}=0$

Is this a good way in solving the problem? I would proceed with using a discretization scheme for the spatial derivative and using Runge-Kutta to find the time derivative. Then I would get $\rho$ and $\rho \cdot \phi$. But can I do this, because $\rho = f(\phi)$ so there is also a coupling.

A last question is, how should I impose the boundary condition for $u$? Because $u$ is not in these last two equations anymore.

Thanks

Use $\partial \rho \phi = \rho \partial \phi + \phi \partial \rho$ in the equation for the component fraction, then apply the continuity equation to obtain \begin{equation} \rho \frac{\partial \phi} {\partial t} + \frac1\epsilon \rho u \frac{\partial \phi}{\partial x} = 0. \end{equation} Assuming $\rho > 0$ in the whole domain, it can be canceled in this equation. Substitute $u$ with Darcy's equation as before and solve this equation for $\phi$ using the approach you suggested and then use $\rho = f(\phi)$ to get $\rho$. Alternatively, if $f$ can be inverted, you might as well solve the original continuity equation for $\rho$ and get $\phi$ as $\phi = f^{-1}(\rho)$.
As for the boundary condition for $u$, substitute the equation of state and Darcy's equation into $u(0) = u_{inlet}$ and discretize the spatial derivative. Though I'm not sure if the boundary conditions described in your question are consistent with the problem you're trying to solve.