In practical engineering applications, since parameters may be interrelated, I need to simultaneously sweep multiple parameters to analyze the comprehensive impact of these parameters on simulation results. How should I efficiently implement multi-parameter joint sweeping in the software?
The parameter sweep functionality in simulation software evaluates how specific parameters influence outcomes. This helps users identify optimal solutions that meet target requirements or pinpoint critical structural parameters. During the sweep, the software models and executes simulations based on predefined parameter values. It automatically saves each run’s project files and results. Users can conduct complex parameter sweeps during the model creation phase by leveraging pre-processing and post-processing script controls. For multi-parameter sweeps, the software provides several configuration methods.
The software provides multiple methods for multi-parameter sweeps:
1. For non-nested sweeps, multiple parameters can be added simultaneously. Note: All parameters must have an identical number of sample points.
2. For nested sweeps, the system prohibits duplicate names across different sweep hierarchies.
3. To perform parameter sweeps using script commands, users need to be familiar with the relevant scripting methods.
The following provides a detailed explanation of the above methods:
1. When configuring non-nested sweeps, multiple parameters can be added simultaneously within a single sweep. These parameters must have an identical number of sample points. Each sweep iteration will synchronously update all parameters according to the values in each column of the parameter settings. For specific configuration instructions, please refer to Sweep Settings.
In the illustration below, when performing a sweep of the Bloch wave vector along the periodic direction of a photonic crystal, the simulation settings for each project iteration are updated according to the values in each column of [kz,kx].
Users can also switch from Range to Sample mode to input discrete sample values for specific parameters. The figure below demonstrates the sweep configuration for material parameters.
2. Multi-parameter sweeps can also utilize the nested sweep function. Each sweep iteration combines one parameter from the outer sweep with all parameters from the inner sweep, executing simulations sequentially for each combination. For example, in the Tunable Terahertz Metamaterials Based on Graphene case study, nested sweeps are employed to investigate the relationship between graphene layer count and Fermi energy level as shown in the table below.
Number | Scattering Rate() | Chemical Potential(/eV) | Temperature(T/K) | Conductivity Scaling© |
---|---|---|---|---|
1 | 0.00102 | 0.265 | 300 | 1 |
2 | 0.00102 | 0.265 | 300 | 4 |
3 | 0.00099 | 0.217 | 300 | 1 |
4 | 0.00099 | 0.217 | 300 | 4 |
The nested sweep described above consists of two hierarchical levels: an outer sweep parameterizing the number of graphene layers, and an inner multi-parameter sweep encompassing chemical potential and scattering rate. Specifically, when the Conductivity Scaling for graphene is set to 1 layer, the simulation will sequentially execute all parameter configurations associated with Chemical Potential. This process repeats when the layer count is changed to 4. Refer to Nested Parameter Sweeps for detailed setup instructions.
3. For more complex multi-parameter sweeps, script commands can be utilized.
In the Exciting the Surface Plasmon-Polaritons in Graphene case study, when dealing with a large number of nonlinear parameter variations, the following script can be referenced to implement parameter sweeps using scripting commands. A parameter space for the incident angle of the light source is established. Within a for
loop, the setnamed
command configures the light source parameters, run
initiates the simulation, and getdata
retrieves the results of each sweep. Relevant script commands can be found in the Knowledge Base Script Commands.
## build source angle sweep
src_theta_TIR = (43.0:0.1:43.9)';
src_theta_rest =(44.0:1:48.0)';
src_theta_dip = (49:0.1:51)';
TIR_len = length(src_theta_TIR);
rest_len = length(src_theta_rest);
dip_len = length(src_theta_dip);
theta_len= TIR_len+rest_len+dip_len;
src_theta(1:TIR_len) = src_theta_TIR;
src_theta(TIR_len+1:TIR_len+rest_len) = src_theta_rest;
src_theta(TIR_len+rest_len+1:theta_len) = src_theta_dip;
for I=1:theta_len
## Modify the source parameters of the project
setnamed("FDTD::Plane Source","angle",src_theta(I));
## run project
run();
## get result
R_num(I) = abs(getdata("FDTD::back","T","T"));
T_num(I) = abs(getdata("FDTD::front","T","T"));
E_x=squeeze(getdata("FDTD::field","E","Ex"));
E_y=squeeze(getdata("FDTD::field","E","Ey"));
E_z=squeeze(getdata("FDTD::field","E","Ez"));
E_image=abs(E_z).^2+abs(E_x).^2+abs(E_y).^2;
end