2024/7/5
Tim
Radialer is a C++ project designed to generate a 3D radialial polarization and export them into txt, npy files. In literature, "cylindrical vector beams"[1,2] are used to describe the mode. I used to use python MEEP for running a lot of electromagnetic simulations. However, there is no c++ implementation for radial polarization in MEEP. Python scripts are not ideal for large-scale computation. This project provides python MEEP users an easy and efficient tool to create a 3D waveform of radial polarization instead of using python implementation. Jupyter notebooks are provided for data visualization and simple simulation demonstration. Since the focal field distribution is exported as independent files, porting to other FDTD simulation solvers might be possible.
- High-performance computing with C++
- Build system integration using CMake
- Uses Boost libraries for efficient numerical calculations
- Data visualization with matplotlib (Jupyter notebook)
- CMake (version 3.10 or higher)
- Boost library
- cnpy (optional)
- HDF5 library (optional)
-
Clone the repository:
git clone https://github.com/mithgil/Radialer.git cd Radialer
-
Create a build directory and navigate to it:
mkdir build cd build
-
Run CMake to configure the project:
cmake ..
-
Buid the project
make
To run the project, use the following command:
./build/runradial
The whole project is built and tested using Unbuntu 20 LTS. Any of Linux distro may not encounter problems. Users can choose the precompiled version. The aurthor of the project presumes the MEEP users work in a Linux environment. The installation for MEEP can be found here.
and then a 4D array of the field will be output as txt and npy. (h5 file is buggy). The file can be visualized by python (/tests/vis.ipynb
and read.py
).
The Numpy npy file format is binary and more lightweight than txt file format.
The txt-format array can be imported through the functions in read.py
.
Mathematical form of the electromagnetic wave of radial polarization is in complex form here. The full calculation including imaginary part is not necessary. It is just for retaining the physical notation and MEEP data-type input in the calculation. Minor modifications could be done here. Waveform input for a MEEP simulation will be in complex form here.
Gaussian-quadrature (from Boost
) is applied in the numerical integrations. This method is more accurate and efficient than other numerical integration methods. Numerical integral function using mid-point method is tested before but not used anymore. Numerical integrals using Gaussian-quadrature rule take around 2 minutes, and is about 3.5 faster than that by midpoint rule on my Linux laptop with a 8th-gen i5 CPU.
Example code snippet in /tests/main.cpp
int dimSet = 81; // pixels per dimension
float wavelengthSet = 0.636; // um
float fillfactorSet = 1.0; //filling factor
float ampSet = 1.0; // amplitude
float NASet = 0.998; // numerical aperture
float hwindowSet = 1.0; // half window in um
where
-
dimSet
will determine the pixels for each dimension of the array as(3,dimSet,dimSet,dimSet)
, where the first3
denotes (x,y,z). MEEP can interpolate grids if the waveform array and simulation cell are mismatched. -
fillfactorSet
denotes the filling factor, which is determined by the experimental condition. For overfilling backaperture of an objective, it can be set to1.0
. -
Apodization function: here Gauss-Bessel function is utilized. Please go to
/src/radial.cpp
for modifications of code and domake
again if other functions are chosen. -
ampSet
here is the amplitude and set as1.0
. So the later simulation in MEEP will have the overall waveform without defining an absoluted physical value. The relative amplitudes can still be compared within the same simulation. If one has concern about this value, please replace it with a value closer to the experimental one. -
NASet
would depend on the objective or parabolic mirror to focus the beam. Here, theNASet
is0.998
since an on-axis parabolic mirror in air is applied. -
hwindowSet
is half of window in each dimension of the calculation. The whole window will be2*hwindowSet
in each dimension. -
units for each dimension here are
$\mu m$ since the units definitions in MEEP universe.
These parameters for calculations can let user clearly visualze the focal field in the jupyter notebook (/tests/vis.ipynb
) and implement the field as source in MEEP .
For xy cross-section,
For xz cross-section,
Radial polarization implemented in MEEP
One can find the examples in the /tests
directory.
-
Qiwen Zhan, "Cylindrical vector beams: from mathematical concepts to applications," Adv. Opt. Photon.(2009)
-
Youngworth, Kathleen S., and Thomas G. Brown. "Focusing of high numerical aperture cylindrical-vector beams." Optics Express 7.2 (2000)
This project is considered as experimental. If anyone creates and publishes incorrect or misleading simulation results using this C++ project along with MEEP, I, as the maintainer of the project, am not responsible for that.
Contributions are welcome! Please fork the repository and submit a pull request.
Distributed under the GNU general public License. See LICENSE for more information.
- Radial Polarization
- MEEP
- FDTD Simulation
- Computational Electromagnetics