{ "info": { "author": "Tyler Hughes, Momchil Minkov, Ian Williamson", "author_email": "tylerwhughes91@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "![](img/dipole_dielectric_field.png)\n\n# fdfdpy\n\nThis is a pure Python implementation of the finite difference frequency domain (FDFD) method. It makes use of scipy, numpy, matplotlib, and the MKL Pardiso solver. fdfdpy currently supports 2D geometries\n\n## Installation\n\n python setup.py install\n\n## Structure\n\n### Initialization\n\nThe `Fdfd` class is initialized as\n\n\tsimulation = Fdfd(omega, eps_r, dl, NPML, pol, L0)\n\n- `omega` : the angular frequency in units of` 2 pi / seconds`\n- `eps_r` : a numpy array specifying the relative permittivity distribution\n- `dl` : the spatial grid size in units of `L0`\n- `NPML` : defines number of PML grids `[# on x borders, # on y borders]`\n- `pol` : polarization, one of `{'Hz','Ez'}` where `z` is the transverse field.\n- `L0` : simulation length scale, default is 1e-6 meters (one micron)\n\nCreating a new Fdfd object solves for:\n\n- `xrange` : defines spatial domain in x [left-most position, right-most position] in units of `L0`\n- `yrange` : defines spatial domain in y [bottom-most position, top-most position] in units of `L0`\n- `A` : the Maxwell operator, which is used later to solve for the E&M fields.\n- `derivs` : dictionary storing the derivative operators.\n\nIt also creates a relative permeability, `mu_r`, as `numpy.ones(eps_r.shape)` and a source `src` as `numpy.zeros(eps_r.shape)`.\n\n### Adding sources is exciting!\n\nSources can be added to the simulation either by manually editing the 2D src array inside of the simulation object,\n\n\tsimulation.src[10,20:30] = 1\n\nor by adding modal sources, which are defined as planes within the 2D domain which launch a mode in their normal direction. Modal source definitions can be added to the simulation by\n\n\tsimulation.add_mode(neff, direction, center, width)\n\tsimulation.setup_modes()\n\n- `neff` : defines the effective index of the mode; this will be used as the eigenvalue guess\n- `direction` : defines the normal direction of the plane, should be either 'x' or 'y'\n- `center` : defines the center coordinates for the plane in cell coordinates [xc, yc]\n- `width` : defines the width of the plane in number of cells\n\nNote that `simulation.setup_modes()` must always be called after adding mode(s) in order to populate `simulation.src`.\n\n### Solving for the electromagnetic fields\n\nNow, we have everything we need to solve the system for the electromagnetic fields, by running\n\n\tfields = simulation.solve_fields(timing=False)\n\n`simulation.src` is proportional to either the `Jz` or `Mz` source term, depending on whether `pol` is set to `'Ez'` or `'Hz'`, respectively.\n\n`fields` is a tuple containing `(Ex, Ey, Hz)` or `(Hx, Hy, Ez)` depending on the polarization.\n\n### Setting a new permittivity\n\nIf you want to change the permittivity distribution, you may run\n\n\tsimulation.reset_eps(new_eps)\n\nAnd this will reconstruct the system matrix and store it in `FDFD`. Note that `simulation.setup_modes()` should also be called if the permittivity changed within the plane of any of the modal sources.\n\n### Plotting\n\nPrimary fields (Hz/Ez) can be visualized using the included helper functions:\n\n\tsimulation.plt_re(outline=True, cbar=True)\n\tsimulation.plt_abs(outline=True, cbar=True)\n\nThese optionally outline the permittivity with contours and can be supplied with a matplotlib axis handle to plot into.\n\n### Requirements\n\n- numpy\n- scipy\n- matplotlib\n\nTo load the MKL solver:\n\n\tgit submodule update --init --recursive\n\n### To Do\n\n#### Whenever\n- [x] Modal source.\n- [x] More dope plotting methods.\n- [ ] xrange, yrange labels on plots.\n- [ ] set modal source amplitude (and normalization)\n- [ ] Add ability to run local jupyter notebooks running FDFD on parallel from hera.\n- [ ] Save the factorization of `A` in the `Fdfd` object to be reused later if one has the same `A` but a different `b`.\n- [ ] Allow the source term to have `(Jx, Jy, Jz, Mx, My, Mz)`, which would be useful for adjoint stuff where the source is not necessarily along the `z` direction.\n- [ ] Clean up imports (e.g. `import numpy as np` to `from numpy import abs, zeros, ...`)\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fancompute/fdfdpy", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "fdfdpy", "package_url": "https://pypi.org/project/fdfdpy/", "platform": "", "project_url": "https://pypi.org/project/fdfdpy/", "project_urls": { "Homepage": "https://github.com/fancompute/fdfdpy" }, "release_url": "https://pypi.org/project/fdfdpy/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "Electromagnetic Finite Difference Frequency Domain Solver", "version": "0.1.2" }, "last_serial": 4276645, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7018232bf4339fba39b9d1387889d29f", "sha256": "748acc77c0d5c6c994f7a12f3aeba758eae3fe30904d18bb4fec4bb5224b899d" }, "downloads": -1, "filename": "fdfdpy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7018232bf4339fba39b9d1387889d29f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15678, "upload_time": "2018-09-16T14:02:06", "url": "https://files.pythonhosted.org/packages/b2/31/7a3b3ccbdb4460bebc8f9798658a3cf4cb67b5d1476e7e8ab2b53f532d27/fdfdpy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "5cf91b8faf187ef91aacaaf586a11453", "sha256": "a2d1e392d51d56f24f44de78c2d09853d407155f29ace8a52ae88d3020781ccc" }, "downloads": -1, "filename": "fdfdpy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "5cf91b8faf187ef91aacaaf586a11453", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14419, "upload_time": "2018-09-16T14:12:02", "url": "https://files.pythonhosted.org/packages/ac/ac/cbaad7bc0420eba294f711f440cdef5ee6c9a3505ff41a8af6ae912a4de9/fdfdpy-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "53c1ac0f5e7d4e4c7f92c4ae2aad1825", "sha256": "1a90afc12df373f568d8641d17c1f7e6e503bb1ed4a9c1c7ed72a6f514d93539" }, "downloads": -1, "filename": "fdfdpy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "53c1ac0f5e7d4e4c7f92c4ae2aad1825", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14420, "upload_time": "2018-09-16T14:13:55", "url": "https://files.pythonhosted.org/packages/f1/28/e802f2c4d6f94705356f81fac292fa2ebfe68af7a1f3fe07093605d85901/fdfdpy-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "53c1ac0f5e7d4e4c7f92c4ae2aad1825", "sha256": "1a90afc12df373f568d8641d17c1f7e6e503bb1ed4a9c1c7ed72a6f514d93539" }, "downloads": -1, "filename": "fdfdpy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "53c1ac0f5e7d4e4c7f92c4ae2aad1825", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14420, "upload_time": "2018-09-16T14:13:55", "url": "https://files.pythonhosted.org/packages/f1/28/e802f2c4d6f94705356f81fac292fa2ebfe68af7a1f3fe07093605d85901/fdfdpy-0.1.2.tar.gz" } ] }