field-Ag-flow.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3. #
  4. # Copyright (C) 2009-2015 Ovidio Peña Rodríguez <ovidio@bytesfall.com>
  5. # Copyright (C) 2013-2015 Konstantin Ladutenko <kostyfisik@gmail.com>
  6. #
  7. # This file is part of python-scattnlay
  8. #
  9. # This program is free software: you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation, either version 3 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # The only additional remark is that we expect that all publications
  20. # describing work using this software, or all commercial products
  21. # using it, cite the following reference:
  22. # [1] O. Pena and U. Pal, "Scattering of electromagnetic radiation by
  23. # a multilayered sphere," Computer Physics Communications,
  24. # vol. 180, Nov. 2009, pp. 2348-2354.
  25. #
  26. # You should have received a copy of the GNU General Public License
  27. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  28. # This test case calculates the electric field in the
  29. # E-k plane, for an spherical Ag nanoparticle.
  30. import scattnlay
  31. from scattnlay import fieldnlay
  32. from scattnlay import scattnlay
  33. from fieldplot import fieldplot
  34. import numpy as np
  35. import cmath
  36. # # a)
  37. #WL=400 #nm
  38. #core_r = WL/20.0
  39. #epsilon_Ag = -2.0 + 10.0j
  40. # # b)
  41. #WL=400 #nm
  42. #core_r = WL/20.0
  43. #epsilon_Ag = -2.0 + 1.0j
  44. # c)
  45. WL=354 #nm
  46. core_r = WL/20.0
  47. epsilon_Ag = -2.0 + 0.28j
  48. # d)
  49. #WL=367 #nm
  50. #core_r = WL/20.0
  51. #epsilon_Ag = -2.71 + 0.25j
  52. index_Ag = np.sqrt(epsilon_Ag)
  53. # n1 = 1.53413
  54. # n2 = 0.565838 + 7.23262j
  55. nm = 1.0
  56. x = np.ones((2), dtype = np.float64)
  57. x[0] = 2.0*np.pi*core_r/WL/4.0*3.0
  58. x[1] = 2.0*np.pi*core_r/WL
  59. m = np.ones((2), dtype = np.complex128)
  60. m[0] = index_Ag/nm
  61. m[1] = index_Ag/nm
  62. print "x =", x
  63. print "m =", m
  64. comment='bulk-Ag-flow'
  65. WL_units='nm'
  66. npts = 501
  67. factor=2.1
  68. flow_total = 39
  69. #flow_total = 21
  70. #flow_total = 0
  71. crossplane='XZ'
  72. #crossplane='YZ'
  73. #crossplane='XY'
  74. # Options to plot: Eabs, Habs, Pabs, angleEx, angleHy
  75. field_to_plot='Pabs'
  76. #field_to_plot='angleEx'
  77. fieldplot(x,m, WL, comment, WL_units, crossplane, field_to_plot, npts, factor, flow_total, is_flow_extend=False)