I am plotting this vector field:
Q[k_, N_] := Show[ContourPlot[3 - 3 BesselJ[0, r[x, y] a^-1], {x, -N, N}, {y, -N, N},
ContourStyle -> Opacity[0.3]],
StreamPlot[{Sin[θ[x, y]], -Cos[θ[x, y]]}, {x, -N, N}, {y, -N, N},
PlotRange -> {Full, Full}, RegionFunction ->
Function[{x, y}, a^2 - a^2/100 < x^2 + y^2 <= a^2 + a^2/100],
StreamStyle -> Red, StreamPoints -> {pts, Automatic, Scaled[2]},
StreamScale -> None],
StreamPlot[{Abs[(1 - a/r[x, y])^(1/2)] +
a^(1/2)/r[x, y]^(1/2) Cos[θ[x, y] k],
a^(1/2)/r[x, y]^(1/2) Sin[θ[x, y] k]}, {x, -N, N}, {y, -N,
N}, PlotRange -> {Full, Full},
RegionFunction -> Function[{x, y}, x^2 + y^2 > a^2],
StreamStyle -> {Blue, Thick, "Line"}, PerformanceGoal -> "Quality",
StreamScale -> Full],
ImageSize -> Large]
with
r[x_, y_] := Sqrt[x^2 + y^2];
θ[x_, y_] := ArcTan[x, y];
a = 3;
pts = Flatten[
Table[{x, y}, {x, -a - a/10, a + a/10, 0.1}, {y, a - a/10, a + a/10, 0.1}], 1];
But I can't find a set of StreamPoints to avoid the segmentation of the lines near the x-axes.
Q[1/2,10]
Any ideas? Thanks!
Answer
r[x_, y_] := Sqrt[x^2 + y^2];
θ[x_, y_] := ArcTan[x, y];
a = 3;
pts = Flatten[Table[{x, y}, {x, -a - a/10, a + a/10, 0.1}, {y, a - a/10, a + a/10, 0.1}], 1];
Q[k_, n_] := Module[{pts1}, pts1 = Table[{0, x}, {x, -2 n, 2 n, 1/2}];
Show[ContourPlot[ 3 - 3 BesselJ[0, r[x, y] a^-1], {x, -n, n}, {y, -n, n},
ContourStyle -> Opacity[0.3]],
StreamPlot[{Sin[θ[x, y]], -Cos[θ[x, y]]}, {x, -n, n}, {y, -n, n}, PlotRange -> {Full, Full},
RegionFunction -> Function[{x, y}, a^2 - a^2/100 < x^2 + y^2 <= a^2 + a^2/100],
StreamStyle -> Red, StreamPoints -> {pts, Automatic, Scaled[2]},
StreamScale -> None],
StreamPlot[{Abs[(1 - a/r[x, y])^(1/2)] + a^(1/2)/r[x, y]^(1/2) Cos[θ[x, y] k],
a^(1/2)/r[x, y]^(1/2) Sin[θ[x, y] k]}, {x, -2 n, 2 n}, {y, -2 n, 2 n},
RegionFunction -> Function[{x, y}, x^2 + y^2 > a^2 && Abs@x < n && Abs@y < n],
StreamPoints -> {pts1, Automatic, Scaled[2]}, StreamStyle -> {Blue, Thick, "Line"},
PerformanceGoal -> "Quality", StreamScale -> Full],
ImageSize -> Large]]
Q[1/2, 10]
Comments
Post a Comment