1
$\begingroup$

I got to a scalar field that really looks just fine to me in polar coordinates. "looks just fine" = all the physical limits make sense. The scalar field in polar coordinates r and θ is:

ϕ[r_, θ_] := -v0*Cos[θ + α] (r + R^2 (1 - 2*ϵ*Sin[θ]^2)/r)

Now using equation

v = -Grad[ϕ[r, θ], {r, θ}, "Polar"]

I want to get the desired vector field. The equation above leaves me with this

v={v0 Cos[α + θ] (1 - (
   R^2 (1 - 2 ϵ Sin[θ]^2))/r^2), -(((
   4 R^2 v0 ϵ Cos[θ] Cos[α + θ] Sin[θ])/r + 
   v0 (r + (R^2 (1 - 2 ϵ Sin[θ]^2))/
   r) Sin[α + θ])/r)}

All nice, whatever this is. BUT I want to plot that vector field. And in order to do it, I did:

vx = 
 TransformedField["Polar" -> "Cartesian", 
   v0 Cos[α + θ] (1 - (
      R^2 (1 - 2 ϵ Sin[θ]^2))/
      r^2), {r, θ} -> {x, y}] // Simplify

(*  (v0 ((x^2 + y^2)^2 - 
   R^2 (x^2 + y^2 (1 - 2 ϵ))) Cos[α + 
   ArcTan[x, y]])/(x^2 + y^2)^2          *)

vy = 
 TransformedField[
   "Polar" -> 
    "Cartesian", -(((
     4 R^2 v0 ϵ Cos[θ] Cos[α + θ] Sin[θ])/r + 
     v0 (r + (R^2 (1 - 2 ϵ Sin[θ]^2))/
        r) Sin[α + θ])/r), {r, θ} -> {x, y}] // 
  Simplify

(*  -((
 v0 (4 R^2 x y ϵ Cos[α + 
       ArcTan[x, y]] + ((x^2 + y^2)^2 + 
       R^2 (x^2 + y^2 - 2 y^2 ϵ)) Sin[α + 
       ArcTan[x, y]]))/(x^2 + y^2)^2)      *)

Which for parameters:

v0 = 1;
R = 1;
ϵ = .02;
α = Pi/4;

Show[StreamPlot[{vx, vy}, {x, -5, 5}, {y, -5, 5}], 
 PolarPlot[f[θ], {θ, 0, 2*Pi}]]

Mathematica graphics

Brings me to a very strange and unexpected vector field. It's a vector field that has no sense at all.

And I have a strong feeling that this method of plotting a vector field is wrong, because i am 99.9% sure that the scalar field I got is ok. So, my question to is: What is wrong and how do I change it?

(BTW: scalar field is only defined for r that are equal to or bigger than f[θ_]:=R(1-ϵSin[θ]^2).)

Any help will be highly appreciated.

$\endgroup$
  • 1
    $\begingroup$ To avoid getting all those irritating In/Out labels, you can set SetOptions[$FrontEnd, ExportMultipleCellsOptions -> {"IncludeCellLabels" -> False}] or SetOptions[$FrontEndSession, ExportMultipleCellsOptions -> {"IncludeCellLabels" -> False}]. (The first makes the permanent; the second changes only the current session.) $\endgroup$ – Michael E2 May 16 '15 at 10:54
3
$\begingroup$

Try this:

 v0 = 1;R = 1;ϵ = .02;α = Pi/4;
 ϕ[r_, θ_] := -v0*Cos[θ + α] (r + R^2 (1 - 2*ϵ*Sin[θ]^2)/r);
 v = -Grad[ϕ[r, θ], {r, θ}, "Polar"];
 gxy = TransformedField["Polar" -> "Cartesian",v, {r, θ} -> {x, y}] // Simplify;

StreamPlot[gxy, {x, -5, 5}, {y, -5, 5}];

Or use Cartesian coordinate from the beginning:

f = TransformedField[
       "Polar" -> "Cartesian", ϕ[
        r, θ], {r, θ} -> {x, y}];
gxy2 = -Grad[f, {x, y}];

Show[StreamPlot[gxy2, {x, -5, 5}, {y, -5, 5}], 
 ContourPlot[f, {x, -5, 5}, {y, -5, 5}, ContourShading -> None]]

enter image description here

$\endgroup$
  • $\begingroup$ This is a perfect and easy solution! Thank you! =) $\endgroup$ – skrat May 16 '15 at 18:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.