Error: singular Jacobian encountered

1 view (last 30 days)
Alessandro
Alessandro on 5 Mar 2014
Edited: Walter Roberson on 5 Mar 2014
Hello,
I am trying to solve nonlinear differential equations with boundary values. My system works like a heat exchanger.
For length's small values (here Z=2) Matlab seems to solve perfectly my system. However when I increase the value (Z=10) the following message appears:
??? Error using ==> bvp4c at 203
Unable to solve the collocation equations -- a singular
Jacobian encountered
Does someone have an idea where the error could come from?
Many thanks in advance for your assistance.
Here are the following functions used for my system:
clear all
global L Lp kh G Cp K Ax Te Tw Td Refilm he Re hd k u rho g v rhomix;
Z=2;
r=0.0045;
Ax=pi*r^2;
G=0.2;
Gx=G/Ax;
Cp=4.185;
R=1;
L=G*R;
Lp=L/(pi*2*r);
kh=2.1*(Gx/1000)^1.27*(Lp/1000)^(-0.29);
K=150;
Te=20;
Td=70;
Tw=Te;
solinit=bvpinit(linspace(0,Z,100),[Te Tw L 0 Td]);
sol=bvp4c(@dew1,@m1,solinit);
z=linspace(0,Z,100);
y=deval(sol,z);
figure(1);
plot(z,y(1,:),z,y(2,:),z,y(5,:));
xlabel('Distance [m]')
ylabel('Temperature [°C]')
leg=legend('Te','Tw','Td');
figure(2);
plot(z,y(3,:),z,y(4,:));
xlabel('Distance [m]')
ylabel('Flux [g/s]')
leg=legend('L','F');
function [F]= dew1(z,y)
global kh G Lp Cp K Ax Refilm he Re hd k u rho g v rhomix;
[He,We]=psychro(y(1));
[Hd,Wd]=psychro(y(5));
[Hw,Ww]=psychro(y(2));
dt=0.1;
[Hep,Wep]=psychro(y(1)+dt);
[Hen,Wen]=psychro(y(1)-dt);
[Hdp,Wdp]=psychro(y(5)+dt);
[Hdn,Wdn]=psychro(y(5)-dt);
m1=(Wep-Wen)/(2*dt);
m2=(Wdp-Wdn)/(2*dt);
m3=(Hep-Hen)/(2*dt);
m4=(Hdp-Hdn)/(2*dt);
n1=pi*0.01;
n2=pi*0.009;
F=[kh*n2*(Hw-He)/(G*m3);
(kh*n2*(m1-m3*Cp*y(2))*(Hw-He)-m3*K*n1*(y(5)-y(2)))/(m3*y(3)*Cp);
kh*n2*(Hw-He);
-G*m4*(K*n1*(y(5)-y(2)))/(G*m2+y(4)*Cp-G*m4*Cp*y(5));
(K*n1*(y(5)-y(2)))/(G*m2+y(4)*Cp-G*m4*Cp*y(5))];
end
function [F]=m1(ya,yb)
global L Te Tw Td;
%[Te Tw L F Td]
F=[ya(1)-Te
yb(2)-Td
yb(3)-L
yb(4)
yb(5)-(yb(1)+0.5)];
end
function [H,W]=psychro (T)
P=10^(8.07131-1730.63/(233.426+T))*101235/760;
H=P*18/(28.8*(101235-P));
Cs=4.185*H+1;
W=Cs*T+H*2260;
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!