Error while using pdepe

3 vues (au cours des 30 derniers jours)
Akshat Koolwal
Akshat Koolwal le 27 Mar 2021
I am trying to solve a set of partial differential equations but the system returns the following error -:
Error using pdepe (line 293)
Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.
The code with the local functions is as follows -
clc;
clear all;
global k_10 k_20 E2_by_R E1_by_R h_1 h_2 v_r rho_r C_pr U_1 d_1 d_2 U_2 n d_3 rho_c C_pc v_c L rho_w C_pw ;
%% parameters
d_1 = 0.02; %m
d_2 = 0.024; %m
d_3 = 1; %m
n = 1200;
L = 6; %m
rho_r = 985; %kg/m3
rho_w = 7800; %kg/m3
rho_c = 998; %kg/m3
C_pr = 4.05; %kJ/kg*K
C_pw = 0.71; %kJ/kg*K
C_pc = 4.18; %kJ/kg*K
U_1 = 2.8; %kJ/m2*K*s
U_2 = 2.56; %kJ/m2*K*s
k_10 = 5.61e16; %/s
k_20 = 1.128e16; %/s
E1_by_R = 13477; %K
E2_by_R = 15290; %K
h_1 = 5.8e4; %kJ/kmol
h_2 = 1.8e4; %kJ/kmol
c_A0 = 2.85; %kmol/m3
T_r0 = 323; %K
T_c0 = 293; %K
q_r = 0.05;
q_c = 0.35;
f_r = n*pi*d_1*d_1/4;
f_c = pi*(d_3*d_3 - n*d_2*d_2)/4;
v_r = q_r/f_r; %m/s
v_c = q_c/f_c;
z = linspace(0,6,100);
t = linspace(0,1000,1000);
m = 0;
sol = pdepe(m,@pdefun,@pdeic,@pdebc,z,t);
y1 = sol(:,:,1);
y2 = sol(:,:,2);
y3 = sol(:,:,3);
y4 = sol(:,:,4);
y5 = sol(:,:,5);
function [c,f,s] = pdefun(z,t,y,dydz)
global k_10 k_20 E2_by_R E1_by_R h_1 h_2 v_r rho_r C_pr U_1 d_1 d_2 U_2 n d_3 rho_c C_pc v_c L rho_w C_pw;
c_A = y(1)
c_B = y(2)
T_r = y(3)
T_w = y(4)
T_c = y(5)
k_1 = k_10*exp(-E1_by_R/T_r);
k_2 = k_20*exp(-E2_by_R/T_r);
h_r = h_1*k_1*c_A+h_2*k_2*c_B;
s1 = -k_1*c_A;
s2 = (k_1*c_A-k_2*c_B);
s3 = (h_r/(rho_r*C_pr) - 4*U_1*(T_r-T_w)/(d_1*rho_r*C_pr));
s4 = 4*(d_1*U_1*(T_r-T_w)+d_2*U_2*(T_c-T_w))/(rho_w*C_pw*(d_2*d_2-d_1*d_1));
s5 = ((4*n*d_2*U_2*(T_w-T_c))/((d_3^2 - n*d_2^2)*rho_c*C_pc));
c = [1;1;1;1;1]
f = [-v_r*c_A;-v_r*c_B;-v_r*T_r;0;v_c*T_c]
s = [s1;s2;s3;s4;s5]
end
function u0 = pdeic(z)
u0 = [2.85;0;323;307.30;293];
end
function [pl,ql,pr,qr] = pdebc(zl,yl,zr,yr,t)
pl = [yl(1)-2.85;yl(2)-0;yl(3)-323;0;0];
pr = [0;0;0;0;yr(5)-293];
ql = [0;0;0;1;0];
qr = [0;0;0;1;0];
end

Réponses (1)

Ananya Tewari
Ananya Tewari le 30 Mar 2021
The specified error generally arises when the initial conditions are inconsistent with boundary conditions. Try to rectify your code along with all the initial and boundary conditions.
Please refer to this answer for a solution
Refer to this doc to understand more about pdepe()

Catégories

En savoir plus sur Biological and Health Sciences dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by