Boundary using system of pdepes
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the following pdes systèmes wirh four membres:R_j*dC_j/dt = 1000*(1+0.0025*x)^2 - 100*(1+0.0025*x) - R_j*C_j + R_(j-1)*C_(j-1) with initial and boundary conditions. C_j(x,t=0)=0;. 100*C_j(x=0,t)-1000*C_j(x=0,t)=f_j(t) dC_j(x=L,t)=0 R_j =[10000, 14000, 50000, 500]. I try to solve it with pdepe solver but i obtained results differents to another method. I would like to know if it is because of the definition of boundary conditions in m'y pdepe code. Heure ils the pdepe code
function pdex4 m = 0; x = linspace(0,250,100); t = linspace(0,10000,100);
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t); u1 = sol(:,:,1); u2 = sol(:,:,2); u3 = sol(:,:,3); u4 = sol(:,:,4);
figure surfc(x,t,u1) title('u1(x,t)') xlabel('Distance x') ylabel('Time t')
figure surfc(x,t,u2) title('u2(x,t)') xlabel('Distance x') ylabel('Time t')
figure surfc(x,t,u3) title('u3(x,t)') xlabel('Distance x') ylabel('Time t')
figure surfc(x,t,u4) title('u4(x,t)') xlabel('Distance x') ylabel('Time t')
figure plot(x,u1(10,:), x,u2(10,:), x,u3(10,:), x,u4(10,:)) title('Solution at t = 2') xlabel('Distance x') ylabel('u(x,2)') % -------------------------------------------------------------- function [c,f,s] = pdex4pde(x,t,u,DuDx) c = [10000; 14000; 50000; 500]; f = [1000*((1+0.0025*x)^2); 1000*((1+0.0025*x)^2); 1000*((1+0.0025*x)^2); 1000*((1+0.0025*x)^2)] .* DuDx ... -[100*(1+0.0025*x); 100*(1+0.0025*x); 100*(1+0.0025*x); 100*(1+0.0025*x)].* u; s = [-0.0079*10000*u(1); 0.0079*10000*u(1)-0.0000028*14000*u(2); 0.0000028*14000*u(2)-0.0000087*50000*u(3); 0.0000087*50000*u(3)-0.00043*500*u(4)]; % -------------------------------------------------------------- function u0 = pdex4ic(x); u0 = [0; 0; 0; 0]; % -------------------------------------------------------------- function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t) pl = [1.25*exp(-0.0089*t); 1.25044*(exp(-0.0010028*t)-exp(-0.0089*t)); (0.443684*1e-3*exp(-0.0089*t)+0.593431*exp(-0.0010028*t)-0.593874*exp(-0.0010087*t)); (-0.51674*1e-6*exp(-0.0089*t)+0.120853*1e-1*exp(-0.0010028*t)-0.122637*1e-1*exp(-0.0010087*t)+0.178925*1e-3*exp(-0.00143*t))]; ql = [1; 1; 1; 1]; pr = [100*(1+0.0025*100)*ur(1); 100*(1+0.0025*100)*ur(2); 100*(1+0.0025*100)*ur(3); 100*(1+0.0025*100)*ur(4)]; qr = [1; 1; 1; 1];
14 Kommentare
Torsten
am 6 Okt. 2023
Bearbeitet: Torsten
am 6 Okt. 2023
I just noticed that the normalization by 1000*((1+0.0025*xr)^2) was not necessary because
1000*((1+0.0025*xr)^2) * dC/dx = 0
implies
dC/dx = 0
Thus your boundary conditions in the code are in correspondence with your mathematical equations if you change the 100 by xr ( = 250) in
pr = [100*(1+0.0025*100)*ur(1); 100*(1+0.0025*100)*ur(2); 100*(1+0.0025*100)*ur(3); 100*(1+0.0025*100)*ur(4)];
Antworten (0)
Siehe auch
Kategorien
Mehr zu PDE Solvers finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




