mirror of
https://github.com/edoverg/modeconverter.git
synced 2026-10-14 23:06:39 +00:00
testing fields again
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ print(max_clim)
|
|||||||
def animate(frame):
|
def animate(frame):
|
||||||
ax.clear()
|
ax.clear()
|
||||||
|
|
||||||
im = ax.imshow(np.rot90(np.abs(data[frame][:,0,:]),k=1), origin="lower",
|
im = ax.imshow(np.rot90(np.abs(data[frame][:,0,:]),k=3), origin="lower",
|
||||||
extent=[z.min(), z.max(),x.min(), x.max(),],
|
extent=[z.min(), z.max(),x.min(), x.max(),],
|
||||||
|
|
||||||
cmap="viridis",
|
cmap="viridis",
|
||||||
|
|||||||
+7
-8
@@ -11,20 +11,20 @@ import os
|
|||||||
import xarray as xr
|
import xarray as xr
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
mp.verbosity(3)
|
mp.verbosity(2)
|
||||||
|
|
||||||
if not os.path.exists("results"):
|
if not os.path.exists("results"):
|
||||||
os.makedirs("results")
|
os.makedirs("results")
|
||||||
|
|
||||||
###### PHYSICS SETUP ######
|
###### PHYSICS SETUP ######
|
||||||
RESOLUTION = 18 #pixels per meep unit length (1um)
|
RESOLUTION = 20 #pixels per meep unit length (1um)
|
||||||
MAX_RUN_TIME = 1100 #meep units
|
MAX_RUN_TIME = 1100 #meep units
|
||||||
WAVELENGTH_MIN_UM = 1.50
|
WAVELENGTH_MIN_UM = 1.50
|
||||||
WAVELENGTH_MAX_UM = 1.60
|
WAVELENGTH_MAX_UM = 1.60
|
||||||
PML_UM = 1.0 #PML thickness
|
PML_UM = 1.0 #PML thickness
|
||||||
BUFFER = 2.0
|
BUFFER = 3.0
|
||||||
DESIGN_WAVELENGTHS_UM = [1.50,1.55,1.60] #wavelengths at which to optimize the device
|
DESIGN_WAVELENGTHS_UM = [1.50,1.55,1.60] #wavelengths at which to optimize the device
|
||||||
DESIGN_REGION_UM = mp.Vector3(2,2,1)
|
DESIGN_REGION_UM = mp.Vector3(4,4,1)
|
||||||
DESIGN_REGION_RESOLUTION = int(2 * RESOLUTION)
|
DESIGN_REGION_RESOLUTION = int(2 * RESOLUTION)
|
||||||
DESIGN_REGION_CENTER = mp.Vector3(0, 0, DESIGN_REGION_UM.z / 2)
|
DESIGN_REGION_CENTER = mp.Vector3(0, 0, DESIGN_REGION_UM.z / 2)
|
||||||
NX_DESIGN_GRID = int(DESIGN_REGION_UM.x * DESIGN_REGION_RESOLUTION) + 1
|
NX_DESIGN_GRID = int(DESIGN_REGION_UM.x * DESIGN_REGION_RESOLUTION) + 1
|
||||||
@@ -67,7 +67,7 @@ frequency_width = frequency_max - frequency_min
|
|||||||
SOURCE_CENTER = mp.Vector3(0,0,-BUFFER/2)
|
SOURCE_CENTER = mp.Vector3(0,0,-BUFFER/2)
|
||||||
SOURCE_SIZE = mp.Vector3(physical_domains_size.x,physical_domains_size.y,0)
|
SOURCE_SIZE = mp.Vector3(physical_domains_size.x,physical_domains_size.y,0)
|
||||||
|
|
||||||
NEAR_REGION_MONITOR_CENTER = mp.Vector3(0,0, DESIGN_REGION_UM.z)
|
NEAR_REGION_MONITOR_CENTER = mp.Vector3(0,0, DESIGN_REGION_UM.z + BUFFER/2)
|
||||||
NEAR_REGION_MONITOR_SIZE = mp.Vector3(physical_domains_size.x,physical_domains_size.y,0)
|
NEAR_REGION_MONITOR_SIZE = mp.Vector3(physical_domains_size.x,physical_domains_size.y,0)
|
||||||
|
|
||||||
ff_monitor_center = mp.Vector3(0,0,DESIGN_REGION_UM.z + BUFFER)
|
ff_monitor_center = mp.Vector3(0,0,DESIGN_REGION_UM.z + BUFFER)
|
||||||
@@ -366,7 +366,7 @@ def normalization_sim() -> np.ndarray:
|
|||||||
mp.Source(
|
mp.Source(
|
||||||
src=mp.GaussianSource(
|
src=mp.GaussianSource(
|
||||||
frequency=frequency_center,
|
frequency=frequency_center,
|
||||||
fwidth=frequency_width/2),
|
fwidth=frequency_width),
|
||||||
component=mp.Ex,
|
component=mp.Ex,
|
||||||
center=SOURCE_CENTER,
|
center=SOURCE_CENTER,
|
||||||
size=SOURCE_SIZE,
|
size=SOURCE_SIZE,
|
||||||
@@ -408,9 +408,8 @@ def normalization_sim() -> np.ndarray:
|
|||||||
|
|
||||||
norm_near2far = norm_sim.add_near2far(frequencies, *NearRegions)
|
norm_near2far = norm_sim.add_near2far(frequencies, *NearRegions)
|
||||||
|
|
||||||
#norm_sim.run(until_after_sources=stop_cond)
|
|
||||||
norm_sim.run(
|
norm_sim.run(
|
||||||
mp.at_every(10,mp.in_volume(
|
mp.at_every(1,mp.in_volume(
|
||||||
mp.Volume(center=mp.Vector3(), size=physical_domains_size),
|
mp.Volume(center=mp.Vector3(), size=physical_domains_size),
|
||||||
mp.output_efield_x
|
mp.output_efield_x
|
||||||
)),
|
)),
|
||||||
|
|||||||
Reference in New Issue
Block a user