Parametric Sweep
Use a Parametric Sweep () study to find the solution to a sequence of stationary or time-dependent problems that arise when you vary some parameters of interest. The parametric sweep can include multiple independent parameters directly for a full multiparameter sweep (solve for the first value of the first parameter combined with all values of the second parameter, then the second value of the first parameter combined with all values of the second parameter, and so on, or use a specified combination of parameter values). You can also add more than one Parametric Sweep node to create nested parametric sweeps. The program then treats the parametric sweeps as a “nested for-loop” and indicates the nested structure using indentations of the Parametric Sweep nodes’ names.
See Table Surface for information about how to plot the variation of some quantity as a function of two parameters as a 2D surface plot where you vary two parameters and fix the others.
It is only possible to use one Sensitivity, Optimization, or Parametric Sweep feature in any study.
The Settings window has the following sections:
Study Settings
Use the Sweep type list to specify the type of sweep to perform. The Specified combinations type (the default) solves for a number of given combinations of values, while the All combinations type solves for all combinations of values. Using all combinations can lead to a very large number of solutions.
Use the table with Parameter name, Parameter value list, and (optional) Parameter unit to specify parameter names, values, and units for the parametric solver. Use the Add button () to add a row to the table. Each row has one parameter name, a corresponding parameter value list, and an optional unit. The unit becomes orange if the unit that you specify does not match the unit given for the parameter where it is defined. For the Specified combinations sweep type, the list of values must have equal length. When you click in the Parameter value list column to define the parameter values, you can click the Range button () to define a range of parameter values. The parameter unit overrides the unit of the global parameter. If no parameter unit is given, parameter values without explicit dimensions are considered dimensionless.
If more than one parameter name have been specified, the lists of parameter values are interpreted as follows: Assume that the parameter names are p1 and p2, and that p1 has the list 1 3 and p2 has the list 2 4. For the Specified combinations sweep type, the solver first uses p1 equal to 1 and p2 equal to 2. Thereafter, it uses p1 equal to 3 and p2 equal to 4. And when the sweep type is All combinations, the solver uses the following order for the parameter combinations: 1 2, 1 4, 3 2, and 3 4.
An alternative to specifying parameter names and values directly in the table is to specify them in a text file. Use the Load from File button () to browse to such a text file. The program appends the read names and values to the current table. The format of the text file must be such that the parameter names appear in the first column and the values for each parameter appear row-wise with a space separating the name and values, and a space separating the values. Click the Save to File button () to save the contents of the table to a text file (or to a Microsoft Excel Workbook spreadsheet if the license includes LiveLink™ for Excel®).
The loading and saving of parameter table data using Excel includes the units in the Parameter unit column. The unit column is ignored when saving and loading parameter data to *.txt, *.csv, and *.dat files.
Output while Solving
Select the Plot check box to allow plotting of results while solving. Then select what to plot from the Plot group list. The software plots the data set of the selected plot group as soon as the results become available.
Use the Probes list to select probes to update during the parametric sweep. The default is All, which selects all probes for plotting and tabulation of probe data. Select Manual to open a list with all available probes. Use the Move Up (), Move Down (), Delete (), and Add () buttons to make the list contain the probes that you want to see results from while solving. Select None to disable probe updating for parametric sweep. Note that the control of tables and plot windows is done using the probe settings.
If a probe is updated on the Parametric Sweep level and also through another solution process (for example, a time-dependent simulation) this probe is not updated at the Parametric Sweep level. When the probes themselves (not the probe expression) depend on model parameters, the update of these probes is only correct for parameter sweeps that are done through outer parametric sweeps (not by a parametric solver). Outer parametric sweeps are performed by a Parametric node under Job Configurations. COMSOL Multiphysics currently does not autodetect model parameters in probes, so you might want to select Off from the Use parametric solver list in the Study Extensions section for the Parametric Sweep study node.
Select the Accumulated probe table check box to activate the accumulation of probe updates for both the variation on the solver level (time, frequency, and so forth) and on the parametric sweep level. Use the Output table to select where to put the data. Select the Use all probes check box if all the model probes should be accumulated in the table. If not selected, the probes selected by the Probes selector are used.
No plots are generated automatically from the accumulated probe tables. When a full variation has been accumulated, then the Format: Filled is available for the table (see the Settings window for Table). This format makes it possible to modify the table data and make so-called response surfaces directly from the Results view toolbar Surface Plot button.
Also, if the Use parametric solver setting is Automatic and the solver decides to use the parametric solver instead of a parametric sweep, an accumulated probe table is not created.
You can use the Memory settings for jobs and the Keep solutions in memory list to control how to store the solutions from the individual parametric sweep solutions. Select All to store all the parametric sweep solutions in memory, or select Only last to store only the last solution from the parametric sweep. If you select Only last and the parametric solver is used, all solutions are kept in memory. When only the last solution is stored, you can also select the Save each solution as model file check box. It stores the separate parametric sweep solutions and their corresponding models in separate MPH-files. Enter a filename in the Filename field or click Browse to choose a name and location for the model files. You can also use probes to collect some solution values of interest during the sweep rather than storing all solutions, which can save memory and solution time.
To make sure that each solution is saved as a Model MPH-file, select Off from the Use parametric solver list in the Study Extensions section (see below). With that setting, the solver uses an outer sweep instead of an inner sweep, and it is then possible to save each solution to file.
Study Extensions
From the Use parametric solver list, select one of the following options:
Automatic (the default) to generate a Parametric job configuration, unless the problem and parameters are such that the parametric sweep can be realized through a Stationary Solver with a Parametric solver subnode (), which is more efficient.
Off to always generate a Parametric job configuration.
If you are running a parametric sweep and want to distribute it by sending one parameter value to each compute node, select the Distribute parametric sweep check box. To enable this option, click the Show button () and select Advanced Study Options.
To reduce the size of MPH-files for models using parametric sweeps, you have the option of storing only the last solution in the sweep in the file. If you want to use this setting as the default, open the Preferences dialog box and click Parametric Sweep. Then choose Only last from the Keep solutions in memory list. You then have the further option of saving each solution as a model file. To do this, select the Save each solution as model file check box and then enter a filename in the Filename field, or click Browse to choose a name and location for the model files. The default option in the Keep solutions in memory list, All, stores all solutions in the file.
Stationary for information about the continuation parametric solver versus parametric sweeps.