Solving the system of ODEs and algebraic Equation
Ältere Kommentare anzeigen
I am trying to solve the coupled ODE with dependent algebraic equation using RK4 method. I tried with my code below. I want to plot v, w, p, R, u_s and h_r, v/s, t. But I am getting error "Too many input arguments". I tried to figure out the problem for a day but could not able to do. Can anyone point my mistake? Your help will be much aappreciated.

t0 = deg2rad(0);
a = deg2rad(60);
m = 1;
d_j = 0.6;
We = 558;
Re = 87;
b = (-0.13*m^3 + 0.263*m^2 + 0.039*m + 0.330)/tan(a);
%% Initial Conditions for differential equation
u_b0 = 0.1;
p0 = pi/2;
R0 = 0.002*We/b;
s_b0 = 0.02712;
%% Estimating Sheet Velocity at theta = 0 (initial sheet velocity)
x = b*cos(t0)*sin(a)^2;
x01 = 4*(1 - (cos(t0)^2)*cos(a)^2);
x02 = (b*sin(t0)*sin(a))^2;
q_j0 = - (x - (x01 - x02)^0.5)/(x01/4);
syms q
d = (b^2*sin(a)^2 + q^2*(1 - cos(t0)^2*cos(a)^2) + 2*b*q*cos(t0)*sin(a)^2)^0.5;
u_j0 = 2*(m-1)*(4*d^2 - 1) + m;
F0 = int(q*u_j0, q, 0, q_j0);
F0 = double(F0);
eq_e = @(u_s) (R0-q_j0)*F0*sin(a)*u_s.^3 +...
(R0.^2+2*R0*sqrt(pi*s_b0)+(16/(sin(a)*3*q_j0.^3*R0*Re))*((R0-q_j0)*F0*sin(a)).^2)*u_s.^2 -...
((R0-q_j0)*F0*sin(a)-((F0.^3*sin(a).^3)/(9))*((1/q_j0.^3)-(1/R0.^3))+((R0-q_j0)*F0*sin(a))*(4/(q_j0*sin(a))))*u_s-...
((R0-q_j0)*F0*sin(a))*((4*sin(a).^2*F0.^3*(R0.^5-q_j0.^5))/(15*q_j0.^7*R0.^5*Re));
u_s0 = fsolve(eq_e, 0.5)
%% DAE System
syms q t
q_j = (-(b*cos(t)*sin(a)^2)+(1-cos(t)^2*cos(a)^2-(b*sin(t)*sin(a))^2)^0.5)/(1-cos(t)^2*cos(a)^2);
u_j = 2*(m-1)*(4*((q*sin(t))^2 + sin(a)^2*(q*cos(t)+b)^2)-1) + m;
F = matlabFunction(int(q*u_j, q, 0, q_j));
G = matlabFunction(int(q*u_j^3, q, 0, q_j));
t = 0:0.01:pi;
y = zeros(4, length(t));
y(:,1) = [u_b0; s_b0; p0; R0];
%% Solve algebraic equation for u_s
for i = 1:length(t)-1
q_j = (-(b*cos(t(i))*sin(a)^2)+(1-cos(t(i))^2*cos(a)^2-(b*sin(t(i))*sin(a))^2)^0.5)/(1-cos(t(i))^2*cos(a)^2);
S1 = double(F(t(i)));
us_eqs = @(u_s) (y(4,i) - q_j(i))*S1*sin(a)*u_s + (S1*sin(a)).^3*((1/q_j(i).^3) - (1/y(4,i).^3))/(9*u_s) + y(4,i).^2 + 2*y(4,i)*sqrt(pi*y(2,i)) - 4*(y(4,i) - q_j(i))*S1/(q_j(i)*u_s) + (16*sin(a)*S1.^2*(y(4,i) - q_j(i)).^2/(3*q_j(i)*y(4,i)*Re)) + 4*sin(a).^3*S1.^4*(y(4,i) - q_j(i))*(y(4,i).^5-q_j(i).^5)/(15*q_j(i).^7*y(4,i).^5*Re*u_s.^2) - (y(4,i) - q_j(i))*S1*sin(a)/u_s;
u_s = fsolve(us_eqs, 1);
sol = ode45(@(t, y) odesym(t, y, We, Re, F, G, u_s), [t(i) t(i+1)], y(:,i));
end
%% Test system if u_s is a constant
% u_s = 1;
% y0 = [u_b0; s_b0; p0; R0];
% [t, y] = ode15s(@(t, y) odesym(t, y, We, Re, F, G, u_s), t, y0);
% for j = 1:4
% subplot(2,2,j)
% plot(t/pi, y(:,j)), grid on
% xlabel('\theta/\pi ')
% end
%% Differential Equations
function dydt = odesym(t, y, We, Re, F, G, u_s)
u_b = y(1);
s_b = y(2);
p = y(3);
R = y(4);
F = F(t);
K = (F^(3/2))/(G(t)^0.5);
F_v = (u_b - u_s*cos(p))/sqrt(s_b/pi)*K/(sin(p)*Re);
dudt = (u_s^2*cos(p)*K - (u_b*u_s*K + F_v))/(u_b*s_b);
dsdt = (2*u_b*u_s*K - (cos(p)*u_s^2*K - F_v))/(u_b^2);
dpdt = (2*R/(We*sin(p)) - sin(p)*u_s^2*K)/(u_b^2*s_b) - 1;
dRdt = R/tan(p);
dydt = [dudt; dsdt; dpdt; dRdt];
end
5 Kommentare
Dyuman Joshi
am 9 Dez. 2023
k1 = odesym(t(i,1),y(:,i),a,We,Re,F,u_s);
The function odesym is defined with 6 inputs variables, whereas you have provided 7 inputs in the above call. That is the cause of the error. 'a' is the extra input.
function dydt = odesym(t,y,We,Re,F,u_s)
Surendra Ratnu
am 9 Dez. 2023
Dyuman Joshi
am 9 Dez. 2023
F is a scalar and you are trying to using t as an index to it in the function. Same with G, but, you have not passed G as a variable, yet you are using it in odesym().
There might be many more errors in your code, and rather than clearing them one-by-one, it will be better if you can describe what you are doing, so we have a better understanding of your code.
Provide the mathematical equations of the ODE you are trying to solve.
Also, you should incorporate putting comments in your code.
John D'Errico
am 9 Dez. 2023
I closed the duplicate question you posted. Note that really, you should be using a tool like ODE15i to solve problems like this, instead of writing your own code. Regardless, there is no need to keep on asking the same question.
Surendra Ratnu
am 10 Dez. 2023
Bearbeitet: Surendra Ratnu
am 10 Dez. 2023
Antworten (1)
As you can see, your algebraic equation does not seem to have a zero for your initial vector for the other variables.
Further tan(pi/2) = 0 so that you will get an immediate division-by-zero in the equation for R.
y0 = [0.0424*0.0042; 0.0424^2*0.0042; pi/2; 1.7440; 1.0];
us = 0:0.01:10;
for i = 1:numel(us)
dydt = fun(0,[0.0424*0.0042; 0.0424^2*0.0042; pi/2; 1.7440;us(i)]);
fus(i) = dydt(5);
end
plot(us,fus)
tspan = [0 pi];
M = eye(5);
M(5,5) = 0;
options = odeset('Mass',M);
%[T,Y] = ode15s(fun,tspan,y0,options)
function dydt = fun(t,y)
alpha = deg2rad(45);
We = 277;
Re = 75;
ub = y(2)/y(1);
sb = y(1)/ub;
phi = y(3);
R = y(4);
us = y(5);
q = -(0.3284-(3+0.671*sin(t)^2)^0.5)/(1-0.25*cos(t)^2);
funF = @(Q)Q.*(-4.098*(0.4379+Q*cos(t)).^2+5.464*Q.^2*sin(t)^2+2.049);
funG = @(Q)Q.*(-4.098*(0.4379+Q*cos(t)).^2+5.464*Q.^2*sin(t)^2+2.049).^3;
F = integral(funF,0,q);
G = integral(funG,0,q);
hr = F^1.5/(G^0.5*R);
Fnu = (ub-us*cos(phi))/sqrt(sb/pi) * hr*R/(sin(phi)*Re);
dydt(1) = us*hr*R;
dydt(2) = us^2*hr*R*cos(phi) + Fnu;
dydt(3) = (2*R/(We*sin(phi))- us^2*hr*R*sin(phi))/(ub^2*sb) - 1;
dydt(4) = R/tan(phi);
dydt(5) = (R-q)*us*F*sin(alpha)+F^3*sin(alpha)^3/(9*us)*(1/q-1/R)+(R^2+2*R*sqrt(pi*sb))-...
4*(R-q)*F/(q*us) + 16*sin(alpha)*F^2*(R-q)^2/(3*q^3*R*Re) + ...
4*sin(alpha)^3*F^4*(R-q)*(R^5-q^5)/(15*us^2*q^7*R^5*Re) - (R-q)*sin(alpha)*F/us;
dydt = dydt(:);
end
31 Kommentare
Surendra Ratnu
am 11 Dez. 2023
Bearbeitet: Surendra Ratnu
am 11 Dez. 2023
Torsten
am 11 Dez. 2023
In the code above, replace
[T,Y] = ode15s(fun,tspan,y0,options)
by
[T,Y] = ode15s(@fun,tspan,y0,options)
But before the two problems (missing zero of the algebraic equation for the initial conditions and division by zero in the fourth equation) are not solved, you don't need to start computing. You will immediately get an error from ode15s.
And I don't see a line
v = y(1)
in the code for which you got the error message.
Surendra Ratnu
am 12 Dez. 2023
It seems that the reason for failure of the integrator is that ub becomes 0.
And here, you divide by ub:
dydt(3) = (2*R/(We*sin(phi))- us^2*hr*R*sin(phi))/(ub^2*sb) - 1;
clc
clear
close all
us = 1.4:0.001:10;
for i = 1:numel(us)
dydt = fun(0,[0.1*0.0042; 0.1^2*0.6541; pi/2; 1.1965;us(i)]);
fus(i) = dydt(5);
end
%plot(us,fus)
[~,idx] = min(abs(fus));
us0 = us(idx)
y0 = [0.1*0.0042; 0.1^2*0.6541; pi/2; 1.1965; us0];
%tspan = [0 pi];
tspan = [0 3e-4];
M = eye(5);
M(5,5) = 0;
options = odeset('Mass',M);
[T,Y] = ode15s(@fun,tspan,y0,options);
UB = Y(:,2)./Y(:,1);
SB = Y(:,1)./UB;
PHI = Y(:,3);
R = Y(:,4);
US = Y(:,5);
figure(1)
plot(T,UB)
grid on
figure(2)
plot(T,SB)
grid on
figure(3)
plot(T,PHI)
grid on
figure(4)
plot(T,R)
grid on
figure(5)
plot(T,US)
grid on
function dydt = fun(t,y)
alpha = deg2rad(45); We = 277; Re = 75;
ub = y(2)/y(1); sb = y(1)/ub; phi = y(3); R = y(4); us = y(5);
q = (0.4630*cos(t)-(8-2*cos(t).^2-0.4287*sin(t).^2)^0.5)./(cos(t).^2-2);
funF = @(Q)Q.*(1.0285-0.7408*cos(t)*Q - 0.8*Q.^2*(2-cos(t).^2));
funG = @(Q)Q.*(1.0285-0.7408*cos(t)*Q - 0.8*Q.^2*(2-cos(t).^2)).^3;
F = integral(funF,0,q);
G = integral(funG,0,q);
hr = F^1.5/(G^0.5*R);
Fnu = (ub-us*cos(phi))/sqrt(sb/pi) * hr*R/(sin(phi)*Re);
dydt(1) = us*hr*R;
dydt(2) = us^2*hr*R*cos(phi) + Fnu;
dydt(3) = (2*R/(We*sin(phi))- us^2*hr*R*sin(phi))/(ub^2*sb) - 1;
dydt(4) = R/tan(phi);
dydt(5) = (R-q)*us*F*sin(alpha)+F^3*sin(alpha)^3/(9*us)*(1/q-1/R)+(R^2+2*R*sqrt(pi*sb))-...
4*(R-q)*F/(q*us) + 16*sin(alpha)*F^2*(R-q)^2/(3*q^3*R*Re) + ...
4*sin(alpha)^3*F^4*(R-q)*(R^5-q^5)/(15*us^2*q^7*R^5*Re) - (R-q)*sin(alpha)*F/us;
dydt = dydt(:);
end
Surendra Ratnu
am 13 Dez. 2023
Torsten
am 13 Dez. 2023
The issue is due to your differential equations that make ub decrease and reach zero very fast. I don't know where you see that ub is constant after t = 2.0838e-04, I only see that the solver gives up at this time.
So you should check your equations and parameters to see if they are as you want them to be.
Surendra Ratnu
am 13 Dez. 2023
As you can see from the result curve for ub, your equations result in a decreasing ub. So the error must lie in your equations or the parameters you use. I cannot help you in this respect.
Why do you prescribe
y0 = [0.1*0.0042; 0.1^2*0.6541; pi/2; 1.1965; us0];
This means that
ub * sb = 0.1*0.0042
and
ub^2 * sb = 0.1^2*0.6541
which gives a contradictory choice for sb (sb = 0.0042 in the first case, sb = 0.6541 in the second case).
Surendra Ratnu
am 13 Dez. 2023
Bearbeitet: Surendra Ratnu
am 13 Dez. 2023
Torsten
am 13 Dez. 2023
I didn't differentiate out the expressions for d(ub*sb)/dt and d(ub^2*sb)/dt, but solved in ub*sb and ub^2*sb instead of ub and sb. Thus at the first two positions of the y0 vector, you have to prescribe ub0*sb0 and ub0^2*sb0, not ub0 and sb0. But you should have noticed that when you looked over the code ...
I executed the code from 'DAE_System.m,' and at some point, complex values emerged in 'ub'.
Is this behavior expected in the physical DAE System? The display is quite lengthy. I hope we can incorporate a 'hide and expand' or 'spoiler' feature in the forum.
Update: I removed the lengthy display of 'ub' values to make scrolling more user-friendly.
tspan = [0 pi];
y0 = [0.1*0.0042; 0.1^2*0.6541; pi/2; 1.1965; 1.1423];
M = eye(5);
M(5, 5) = 0;
options = odeset('Mass', M);
[T, Y] = ode15s(@fun, tspan, y0, options);
plot(T, Y(:,2)./Y(:,1))
function dydt = fun(t,y)
alpha = deg2rad(45);
We = 277;
Re = 75;
ub = y(2)/y(1); % <-- view ub by removing the semicolon ';'
sb = y(1)/ub;
phi = y(3);
R = y(4);
us = y(5);
q = (0.4630*cos(t)-(8-2*cos(t).^2-0.4287*sin(t).^2)^0.5)./(cos(t).^2-2);
funF = @(Q)Q.*(1.0285-0.7408*cos(t)*Q - 0.8*Q.^2*(2-cos(t).^2));
funG = @(Q)Q.*(1.0285-0.7408*cos(t)*Q - 0.8*Q.^2*(2-cos(t).^2)).^3;
F = integral(funF,0,q);
G = integral(funG,0,q);
hr = F^1.5/(G^0.5*R);
Fnu = (ub-us*cos(phi))/sqrt(sb/pi) * hr*R/(sin(phi)*Re);
dydt(1) = us*hr*R;
dydt(2) = us^2*hr*R*cos(phi) + Fnu;
dydt(3) = (2*R/(We*sin(phi))- us^2*hr*R*sin(phi))/(ub^2*sb) - 1;
dydt(4) = R/tan(phi);
dydt(5) = (R-q)*us*F*sin(alpha)+F^3*sin(alpha)^3/(9*us)*(1/q-1/R)+(R^2+2*R*sqrt(pi*sb))-...
4*(R-q)*F/(q*us) + 16*sin(alpha)*F^2*(R-q)^2/(3*q^3*R*Re) + ...
4*sin(alpha)^3*F^4*(R-q)*(R^5-q^5)/(15*us^2*q^7*R^5*Re) - (R-q)*sin(alpha)*F/us;
dydt = dydt(:);
end
Sam Chak
am 13 Dez. 2023
In the differential equation:
dydt(4) = R/tan(phi);
The initial value of phi is
, thus making
. During the integration process, phi approaches π causing
. This leads to
approaching a division-by-zero singularity event. What does this actually imply in the true physical system?
. During the integration process, phi approaches π causing
Surendra Ratnu
am 14 Dez. 2023
Bearbeitet: Torsten
am 14 Dez. 2023
Torsten
am 14 Dez. 2023
As you can see in the graphics for PHI, PHI reaches pi and the division by 0 in dR/dt = R/tan(phi) makes MATLAB give up.
Surendra Ratnu
am 16 Jan. 2024
Bearbeitet: Torsten
am 16 Jan. 2024
Torsten
am 16 Jan. 2024
Your function odesym has 7 input arguments
function dydt = odesym(t,y,We,Re,F,G,u_s)
but you let ode45 call it with 6:
sol = ode45(@(t,y) odesym(t,y,We,F,G,u_s),[0 pi],y(:,i));
Further in the last call, [0 pi] has to be replaced by [t(i) t(i+1)], and y(:,i) is not defined for i>1.
But all these changes to the code won't alter the problem that your equations produce a division by zero because PHI reaches pi. You must work on the equations themselves - the solution method is irrelevant in this case.
Surendra Ratnu
am 17 Jan. 2024
Sam Chak
am 17 Jan. 2024
I have included the image of your differential-algebraic equations (DAE system) in your question. This way, when users view your post, they can better understand what you are trying to accomplish. Initially, I did not see the attached image, and your code contained 5 ODEs.
Now, the system has been reduced to only 4 ODEs, along with an algebraic equation that you are attempting to solve for
. I also noticed that you made changes to the ODEs in the code. Please consider updating the ODEs in the image accordingly.
Based on your updated code, it seems you are trying to solve the algebraic equation at each time step and then pass it to the odesym() function for ode15s to solve the system. Am I correct?
Surendra Ratnu
am 17 Jan. 2024
Sam Chak
am 17 Jan. 2024
I appreciate your efforts in updating the code. However, we haven't had the chance to review the updated contents of the new ODEs, as requested earlier. It's possible there might be a slight oversight. Could you please take a moment to revisit my previous message and share the updated ODEs? Thank you for your attention.
Surendra Ratnu
am 17 Jan. 2024
Nothing has changed concerning the error.
p approaches pi, and you divide by tan(p) in dRdt. So ode15s gives up.
You won't establish a different result by just using a different solution method.
But I wonder why you use different equations to compute u_s:
First expression:
eq_e = @(u_s) (R0-q_j0)*F0*sin(a)*u_s.^3 +...
(R0.^2+2*R0*sqrt(pi*s_b0)+(16/(sin(a)*3*q_j0.^3*R0*Re))*((R0-q_j0)*F0*sin(a)).^2)*u_s.^2 -...
((R0-q_j0)*F0*sin(a)-((F0.^3*sin(a).^3)/(9))*((1/q_j0.^3)-(1/R0.^3))+((R0-q_j0)*F0*sin(a))*(4/(q_j0*sin(a))))*u_s-...
((R0-q_j0)*F0*sin(a))*((4*sin(a).^2*F0.^3*(R0.^5-q_j0.^5))/(15*q_j0.^7*R0.^5*Re));
Second expression:
us_eqs = @(u_s)(y(4,i)-q_j(i))*S1*sin(a)*u_s + (S1*sin(a)).^3*((1/q_j(i).^3)-(1/y(4,i).^3))/(9*u_s)+...
y(4,i).^2 + 2*y(4,i)*sqrt(pi*y(2,i)) - 4*(y(4,i)-q_j(i))*S1/(q_j(i)*u_s)+...
(16*sin(a)*S1.^2*(y(4,i)-q_j(i)).^2/(3*q_j(i)*y(4,i)*Re)) + 4*sin(a).^3*S1.^4*(y(4,i)-q_j(i))*(y(4,i).^5-q_j(i).^5)/(15*q_j(i).^7*y(4,i).^5*Re*u_s.^2)-...
(y(4,i)-q_j(i))*S1*sin(a)/u_s;
Which of the two is the correct one ?
clc
clear
close all
a = deg2rad(45); m = 1; d_j = 0.6;
We = 558; Re = 87; t0 = deg2rad(0);
b = (-0.13*m.^3+0.263*m.^2 +0.039*m +0.330)/tan(a);
%% Initial Conditions for differential equation
u_b0 = 0.1; p0 = pi/2; R0 = 0.002*We/b; s_b0 = 0.01163;
%% Estimating Sheet Velocity at theta = 0 (initial sheet velocity)
x = b*cos(t0)*sin(a)^2; x01 = 4*((1-cos(t0)^2*cos(a)^2)); x02 = (b*sin(t0)*sin(a))^2;
q_j0 = -((x -(x01-x02)^0.5)/(x01/4));
syms q
d = (b.^2*sin(a).^2 + q.^2*(1-cos(t0).^2*cos(a).^2) + 2*b*q*cos(t0)*sin(a).^2).^0.5;
u_j0 = 2*(m-1)*(4*d.^2-1) + m;
F0 = int(q*u_j0, q, 0, q_j0);
F0 = double(F0);
eq_e = @(u_s) (R0-q_j0)*F0*sin(a)*u_s.^3 +...
(R0.^2+2*R0*sqrt(pi*s_b0)+(16/(sin(a)*3*q_j0.^3*R0*Re))*((R0-q_j0)*F0*sin(a)).^2)*u_s.^2 -...
((R0-q_j0)*F0*sin(a)-((F0.^3*sin(a).^3)/(9))*((1/q_j0.^3)-(1/R0.^3))+((R0-q_j0)*F0*sin(a))*(4/(q_j0*sin(a))))*u_s-...
((R0-q_j0)*F0*sin(a))*((4*sin(a).^2*F0.^3*(R0.^5-q_j0.^5))/(15*q_j0.^7*R0.^5*Re));
u_s0 = fsolve(eq_e,0.5,optimset('Display','off'))
%% DAE System
syms q t
q_j = (-(b*cos(t)*sin(a)^2)+(1-cos(t)^2*cos(a)^2-(b*sin(t)*sin(a))^2)^0.5)/(1-cos(t)^2*cos(a)^2);
u_j = 2*(m-1)*(4*((q*sin(t))^2 + sin(a)^2*(q*cos(t)+b)^2)-1) + m;
F = matlabFunction(int(q*u_j, q, 0, q_j));
G = matlabFunction(int(q*u_j^3,q,0,q_j));
y0 = [u_b0; s_b0; p0; R0; u_s0];
M = eye(5);
M(5,5) = 0;
options = odeset('Mass',M);
[T,Y] = ode15s(@(t,y) odesym(t,y,We,Re,a,b,F,G),[0 pi],y0,options);
UB = Y(:,2)./Y(:,1);
SB = Y(:,1)./UB;
PHI = Y(:,3);
R = Y(:,4);
US = Y(:,5);
figure(1)
plot(T,UB)
grid on
figure(2)
plot(T,SB)
grid on
figure(3)
plot(T,PHI)
grid on
figure(4)
plot(T,R)
grid on
figure(5)
plot(T,US)
grid on
function dydt = odesym(t,y,We,Re,a,b,F,G)
u_b = y(1); s_b = y(2); p = y(3); R = y(4); u_s = y(5);
q_j = (-(b*cos(t)*sin(a)^2)+(1-cos(t)^2*cos(a)^2-(b*sin(t)*sin(a))^2)^0.5)/(1-cos(t)^2*cos(a)^2);
F = F(t);
G = G(t);
K = ((F^(3/2))/(G^0.5));
F_v = (((u_b-u_s*cos(p))/sqrt(s_b/pi))*(K/(sin(p)*Re)));
dudt = ((u_s^2*cos(p)*K) - (u_b*u_s*K +F_v))/(u_b*s_b);
dsdt = ((2*u_b*u_s*K) - (cos(p).*u_s^2*K-F_v))/(u_b^2);
dpdt = (((2*R/(We*sin(p))) - sin(p)*u_s^2*K)/(u_b^2*s_b))-1;
dRdt = R / tan(p);
dusdt = (R-q_j)*F*sin(a)*u_s + (F*sin(a))^3*((1/q_j^3)-(1/R^3))/(9*u_s)+...
R^2 + 2*R*sqrt(pi*s_b) - 4*(R-q_j)*F/(q_j*u_s)+...
(16*sin(a)*F^2*(R-q_j)^2/(3*q_j*R*Re)) + 4*sin(a)^3*F^4*(R-q_j)*(R^5-q_j^5)/(15*q_j^7*R^5*Re*u_s^2)-...
(R-q_j)*F*sin(a)/u_s;
dydt = [dudt; dsdt; dpdt; dRdt; dusdt];
end
Surendra Ratnu
am 18 Jan. 2024
As a test, I've artfully infused a guiding line in 'phi' to thwart the inevitable descent of both
and
towards the abyss of zero. This mathematical spell permits me to glimpse into the future, unraveling the interplay of how the five states evolve across the expanse of
.
Alas, despite my effort to prevent the order of the system from collapsing,
defiantly converges to 0, setting ablaze the singularity in some divisional terms. The system gracefully succumbs at
rad. Only you possess the power to quell the screaming of these equations and halt the impending madness.
a = deg2rad(45);
m = 1;
d_j = 0.6;
We = 558;
Re = 87;
t0 = deg2rad(0);
b = (-0.13*m.^3+0.263*m.^2 +0.039*m +0.330)/tan(a);
%% Initial Conditions for differential equation
u_b0 = 0.1;
p0 = pi/2;
R0 = 0.002*We/b;
s_b0 = 0.01163;
%% Estimating Sheet Velocity at theta = 0 (initial sheet velocity)
x = b*cos(t0)*sin(a)^2; x01 = 4*((1-cos(t0)^2*cos(a)^2)); x02 = (b*sin(t0)*sin(a))^2;
q_j0 = -((x -(x01-x02)^0.5)/(x01/4));
syms q
d = (b.^2*sin(a).^2 + q.^2*(1-cos(t0).^2*cos(a).^2) + 2*b*q*cos(t0)*sin(a).^2).^0.5;
u_j0 = 2*(m-1)*(4*d.^2-1) + m;
F0 = int(q*u_j0, q, 0, q_j0);
F0 = double(F0);
eq_e = @(u_s) (R0-q_j0)*F0*sin(a)*u_s.^3 +...
(R0.^2+2*R0*sqrt(pi*s_b0)+(16/(sin(a)*3*q_j0.^3*R0*Re))*((R0-q_j0)*F0*sin(a)).^2)*u_s.^2 -...
((R0-q_j0)*F0*sin(a)-((F0.^3*sin(a).^3)/(9))*((1/q_j0.^3)-(1/R0.^3))+((R0-q_j0)*F0*sin(a))*(4/(q_j0*sin(a))))*u_s-...
((R0-q_j0)*F0*sin(a))*((4*sin(a).^2*F0.^3*(R0.^5-q_j0.^5))/(15*q_j0.^7*R0.^5*Re));
u_s0 = fsolve(eq_e,0.5,optimset('Display','off'));
%% DAE System
syms q t
q_j = (-(b*cos(t)*sin(a)^2)+(1-cos(t)^2*cos(a)^2-(b*sin(t)*sin(a))^2)^0.5)/(1-cos(t)^2*cos(a)^2);
u_j = 2*(m-1)*(4*((q*sin(t))^2 + sin(a)^2*(q*cos(t)+b)^2)-1) + m;
F = matlabFunction(int(q*u_j, q, 0, q_j));
G = matlabFunction(int(q*u_j^3, q, 0, q_j));
y0 = [u_b0; s_b0; p0; R0; u_s0];
M = eye(5);
M(5,5) = 0;
options = odeset('Mass', M);
[T, Y] = ode15s(@(t,y) odesym(t,y,We,Re,a,b,F,G),[0 pi],y0,options);
UB = Y(:,2)./Y(:,1);
SB = Y(:,1)./UB;
PHI = Y(:,3);
R = Y(:,4);
US = Y(:,5);
subplot(2,3,1), plot(T, UB), grid on, title('u_{b}')
subplot(2,3,2), plot(T, SB), grid on, title('s_{b}')
subplot(2,3,3), plot(T, PHI), grid on, title('\phi')
subplot(2,3,4), plot(T, R), grid on, title('R')
subplot(2,3,5), plot(T, US), grid on, title('u_{s}')
function dydt = odesym(t,y,We,Re,a,b,F,G)
u_b = y(1);
s_b = y(2);
p = y(3);
R = y(4);
u_s = y(5);
%% ----------
% phi = p; % original phi
phi = pi/3*tanh(p) + pi/3; % prevent sin(phi) and tan(phi) from going to 0
%% ----------
q_j = (-(b*cos(t)*sin(a)^2)+(1-cos(t)^2*cos(a)^2-(b*sin(t)*sin(a))^2)^0.5)/(1-cos(t)^2*cos(a)^2); % 0.9122
F = F(t); % 0.4161
G = G(t); % 0.4161
K = ((F^(3/2))/(G^0.5)); % 0.4161
F_v = (((u_b - u_s*cos(p))/sqrt(s_b/pi))*(K/(sin(phi)*Re)));
dudt = ((u_s^2*cos(p)*K) - (u_b*u_s*K +F_v))/(u_b*s_b);
dsdt = ((2*u_b*u_s*K) - (cos(p).*u_s^2*K-F_v))/(u_b^2);
dpdt = (((2*R/(We*sin(phi))) - sin(p)*u_s^2*K)/(u_b^2*s_b))-1; % singularity
dRdt = R/tan(phi);
dusdt = (R-q_j)*F*sin(a)*u_s + (F*sin(a))^3*((1/q_j^3)-(1/R^3))/(9*u_s) + R^2 + 2*R*sqrt(pi*s_b) - 4*(R-q_j)*F/(q_j*u_s) + (16*sin(a)*F^2*(R-q_j)^2/(3*q_j*R*Re)) + 4*sin(a)^3*F^4*(R-q_j)*(R^5-q_j^5)/(15*q_j^7*R^5*Re*u_s^2) - (R-q_j)*F*sin(a)/u_s;
dydt = [dudt; dsdt; dpdt; dRdt; dusdt];
end
Surendra Ratnu
am 18 Jan. 2024
run('DAE_System.m')
Surendra Ratnu
am 18 Jan. 2024
Sam Chak
am 18 Jan. 2024
@Surendra Ratnu, with utmost respect, could you illuminate the scientific foundation behind your reservations about the accuracy of the plots, especially when you've previously affirmed the correctness of all equations with unwavering certainty?
Surendra Ratnu
am 18 Jan. 2024
Sam Chak
am 18 Jan. 2024
Your insights are valued, yet they appear more as subjective interpretations rather than scientifically substantiated claims. Delving deeper into the analysis of the DAE system through exploration of published technical papers would undoubtedly enrich our understanding.
I look forward to the potential unveiling of new knowledge or breakthroughs from your continued contributions.
Since one of your DAE_system.m files work (at least technically, I cannot interprete the results) and the other does not, there should be a difference in your equations, shouldn't it ?
And check again the two functions for u_s: they are not equal. I just checked the first term in both
(R0-q_j0)*F0*sin(a)*u_s.^3
(R-q_j)*F*sin(a)*u_s
and already found a discrepancy.
Kategorien
Mehr zu Boundary Value Problems finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


















