I am solving the following pde that is discretized in space using method of lines, in MATLAB using ode15s.

$$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$ with initial condition $$c(x,0) = 4000$$ and with Dirichlet boundary condition

$$C(x=0,t>0) = 4100$$

Neumann boundary condition $$\frac{\partial C}{\partial x}=0\text{ at } x=L ; t>0.$$

function DiffusionConvectionMATLAB
format short
global D
m = 0;
x = linspace(0,60,10);
t = 0.1:0.1:2;
D = 900;
sol = pdepe(m,@pdefun,@icfun,@bcfun,x,t)
    function [g,f,s] = pdefun(x,t,c,DcDx)
    v = 200;
    g = 1;
    f = D*DcDx;
    s = -v*DcDx;

    function c0 = icfun(x)
    c0 = 4000;

    function [pl,ql,pr,qr] = bcfun(xl,cl,xr,cr,t)
    pl = cl-4100;
    ql = 0;
    pr = 0;
    qr = 1;

From what I understand, the above pde is solved as a differential algebraic equation(DAE) in MATLAB using BDF solvers.

Could someone explain the actual steps involved in solving the above transport equation as a DAE? I would like to understand and code it up myself.

  • 1
    $\begingroup$ As far as I see, pdepe is for solving parabolic-elliptic PDEs in 1d. Where do you see that its solving the equation as dae? $\endgroup$ – VorKir Jan 6 at 20:21
  • $\begingroup$ @VorKir It is mentioned towards the end of the documentation provided in this link $\endgroup$ – Natasha Jan 7 at 5:22
  • 1
    $\begingroup$ There is an article about ode15s. Also see p. 481 of "Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems" $\endgroup$ – homocomputeris Jan 11 at 13:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.