Solving is taking infinite time
2 views (last 30 days)
Show older comments
Hello all, so i have a 59 equations linear system for my heat lab where i need to find temperature so for this reason i wrote the equation and used equations to matrix and linsolve. Even though with everybody in class the code works in mine there are no errors but it keeps on running for infinite time without showing anything. If you can helo or point me in some direction it will be appreciated.
k=18; dx=0.01; dy=0.01; h=500; dr=0.01; ri= 0.035; ro=0.0015;r1 = 0.025;
T_inf = 100;
DFI=pi/12;
T3=0; T6 = 0; T9 = 0; T12 = 0; T15=0; T18=0;
T30=0; T27=0; T24=0 ; T21 = 0;
syms T1 T2 T5 T8 T11 T14 T1 T4 T7 T10 T13 T33 T36 T39 T42 T45 T48 T51 T17 T20 T23 T26 T29 T32 T35 T38 T41 T44 T47 T50 T16 T19 T22 T25 T28 T31 T34 T37 T40 T43 T46 T49 T54 T57 T60 T63 T53 T56 T59 T62 T52 T55 T58 T61 q1 q2 q3 q4 q5 q6 ;
eq1 = 0.5*(T1-T2) + 0.5*(T3-T2) + (T5-T2) ==0;
eq2 = (T4-T5) + (T6-T5) + (T8-T5)+(T2-T5)==0;
eq3 = (T7-T8)+ (T9-T8)+(T11-T8) + (T5-T8)==0;
eq4= (T10-T11)+ (T12-T11)+ (T14-T11)+ (T8-T11)==0;
eq5 =0.5*(T13-T14)+0.5*(T15-T14)-q2 +(T11-T14) ==0;
eq6 = 0.5*(T2-T1) +0.5*(T4-T1)+h*dx*(T_inf-T1)==0;
eq7 = (T5-T4)+0.5*(T7-T4)+0.5*(T1-T4)+h*dx*0.5*(T_inf-T4)==0;
eq8 = (T8-T7)+0.5*(T10-T7)+0.5*(T4-T7) + h*dx*0.5*(T_inf-T7)==0;
eq9 = (T11-T10)+(T13-T10)+(T7-T10) + h*dx*(T_inf-T10) ==0;
eq10= 0.5*(T14-T13)+0.5*(T10-T13)+ h*dx*0.5*(T_inf-T13)-q3 ==0;
eq11 = (dr/(2*ri*DFI))*(T18-T15) +(ri*DFI/(2*dr))*(T14-T15)-q1 ==0;
eq12 = (dr/(2*ri*DFI))*(T36-T33)+(dr/(2*ri*DFI))*(T30-T33)+(ri*DFI/2*dr)*(T32-T33) ==0;
eq13 = (dr/(ri*DFI))*(T39-T36)+(dr/(ri*DFI))*(T33-T36)+(ri*DFI/2*dr)*(T35-T36) == 0;
eq14 = (dr/(ri*DFI))*(T42-T39)+(dr/(ri*DFI))*(T36-T39)+(ri*DFI/2*dr)*(T38-T39) ==0;
eq15 = (dr/(ri*DFI))*(T45-T42)+(dr/(ri*DFI))*(T39-T42)+(ri*DFI/2*dr)*(T41-T42) ==0;
eq16 = (dr/(ri*DFI))*(T48-T45)+(dr/(ri*DFI))*(T42-T45)+(ri*DFI/2*dr)*(T44-T45)==0;
eq17 = (dr/(ri*DFI))*(T51-T48)+(dr/(ri*DFI))*(T45-T48)+(ri*DFI/2*dr)*(T47-T48) ==0;
eq18 = (dr/(2*ri*DFI))*(T48-T51)+(ri*DFI/2*dr)*(T50-T51)+q1 ==0;
eq19 = (dr/(2*r1*DFI))*(T17-T14)+(r1*DFI/dr)*(T13-T14)+ (r1*DFI/2*dr)*(T15-T14)+q2 ==0;
eq20 = (dr/(r1*DFI))*(T20-T17)+(dr/(r1*DFI))*(T14-T17)+((r1*DFI)/dr)*(T16-T17)+(r1*DFI/dr)*(T18-T17) ==0;
eq21 = (dr/(r1*DFI))*(T23-T20)+(dr/(r1*DFI))*(T17-T20)+((r1*DFI)/dr)*(T19-T20)+(r1*DFI/dr)*(T21-T20) ==0;
eq22 = (dr/(r1*DFI))*(T26-T23)+(dr/(r1*DFI))*(T20-T23)+((r1*DFI)/dr)*(T22-T23)+(r1*DFI/dr)*(T24-T23) ==0;
eq23 = (dr/(r1*DFI))*(T29-T26)+(dr/(r1*DFI))*(T23-T26)+((r1*DFI)/dr)*(T25-T26)+(r1*DFI/dr)*(T27-T26) ==0;
eq24 = (dr/(r1*DFI))*(T32-T29)+(dr/(r1*DFI))*(T26-T29)+((r1*DFI)/dr)*(T28-T29)+(r1*DFI/dr)*(T30-T29) ==0;
eq25 = (dr/(r1*DFI))*(T35-T32)+(dr/(r1*DFI))*(T29-T32)+((r1*DFI)/dr)*(T31-T32)+(r1*DFI/dr)*(T33-T32)==0;
eq26 = (dr/(r1*DFI))*(T38-T35)+(dr/(r1*DFI))*(T32-T35)+((r1*DFI)/dr)*(T34-T35)+(r1*DFI/dr)*(T36-T35)==0;
eq27 = (dr/(r1*DFI))*(T41-T38)+(dr/(r1*DFI))*(T35-T38)+((r1*DFI)/dr)*(T37-T38)+(r1*DFI/dr)*(T39-T38) ==0;
eq28 = (dr/(r1*DFI))*(T44-T41)+(dr/(r1*DFI))*(T38-T41)+((r1*DFI)/dr)*(T40-T41)+(r1*DFI/dr)*(T42-T41) ==0;
eq29 = (dr/(r1*DFI))*(T47-T44)+(dr/(r1*DFI))*(T41-T44)+((r1*DFI)/dr)*(T43-T44)+(r1*DFI/dr)*(T45-T44) ==0;
eq30 = (dr/(r1*DFI))*(T50-T47)+(dr/(r1*DFI))*(T44-T47)+((r1*DFI)/dr)*(T45-T47)+(r1*DFI/dr)*(T48-T47)==0;
eq31 = -q2 +(dr/(2*r1*DFI))*(T47-T50)+((r1*DFI)/dr)*(T49-T50)+(r1*DFI/dr)*(T51-T50) ==0;
eq32 = (dr/(2*ro*DFI))*(T16-T13)+q3+((ro*DFI)/dr)*(T14-T13)+h*ro*DFI/2*(T_inf-T13) ==0;
eq33 = (dr/(2*ro*DFI))*(T19-T16)+(dr/(2*ro*DFI))*(T13-T16)+((ro*DFI)/dr)*(T17-T16)+h*ro*DFI/2*(T_inf-T16) ==0;
eq34 = (dr/(2*ro*DFI))*(T22-T19)+(dr/(2*ro*DFI))*(T16-T19)+((ro*DFI)/dr)*(T20-T19)+h*ro*DFI/2*(T_inf-T19) ==0;
eq35 = (dr/(2*ro*DFI))*(T25-T22)+(dr/(2*ro*DFI))*(T19-T22)+((ro*DFI)/dr)*(T23-T22)+h*ro*DFI/2*(T_inf-T22) ==0;
eq36 = (dr/2*ro*DFI)*(T28-T25)+(dr/(2*ro*DFI))*(T22-T25)+((ro*DFI)/dr)*(T26-T25)+h*ro*DFI/2*(T_inf-T25) ==0 ;
eq37= (dr/(2*ro*DFI))*(T31-T28)+(dr/(2*ro*DFI))*(T25-T28)+((ro*DFI)/dr)*(T29-T28)+h*ro*DFI/2*(T_inf-T28) ==0 ;
eq38= (dr/(2*ro*DFI))*(T34-T31)+(dr/(2*ro*DFI))*(T28-T31)+((ro*DFI)/dr)*(T32-T31)+h*ro*DFI/2*(T_inf-T31) ==0 ;
eq39= (dr/(2*ro*DFI))*(T37-T34)+(dr/(2*ro*DFI))*(T31-T34)+((ro*DFI)/dr)*(T35-T34)+h*ro*DFI/2*(T_inf-T34) ==0 ;
eq40= (dr/(2*ro*DFI))*(T40-T37)+(dr/(2*ro*DFI))*(T34-T37)+((ro*DFI)/dr)*(T38-T37)+h*ro*DFI/2*(T_inf-T37)==0 ;
eq41= (dr/(2*ro*DFI))*(T43-T40)+(dr/(2*ro*DFI))*(T37-T40)+((ro*DFI)/dr)*(T41-T40)+h*ro*DFI/2*(T_inf-T40) ==0;
eq42= (dr/(2*ro*DFI))*(T46-T43)+(dr/(2*ro*DFI))*(T40-T43)+((ro*DFI)/dr)*(T44-T43)+h*ro*DFI/2*(T_inf-T43)==0;
eq43= (dr/(2*ro*DFI))*(T49-T46)+(dr/(2*ro*DFI))*(T43-T46)+((ro*DFI)/dr)*(T47-T46)+h*ro*DFI/2*(T_inf-T46) ==0 ;
eq44 = -q3+(dr/(2*ro*DFI))*(T43-T49)+((ro*DFI)/dr)*(T50-T49)+h*ro*DFI/2*(T_inf-T49) ==0;
eq45 = 0.5*(T50-T51)+ (T54-T51) + q4 ==0;
eq46 = (T53-T54) + 0.5*(T57-T54)+0.5*(T51-T54)==0;
eq47 = (T56-T57)+0.5*(T60-T57)+0.5*(T54-T57) ==0;
eq48 = (T59-T60)+ 0.5*(T63-T60) +0.5*(T57-T60) ==0;
eq49 = 0.5*(T62-T63) + 0.5*(T60-T63) ==0;
eq50 = 0.5*(T51-T50) + 0.5*(T49-T50)+ 0.5*(T53-T50)+ q5 ==0;
eq51 = (T54-T53) +(T52-T53)+(T56-T53) + (T50-T53)==0;
eq52 = (T57-T56)+ (T55-T56)+(T59-T56)+(T53-T56)==0;
eq53 = (T60-T59) +(T56-T59)+(T62-T59)+ (T56-T59)==0;
eq54 = 0.5*(T61-T62)+0.5*(T59-T62) +(T63-T62) ==0;
eq55 = 0.5*(T50-T49)+ 0.5*(T52-T49)+q6+h*dx*0.5*(T_inf - T49)==0;
eq56 = (T53-T52)+ 0.5*(T55-T52)+ 0.5*(T49-T52) + h*dx*(T_inf - T52)==0;
eq57 = (T54-T55)+ 0.5*(T58-T55)+ 0.5*(T52-T55) + h*dx*(T_inf - T55) ==0;
eq58 = (T59-T58)+ 0.5*(T61-T58)+ 0.5*(T55-T58) + h*dx*(T_inf - T58) ==0;
eq59 = 0.5*(T62-T61)+0.5*(T58-T61) + h*dx*0.5*(T_inf - T61) ==0;
[A,B] = equationsToMatrix([eq1,eq2,eq3,eq4,eq5, eq6, eq7, eq8, eq9, eq10,eq11,eq12, eq13, eq14, eq15, eq16, eq17, eq18, eq19, eq20, eq21 eq22,eq23,eq24,eq25, eq26 ,eq27, eq28, eq29, eq30, eq31, eq32, eq33,eq34,eq35,eq36,eq37, eq38,eq39,eq40,eq41, eq42, eq43, eq44, eq45, eq46, eq47, eq48, eq49, eq50, eq51, eq52,eq53, eq54, eq55, eq56,eq57,eq58,eq59],[ T2 T5 T8 T11 T14 T1 T4 T7 T10 T13 T33 T36 T39 T42 T45 T48 T51 T17 T20 T23 T26 T29 T32 T35 T38 T41 T44 T47 T50 T16 T19 T22 T25 T28 T31 T34 T37 T40 T43 T46 T49 T54 T57 T60 T63 T53 T56 T59 T62 T52 T55 T58 T61 q1 q2 q3 q4 q5 q6]);
X = linsolve(A,B);
for x=X
double(x)
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!