Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Vial committed Apr 4, 2022
1 parent c424ad7 commit 7ef9237
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
8 changes: 4 additions & 4 deletions doc/texlive/texlive.profile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
selected_scheme scheme-basic
TEXDIR $HOME/texlive
TEXDIR /root/texlive
TEXMFCONFIG ~/.texlive/texmf-config
TEXMFHOME ~/texmf
TEXMFLOCAL $HOME/texlive/texmf-local
TEXMFSYSCONFIG $HOME/texlive/texmf-config
TEXMFSYSVAR $HOME/texlive/texmf-var
TEXMFLOCAL /root/texlive/texmf-local
TEXMFSYSCONFIG /root/texlive/texmf-config
TEXMFSYSVAR /root/texlive/texmf-var
TEXMFVAR ~/.texlive/texmf-var
option_doc 0
option_src 0
2 changes: 1 addition & 1 deletion doc/texlive/texlive_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# A minimal current TL is installed adding only the packages that are
# required

export PATH=$HOME/texlive/bin/x86_64-linux:$PATH
export PATH=/root/texlive/bin/x86_64-linux:$PATH

# Obtain TeX Live
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
Expand Down
51 changes: 51 additions & 0 deletions examples/dev/epsilon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Benjamin Vial
# This file is part of nannos
# License: GPLv3
# See the documentation at nannos.gitlab.io

import matplotlib.pyplot as plt
import numpy as np

import nannos as nn

plt.ion()

bk = nn.backend
# formulation = "tangent"
formulation = "original"

lattice = nn.Lattice([[1.0, 0], [0, 1.0]], discretization=2**9)
sup = lattice.Layer("Superstrate", epsilon=1)
sub = lattice.Layer("Substrate", epsilon=1)
o = lattice.ones()
hole = lattice.circle(center=(0.5, 0.5), radius=0.2)
epsilon = o * 4
epsilon[hole] = 1
ms = lattice.Layer("Metasurface", thickness=0.5, epsilon=epsilon)
pw = nn.PlaneWave(frequency=1.4, angles=(0, 0, 0 * nn.pi / 2))


plt.close("all")
for n in [1, 3, 5, 7, 11, 21, 41]:
nh = n**2
print("------------------------")
print("Number of harmonics: ", nh)
sim = nn.Simulation([sup, ms, sub], pw, nh=nh, formulation=formulation)
# eps = sim.get_epsilon("Substrate")
t = nn.tic()
print("Building matrix...")
ms = sim._build_matrix(ms)
print("Done build matrix")
nn.toc(t)
t = nn.tic()
print("Retrieving epsilon...")
eps = sim.get_epsilon(ms)
print("Done retrieving epsilon...")
nn.toc(t)
plt.figure()
plt.imshow(eps.real)
plt.colorbar()
plt.title(nh)
plt.pause(0.1)
1 change: 1 addition & 0 deletions src/nannos/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def _get_toeplitz_matrix(self, u, transverse=False):
return uft[delta[0, :], delta[1, :]]

def _build_matrix(self, layer):
layer, layer_index = self._get_layer(layer)
if layer.iscopy:
layer.matrix = layer.original.matrix
layer.Kmu = layer.original.Kmu
Expand Down

0 comments on commit 7ef9237

Please sign in to comment.