Skip to content

Commit

Permalink
README updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagovla authored Mar 7, 2021
1 parent 2afcaf5 commit 4ba6328
Showing 1 changed file with 58 additions and 5 deletions.
63 changes: 58 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,67 @@
|PyPI License| |PyPI PyVersions| |PyPI Version| |Build Status| |DeepSource| |Codecov| |Documentation Status|

================
PWE Framework for 3D Photonic Crystal Analysis
PWE Framework for 3D/2D/1D Photonic Crystal Analysis
================


Quick example:
Quick examples:
##############

.. code-block:: python
"""2D example."""
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()
Results:
**********
.. image:: docs/_static/bandgap_diagram_2d.png
:width: 300

.. code-block:: python
"""3D example."""
Expand Down Expand Up @@ -58,11 +112,10 @@ Quick example:
# Solve
solver = Solver(geometry=geo, path=bz_path, P=P, Q=Q, R=R)
solver.run()
solver.plot_bands()
Results:
########
.. image:: docs/_static/bandgap_diagram_sc.png
**********
.. image:: docs/_static/bandgap_diagram_3d.png
:width: 300

References:
Expand Down

0 comments on commit 4ba6328

Please sign in to comment.