Hi, Thanks for your answer but I've got a question about the physical meaning of the aplitude function. I understand that the "k" is used to obtain an inclination of the beam but how is the "sigma" that I introduce linked with pysical values like the NA and the wavelenght?
Thank you. Andrea <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Mail priva di virus. www.avg.com <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> Il giorno lun 11 feb 2019 alle ore 21:42 Ardavan Oskooi < ardavan.osk...@gmail.com> ha scritto: > On 2/11/19 09:28, Prs R wrote: > > > I'd like to create a focused gaussian beam where I can choose the > > (numerical aperture) NA of the beam. > > Is there any predefined functions to do that? > > There are currently no predefined functions to define a Gaussian > envelope but you can set this up yourself using the amplitude function > of the source object. An example is provided for a tilted beam in the > script below. Four snapshots of the resulting field profile for > different values of the beam width ("sigma") and rotation angle > ("rot_angle") are shown in: > > http://ab-initio.mit.edu/~oskooi/meep_discuss/gaussian_beam.png > > Since this topic has come up several times before on this list (e.g., > https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg00074.html), > > we'll create a new FAQ for the documentation which will be up shortly. > > --------------------------------------------------------------------- > > import meep as mp > import math > import cmath > import numpy as np > import matplotlib.pyplot as plt > > cell_size = mp.Vector3(20,10,0) > > resolution = 40 > > pml_layers = [mp.PML(thickness=1.0,direction=mp.Y)] > > fcen = 1.0 # center frequency of CW source > > rot_angle = math.radians(20) # rotation angle of beam > k = mp.Vector3(y=1).rotate(mp.Vector3(z=1),rot_angle).scale(fcen) > > sigma = 1.0 # width of beam > > def gaussian_beam(sigma, k, x0): > def _gaussian_beam(x): > return > cmath.exp(1j*2*math.pi*k.dot(x-x0)-(x-x0).dot(x-x0)/(2*sigma**2)) > return _gaussian_beam > > src_pt = mp.Vector3(y=4) > sources = [mp.Source(src=mp.ContinuousSource(fcen, fwidth=0.2*fcen), > component=mp.Ez, > center=src_pt, > size=mp.Vector3(10), > amp_func=gaussian_beam(sigma,k,src_pt))] > > sim = mp.Simulation(cell_size=cell_size, > sources=sources, > k_point=k, > boundary_layers=pml_layers, > resolution=resolution) > > > sim.run(until=50) > > non_pml_vol = mp.Volume(center=mp.Vector3(), size=mp.Vector3(20,8,0)) > ez_data = sim.get_array(vol=non_pml_vol, component=mp.Ez) > > plt.figure() > plt.imshow(np.flipud(np.transpose(np.real(ez_data))), > interpolation='spline36', cmap='RdBu') > plt.axis('off') > plt.show() > > > _______________________________________________ > meep-discuss mailing list > meep-discuss@ab-initio.mit.edu > http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
_______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss