Τhank you for the help Neil.
The list and the plot works as it should. The "If" doesn't do what I want it to do. The idea is to change the γuinit to (γ1+(γ1+γ2)/2)/2 inside the first If or to (γ2+(γ1+γ2)/2)/2 inside the second, in order to bisect the initial interval of γ1,γ2.
I tried the Piecewise also instead of if ,after reading some posts, but did not work either.
I used the last line in order to visual see the results, but this only shows the result of the last integration. Is it possible to see it for the previous integrations?
Any ideas would be really appreciated.
Regards,
Agapi
\[CapitalGamma] = 5/3;
c4 = 6;
smax = 2;
Rinit = 1.05;
\[Gamma]1 = 0.8;
\[Gamma]2 = 0.9;
\[Gamma]uinit = (\[Gamma]1 + \[Gamma]2)/2;
sol1 = Table[
Reap@NDSolve[{D1[s] ==
2 (-1 + R[s]) R[
s] (-(-1 + \[CapitalGamma]) \[Gamma]u[s] +
c4 ((-1 + R[s]) R[s]^3)^((1 - \[CapitalGamma])/
2) (-2 + \[CapitalGamma]) \[CapitalGamma] \[Gamma]u[s]^(
2 - \[CapitalGamma]) +
c4 ((-1 + R[s]) R[s]^3)^((1 - \[CapitalGamma])/
2) (-1 + \[CapitalGamma]) \[CapitalGamma] \[Gamma]u[
s]^-\[CapitalGamma]),
N1[s] == -(1 + \[Gamma]u[s]^2) (1 - \[CapitalGamma] +
c4 (-1 + R[s])^(1/2 - \[CapitalGamma]/2)
R[s]^(-(3/2) (-1 + \[CapitalGamma])) (2 +
4 R[s] (-1 + \[CapitalGamma]) -
3 \[CapitalGamma]) \[CapitalGamma] \[Gamma]u[s]^(
1 - \[CapitalGamma])),
R'[s] == D1[s]/Sqrt[D1[s]^2 + N1[s]^2],
Derivative[1][\[Gamma]u][s] == N1[s]/Sqrt[D1[s]^2 + N1[s]^2],
R[0] == Rinit, \[Gamma]u[0] == \[Gamma]uinit,
WhenEvent[ {D1[s] == 0, N1[s] == 0} ,
j = Sow[{s, N1[s], D1[s], Abs[N1[s]/D1[s]]}]; smax = s;
If[
Abs[N1[s]/D1[s]] >
1, {\[Gamma]uinit = (\[Gamma]1 + \[Gamma]uinit)/2,
Print[\[Gamma]uinit]}];
If[
Abs[N1[s]/D1[s]] <
1, {\[Gamma]uinit = (\[Gamma]2 + \[Gamma]uinit)/2,
Print[\[Gamma]uinit]}]]}, {R, \[Gamma]u}, {s, 0, smax}], 5];
data = Map[({R[s], \[Gamma]u[s]} /. #) &,
sol1[[All, 1, 1]]];
ParametricPlot[data, {s, 0, smax}, AspectRatio -> 1,
AxesLabel -> {"R", "\[Gamma]u"}]
j[[All]] & /@ sol1