{"id":13736564,"url":"https://github.com/demisjohn/CAMFR","last_synced_at":"2025-05-08T12:33:08.990Z","repository":{"id":29922874,"uuid":"70273311","full_name":"demisjohn/CAMFR","owner":"demisjohn","description":"Python-based electromagnetic simulator and mode solver for nanophotonics applications, using the Eigenmode Expansion (EME) method.","archived":false,"fork":false,"pushed_at":"2023-03-21T11:05:17.000Z","size":2365,"stargazers_count":65,"open_issues_count":9,"forks_count":30,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-30T15:23:30.547Z","etag":null,"topics":["electromagnetic-fields","laser","laser-cavity","light-emitting-diodes","photonic-crystals","photonics","physics-simulation","python","python27","simulation","waveguide"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kitchenknif/CAMFR","license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/demisjohn.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-10-07T18:39:08.000Z","updated_at":"2024-06-22T13:44:45.000Z","dependencies_parsed_at":"2022-08-08T18:00:05.408Z","dependency_job_id":"ada31764-e8e1-4192-b8f8-f7a747578e03","html_url":"https://github.com/demisjohn/CAMFR","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demisjohn%2FCAMFR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demisjohn%2FCAMFR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demisjohn%2FCAMFR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demisjohn%2FCAMFR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/demisjohn","download_url":"https://codeload.github.com/demisjohn/CAMFR/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224524740,"owners_count":17325661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electromagnetic-fields","laser","laser-cavity","light-emitting-diodes","photonic-crystals","photonics","physics-simulation","python","python27","simulation","waveguide"],"created_at":"2024-08-03T03:01:24.160Z","updated_at":"2024-11-15T04:32:04.515Z","avatar_url":"https://github.com/demisjohn.png","language":"C++","readme":"# CAMFR\n\nForked from [Sourceforge project](http://camfr.sourceforge.net/) for maintenance.\n\nOriginally written by [Peter Bienstman at Ghent University, Belgium](http://www.photonics.intec.ugent.be/contact/people.asp?ID=5).\n\n\n## Introduction\n\nCAMFR (CAvity Modelling FRamework) is a Python module providing a fast, flexible, full-vectorial Maxwell solver for electromagnetics simulations. Its main focus is on applications in the field of nanophotonics, like\n- wavelength-scale microstructures (like photonic crystal devices, optical waveguides)\n- lasers (like vertical-cavity surface-emitting lasers)\n- light-emitting diodes (like resonant-cavity LEDs)\n\nIt is based on a combination of eigenmode expansion (EME) and advanced boundary conditions like perfectly matched layers (PML).  \n\nUsing an intuitive python scripting interface one can create and solve for the optical modes/fields in various wavelength-scale structures. Additional math and plotting can then be performed via the SciPy stack. The Eigenmode Expansion (EME) method is especially well-suited to solving for very thin layers, or structures in which the X and Y dimensions are very different, where typical methods like FDTD and FEM have trouble with the vastly differing X/Y discretization.\n\nYou can find more information, publications and details [here](http://www.photonics.intec.ugent.be/research/topics.asp?ID=17).\n\n\n\n## Features\n\nCAMFR was a research project, started at the photonics group of the Department of Information Technology (INTEC) at Ghent University in Belgium. CAMFR can be used to calculate\n- the scattering matrix of a structure\n- the field inside a structure, for any given excitation\n- band diagrams of an infinite periodic structure\n- threshold material gain and resonance wavelength of laser modes\n- the response to a current source in an arbitrary cavity\n- structures terminated by a semi-infinite repetition of another structure\n\nThis functionality is currently available for two types of geometries:\n- 2D Cartesian structures\n- 3D cylindrical symmetric structures\n\nAdditionally, there is code to model the extraction from light emitting diodes, either planar devices, or 3D devices which incorporate 2D periodic structures.\n\nDefining structures is quite straightforward, either layer-by-layer, or using geometric primitive shapes. There are also integrated plotting routines for rapid simulation feedback.\n\nOne of the main benefits of the Eigenmode Expansion (EME) method is that very thin (nm) and thick (um) structures can be combined without incurring significant numerical errors, as is often the case for Finite-Difference meshing, in which large differences in the X/Y grids cause calculation problems. Also, once the modes/scattering matrices of a 1D slab or 2D Section have been calculated, extending those regions over an additional dimension does not require large amounts of computational power, as most of the work was in calculating the initial eigenmodes of the structure. This means that repeating structures can be simulated fairly quickly, since the eigenmodes are only calculated once for a repeating section.\n\n\n\n## Framework/Module Character\n\nCAMFR is utilized as a Python module, although internally it is conceived as a C++ framework, with all the algorithms implemented in terms of abstract waveguides and scatterers. This makes it extremely easy to extend CAMFR to new geometries.\n\nThe end user does not deal with this C++ code directly, but rather through bindings to the Python scripting language. This makes the code very clear and flexible, and allows e.g. to seamlessly integrate CAMFR with Python-aware visualistion tools such as [matplotlib](https://matplotlib.org) and [numpy](http://www.numpy.org).\n\n\n\n## Examples\n### Silicon Waveguide Mode Solver\nSilicon waveguide, Power, Ex and Ey plotted with matplotlib:\n\n\u003cimg src=\"examples/contrib/Silicon_WG_-_Modesolver_example_v1.png\" width=\"350\"\u003e\n\nSee the file `examples/contrib/Example - Silicon-Waveguide ModeSim v2018-01.py` for a full working example.\n\n### Brief Example\nExample of rectangular waveguide construction syntax: We will create a rectangular waveguide of SiO2 cladding and Silicon core, calculate the first 4 modes mode \u0026 plot them.  \n\n    \u003e\u003e\u003e import camfr                # import the module\n\nFirst, create some Materials with some refractive index:\n\n    \u003e\u003e\u003e SiO = camfr.Material( 1.45 )    # refractive index of SiO2\n    \u003e\u003e\u003e Si = camfr.Material( 3.4 )    # refractive index of Silicon\n\nThen, create some 1-D slabs, by calling those Materials with a thickness value, and adding them together from bottom to top in a Slab:\n\n    \u003e\u003e\u003e clad = camfr.Slab(  SiO(15.75)  )      # Thicknesses in microns\n    \u003e\u003e\u003e core = camfr.Slab(  SiO(10.0) + Si(2.5) + SiO(5.0)  )\n    \nThis created an imaginary \"Slab\" structure from bottom-to-top. For example `core` looks like:\n\n            top         \n    --------------------\n            SiO\n        5.0 um thick\n    --------------------\n            Si\n       2.50 um thick\n    --------------------\n            SiO\n       10.0 um thick\n    --------------------\n           bottom\n\nThen make a 2-D structure by calling these Slabs with a width value, and adding them together from left to right in a Waveguide:\n\n    \u003e\u003e\u003e WG = camfr.Section(  clad(3.0) + core(1.0) + clad(4.0)  )   # Widths in microns\n    \nWhich creates this imaginary 2-D Waveguide structure from left-to-right:\n\n                                top         \n    ---------------------------------------------------------\n    |\u003c----- 3.0um------\u003e|\u003c-----1.0um------\u003e|\u003c---- 4.0um----\u003e|\n    |                   |        SiO       |                |\n    |                   |    5.0 um thick  |                |                \n    |                   |------------------|                |\n    |        SiO        |        SiN       |       SiO      |\n    |      15.75um      |   2.50 um thick  |     15.75um    |\n    |       thick       |------------------|      thick     |\n    |                   |        SiO       |                |\n    |                   |   10.0 um thick  |                |\n    ---------------------------------------------------------\n                               bottom\n\nYou can then have CAMFR calculate the modes as so:\n\n    \u003e\u003e\u003e WG.calc()\n\nAnd plot the modes like so:\n\n    \u003e\u003e\u003e WG.plot()   # plots the fundamental mode with MatPlotLib.\n    \u003e\u003e\u003e fig = WG.plot(field=['P','Ex','Ey'], mode=[0,1,2])   # plots the Power and fields of 3 modes\n    \nSee the Examples directory for full examples, as some details are missing here.\n\n\n\n## Installation\nCAMFR currently only supports Python 2.7.\n\nTo use CAMFR, download one of the released versions (see the \"releases\" or \"tags\" section of this github repo), or the bleeding-edge code, and extract the archive into a directory.  Follow the instruction in the `INSTALL` text file for your system.  You will have to compile the CAMFR library, as it compiles C code to generate the Python library.  A number of dependencies are required, which you can hopefully install easily through your system's package manager, or download directly from the developer websites.\n\nThe preferred method to run your scripts is through a Python IDE like Spyder (a matlab-like IDE).  The simplest installation of Spyder (along with all required scientific python modules) can be accomplished via [Python(x,y)](https://code.google.com/p/pythonxy/) (Win) or [Anaconda](http://continuum.io/downloads) (Mac,Win,Linux), or from source, for example via MacPorts `port install py27-spyder` on Mac OS. \n\nCAMFR scripts can also be run like any typical Python script on the command line via `python myScript.py` or `python -i myScript.py` to make it interactive afterwards.\n\n\n\n## License and support\nAll the code is released under the GPL.\n","funding_links":[],"categories":["simulation"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemisjohn%2FCAMFR","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemisjohn%2FCAMFR","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemisjohn%2FCAMFR/lists"}