Collecting the field profile from a sweep

Continuing the discussion from Convergence of field:

You can collect the field profile for all frequency points and parameters in the sweep by collecting the field profile as a result of the nested sweep. For example, if the electric field profile is the result you want to collect, you can collect the “E” result from the monitor in the inner sweep:

For a nested sweep, you will also need to collect the result of the inner sweep as one of the outer sweep results.

If you have any trouble with it, let me know.

1 Like

Hi nancy,
I am using script to calculate the maximum electric field, the transmission, and the position of maximum electric field. I also want to save the field profile for the same at each frequency. i am sending structure and the script. Please either make changes in the script file or suggest me.

Thanksmax field with frequency and position .lsf (5.9 KB)
p=600,a=200g=10, t=20.fsp (284.6 KB)

Here is a modified script file: modified_max field with frequency and position .lsf (6.2 KB)

For the sweep which is run using a script file, one way to collect the field profile data is to collect the data from all points in the sweep into a single matrix dataset result. However, this is only possible if the E field data is collected over the same x and y positions for each simulation in the sweep since there can only be one set of x and y parameters for the E field data at each sweep point.

Since the sweep is sweeping the period of the array, the simulation mesh changes for different points in the sweep, so we can’t collect the data into one dataset. Instead, I have modified the script to collect the E dataset results for each point in the sweep in a cell type variable called “E_profile” which is initialized in line 104 of the script file. The E datasets in the cell are collected for each point in the sweep on line 163. More information about cell type variables can be found here:

After running the script, you can access the data for an individual sweep point from the E_profile variable using the syntax E_profile{sweep point number}. Or, I have also added a loop starting at line 181 of the script to loop through and visualize the collected E dataset for each point in the sweep. This will be run if you change “if(0)” to “if(1)”. I have set it not to run by default since if you are sweeping many points, it could open up many visualizer windows which could slow down the system.

I have only changed the analysis for the nested sweep portion of the script file.

1 Like