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()
model.study(<tag>).runNoGen()
model.study(<tag>).createAutoSequences(type)
model.study(<tag>).showAutoSequences(type)
model.study(<tag>).getSolverSequences(type)
model.study(<tag>).setStoreSolution(boolean)
model.study(<tag>).setPlotUndefVals(boolean);
model.study(<tag>).isStoreSolution()
model.study(<tag>).feature(<ftag>).getAllowedPropertyValues(property);
model.study(<tag>).feature(<ftag>).loadFile(filePath);
model.study(<tag>).feature(<ftag>).saveFile(filePath);
 
step = model.study(<tag>).feature(<ftag>);
 
step.mesh(<geom>,<mesh>);
step.activate(<physpath>,<bool>);
step.discretization(<physpath>,<discr>);
step.mglevel.create(<mglevel>);
step.mglevel(<mglevel>).mesh(<geom>,<mesh>);
step.mglevel(<mglevel>).discretization(<physpath>,<discr>);
 
step.type();
step.activate(<physpath>);
step.discretization(<physpath>);
step.mesh(<geom>);
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, 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.
model.study().create(<tag>) creates a new study sequence.
model.study(<tag>).run() computes the study.
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>).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>).setPlotUndefVals(boolean) creates a plot that indicates the location of undefined values such as Inf and NaN, if set to 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.
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.
model.study(<tag>).feature(<ftag>)).
getAllowedPropertyValues(property)
returns the set of allowed values for a property if the set is a finite set of strings; otherwise, it returns null.
step.mesh(<geom>,<mesh>) specifies which mesh to use for geometry <geom> in the model.
step.activate(<physpath>,<bool>) activates or deactivates a physics interface or a physics feature. The string <physpath> is a path to a node in a physics interface. Currently only the tag of the physics interface tag itself is supported.
 step.discretization(<physpath>,<discr>) assigns discretization for a physics interface. 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.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.type() returns the study type.
step.mesh(<geom>) returns the mesh selected for the given geometry.
 step.activate(<physpath>) returns activation status of a physics interface or a physics interface feature. Currently only the tag of the physics interface tag itself is supported.
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()