-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
377 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
API Reference | ||
============== | ||
|
||
|
||
Geometry Module | ||
--------------------------- | ||
|
||
.. autoclass:: morpho.geometry.Geometry | ||
:members: | ||
:show-inheritance: | ||
|
||
BrillouinZone Module | ||
--------------------------- | ||
|
||
.. autoclass:: morpho.brillouinzone.SymmetryPoint | ||
:members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: morpho.brillouinzone.BrillouinZonePath | ||
:members: | ||
:show-inheritance: | ||
|
||
Solver Module | ||
--------------------------- | ||
.. autoclass:: morpho.solver.Solver | ||
:members: run | ||
:show-inheritance: | ||
|
||
.. autoclass:: morpho.solver.Solver2D | ||
:members: run | ||
:show-inheritance: | ||
|
||
|
||
Utils Module | ||
--------------------------- | ||
.. autofunction:: morpho.utils.convmat | ||
|
||
|
||
Exceptions Module | ||
------------------------ | ||
|
||
.. automodule:: morpho.exceptions | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
============== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Introduction | ||
============== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
QuickStart | ||
============== | ||
|
||
|
||
Installation | ||
--------------------------- | ||
The package can be installed by: | ||
|
||
.. code-block:: bash | ||
pip install morpho.py | ||
Examples | ||
--------------------------- | ||
|
||
.. code-block:: python | ||
"""2D example.""" | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from morpho import BrillouinZonePath as BZPath | ||
from morpho import Geometry, Solver2D | ||
from morpho import SymmetryPoint as SPoint | ||
Nx, Ny = 64, 64 | ||
P, Q = 5, 5 | ||
a = 1 | ||
eps_r = 9.8 | ||
mu_r = 1.0 | ||
# Define the symmetry points | ||
G = SPoint((0, 0), "Γ") | ||
X = SPoint((1 / 2, 0), "X") | ||
M = SPoint((1 / 2, 1 / 2), "M") | ||
t1, t2, t3 = (a, 0, 0), (0, a, 0), (0, 0, a) | ||
# Construct the bloch wave path | ||
bz_path = BZPath([G, X, M, G], t1, t2, n_points=100) | ||
# Construct the geometry | ||
geo = Geometry(t1, t2, None, Nx, Ny, 1) | ||
# Define the permitivity profile | ||
@geo.set_epsr_f | ||
def epsr_f(): | ||
"""Define eps_r profile function.""" | ||
mask = geo.x**2 + geo.y**2 <= 0.2**2 | ||
geo.eps_r[mask] = eps_r | ||
# Define the permeability profile | ||
@geo.set_mur_f | ||
def mur_f(): | ||
"""Define mu_r profile function.""" | ||
# Solve | ||
solver_tm = Solver2D(geometry=geo, path=bz_path, P=P, Q=Q, pol="TM") | ||
solver_tm.run() | ||
solver_te = Solver2D(geometry=geo, path=bz_path, P=P, Q=Q, pol="TE") | ||
solver_te.run() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
References | ||
============== | ||
|
||
[1] J. D. Joannopoulos, Ed., Photonic crystals: molding the flow of light, 2nd ed. Princeton: Princeton University Press, 2008. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.