2
$\begingroup$

As you can see from the plot below, my contour plot renders several contour lines. The legend shows the how values change with colors.

However, all the contour lines on the plot are labeled 0, which is wrong because the value is changing with color. The real 0 contour should be the middle one.

What is the problem here, and how can I correct it?

c = 1;
NN = 0.365*10^19;
GradN = -9.42*10^19;
Te = 143;
λDe = 7.43*1000*Sqrt[Te/NN];
λDi = 7.43*1000*Sqrt[Ti/NN];

lne = Log[4*Pi*NN*λDe^3];

lni = Log[4*Pi*NN*λDi^3];
νi = 4.8*10^(-14)*NN*lni/(Ti^1.5);
νe = 2.9*10^(-12)*NN*lne/(Te^1.5);
Me = 9.109*10^-31;
Mi = 1.672*10^-27;
e = 1.602*10^-19;

R = 1.5; (*m*)
a = 0.2; (*m*)
ϵ = a/R;
B = 1;
BT = 0.955;
BP = Sqrt[1 - BT^2];(*rw*BT/(R*qs) B=Sqrt[BT^2+BP^2]*)

Clear[r]
ι0 = 1.551;
ι1 = 0.05238;
ι2 = -0.07569;
ι3 = 0.12862;
qr = 1/(ι0 + ι1*r/a + ι2*r^2/a^2 + ι3*r^3/a^3);

m = 5;(*m,mode,number*)
n = 8;
risola = Solve[qr - m/n == 0, r, Reals];
rw = r /. risola[[1]];
dw = 0.01;(*Width of the island 1cm*)
δw = dw/R;(*Width divided by major radius R*)

Plot[1/qr, {r, 0, a}, GridLines -> {{rw}, {m/n}}];

Clear[r];
dqr = D[qr, r];
r = rw;
dqs = dqr;
qs = qr;

Clear[r];
ve = Sqrt[2*Te*e/Me];
vi = Sqrt[2*Ti*e/Mi];
νerefe = 10^-4*ve/(qs*R);
νirefe = 10^-2*vi/(qs*R);
ωbe = ve/(R*qs);
ωbi = vi/(R*qs);
νe = νe/ωbe;
νi = νi/ωbi;

drdΦ = 1/(2 Pi*BP*R)/(dqs*dw/qs);
H = Exp[-((r/a - rw/a)/dw/a)^2];
G = Exp[-((r/a - rw/a)/dw/a)^2];

xx = 100;
C1e = (Te/(B*r))^2;
C1i = (Ti/(B*r))^2;
ωE = drdΦ*Er/(B*r);

gammadwscanee = -(GradN + NN*Er/Te)*(drdΦ)^2*
   C1e*(νe*
     ve/(qs*R)/(ϵ))*(R*BP)^2*(dqs*
      dw/qs)^2*(m*δw)^2*ϵ^(0.5)/(ωE^2*(R*
          BP)^2*(dqs*dw/qs)^2*
       m^2/(0.22*G) + (νe*ve/(qs*R)/ϵ)^2/(0.5*H));
gammadwscanii = -(GradN - NN*Er/Ti)*(drdΦ)^2*
   C1i*(νi*
     vi/(qs*R)/(ϵ))*(R*BP)^2*(dqs*
      dw/qs)^2*(m*δw)^2*ϵ^(0.5)/(ωE^2*(R*
          BP)^2*(dqs*dw/qs)^2*
       m^2/(0.22*G) + (νi*vi/(qs*R)/ϵ)^2/(0.5*H));
gammadwscan = Numerator[Together[gammadwscanee - gammadwscanii /. r -> rw]]

ContourPlot[gammadwscan, {Er, -5000, 5000}, {Ti, 20, Te}, 
  PlotLegends -> Automatic, ContourLabels -> All]    

enter image description here

$\endgroup$
  • 2
    $\begingroup$ Hard to help you out with just a picture. Where's the code that generated this? $\endgroup$ – J. M. will be back soon Jun 14 '16 at 14:38
  • $\begingroup$ @J.M. Just add the code. Took some time to figure out how to add code in code format. $\endgroup$ – yangyang Jun 14 '16 at 14:47
  • $\begingroup$ This (Debye length in unit of meter) means multiply the symbols 'Debye' 'length' 'in' etc togther. Comments are (* comment text *). I don't think this is your problem but it won't help. $\endgroup$ – Ymareth Jun 14 '16 at 14:59
  • $\begingroup$ Additionally do you expect the result values to span the range -2x10^41 to +2x10^41? This seems a bit wide for anything physically realizable. $\endgroup$ – Ymareth Jun 14 '16 at 15:02
  • $\begingroup$ This is the particle flux which could be this order. $\endgroup$ – yangyang Jun 14 '16 at 15:05
4
$\begingroup$

It looks as if Mathematica's contour labeling can not handle the immense range of your plot. When the gammadwscan is scaled down, everything looks good.

ContourPlot[gammadwscan/1*^40, {Er, -5000, 5000}, {Ti, 20, Te},
  ContourLabels -> All,
  PlotLegends -> Automatic]

plot

$\endgroup$
  • 2
    $\begingroup$ OP could always add a label to the legend stating that the plot is in peta-yotta-particles/meter. $\endgroup$ – N.J.Evans Jun 14 '16 at 20:41
  • $\begingroup$ Thanks for your help. Stupid issue. $\endgroup$ – yangyang Jun 15 '16 at 5:20
  • $\begingroup$ @yangyang. I don't think it is a stupid issue. I think you should make bug report to WRI. The above is only an explanation of what is going wrong and a work-around, not a solution. $\endgroup$ – m_goldberg Jun 15 '16 at 20:40
  • $\begingroup$ @m_goldberg I am not sure if this is really a bug because as you could see that the difference between the lines are too small to be shown in numbers. Anyway, I don't know how to report bug, so if you want to, you could report this. :-) $\endgroup$ – yangyang Jun 22 '16 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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