Guest User

Untitled

a guest
Oct 15th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. N = 800.0
  2. p1 = {1, 0, 0};
  3. p2 = {0, 1, 0};
  4. p3 = {0, 0, 1};
  5. B = {0.0, 0, 200.0};
  6. MV = Convert[(MN Milli
  7. Tesla)/VacuumPermeability,Ampere/Meter]/(Ampere/Meter);
  8.  
  9. ClearAll[Simple]
  10. Options[Simple] = {
  11. Angleθ0 -> 0,
  12. Angleϕ0 -> 0,
  13. Field -> B,
  14. Sat -> MN,
  15. Int -> m0,
  16. Energy -> 0,
  17. Direction1 -> p1,
  18. Direction2 -> p2,
  19. Direction3 -> p3
  20. };
  21.  
  22. Simple[OptionsPattern[]] := Module[
  23. {
  24. B = OptionValue[Field],
  25. θ0 = OptionValue[Angleθ0],
  26. ϕ0 = OptionValue[Angleϕ0],
  27. MN = OptionValue[Sat],
  28. m0 = OptionValue[Int],
  29. En = OptionValue[Energy],
  30. p1 = OptionValue[Direction1],
  31. p2 = OptionValue[Direction2],
  32. p3 = OptionValue[Direction3],
  33. t, m, mx, my, mz, Be, M, M1, a1, a2, a3
  34.  
  35. },
  36. a1 = Sin[θ0] Cos[ϕ0] p1(*{1,0,0}*);
  37. a2 = Sin[θ0] Sin[ϕ0] p2(*{0,1,0}*);
  38. a3 = Cos[θ0] p3(*{0,0,1}*);
  39. m0 = {Sin[θ0] Cos[ϕ0], Sin[θ0] Cos[ϕ0],
  40. Cos[θ0]};
  41. m = {mx[t], my[t], mz[t]};
  42. M = m/m0;
  43. M1 = {a1, a2, a3};
  44. Be = B - MN {0.0, 0.0, mz[t]};
  45. En = -{Be.M1}
  46. ]
  47.  
  48. DensPlot =
  49. DensityPlot[
  50. N[Energy], {Angleθ0, 0, 180}, {Angleϕ0, 0, 360},
  51. ColorFunction -> "SunsetColors", PlotLegends -> Automatic];
  52.  
  53. DensPlot
Add Comment
Please, Sign In to add comment