Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into DorisReiter-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeGehring committed May 8, 2024
2 parents 499d9af + 8618162 commit 98ec05d
Show file tree
Hide file tree
Showing 34 changed files with 1,799 additions and 204 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: '1.9.2'
- uses: julia-actions/cache@v1
version: '1.10.2'
- uses: julia-actions/cache@v2
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
installer-parallel: true
- name: Install dependencies
run: |
sudo apt-get install -y libglu1-mesa
sudo apt-get install -y libglu1-mesa xvfb
poetry install --no-interaction
pip install --upgrade scipy
mamba install slepc4py=*=complex* -y
Expand All @@ -47,18 +47,22 @@ jobs:
pip install gdsfactory gplugins
pip list
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: '1.9.3'
- uses: julia-actions/cache@v1
version: '1.10.3'
- uses: julia-actions/cache@v2
with:
cache-name: ${{ runner.os }}-${{ steps.get-date.outputs.date }}
cache-compiled: "true"
- uses: julia-actions/julia-buildpkg@v1
- name: Install dependencies
- name: Install julia dependencies
run: |
pip install juliacall
julia -e 'using Pkg; Pkg.add("PythonCall")'
- name: Precompile julia dependencies
continue-on-error: true
run: |
julia --project=~/work/femwell/femwell -e 'using Pkg; Pkg.precompile()'
- uses: actions/cache@v4
with:
path: |
Expand Down
39 changes: 21 additions & 18 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,31 @@ parts:
- file: install
- caption: Derivation of the equations
chapters:
- file: math/maxwell
sections:
- file: math/waveguide_port
- file: math/overlap_integrals
- file: math/thermal
- file: math/dispersion
- file: math/coupled_mode_theory
- file: math/schroedinger
- file: math/maxwell
sections:
- file: math/maxwell_quantities
- file: math/waveguide_port
- file: math/overlap_integrals
- file: math/thermal
- file: math/dispersion
- file: math/coupled_mode_theory
- file: math/schroedinger

- caption: Examples
chapters:
- file: photonics/examples/waveguide_modes.py
#- file: photonics/examples/leaky_waveguide.py
#- file: photonics/examples/bent_waveguide.py
- file: photonics/examples/vary_width.py
- file: photonics/examples/vary_wavelength.py
- file: photonics/examples/selecting_modes.py
- file: photonics/examples/calculate_GVD.py
- file: photonics/examples/fiber_overlap.py
- file: photonics/examples/crosstalk.py
sections:
#- file: photonics/examples/leaky_waveguide.py
#- file: photonics/examples/bent_waveguide.py
- file: photonics/examples/vary_width.py
- file: photonics/examples/vary_wavelength.py
- file: photonics/examples/selecting_modes.py
- file: photonics/examples/calculate_GVD.py
- file: photonics/examples/fiber_overlap.py
- file: photonics/examples/crosstalk.py
- file: photonics/examples/propagation_loss.py
- file: photonics/examples/effective_area.py
- file: photonics/examples/crosstalk_reduction/crosstalk_reduction.py
- file: photonics/examples/metal_heater_phase_shifter.py
- file: photonics/examples/metal_heater_phase_shifter_transient.py
- file: photonics/examples/si_heater_phase_shifter.py
Expand All @@ -38,9 +43,7 @@ parts:
- file: photonics/examples/grating_coupler.py
- file: photonics/examples/coupled_mode_theory.py
- file: photonics/examples/depletion_waveguide.py
- file: photonics/examples/effective_area.py
- file: photonics/examples/refinement.py
- file: photonics/examples/propagation_loss.py
- file: electronics/examples/capacitor.py
- file: electronics/examples/coax_cable.py
- file: electronics/examples/coplanar_waveguide_vary_width.py
Expand Down
16 changes: 9 additions & 7 deletions docs/benchmarks/mode_solver.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# ---
# jupyter:
# jupytext:
# formats: py:light,md:myst
# formats: py:percent,md:myst
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.4
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.1
# kernelspec:
# display_name: Python 3
# name: python3
# ---

# %% [markdown]
# # Benchmark of the mode solver 2

# %% [markdown]
# Reproducing {cite}`Hadley2002`, where the modes of a strip and
# several rib waveguide were calculated and presented with an error value.
# The error for all modes is calculated to be smaller than $\pm 3 \cdot 10^{-6}$,
# thus this should be the maximum derivation for our simulations.
# The results are presented here:

# + tags=["remove-stderr", "hide-input", "hide-output"]
# %% tags=["remove-stderr", "hide-input", "hide-output"]
from collections import OrderedDict

import numpy as np
Expand Down Expand Up @@ -135,7 +137,7 @@
neff_values_femwell_scipy.append(np.real(modes[0].n_eff))


# + tags=["remove-stderr", "hide-input"]
# %% tags=["remove-stderr", "hide-input"]
pd.DataFrame(
{
"slab_thickness": slab_thicknesses,
Expand All @@ -160,8 +162,8 @@
],
subset=["difference scipy", "difference julia"], # "difference slepc",
)
# -

# %% [markdown]
# ## Bibliography
#
# ```{bibliography}
Expand Down
28 changes: 15 additions & 13 deletions docs/benchmarks/mode_solver_rectangle.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# ---
# jupyter:
# jupytext:
# formats: py:light,md:myst
# formats: py:percent,md:myst
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.4
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.15.0
# kernelspec:
# display_name: Python 3
# name: python3
# ---

# %% [markdown]
# # Benchmark of the mode solver 1

# %% [markdown]
# Reproducing {cite}`Hadley2002`, where the modes of a analytically solvable geometry are calculated.
# The error for all modes is calculated to be smaller than $\pm 1 \cdot 10^{-8}$.
# We'll show that we get pretty close, but will stop at a resonable resolution to keep the runtime sensible.
# Getting even higher accurancy will be left open for adaptive refinement.
# The results are presented here:

# + tags=["remove-stderr", "hide-input"]
# %% tags=["remove-stderr", "hide-input"]
from collections import OrderedDict

import numpy as np
Expand Down Expand Up @@ -87,16 +89,16 @@

pd.DataFrame(
{
"epsilons": [
"Epsilons": [
f"{epsilons['core']:.2f} / {epsilons['clad']:.2f}" for epsilons in epsilons_paper
],
"reference value": (f"{n:.8f}" for n in neff_values_paper),
"calculated value slepc": (f"{n:.8f}" for n in neff_values_femwell_slepc),
"difference slepc": (
"Reference value": (f"{n:.8f}" for n in neff_values_paper),
"Calculated value slepc": (f"{n:.8f}" for n in neff_values_femwell_slepc),
"Difference slepc": (
f"{n1-n2:.8f}" for n1, n2 in zip(neff_values_paper, neff_values_femwell_slepc)
),
"calculated value scipy": (f"{n:.8f}" for n in neff_values_femwell_scipy),
"difference scipy": (
"Calculated value scipy": (f"{n:.8f}" for n in neff_values_femwell_scipy),
"Difference scipy": (
f"{n1-n2:.8f}" for n1, n2 in zip(neff_values_paper, neff_values_femwell_scipy)
),
}
Expand All @@ -105,10 +107,10 @@
"background-color: green" if abs(float(difference)) < 5e-6 else "background-color: red"
for difference in differences
],
subset=["difference slepc", "difference scipy"],
subset=["Difference slepc", "Difference scipy"],
)
# -

# %% [markdown]
# ## Bibliography
#
# ```{bibliography}
Expand Down
10 changes: 6 additions & 4 deletions docs/julia/heater_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down Expand Up @@ -101,9 +101,9 @@ thermal_diffisitivities =
# The next step is to define the boundary conditions, this can be done simply via julia-dicts:

# %% tags=["remove-stderr", "hide-output"]
boundary_potentials = Dict(["metal3#e1___None" => 0.4, "metal3#e2___None" => 0.0])
boundary_potentials = Dict(["metal3#e1___clad" => 0.4, "metal3#e2___clad" => 0.0])
boundary_temperatures =
Dict("metal3#e1___None" => 0.4, "metal3#e2___None" => 0.0, "box___None" => 0.0)
Dict("metal3#e1___None" => 0.0, "metal3#e2___None" => 0.0, "box___None" => 0.0)

# %% [markdown]
# Now we're ready to do the simulations! First we simulate the electrical potential,
Expand Down Expand Up @@ -136,9 +136,10 @@ println(
)

# %% [markdown]
# And we write the fields to a file for visualisation using paraview:
# And we write the fields to a vtu-file for visualisation using paraview:

# %% tags=["remove-stderr", "hide-output"]
Base.zero(::Type{String}) = ""
writevtk(
Ω,
"results",
Expand All @@ -148,6 +149,7 @@ writevtk(
"temperature" => temperature(T0),
"heat flux" => heat_flux(T0),
"tags" => τ,
"tag_name" => (tag -> get_tag_name(labels, tag)) τ,
],
)

Expand Down
2 changes: 1 addition & 1 deletion docs/julia/heater_3d_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Choose some component
c = gf.component.Component()
waveguide = c << gf.get_component(gf.components.straight_heater_metal(length=40))
waveguide = c << gf.get_component(gf.components.straight_heater_metal(length=80))
e1 = c << gf.components.straight(1, cross_section="xs_m3")
e1.connect(e1["e1"], waveguide["l_e1"])
e2 = c << gf.components.straight(1, cross_section="xs_m3")
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/lithium_niobate_phase_shifter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/microstrip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/thermal_fill.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/thermal_simple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/waveguide.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/waveguide_anisotropic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/waveguide_bent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/waveguide_bent_coupling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
2 changes: 1 addition & 1 deletion docs/julia/waveguide_overlap_integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# kernelspec:
# display_name: base
# language: julia
# name: julia-1.9
# name: julia-1.10
# ---

# %% [markdown]
Expand Down
Loading

0 comments on commit 98ec05d

Please sign in to comment.