Hello everyone...
I have the following equations need to be solved simultanously all these equations depend on the value of "p_1t" calculated from the F(54) ...
%parameters for membrane modeling
function F = eqns(m)
pi= 3.142; d=0.007; n=32;f=0.007;L=2.4;
D1_L1=0.00000346;l_L1=0.00003;R=8.314;T=296;B_L1=30*10^-17;
D2_L1=7.4*10^-7;D1_L2=2.36*10^-4;D2_L2=5.031*10^-5;l_L2=3*10^-3;
B_L2=6.5*10^-13;rho_z=1796;l_z=0.7*10^-6;C1_satA=31.43;b1_A=3.57*10^-8;
C2_satA=19.91;b2_A=6.2*10^-6;C1_satB=44;C2_satB=11.53;b1_B=5*10^-9;b2_B=1.73*10^-8;
P=25*101325;P2=1*101325;D1_o=8.1*10^-8;z=2.5;D2_o=0.45*10^-8;
a1=4.4804;b1=-2.917;a2=1.3095;b2=5.3528;M1=2;M2=44;A=1.6;del_x=0.001;
%boundary conditions
F1t_0=5;
F2t_0=5;
F1s_0=1*10^-6;
F2s_0=1*10^-5;
p_0t=25*101325;
rho_1=2.04998;rho_2=44.9871;
% input functions
c1=m(1);
c2=m(2);
x1=m(3);
x2=m(4);
rho_g=m(5);
q1f=m(6);
q2f=m(7);
q1p=m(8);
q2p=m(9);
delq1=m(10);
delq2=m(11);
tet1=m(12);
tet2=m(13);
bet1=m(14);
bet2=m(15);
phi1=m(16);
phi2=m(17);
ebc1=m(18);
ebc2=m(19);
D1=m(20);
D2=m(21);
D11=m(22);
D22=m(23);
D12=m(24);
eta=m(25);
J1z=m(26);
J2z=m(27);
j1_L1=m(28);
j2_L1=m(29);
j1_L2=m(30);
j2_L2=m(31);
del_pL1=m(32);
del_pL2=m(33);
F1t_1=m(34);
F1s_1=m(35);
F2t_1=m(36);
F2s_1=m(37);
p1_per=m(38);
p2_per=m(39);
del_p1L1=m(40);
del_p2L2=m(41);
del_p1L2=m(42);
del_p2L1=m(43);
F_t=m(44);
F_s=m(45);
M_avg=m(46);
ut=m(47);
p_1t=m(48);
p1z=m(49);
p2z=m(50);
p1_L1=m(51);
J1=m(52);
J2=m(53);
p2_L1=m(54);
%equations in the form of equal to zero or functional forms
F(1)=c1-(C1_satA*((b1_A*P)/1+b1_A*P))-(C1_satB*((b1_B*P)/1+b1_B*P));
F(2)=c2-(C2_satA*((b2_A*P)/1+b2_A*P))-(C2_satB*((b2_B*P)/1+b2_B*P));
F(3)=x1-c1/(c1+c2);
F(4)=x2-c2/(c1+c2);
F(5)=rho_g-(P*M_avg)/R*T;
F(6)=q1f-1/rho_1*((C1_satA*((b1_A*P)/1+b1_A*P))-(C1_satB*((b1_B*P)/1+b1_B*P)));
F(7)=q2f-1/rho_2*((C2_satA*((b2_A*P)/1+b2_A*P))-(C2_satB*((b2_B*P)/1+b2_B*P)));
F(8)=q1p-1/rho_1*((C1_satA*((b1_A*P2)/1+b1_A*P2))-(C1_satB*((b1_B*P2)/1+b1_B*P2)));
F(9)=q2p-1/rho_2*((C2_satA*((b2_A*P2)/1+b2_A*P2))-(C2_satB*((b2_B*P2)/1+b2_B*P2)));
F(10)=delq1-(q1f-q1p);
F(11)=delq2-(q2f-q2p);
F(12)=tet1-c1/C1_satA;
F(13)=tet2-c2/C2_satA;
F(14)=bet1-sqrt(1-4*tet1*(1-tet1)*(1-1/tet1));
F(15)=bet2-sqrt(1-4*tet2*(1-tet2)*(1-1/tet2));
F(16)=phi1-1*exp(0.35*tet1);
F(17)=phi2-1.5*exp(-0.5*tet2);
F(18)=ebc1-((bet1-1+2*tet1)*phi1)/2*(1-tet1);
F(19)=ebc2-((bet2-1+2*tet2)*phi2)/2*(1-tet2);
F(20)=D1-D1_o*((1+ebc1)^z-1)/(1+ebc1/phi1)^z;
F(21)=D2-D2_o*((1+ebc2)^z-1)/(1+ebc2/phi2)^z;
F(22)=D11-D1/(a1+b1*tet1);
F(23)=D22-D2/(a2+b2*tet2);
F(24)=D12-((D11)^x1)*((D22)^x2);
F(25)=eta-(1.302*10^-5*x1)-(1.493*10^-5*x2);
F(26)=J1z-((rho_z*D1)/l_z)*(((1+x1*(D2/D12)*delq1)-(x1*(D2/D12)*delq2))/(1+x1*D1/D12+x2*D1/D12));
F(27)=J2z-((rho_z*D2)/l_z)*(((1+x2*(D1/D12)*delq2)-(x2*(D1/D12)*delq1))/(1+x1*D1/D12+x2*D1/D12));
F(28)=j1_L1-((D1_L1)/(R*T*l_L1)*(del_p1L1))-(((B_L1)/(R*T*2*eta*l_L1))*(p1z+p1_L1)*(del_pL1));
F(29)=j2_L1-(((D2_L1)/(R*T*l_L1))*(del_p2L1))-(((B_L1)/(R*T*2*eta*l_L1))*(p2z+p2_L1)*(del_pL1));
F(30)=j1_L2-(((D1_L2)/(R*T*l_L2))*(del_p1L2))-(((B_L2)/(R*T*2*eta*l_L2))*(p1_L1+p2_per)*(del_pL2));
F(31)=j2_L2-(((D2_L2)/(R*T*l_L2))*(del_p2L2))-(((B_L2)/(R*T*2*eta*l_L2))*(p2_L1+p2_per)*(del_pL2));
F(32)=j1_L1-j1_L2;
F(33)=j1_L1-J1z;
F(34)=j2_L1-j2_L2;
F(35)=j2_L1-J2z;
F(36)=J1-J1z;
F(37)=J2-J2z;
F(38)=del_pL1-del_p1L1-del_p2L1;
F(39)=del_pL2-del_p1L2-del_p2L2;
F(40)=(F1t_0-F1t_1)/del_x+J1*pi*d*n;
F(41)=(F1s_0-F1s_1)/del_x+J1*pi*d*n;
F(42)=(F2t_0-F2t_1)/del_x+J2*pi*d*n;
F(43)=(F2s_0-F2s_1)/del_x+J2*pi*d*n;
F(44)=p1_per-x1*P2;
F(45)=p2_per-x2*P2;
F(46)=del_p1L1-p1z+p1_L1;
F(47)=del_p2L2-p2_L1+p2_per;
F(48)=del_p1L2-p1_L1+p2_per;
F(49)=del_p2L1-p2z+p2_L1;
F(50)=F_t-F1t_1-F2t_1;
F(51)=F_s-F1s_1-F2s_1;
F(52)=M_avg-(x1*M1)-(x2*M2);
F(53)=ut-((F1t_1)*M_avg)/rho_g*A;
F(54)=10*p_0t-10*p_1t+(2*f*pi*rho_g*(ut)^2)/d;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m0=[1,1,0.1,0.9,50,1,1,1,1,0.8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,3,2,2,1,5,1,1,1,1,1,1,1,1,1,10,10,44,14,24];
fun=@eqns;
options = optimoptions('fsolve','MaxFunEvals',200000)
m = fsolve(fun,m0,options)
after running this code the following error appears...
"""Solver stopped prematurely.
fsolve stopped because it exceeded the iteration limit,
options.MaxIter = 400 (the default value).""""
is there any method to solve these equations because when Iterations stopped the solution is wrong/not varifying the system.??
is there any possibility to write this code in a cascade functions to get better solution...??
is there possibility to write this code in a stair case functions...
thank you everyone...
I have the following equations need to be solved simultanously all these equations depend on the value of "p_1t" calculated from the F(54) ...
%parameters for membrane modeling
function F = eqns(m)
pi= 3.142; d=0.007; n=32;f=0.007;L=2.4;
D1_L1=0.00000346;l_L1=0.00003;R=8.314;T=296;B_L1=30*10^-17;
D2_L1=7.4*10^-7;D1_L2=2.36*10^-4;D2_L2=5.031*10^-5;l_L2=3*10^-3;
B_L2=6.5*10^-13;rho_z=1796;l_z=0.7*10^-6;C1_satA=31.43;b1_A=3.57*10^-8;
C2_satA=19.91;b2_A=6.2*10^-6;C1_satB=44;C2_satB=11.53;b1_B=5*10^-9;b2_B=1.73*10^-8;
P=25*101325;P2=1*101325;D1_o=8.1*10^-8;z=2.5;D2_o=0.45*10^-8;
a1=4.4804;b1=-2.917;a2=1.3095;b2=5.3528;M1=2;M2=44;A=1.6;del_x=0.001;
%boundary conditions
F1t_0=5;
F2t_0=5;
F1s_0=1*10^-6;
F2s_0=1*10^-5;
p_0t=25*101325;
rho_1=2.04998;rho_2=44.9871;
% input functions
c1=m(1);
c2=m(2);
x1=m(3);
x2=m(4);
rho_g=m(5);
q1f=m(6);
q2f=m(7);
q1p=m(8);
q2p=m(9);
delq1=m(10);
delq2=m(11);
tet1=m(12);
tet2=m(13);
bet1=m(14);
bet2=m(15);
phi1=m(16);
phi2=m(17);
ebc1=m(18);
ebc2=m(19);
D1=m(20);
D2=m(21);
D11=m(22);
D22=m(23);
D12=m(24);
eta=m(25);
J1z=m(26);
J2z=m(27);
j1_L1=m(28);
j2_L1=m(29);
j1_L2=m(30);
j2_L2=m(31);
del_pL1=m(32);
del_pL2=m(33);
F1t_1=m(34);
F1s_1=m(35);
F2t_1=m(36);
F2s_1=m(37);
p1_per=m(38);
p2_per=m(39);
del_p1L1=m(40);
del_p2L2=m(41);
del_p1L2=m(42);
del_p2L1=m(43);
F_t=m(44);
F_s=m(45);
M_avg=m(46);
ut=m(47);
p_1t=m(48);
p1z=m(49);
p2z=m(50);
p1_L1=m(51);
J1=m(52);
J2=m(53);
p2_L1=m(54);
%equations in the form of equal to zero or functional forms
F(1)=c1-(C1_satA*((b1_A*P)/1+b1_A*P))-(C1_satB*((b1_B*P)/1+b1_B*P));
F(2)=c2-(C2_satA*((b2_A*P)/1+b2_A*P))-(C2_satB*((b2_B*P)/1+b2_B*P));
F(3)=x1-c1/(c1+c2);
F(4)=x2-c2/(c1+c2);
F(5)=rho_g-(P*M_avg)/R*T;
F(6)=q1f-1/rho_1*((C1_satA*((b1_A*P)/1+b1_A*P))-(C1_satB*((b1_B*P)/1+b1_B*P)));
F(7)=q2f-1/rho_2*((C2_satA*((b2_A*P)/1+b2_A*P))-(C2_satB*((b2_B*P)/1+b2_B*P)));
F(8)=q1p-1/rho_1*((C1_satA*((b1_A*P2)/1+b1_A*P2))-(C1_satB*((b1_B*P2)/1+b1_B*P2)));
F(9)=q2p-1/rho_2*((C2_satA*((b2_A*P2)/1+b2_A*P2))-(C2_satB*((b2_B*P2)/1+b2_B*P2)));
F(10)=delq1-(q1f-q1p);
F(11)=delq2-(q2f-q2p);
F(12)=tet1-c1/C1_satA;
F(13)=tet2-c2/C2_satA;
F(14)=bet1-sqrt(1-4*tet1*(1-tet1)*(1-1/tet1));
F(15)=bet2-sqrt(1-4*tet2*(1-tet2)*(1-1/tet2));
F(16)=phi1-1*exp(0.35*tet1);
F(17)=phi2-1.5*exp(-0.5*tet2);
F(18)=ebc1-((bet1-1+2*tet1)*phi1)/2*(1-tet1);
F(19)=ebc2-((bet2-1+2*tet2)*phi2)/2*(1-tet2);
F(20)=D1-D1_o*((1+ebc1)^z-1)/(1+ebc1/phi1)^z;
F(21)=D2-D2_o*((1+ebc2)^z-1)/(1+ebc2/phi2)^z;
F(22)=D11-D1/(a1+b1*tet1);
F(23)=D22-D2/(a2+b2*tet2);
F(24)=D12-((D11)^x1)*((D22)^x2);
F(25)=eta-(1.302*10^-5*x1)-(1.493*10^-5*x2);
F(26)=J1z-((rho_z*D1)/l_z)*(((1+x1*(D2/D12)*delq1)-(x1*(D2/D12)*delq2))/(1+x1*D1/D12+x2*D1/D12));
F(27)=J2z-((rho_z*D2)/l_z)*(((1+x2*(D1/D12)*delq2)-(x2*(D1/D12)*delq1))/(1+x1*D1/D12+x2*D1/D12));
F(28)=j1_L1-((D1_L1)/(R*T*l_L1)*(del_p1L1))-(((B_L1)/(R*T*2*eta*l_L1))*(p1z+p1_L1)*(del_pL1));
F(29)=j2_L1-(((D2_L1)/(R*T*l_L1))*(del_p2L1))-(((B_L1)/(R*T*2*eta*l_L1))*(p2z+p2_L1)*(del_pL1));
F(30)=j1_L2-(((D1_L2)/(R*T*l_L2))*(del_p1L2))-(((B_L2)/(R*T*2*eta*l_L2))*(p1_L1+p2_per)*(del_pL2));
F(31)=j2_L2-(((D2_L2)/(R*T*l_L2))*(del_p2L2))-(((B_L2)/(R*T*2*eta*l_L2))*(p2_L1+p2_per)*(del_pL2));
F(32)=j1_L1-j1_L2;
F(33)=j1_L1-J1z;
F(34)=j2_L1-j2_L2;
F(35)=j2_L1-J2z;
F(36)=J1-J1z;
F(37)=J2-J2z;
F(38)=del_pL1-del_p1L1-del_p2L1;
F(39)=del_pL2-del_p1L2-del_p2L2;
F(40)=(F1t_0-F1t_1)/del_x+J1*pi*d*n;
F(41)=(F1s_0-F1s_1)/del_x+J1*pi*d*n;
F(42)=(F2t_0-F2t_1)/del_x+J2*pi*d*n;
F(43)=(F2s_0-F2s_1)/del_x+J2*pi*d*n;
F(44)=p1_per-x1*P2;
F(45)=p2_per-x2*P2;
F(46)=del_p1L1-p1z+p1_L1;
F(47)=del_p2L2-p2_L1+p2_per;
F(48)=del_p1L2-p1_L1+p2_per;
F(49)=del_p2L1-p2z+p2_L1;
F(50)=F_t-F1t_1-F2t_1;
F(51)=F_s-F1s_1-F2s_1;
F(52)=M_avg-(x1*M1)-(x2*M2);
F(53)=ut-((F1t_1)*M_avg)/rho_g*A;
F(54)=10*p_0t-10*p_1t+(2*f*pi*rho_g*(ut)^2)/d;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m0=[1,1,0.1,0.9,50,1,1,1,1,0.8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,3,2,2,1,5,1,1,1,1,1,1,1,1,1,10,10,44,14,24];
fun=@eqns;
options = optimoptions('fsolve','MaxFunEvals',200000)
m = fsolve(fun,m0,options)
after running this code the following error appears...
"""Solver stopped prematurely.
fsolve stopped because it exceeded the iteration limit,
options.MaxIter = 400 (the default value).""""
is there any method to solve these equations because when Iterations stopped the solution is wrong/not varifying the system.??
is there any possibility to write this code in a cascade functions to get better solution...??
is there possibility to write this code in a stair case functions...
thank you everyone...