I tried to calculate waveguide loss using Meep, but the resources required for calculation seem very large. I don't think this level of calculation should require such a large amount of resources. I use a 15 thread CPU and 128GB of memory for calculation. My program is as follows:
`import numpy as np
import meep as mp
import matplotlib.pyplot as plt
from meep.materials import LiNbO3
resolution = 50 # pixels/a
a = 0.775 # units of um
r = 0.315*a # units of um
h = 0.3 # units of um
plt.plot(wl, Rs, "bo-", label="reflectance")
plt.plot(wl, Ts, "ro-", label="transmittance")
plt.plot(wl, 1 - Rs - Ts, "go-", label="loss")
plt.xlim(min(wl),max(wl))
plt.xlabel("wavelength (μm)")
plt.legend(loc="upper right")
plt.show()`
This is the file I output at runtime
out.text.txt
I would like to know if this is a common phenomenon in 3D computing or a problem I have set up. Thank you very much.
I tried to calculate waveguide loss using Meep, but the resources required for calculation seem very large. I don't think this level of calculation should require such a large amount of resources. I use a 15 thread CPU and 128GB of memory for calculation. My program is as follows: `import numpy as np import meep as mp import matplotlib.pyplot as plt from meep.materials import LiNbO3 resolution = 50 # pixels/a
a = 0.775 # units of um r = 0.315*a # units of um h = 0.3 # units of um
period_num = 50 wave_length = 1.55 wl_min = 1 wl_max = 1.9 fcen_min = 1/wl_max fcen_max = 1/wl_min fcen = (fcen_max+fcen_min)/2 df = fcen_max-fcen_min pml_height = 0.5*wave_length y_num = 6
geometry_up_boundary = y_numnp.sqrt(3)a geometry_left_boundary = period_numa+2pml_height size = mp.Vector3(geometry_left_boundary,h+10pml_height,2geometry_up_boundary) w = np.sqrt(3)
print(LiNbO3.epsilon(1/1.55)) mater_d = LiNbO3 geometry = [mp.Block(center=mp.Vector3(0,0,0),size=mp.Vector3(geometry_left_boundary,h,w), material=mater_d)]
pml_layers = [mp.PML(pml_height)]
sources = [mp.Source(mp.GaussianSource(frequency=fcen,fwidth=df), component=mp.Ez, center=mp.Vector3(-geometry_left_boundary/2+pml_height,0,0), size=mp.Vector3(0,h,w))]
sim = mp.Simulation(resolution=resolution, cell_size=size, geometry=geometry, boundary_layers=pml_layers, sources=sources,symmetries=[mp.Mirror(mp.Y,phase=1)], eps_averaging=True)
nfreq = 10 ref1_local = -period_num/2a+pml_height+0.5a
ref1_fr = mp.FluxRegion(center=mp.Vector3(ref1_local,0,0), size=mp.Vector3(0,2h,2w), direction=mp.X) ref1 = sim.add_flux(fcen,df,nfreq,ref1_fr)
tran_fr = mp.FluxRegion(center=mp.Vector3(ref1_local+period_numa,0,0), size=mp.Vector3(0,2h,2*w), direction=mp.X) tran = sim.add_flux(fcen,df,nfreq,tran_fr)
运行仿真
pt = mp.Vector3(ref1_local+period_numa-0.5a,0,0) sim.run(until_after_sources=mp.stop_when_fields_decayed(50, mp.Ez, pt, 1e-3)) straight_ref1_data = sim.get_flux_data(ref1) straight_tran_flux = mp.get_fluxes(tran)
sim.reset_meep()
geometry = [mp.Block(center=mp.Vector3(0,0,0),size=mp.Vector3(geometry_left_boundary,h,geometry_up_boundary), material=mater_d)] for i in np.linspace(-geometry_left_boundary,geometry_left_boundary,period_num2+1): for j in np.linspace(-geometry_up_boundary,geometry_up_boundary,2y_num+1): if j != 0: geometry += [mp.Cylinder(center=mp.Vector3(i, 0, j, ), height=mp.inf, material=mp.air, radius=r,axis=mp.Vector3(y=1))] geometry += [mp.Cylinder(center=mp.Vector3(i + 0.5 a, 0, np.sqrt(3) / 2 a + j, ), height=mp.inf, material=mp.air,radius=r,axis=mp.Vector3(y=1))] geometry += [mp.Cylinder(center=mp.Vector3(i + 0.5 a, 0, -np.sqrt(3) / 2 a + j, ), height=mp.inf, material=mp.air,radius=r,axis=mp.Vector3(y=1))]
sim = mp.Simulation(resolution=resolution, cell_size=size, geometry=geometry, boundary_layers=pml_layers, sources=sources)
ref1 = sim.add_flux(fcen,df,nfreq,ref1_fr) tran = sim.add_flux(fcen,df,nfreq,tran_fr) sim.load_minus_flux_data(ref1,straight_ref1_data) sim.run(until_after_sources=mp.stop_when_fields_decayed(50, mp.Ez, pt, 1e-3))
pc_ref1_flux = mp.get_fluxes(ref1) pc_tran_flux = mp.get_fluxes(tran)
flux_freqs = mp.get_flux_freqs(ref1)
wl = [] Rs = [] Ts = [] for i in range(nfreq): wl = np.append(wl, 1 / flux_freqs[i]) Rs = np.append(Rs, -pc_ref1_flux[i] / straight_tran_flux[i]) Ts = np.append(Ts, pc_tran_flux[i] / straight_tran_flux[i])
plt.plot(wl, Rs, "bo-", label="reflectance") plt.plot(wl, Ts, "ro-", label="transmittance") plt.plot(wl, 1 - Rs - Ts, "go-", label="loss") plt.xlim(min(wl),max(wl)) plt.xlabel("wavelength (μm)") plt.legend(loc="upper right") plt.show()` This is the file I output at runtime out.text.txt I would like to know if this is a common phenomenon in 3D computing or a problem I have set up. Thank you very much.