Solving 2 coupled pde
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to solve a system of 2 coupled pde (in MATLAB) of the format:
c1*(df/dt)+c2*(df/dz)+c3*(f)+c4*(g)=0
(dg/dt)=c5*f+c6*g
with Initial conditions as
f(0,t)=1, g(z,0)=0 and f(z,0)=0
0<f,g,z,t<1
I am getting the error:
Warning: Failure at t=5.414867e-02. Unable to meet integration tolerances without reducing
the step size below the smallest value allowed (1.110223e-16) at time t.
> In ode15s at 669
In pdepe at 317
In pdex4 at 13
Warning: Time integration has failed. Solution is available at requested time points up to
t=5.414805e-02.
> In pdepe at 323
In pdex4 at 13
Error using surf (line 75)
Data dimensions must agree.
Error in pdex4 (line 18)
surf(x,t,u1);
My code is
function pdex4
c1=(0.63*150*(10^-6))/(6.93*(10^-5)*3600);
c2=1;
c3=((1-0.63-0.27)*0.0045*150*(10^-6)*5021.8)/(6.93*(10^-5));
c4=-((1-0.63-0.27)*0.0045*150*(10^-6)*4.62*(10^3))/(1.03*6.93*(10^-5));
c5=(0.0045*3600*1.03*5021.8)/(4.62*(10^3));
c6=-0.0045*3600;
m = 0;
x = linspace(0,1,10);
t = linspace(0,1,1000000);
options=odeset('NonNegative',[]);
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t,options);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure
surf(x,t,u1);
title('u1(x,t)')
xlabel('Distance x')
ylabel('Time t')
figure
surf(x,t,u2);
title('u2(x,t)')
xlabel('Distance x')
ylabel('Time t')
function [c,f,s] = pdex4pde(x,t,u,DuDx)
c1=(0.63*150*(10-6))/(6.93*(10^-5)*3600);
c2=1;
c3=((1-0.63-0.27)*0.0045*150*(10^-6)*5021.8)/(6.93*(10^-5));
c4=-((1-0.63-0.27)*0.0045*150*(10^-6)*4.62*(10^3))/(1.03*6.93*(10^-5));
c5=(0.0045*3600*1.03*5021.8)/(4.62*(10^3));
c6=-0.0045*3600;
c = [c1; 1];
f = [-c2*u(1); 0];
s = [c3*u(1)+c4*u(2); c5*u(1)+c6*u(2)];
function u0 = pdex4ic(x)
u0 = [0; 0];
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)
pl = [-1; ul(2)-1];
ql = [1; 0];
pr = [-1; ur(2)-1];
qr = [1; 1];
Can you please tell me what changes should I make.
3 Kommentare
Torsten
am 19 Aug. 2015
I think the structure of your matrices A and B is wrong.
But yes: ode15s can handle sparse ODE systems resulting from the discretization of PDEs.
Best wishes
Torsten.
Antworten (1)
Walter Roberson
am 19 Aug. 2015
Those boundary conditions are incompatible.
You have f(0,t)=1, g(z,0)=0 and f(z,0)=0 . So f(z,t)=1 when z = 0. Consider then t = 0, then f(z,0) = 1 by the first boundary condition when z = 0. But in the third boundary condition you said f(z,0) = 0 for all z which has to include the case of z = 0.
With your boundary conditions being incompatible you are not going to be able to meet the integration tolerances.
0 Kommentare
Siehe auch
Kategorien
Mehr zu PDE Solvers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!