Problems in solving Taylor-Maccoll Equation via ode45

20 views (last 30 days)
Hello everyone,
For a study project, I have to solve the Taylor-Maccoll Equation that describes the hypersonic filed around a cone.
My textbook provides the system of ODEs in this fashion
The γ and the are constants. Now I have tried to implement the ode45 via writing a function that codes the second members of the system. In particular, I have substituted
I don't know if this make sense, but then I have solved for x and y in this way
This is how I have implemented
function f = TaylorMaccoll(omega, V)
global gamma V_lim
Vr = V(1);
Vomega = V(2);
% a building
tris = ((V_lim*V_lim) - (Vomega*Vomega) - (Vr*Vr));
den = (gamma - 1)*(tris);
rap = (2*Vomega*Vomega)/(den);
a = 1 - rap;
% b building
b = (2*Vomega*Vr)/den;
% Fs building
F1 = Vomega;
F2 = -((Vomega*cotd(omega))+(2*Vr));
Fq = (b/a)*F1 + (1/a)*F2;
f = [F1; Fq];
end
Then, in the main, I have called the ode45 in this way
V0 = [V_inf*cosd(beta_c), epsilon*V_inf*sind(beta_c)];
[omega,V] = ode45(@TaylorMaccol,[beta_c:-0.001:eps],V0);
The stepsize is negative because I have to integrate from the shock angle to the body wall. The problem is that the solution is not stable
I have seen on the internet several other attempts that actually work, but I would like to follow my class and my textbook. I am pretty sure that the error is in the way I implement the ODEs but I have never seen this kind of problem so far. If some one can provide me some help I would be very grateful, also with some hints I don't want the entire code.
  13 Comments
Torsten
Torsten on 24 Jan 2023
The event function makes the solver stop when y(2) = Vomega = 0.
Leonardo Molino
Leonardo Molino on 24 Jan 2023
I have decided to completely rewrite the ODEs.
The idea I came up with is basically to wrote everthing in terms of , so in this way I can easly explicit the . Starting from this, I simply have wrote the system of ODEs via substituting and
function dy = TyMc (omega, y)
global Vlim gamma
dy = zeros(2,1);
A = 2/(gamma - 1);
a = 1 - ((A)*(y(2)^2/(Vlim^2-y(2)^2-y(1)^2)));
b = (A)*((y(2)*y(1))/(Vlim^2-y(2)^2-y(1)^2));
dy(1) = y(2);
dy(2) = (b/a)*y(2) - (1/a)*((y(2)*cot(omega))+(2*y(1)));
end
Thanks to your help, I know how to stop the iteration. The BC can be negative (the ) with a positive step size or positive with a negative one (I have chosen the first one).
With huge surprise, the whole thing works and I have solved the hypersonic field around the cone!
Thank you very much for your help!

Sign in to comment.

Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!