Пример #1
0
        if i % 2 == 1 and (r.polarization == 'ps' or r.polarization == 'sp'):
            dtmp[:, :nx] = 1.
        else:
            dtmp[:nx, :] = 1.
        dinit.append(dtmp.flatten())
    dinit = np.concatenate(np.array(dinit))
    npf.savetxt('./DATA/tmp.txt', dinit)
    init_type = './DATA/tmp.txt'

# materials
mstruct = []
for i in range(Nlayer):
    if materialL[i] == 'silica' and rank == 0:
        mstruct.append(materials.silica())
    elif materialL[i] == 'silicon' and rank == 0:
        mstruct.append(materials.silicon(epsimag=epsimag))
    elif materialL[i] == 'SiN' and rank == 0:
        mstruct.append(materials.SiN(epsimag=epsimag))
    elif materialL[i] == 'gold' and rank == 0:
        mstruct.append(materials.gold())
mstruct = comm.bcast(mstruct)

# pumping
dbeta = (final_v - 0) / Nf
beta = np.linspace(0 + dbeta / 2, final_v - dbeta / 2, Nf)
freq_list = np.sqrt((1 - beta) / (1 + beta))
gamma = 1. / np.sqrt(1 - beta**2)

# start to assemble RCWA
# lattice vector
Lx = Period / lam0
Пример #2
0
import autograd.numpy as np
from autograd import grad
import nlopt, numpy as npf
from scipy.optimize import fsolve as solve

import use_autograd
use_autograd.use = 1
import rcwa
import materials, cons
from fft_funs import get_conv

lam0=0.8e-6
freq = 1.
gold = materials.gold()
silicon = materials.silicon()
Nlayer=1
thick =.004
Lx = 5
Ly = Lx
Mx = 100
My = 100
Qabs = 1e10

ndof = Mx*My*Nlayer
thickness = [thick/Nlayer]*Nlayer

L1 = [Lx,0.]
L2 = [0.,Ly]
epsuniform = 1.
epsbkg = 1.