model.study()
Create and define studies.
Syntax
model.study().create(<tag>);
model.study(<tag>).create(<ftag>,type);
model.study(<tag>).feature().move(<ftag>,position);
 
model.study(<tag>).run([<createPlots>])
model.study(<tag>).runNoGen()
model.study(<tag>).createAutoSequences(type)
model.study(<tag>).showAutoSequences(type);
model.study(<tag>).getSolverSequences(type);
model.study(<tag>).isGenConv();
model.study(<tag>).isGenIntermediatePlots();
model.study(<tag>).isGenPlots();
model.study(<tag>).isPlotUndefVals();
model.study(<tag>).isStoreSolution();
model.study(<tag>).setEntry(…);
model.study(<tag>).setGenConv(boolean);
model.study(<tag>).setGenIntermediatePlots(boolean);
model.study(<tag>).setGenPlots(boolean);
model.study(<tag>).setPlotUndefVals(boolean);
model.study(<tag>).setStoreSolution(boolean);
model.study(<tag>).feature(<ftag>).loadFile(filePath);
model.study(<tag>).feature(<ftag>).saveFile(filePath);
 
step = model.study(<tag>).feature(<ftag>);
 
step.discardData();
step.discretization(<physpath>,<discr>);
step.exportData(<filePath>);
step.importData(<filePath>);
step.loadFile(<filePath>);
step.mesh(<geom>,<mesh>);
step.refresh();
step.saveFile(<filePath>);
step.setSolveFor(<entityPath>,boolean)
 
step.type();
step.discretization(<physpath>);
step.mesh(<geom>);
step.solveFor(<entityPath>);
 
step.mglevel.create(<mglevel>);
step.mglevel(<mglevel>).mesh(<geom>,<mesh>);
step.mglevel(<mglevel>).discretization(<physpath>,<discr>);
 
step.mglevel(<mglevel>).mesh(<geom>);
step.mglevel(<mglevel>).discretization(<physpath>);
 
Description
model.study stores a list of studies, each of which consists of a number of study steps. Each study step, in turn, defines a solver-ready problem. This means that a study step can be turned into an extended mesh, and a basic solver (Stationary, Time, Eigenvalue, Modal, AWE, or Optimization) can be applied, resulting in a solution object.
The central property of a study step is its study type, which on one hand controls the equations generated by physics interfaces, and on the other hand triggers automatic selection of a suitable solver. Another important property of a study step is which mesh to use (for each geometry in the model). Other fundamental simulation parameters can also be found among the study step settings, like the time span for a Time Dependent study type and frequency range for a Frequency Domain study type.
Under a study step, you can add multigrid levels. The parent node still defines the problem to be solved (for example, the study type and the mesh). Therefore, the added multigrid levels must necessarily be coarser than the parent study step.
Most physics features and also some other parts of the model object (for example, expression features) must support a step member, which (in analogy to the spatial selection) controls for which study steps the feature is active. In many ways, the study selection can be seen as a fourth, discrete, dimension.
The  StudyList is the list of studies in a model. For instance, model.study("std1") gives the study with tag std1.
model.study().create(<tag>) creates a new study sequence.
model.study(<tag>).run() computes the study. The run method can take an additional boolean input argument createPlots, which, when set to true, generates the corresponding default plots when computing a solution.
model.study(<tag>).runNoGen() runs the attached solver sequence without regenerating it.
model.study(<tag>).createAutoSequences(type) creates an attached solver sequence or job using default solver settings if the solver sequence has not been edited. This command is similar to Compute in the COMSOL Desktop. The argument type is one of all, jobs, or sol, corresponding to creating both jobs and solver sequences or one of them.
model.study(<tag>).showAutoSequences(type) generates a new attached solver sequence or job using default solver settings. This command is similar to Show Default Solver in the COMSOL Desktop; that is, it always creates unedited solver sequences. See createAutoSequences above for information about the type argument.
model.study(<tag>).getSolverSequences(type) returns a list of tags for solver sequences (see model.sol()) connected to this study. The type argument is one of SolverSequence, CopySolution, ParametricStore, Stored, Parametric, None, or All.
model.study(<tag>).setGenConv(boolean) controls the generation of convergence plots. Use model.study(<tag>).isGenConv() to check if convergence plots will be generated.
model.study(<tag>).setGenIntermediatePlots(boolean) controls the generation of default plots for intermediate solutions. Use model.study(<tag>).isGenIntermediatePlots() to check if plots will be generated for intermediate solutions.
model.study(<tag>).setGenPlots(boolean) controls the generation of default plot for the final solution after the last step in a study sequence. Use model.study(<tag>).isGenPlots() to check if plots will be generated for the final solution.
model.study(<tag>).setPlotUndefVals(boolean) controls the creation of a plot that indicates the location of undefined values such as Inf and NaN. Use model.study(<tag>).isPlotUndefVals() to check if plots of undefined values will be generated.
model.study(<tag>).setStoreSolution(boolean) inserts a Solution Store node between each study step in a multistep study if set to true. If set to false, Solution Store nodes are only inserted in certain cases. Use model.study(<tag>).isStoreSolution() to check if a Solution Store node is inserted between each study step (it then returns true).
model.study(<tag>).create(<ftag>,type) creates a new study step of the given type within the specified sequence. The set of allowed values should be limited to study types supported by at least one physics interface present in the model (Stationary, Time, Frequency, and Eigenvalue should always be allowed).
model.study(<tag>).feature().move(<ftag>,position) moves the feature <ftag> to the zero indexed position <position> in the list.
The following two lines sets the outputs to store from a study to the selections with tags sel1 and sel2:
model.study(<tag>).setEntry("outputmap", "solid", "selection");
model.study(<tag>).setEntry("outputselectionmap", "solid", "sel1;sel2");
See setEntry() for more information about how it works.
boolean model.study(<tag>).feature(<ftag>).loadFile(String filePath) and boolean model.study(<tag>).feature(<ftag>).SaveFile(String filePath) both work if the type of feature is a Parametric Sweep and then loads or saves information concerning either All Combinations or Specified Combinations. These methods return false if the type of feature is not a Parametric Sweep. They also return false if the operation is not successful.
step = model.study(<tag>).feature(<ftag>) obtains a reference to a specified study step.
step.discardData() discards any experimental data imported into a Parameter Estimation study step.
 step.discretization(<phys>,<discr>) assigns discretization for a physics interface. The string <phys> is the tag of a physics interface. The string <discr> is a tag of a discretization feature under a physics mode or the string physics to use the discretization settings in the physics interface itself.
step.exportData(<filePath>) exports any experimental data previously imported to a Parameter Estimation study step to the specified file.
step.importData(<filePath>) imports experimental data into a Parameter Estimation study step from the specified <filePath>.
step.loadFile(<filePath>) loads parameter values from the specified <filePath> into a Parametric Sweep study step.
step.mesh(<geom>,<mesh>) specifies which mesh to use for geometry <geom> in the model.
step.refresh() refreshes, that is, reloads, any experimental data files used by a Parameter Estimation study step.
step.saveFile(<filePath>) saves parameter values from a Parametric Sweep study step to <filePath>.
step.setSolveFor(<entityPath>,solve) controls whether degrees of freedom defined by the specified entity will be solved for in the study step. When solve is set to false, the degrees of freedom will not be solved for; when set to true, they will be solved for only if the entity can generate equations for the study-step type. The correct <entityPath> argument corresponding to a model entity is given by <entity>.resolveModelPath().
step.type() returns the study type.
step.discretization(<phys>) returns the tag of the discretization feature under a physics interface with tag <phys> that specifies the shape functions to use for the physics interface in this study step, or the string physics to indicate that the discretization settings in the physics interface itself are used.
step.mesh(<geom>) returns the tag of the mesh to be used in geometry <geom> in this study step.
step.solveFor(<entityPath>) returns true if degrees of freedom defined by the specified entity will be solved for in the study step. The return value accounts for both the state of the activate property and whether the entity allows the study step type. The correct <entityPath> argument corresponding to a model entity is given by <entity>.resolveModelPath().
 step.mglevel.create(<mglevel>) adds a (coarser) multigrid level to a study.
step.mglevel(<mglevel>).mesh(<geom>,<mesh>) specifies a mesh for the multigrid level. The set of allowed values must, in addition to the actual meshes, include an option “from parent”. This should be the default choice and indicates that the multigrid level uses the same mesh as the parent study.
 step.mglevel(<mglevel>).discretization(<physpath>,<discr>) assigns discretization for a multigrid level. The string <physpath> is the path of a physics interface. The string <discr> is a tag of a discretization feature under a physics mode. The default <discr> the physics interface tag. It can be changed to the tag of a discretization node under a physics interface.
step.mesh(<geom>) returns the mesh selected for the given geometry.
step.mglevel(<mglevel>).mesh(<geom>) returns the mesh for the selected multigrid level and geometry.
step.mglevel(<mglevel>).discretization(<discpath>) returns activation status of a discretization feature.
Example
The following code sets up a study sequence to analyze the influence of structural deformation on a waveguide with a numerical port boundary condition. It consists of three steps: stationary structural mechanics followed by an eigenvalue study for the port and finally a wave propagation problem solved with manual multigrid levels (to get nested meshes).
Code for Use with Java
Model model = ModelUtil.create("Model");
model.component().create("comp1");
model.component("comp1").geom().create("geom1", 3);
model.component("comp1").geom("geom1").create("blk1", "Block");
model.component("comp1").geom().run();
model.component("comp1").mesh().create("mesh1", "geom1");
model.component("comp1").mesh().create("mesh2", "geom1");
model.component("comp1").mesh().create("mesh3", "geom1");
model.physics().create("rfw1", "ElectromagneticWaves", "geom1");
model.study().create("seq1");
Study s1 = model.study("seq1");
s1.create("struct","Stationary");
s1.feature("struct").mesh("geom1","mesh1");
s1.create("port","BoundaryModeAnalysis");
s1.feature("port").set("PortName","port1");
s1.feature("port").mesh("geom1","mesh2");
s1.create("wave","Frequency");
s1.feature("wave").mesh("geom1","mesh2");
s1.feature("wave").mglevel().create("mgl1");
s1.feature("wave").mglevel().create("mgl2");
s1.feature("wave").mglevel("mgl2").mesh("geom1","mesh3");
model.physics("rfw1").create("mgl1","Discretization");
model.physics("rfw1").feature("mgl1").set("order","1");
Code for Use with MATLAB
model = ModelUtil.create('Model');
model.component.create('comp1');
model.component('comp1').geom.create('geom1', 3);
model.component('comp1').geom('geom1').create('blk1', 'Block');
model.component('comp1').geom.run;
model.component('comp1').mesh.create('mesh1', 'geom1');
model.component('comp1').mesh.create('mesh2', 'geom1');
model.component('comp1').mesh.create('mesh3', 'geom1');
model.physics.create('rfw1', 'ElectromagneticWaves', 'geom1');
model.study.create('seq1');
s1 = model.study('seq1');
s1.create('struct','Stationary');
s1.feature('struct').mesh('geom1','mesh1');
s1.create('port','BoundaryModeAnalysis');
s1.feature('port').set('PortName','port1');
s1.feature('port').mesh('geom1','mesh2');
s1.create('wave','Frequency');
s1.feature('wave').mesh('geom1','mesh2');
s1.feature('wave').mglevel.create('mgl1');
s1.feature('wave').mglevel.create('mgl2');
s1.feature('wave').mglevel('mgl2').mesh('geom1','mesh3');
model.physics('rfw1').create('mgl1','Discretization');
model.physics('rfw1').feature('mgl1').set('order','1');
In this case, the only settings that must be applied in the study members of other features are the ones relating to multigrid levels. The physics interfaces’ equation form is by default set to automatic, which means that they respond suitably to the study type each time an extended mesh (xmesh) is created.
See Also
model.batch(), model.physics(), model.sol()