This topic explains how the Import source can be used to inject an arbitrary field profile into your simulation. In this example, the script can create an approximately radially polarized or azimuthally polarized beam.
Defining the field profile
Download the associated files. Open usr_custom_source.fsp and run the script file usr_custom_source.lsf. The script calculates the electric and magnetic fields at the source injection plane. The default settings in the script file will create a radially polarized beam, but you can modify the value of the "pol" variable in the script to specify an azimuthally polarized beam instead.
Warning: The field profile calculated in this script is greatly simplified equation for a radial polarized beam that is intended for demonstration purpose only. |
Adding the source to your simulation
The script then packages the data into a dataset and loads that data into the Import source using the importdataset function. The data is also saved to a .mat file that can be later loaded into the Import source by editing its properties and pressing the "Import Source" button, as shown below.
Measure the profile with a monitor
As a final test, we can run the simulation and compare the field profile recorded by a monitor just in front of the source with the original EM dataset. After running the simulation, the script will plot both field profiles.
The measured field profile is very similar to what we originally specified.
The solver will attempt to inject whatever fields are specified, but it is important to recognize that specifying unphysical fields can lead to simulation errors. For example, there may be power normalization problems, source back reflections, or differences between the specified and actual injected fields.
Note: Symmetric boundary conditions for custom field profiles Symmetry boundary conditions can be used whenever the EM fields have a plane of symmetry through the middle of the simulation region. For more information see Choosing between symmetric and anti-symmetric BCs |
See also
Custom source profile from monitor data