Пример #1
0
    mp.Block(center=mp.Vector3(y=Sy/4), material=mp.Medium(index=3.45), size=mp.Vector3(0.5, Sy/2, 0)),  # vertical waveguide
    mp.Block(center=design_region.center, size=design_region.size, epsilon_func=basis.func()) # design region
]

sim = mp.Simulation(cell_size=cell_size,
                    boundary_layers=pml_layers,
                    geometry=geometry,
                    sources=source,
                    eps_averaging=False,
                    resolution=resolution)

#----------------------------------------------------------------------
#- Objective quantities and objective function
#----------------------------------------------------------------------

TE0 = mpa.EigenmodeCoefficient(sim,mp.Volume(center=mp.Vector3(0,1,0),size=mp.Vector3(x=2)),mode=1)
ob_list = [TE0]

def J(alpha):
    return npa.sum(npa.abs(alpha) ** 2)

#----------------------------------------------------------------------
#- Define optimization problem
#----------------------------------------------------------------------
opt = mpa.OptimizationProblem(
    simulation = sim,
    objective_function = J,
    objective_arguments = ob_list,
    basis = [basis],
    fcen = fcen,
    df = fwidth,
Пример #2
0
sim = mp.Simulation(cell_size=cell_size,
                    boundary_layers=pml_layers,
                    geometry=geometry,
                    sources=source,
                    eps_averaging=False,
                    resolution=resolution)

#----------------------------------------------------------------------
#- Objective quantities and objective function
#----------------------------------------------------------------------

mode = 1

TE0 = mpa.EigenmodeCoefficient(sim,
                               mp.Volume(center=mp.Vector3(x=-1),
                                         size=mp.Vector3(y=1.5)),
                               mode,
                               eig_parity=mp.EVEN_Y)
TM0 = mpa.EigenmodeCoefficient(sim,
                               mp.Volume(center=mp.Vector3(x=-1),
                                         size=mp.Vector3(y=1.5)),
                               mode,
                               eig_parity=mp.ODD_Y)
TE_top = mpa.EigenmodeCoefficient(sim,
                                  mp.Volume(center=mp.Vector3(0, 1, 0),
                                            size=mp.Vector3(x=1.5)),
                                  mode,
                                  eig_parity=mp.EVEN_Y)
TM_top = mpa.EigenmodeCoefficient(sim,
                                  mp.Volume(center=mp.Vector3(0, 1, 0),
                                            size=mp.Vector3(x=1.5)),
    mp.Block(center=mp.Vector3(y=Sy/4), material=mp.Medium(index=3.45), size=mp.Vector3(0.5, Sy/2, 0)),  # vertical waveguide
    mp.Block(center=design_region.center, size=design_region.size, epsilon_func=basis.func()) # design region
]

sim = mp.Simulation(cell_size=cell_size,
                    boundary_layers=pml_layers,
                    geometry=geometry,
                    sources=source,
                    eps_averaging=False,
                    resolution=resolution)

#----------------------------------------------------------------------
#- Objective quantities and objective function
#----------------------------------------------------------------------
mode = 1
TE0 = mpa.EigenmodeCoefficient(sim,mp.Volume(center=mp.Vector3(x=-1),size=mp.Vector3(y=1.5)),mode)
TE_top = mpa.EigenmodeCoefficient(sim,mp.Volume(center=mp.Vector3(0,1,0),size=mp.Vector3(x=1.5)),mode)
ob_list = [TE0,TE_top]

def J(input,top):
    return npa.abs(top/input) ** 2

#----------------------------------------------------------------------
#- Define optimization problem
#----------------------------------------------------------------------
opt = mpa.OptimizationProblem(
    simulation=sim,
    objective_function=J,
    objective_arguments=ob_list,
    basis=[basis],
    fcen=fcen,
]

sim = mp.Simulation(cell_size=cell_size,
                    boundary_layers=pml_layers,
                    geometry=geometry,
                    sources=source,
                    eps_averaging=False,
                    resolution=resolution)

#----------------------------------------------------------------------
#- Objective quantities and objective function
#----------------------------------------------------------------------

mode = 1

TE0 = mpa.EigenmodeCoefficient(
    sim, mp.Volume(center=mp.Vector3(x=-1), size=mp.Vector3(y=1.5)), mode)
TE_top = mpa.EigenmodeCoefficient(
    sim, mp.Volume(center=mp.Vector3(0, 1, 0), size=mp.Vector3(x=1.5)), mode)
TE_bottom = mpa.EigenmodeCoefficient(sim,
                                     mp.Volume(center=mp.Vector3(0, -1, 0),
                                               size=mp.Vector3(x=1.5)),
                                     mode,
                                     forward=False)
ob_list = [TE0, TE_top, TE_bottom]


def J(source, top, bottom):
    return npa.sum(0.5 * npa.abs(top / source)**2 +
                   0.5 * npa.abs(bottom / source)**2)