# Modelling of Stefan Maxwell equation

I am trying to solve Maxwell Stefan's equation over a membrane to get the transient mole fraction distribution over the membrane thickness 'z'. But somehow I am not able to code it using ODE45, more likely I am not able to write the system to solve using ODE45. It will be really great if someone can help me with the primary syntaxes and function. The equation I am trying to solve is

$$\frac{dy_{H_2}}{dz}={\frac{1}{C \times D_{H_2,{H_2O}}}}\left[y_{H_2}(N_{H_2}+N_{H_2O})-N_{H_2}\right]$$

where C is concentration, $$D_{H_2,H_2O}$$ is the binary diffusion coefficient, N is molar flux and y is mole fraction

Thank you in advance.

• How does the index $j$ play into these equations? You have an entire matrix of $D_{ij}$s as well as $N$ indexed by $j$ Apr 17 '20 at 3:37
• i and j are not matrix indices, they are species involved in binary diffusion, e.g. i = hydrogen and j=water, I will edit it! Apr 17 '20 at 8:36
• So do I see this right that, in reality, the equation simply has the form $y'(t)=Cy(t)-D$ where $y(t)$ is the solution and $C,D$ are constants? Apr 17 '20 at 15:54
• @WolfgangBangerth Yes, analytically! But if we want an iterative process then I reckon ODE45 will be more useful and accurate, wouldn't it? Apr 17 '20 at 21:05
• @AnantShirsath: But what can be more accurate than writing down the exact solution as a function of $C$ and $D$, i.e., the various coefficients you have in the equation? Apr 18 '20 at 1:46