Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Membrane Model (Sievert’s Law Coupling)

A 2D membrane model with a shell-in-tube geometry: counter-current plug flow with radial diffusion. A membrane separates the inner retentate side from the outer annular permeate side, and a substance permeates from one side to the other through the membrane.

This notebook is the Sievert’s-law variant of the plain membrane model (membrane_module_2D.ipynb): instead of a driving force linear in concentration, the membrane flux follows the square root of partial pressure, which makes the interface condition nonlinear and requires a Newton loop.

On both sides the governing equation is:

∂c∂t+divz(v c)−divr(D divr(c))=0\frac{\partial c}{\partial t} + \mathrm{div}_z (v \, c) - \mathrm{div}_r (D \, \mathrm{div}_r(c)) = 0

At the retentate and permeate sides of the membrane, Sievert’s law gives the interface conditions:

D∂cret∂n=P (pperm−pret),RpermRretD∂cperm∂n=P (pret−pperm)D \frac{\partial c_\mathrm{ret}}{\partial n} = P \, (\sqrt{p_\mathrm{perm}} - \sqrt{p_\mathrm{ret}}), \qquad \frac{R_\mathrm{perm}}{R_\mathrm{ret}} D \frac{\partial c_\mathrm{perm}}{\partial n} = P \, (\sqrt{p_\mathrm{ret}} - \sqrt{p_\mathrm{perm}})

with the partial pressure taken from the ideal-gas relation p=RgTcp = R_g T c. Here nn is the outward normal of each subdomain. pymrm boundary conditions always use the outward normal (pitfall P1): the membrane interface is the upper radial boundary of the retentate domain, so there ∂/∂n=∂/∂r\partial/\partial n = \partial/\partial r, while it is the lower radial boundary of the permeate domain, so there ∂/∂n=−∂/∂r\partial/\partial n = -\partial/\partial r. The two conditions above look alike but therefore impose opposite-signed fluxes when written in terms of rr.

The notebook is organised as parameter and grid setup, a mass-balance check, and the implicit Newton-coupled solve, ending with a check of the boundary conditions actually imposed at the interface.

Implicit Coupling

Both sides are solved as one coupled system, as in the implicit-coupling section of the plain membrane model, but here the membrane flux follows Sievert’s law, N=P(pperm−pret)N = P(\sqrt{p_\mathrm{perm}} - \sqrt{p_\mathrm{ret}}), instead of a driving force linear in concentration. Because Sievert’s law is nonlinear in the interface concentration, the interface conditions are linearized and updated in a Newton loop instead of being assembled once.

Interface Matrices and Jacobian Assembly

Build the constant part of the coupled Jacobian (retentate and permeate transport, without the membrane coupling), then the Neumann-type interface matrices that turn an interface flux into an interface (Dirichlet) value. These are reused every Newton iteration to linearize Sievert’s law about the current interface concentrations.

Newton Iteration for the Sievert Coupling

At each iteration, the Sievert driving force P(pperm−pret)P(\sqrt{p_\mathrm{perm}} - \sqrt{p_\mathrm{ret}}) is linearized about the current interface concentrations (driving_force, regularized near cb=0c_b = 0 to keep its derivative finite), the interface matrices are rebuilt with the resulting local slope, and the coupled linear system is solved for the Newton step and the updated interface concentrations. The loop stops early once the residual norm drops below tol.

Plot and Balance Check

Plot the retentate and permeate concentration fields and confirm mass is conserved with print_balances().

<Figure size 640x480 with 2 Axes>
retentate side: inlet molar flow = 1.88934e-06, membrane molar flow out = 1.44650e-06, outlet molar flow = 4.42837e-07
retentate balance: -4.02605e-19
permeate side:  inlet molar flow = 0.00000e+00, membrane molar flow in  = 1.44650e-06, outlet molar flow = 1.44650e-06
permeate balance: 5.32784e-19
overall balance: -6.01182e-19

Checking the result

describe_bc prints a boundary-condition dictionary as the equation it actually imposes. ic_1_neumann and ic_2_neumann couple both fields, so a lists the retentate and permeate coefficients in order. As in the plain membrane model, the two conditions look alike, but because pymrm boundary conditions always use the outward normal (pitfall P1), the sign of the flux term flips between the retentate (inner, upper rr boundary) and permeate (outer, lower rr boundary) sides.

Retentate side interface condition (ic_1_neumann):
lower (r=0, outward normal -r): -1*dc/dr + 0*c = 0  [Neumann]
upper (r=0.005, outward normal +r): [0.0001, 0]*dc/dr + 0*c = 5e-06  [mixed or degenerate]

Permeate side interface condition (ic_2_neumann):
lower (r=0.0055, outward normal -r): [0, -0.00011]*dc/dr + 0*c = -5e-06  [mixed or degenerate]
upper (r=0.007, outward normal +r): 1*dc/dr + 0*c = 0  [Neumann]