# Coupled PDE system - problem solving

13 views (last 30 days)
Hi, I have the following set of equations, which for ease of sight I wrote in mathematica:
I am trying to use pdepe() to solve this system, but receive the infamous error: "Spatial discretization has failed."
My code is as follows:
Consts = [Cm VL VK VNa gL_ gK_ gNa_ Immax Imduration Vm0 a rho_i];
[mout,hout,nout,Vmout,tout,xout] = cableEqn(xAxis,tAxis,Consts);
function [mout,hout,nout,Vmout,tout,xout] = cableEqn(xAxis,tAxis,Consts)
m=0;
x=xAxis;
t=tAxis;
% constants
Cm=Consts(1);
VL=Consts(2);
VK=Consts(3);
VNa=Consts(4);
gL_=Consts(5);
gK_=Consts(6);
gNa_=Consts(7);
Immax = Consts(8);
Imduration = Consts(9);
Vm0=Consts(10);
a = Consts(11);
rho_i = Consts(12);
sol = pdepe(m,@pdefun,@pdeic,@pdebc,x,t);
mout = sol(:,:,1);
nout = sol(:,:,2);
hout = sol(:,:,3);
Vmout = sol(:,:,4);
tout=t;
xout=x;
function [c,f,s]=pdefun(x,t,u,DuDx)
mm=u(1);
nn=u(2);
hh=u(3);
Vm=u(4);
%conductivity functions
gNa =gNa_ * (mm^3) * hh;
gK = gK_ * (nn^4);
gL = gL_;
% currents
INa = gNa*(Vm-VNa);
IK = gK*(Vm-VK);
IL = gL*(Vm-VL);
Iion = INa+IK+IL;
Is = Im(t,Immax,Imduration);
c=[1; 1; 1; Cm/(a/(2*rho_i))];
f=[0; 0; 0; 1] .* DuDx;
s=[alpha_m(Vm)*(1-mm)-mm*beta_m(Vm); % m(t) part
alpha_h(Vm)*(1-hh)-hh*beta_h(Vm); % h(t) part
alpha_n(Vm)*(1-nn)-nn*beta_n(Vm); % n(t) part
-1*(Iion-Is)/(a/(2*rho_i))]; % Vm(t,x) part
end
function u0 = pdeic(x)
[ m0, n0, h0 ] = initVars( Vm0 );
u0=[m0; h0; n0; Vm0];
end
function [pa, qa, pb, qb] = pdebc(xa, ua, xb, ub, t)
pa=[0; 0; 0; 0];
qa=[0; 0; 0; 1];
pb=[0; 0; 0; 0];
qb=[0; 0; 0; 1];
end
end
As far as I can see, the problem might be from the first 3 equations which are basically ODE's, but I'm not sure and I don't really know what to do. The goal: solving the The Propagating Action Potential problem as you might've noticed.
Will be happy for your help. It's the first time I'm trying something with pdepe...

Torsten on 6 Jan 2017
pdepe is not suited to solve mixtures of PDEs and ODEs.
You will first have to discretize the PDE in x-direction and solve the resulting system of ODEs using ODE15S.
Look up "method of lines" for more details.
Best wishes
Torsten.

Stanislav Steinberg on 6 Jan 2017
Thanks, I thought so. I will try the method of lines then. Will update if further issues arise.