Research on the optical far field of Dirac vortex topological cavities
MATLAB class Field2D
supports the some operations on near to far field transformation.
There are a few public properties in Field2D
:
- Properties
x
,y
,nx
,ny
are matrices of the same size to store the data of near field.x
andy
are the coordinate mesh whilenx
andny
are the x- and y-components of the near field. - Properties
kx
,ky
,fx
,fy
are matrices of the same size to store the data of far field.fx
andfy
are x- and y-components of far field .Different with near field, the coordinate of far field is indicated by the wave vectorkx
andky
. - Properties
freq0
,lambda0
,k0
are the frequency, wavelength, wave vectore in vacuum respectively.
obj = Field2D(x_in, y_in, fx_in, fy_in, freq, unit)
The constructor accepts the input data of near field to assign a class.
x_in
: the x-coordinate of near field. Must be a n-vector.y_in
: the y-coordinate of near field. Must be a n-vector.fx_in
: the x-component of near field. Must be a n-vector.fy_in
: the y-component of near field. Must be a n-vector.freq
: the frequency of the input near field. Must be a real number.unit
: the unit of x- and y-coordinate. Valid values are'm', 'cm', 'mm', 'um', 'nm', 'a'
.
obj = obj.getFarFieldCPU({kx, ky})
obj = obj.getFarFieldCPU({kx, ky}, CoreNumber)
obj = obj.getFarFieldCPU(farGridNumber)
obj = obj.getFarFieldCPU(farGridNumber, CoreNumber)
The method getFarFieldCPU(-)
uses CPU to calculate parallelly and save the far field of the near field store in class obj
.
{kx, ky}
: this is a single input variable, which is a cell in MATLAB. The first element is a n-vector contains the value ofkx
and the second element is the same.farGridNumber
: the number of grids of far field. It is no different withkx=ky=linspace(-1,1,farGridNumber)
.CoreNumber
: the CPU core number of parallel computation. Default is the half of total CPU core.
This method will first check if a parallel pool is running or not. if not, this method will start a parallel pool with size of CoreNumber
.
obj = obj.getFarFieldGPU(fargrid)
obj = obj.getFarFieldGPU({kx, ky})
The method getFarFieldGPU(-)
uses GPU to compute and will return the same result as getFarFieldCPU(-)
. getFarFieldGPU(-)
is recommended to use because of its high efficiency.
obj.plotNearField()
obj.plotNearField(colormap)
s = obj.plotNearField(-)
The method plotNearField(-)
plots the near field power distribution abs(obj.nx).^2+abs(obj.ny).^2
, and returns a image object of class Patch
.
colormap
: the colormap. Default isparula
obj.plotFarField(quiverSize,density,range)
s = obj.plotFarField(-)
The method plotFarField(-)
plots the far field power distribution P=abs(obj.fx).^2+abs(obj.fy).^2
, and returns a image object of class Patch
. This method also plots the polarization of the far field in green line.
quiverSize
: this factor determines size of polarization marks (green line).quiverSize=1
is recommended.density
: this factor determines the density of polarization marks. This factor must be an interger (1,2,3...). A greaterdensity
indicates a smaller marker density.density=2
is recommendedrange
: this factor determines the ploting range of polarization marks. The marks will be plotted in the area where the internsityP<Pmax*range
. A smallerrange
indicates a bigger marked area.range=0.1
is recommended.
First, load data from file and use the constructor to assign an object field
clear
data = readmatrix('near-field-data.csv');
x_in = data(:,1);
y_in = data(:,1);
Ex_in = real(data(:,3));
Ey_in = real(data(:,4));
f0 = 3.0454e14;
field = Field2D(x_in, y_in, Ex_in, Ey_in, f0, 'nm');
Then use getFarFieldGPU(-)
to calculate the far field
field = field.getFarFieldGPU(101);
Finally, use plotFarField(-)
to plot the far field power distribution.
figure
s = field.plotFarField(1,2,0.1);
This project is licensed under GPL v3.0 license