2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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$ $\endgroup$ – whpowell96 Apr 17 at 3:37
  • $\begingroup$ 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! $\endgroup$ – Anant Shirsath Apr 17 at 8:36
  • $\begingroup$ 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? $\endgroup$ – Wolfgang Bangerth Apr 17 at 15:54
  • $\begingroup$ @WolfgangBangerth Yes, analytically! But if we want an iterative process then I reckon ODE45 will be more useful and accurate, wouldn't it? $\endgroup$ – Anant Shirsath Apr 17 at 21:05
  • 1
    $\begingroup$ @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? $\endgroup$ – Wolfgang Bangerth Apr 18 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.