model.result()
Postprocessing and results interface.
Syntax
model.result();
model.result().create(<pgtag>,dim);
model.result().create(<pgtag>,ftype);
model.result(<pgtag>).set(property,<value>);
model.result(<pgtag>).run();
 
model.result(<pgtag>).create(<ftag>,ftype);
model.result(<pgtag>).feature(<ftag>).getPlotGroup();
model.result(<pgtag>).feature(<ftag>).getType();
model.result(<pgtag>).feature(<ftag>).getSDim();
model.result(<pgtag>).feature(<ftag>).isPlotGroup();
model.result(<pgtag>).feature(<ftag>).prepareView(<value>);
model.result(<pgtag>).feature(<ftag>).selection(...);
model.result(<pgtag>).feature(<ftag>).set(property,<value>);
model.result(<pgtag>).feature(<ftag>).run();
model.result(<tag>).feature(<ftag>).getAllowedPropertyValues(property);
 
model.result(<pgtag>).feature(<ftag>).create(<attrtag>, attrtype);
model.result(<pgtag>).feature(<ftag>).feature(<attrtag>).set(property,<value>);
 
model.result().dataset().create(<dtag>,dtype);
model.result().dataset(<dtag>).create(<dtag2>,dtype);
model.result().dataset(<dtag>).selection(...);
model.result().dataset(<dtag>).set(property,<value>);
model.result().dataset(<dtag>).getAllowedPropertyValues(property);
 
model.result().export().create(<etag>,<pgtag>,ctype);
model.result().export(<etag>).create(<e2tag>,ctype);
model.result().export(<etag>).set(property,<value>);
model.result().export(<etag>).run();
model.result().export(<etag>).getAllowedPropertyValues(property);
 
model.result().numerical().create(<ntag>,ntype);
model.result().numerical(<ntag>).selection(...);
model.result().numerical(<ntag>).set(property,<value>);
model.result().numerical(<ntag>).run();
 
model.result().table().create(<ftag>,ntype);
model.result().table(<ftag>).setColumnHeaders(<headers>);
model.result().table(<ftag>).setTableData(<realData>,<imagData>);
model.result().table(<ftag>).getColumnHeaders();
model.result().table(<ftag>).getReal();
model.result().table(<ftag>).getImag();
model.result().table(<ftag>).isComplex();
model.result().table(<ftag>).clearTableData();
model.result().table(<ftag>).save(<filename>);
 
model.result().report().create(<rtag>);
model.result().report(<rtag>).getAllowedPropertyValues(property);
model.result().report(<rtag>).set(rprop,<value>);
model.result().report(<rtag>).set("template", <value>);
model.result().report(<rtag>).generate();
model.result().report(<rtag>).create(<r2tag>,frtype);
model.result().report(<rtag>).feature(<r2tag>).set(rprop,<value>);
model.result().report(<rtag>).feature(<r2tag>).create(<r3tag>,frtype);
model.result().report(<rtag>).feature(<r2tag>).feature(<r3tag>).set(rprop,<value>);
model.result().report(<rtag>).run();
Description
model.result(<pgtag>) returns a plot group with tag <pgtag>.
model.result().create(<pgtag>,dim) creates a plot group with the tag <pgtag>, of dimension dim, where dim can be 1, 2, or 3.
model.result().create(<pgtag>,ftype) creates a plot group of type ftype. The valid types are "PlotGroup1D", "PlotGroup2D", "PlotGroupe3D", "PolarGroup", and "SmithGroup".
  model.result(<pgtag>).create(<ftag>,ftype) creates a plot feature of type ftype tagged <ftag> belonging to the plot group <pgtag>.
model.result(<pgtag>).feature(<ftag>).getType() returns the type of the feature <ftag>. This is the same string ftype that was used to create the feature.
model.result(<pgtag>).feature(<ftag>).getSDim() returns the spatial dimension of the plot group.
model.result(<pgtag>).feature(<ftag>).isPlotGroup() return true if the feature is a plot group. This method is also available on the child features.
model.result(<pgtag>).feature(<ftag>).getPlotGroup() returns the plot group the feature belongs to. This method is also available on the child features.
model.result(<pgtag>).feature(<ftag>).create(<attrtag>, attrtype) creates an attribute feature with the tag <attrtag> of type attrtype, belonging to the feature <ftag>.
model.result(<pgtag>).run() plots the plot group.
model.result(<pgtag>).feature(<ftag>).prepareView(<value>) returns the view to use when plotting the plot group to which the feature belongs. The argument is a Boolean, and if true, the view is created if needed.
model.result().dataset().create(<dtag>,dtype) creates a dataset feature with the tag <dtag> and the type dtype.
model.result().export().create(<etag>,<pgtag>,etype) creates an export feature with the tag <etag>, belonging to plot group <pgtag> and of export type etype.
model.result().numerical().create(<ntag>, ntype) creates a numerical results feature with the tag <ntag> of the numerical feature type ntype.
model.result().numerical(<ntag>).run() evaluates the numerical results feature.
model.result(<tag>).feature(<ftag>)).getAllowedPropertyValues(property),  model.result().dataset(<dtag>).getAllowedPropertyValues(property),  model.result().export(<etag>).getAllowedPropertyValues(property), and  model.result().report(<rtag>).getAllowedPropertyValues(property)return the set of allowed values for a property if the set is a finite set of strings; otherwise, they return null.
model.result().dataset(<dtag>).refresh() updates Grid dataset using data from functions that read files (Elevation, Image, and Interpolation).
model.result().table().create(<ftag>,ntype) creates a table feature with the tag <ftag>. The set and get methods used to manipulate tables are described in Table.
The data extraction methods used to retrieve plot or numerical data are described in Results.
model.result().report().create(<rtag>,"Report") creates a report with tag <rtag>.
model.result().report().create(<ptag>,"Presentation") creates a presentation with tag <ptag>.
model.result().report().create(<ttag>,"Template") creates a report template with tag <ttag>. Such report templates are customized alternatives to the built-in templates: brief, intermediate, and complete. A complete report template contains a single instance of each of the regular model-contents report features. When a model-contents report feature occurs in a template, the available properties match those of the corresponding regular report feature. However, some regular report-feature properties, such as the noderef property for referencing the model feature to report on, are not applicable and therefore not available.
To set up a template template, you can build it feature by feature or use one of the built-in templates as the starting point and then generate it before customizing the settings:
template.set("level", lvalue);
template.set("absentnodes",
state);
template.generate();
The allowed values for the level property are "brief", "intermediate" (default), and "complete". The value of this property is also used to define the initial settings when building the template manually. The absentnodes property can take two values:
"exclude" (default) — template nodes that are absent from or disabled in the template are excluded when generating a report using the template;
"include" — conversely, template nodes that are absent from or disabled in the template are included when generating a report using the template.
Having created the report report, specify which template to use and then generate contents:
report.set("template", value);
report.generate();
The allowed values for the template property depends on the availability of custom templates in the model, the installation, and the user’s report templates directory:
The built-in templates, "brief", "intermediate" (default), and "complete", are always available.
If the model contains report templates with tags tmpl1, …, tmpln, these can be chosen as templates for report by setting the template property to any of the values "model.tmpl1", …, "model.tmpln", with model being a fixed namespace prefix.
If the directory data/reporttemplates under the COMSOL Multiphysics installation root directory contains MPH-files with report templates, these can be chosen by setting template to "installation.<TemplateFilename>.<ttag>". Here installation is a fixed namespace prefix, <TemplateFilename>.mph is the name of the MPH-file, and <ttag> is a report template tag.
Finally, if the reporttemplates directory under the user settings directory .comsol/v56 under your local home directory contains MPH-files with report templates, these are chosen using the same pattern as for installation templates with the difference that the namespace prefix is user.
Note that if report already has child nodes when report.generate() is called, these nodes will be removed before the generation of new contents.
model.result().report().create(<ttag>,"PresentationTemplate") creates a presentation template with tag <ttag>. Such presentation templates are customized alternatives to the built-in templates: default and detailed. A complete presentation template contains a single instance of each of the regular model-contents presentation features. When a model-contents presentation feature occurs in a template, the available properties match those of the corresponding regular presentation feature. However, some regular presentation-feature properties, such as the noderef property for referencing the model feature to include, are not applicable and therefore not available.
report.create(<tptag>,"TitlePage") adds a title page to the report report. Only one title-page feature can be added.
report.create(<tptag>,"TitleSlide") adds a title slide to the presentation presentation. Only one title-slide feature can be added.
report.feature(<tptag>).set(prop,value) sets the title-page property prop to the value value.
report().create(<toctag>,"TableOfContents") adds a table of contents to the report report. Only one table-of-contents feature can be added.
report.create(<stag>,"Section") adds an additional section level to a report.
report.create(<stag>,"SectionSlide") adds a section slide to the presentation presentation.
report.feature(<stag>).set(prop,value)
report.feature(<stag>).create(<ftag>),feature)
report.feature(<stag>).feature(<ftag>).set(prop,value)
To add a report or presentation contents feature — that is, a feature corresponding to content in the report or presentation — to a section feature section, type, section.create(<frtag>,frtype,…). Depending on the feature type frtype, the create operation includes zero, one, or two tags that refer to the model feature to include. The tags must refer to an existing feature of the correct type. The feature types that are available for reporting on the model contents are listed in Table 2-108. For details on their usage, see the section Model Contents — Report Components in the COMSOL Multiphysics User’s Guide.
In addition, the custom feature types listed in Table 2-109 are also available for building reports and presentations. Their usage is described in the section Custom Report, Documentation, and Presentation Components in the COMSOL Multiphysics User’s Guide.
Finally, a number of report feature types are provided for creating reports and presentations for apps created in the Application Builder. These are listed in Table 2-110. For further details, see the sections Arrays and Scalars and Declaration Components in the COMSOL Multiphysics User’s Guide and references therein.
StringDataField, BooleanDataField, IntegerDataField, DoubleDataField
StringArrayDataField, BooleanArrayDataField, IntegerArrayDataField, DoubleArrayDataField
StringMatrixDataField, BooleanMatrixDataField, IntegerMatrixDataField, DoubleMatrixDataField
To point a report feature rFeature to another feature with tag <ftag> in the tree, use the method rFeature.set("noderef",<ftag>) method. A report contents feature must point to a feature of the type it is designed to report on; see the table above. Instead of a feature tag, set "noderef" to "none" to clear a reference.
model.result().report(<rtag>).feature(<stag>).feature(<frtag>).set(frprop, <value>)
to set a property in a report feature.
Examples
Create a dataset and set it to point to the tagged solution sol1 from a solver sequence:
Code for Use with Java
model.result().dataset().create("dset", "Solution");
model.result().dataset("dset").set("solution", "Sol1");
Code for Use with MATLAB
model.result.dataset.create('dset', 'Solution');
model.result.dataset('dset').set('solution', 'Sol1');
Create a 3D plot group containing a streamline plot and a plane with a contour plot on:
Code for Use with Java
result().create("pg1",3);
result("pg1").set("data","dset");
result("pg1").create("stream","Streamline");
model.result("pg1").feature("stream").set("expr", new String[]{"2-x", "0", "z"});
model.result("pg1").feature("stream").selection().set(new int[]{2});
result().dataset().create("cutp1","CutPlane");
result("pg1").create("cont1","Contour");
result("pg1").feature("cont1").set("data","cutp1");
result("pg1").run();
Code for Use with MATLAB
result.create('pg1',3);
result('pg1').set('data','dset');
result('pg1').create('stream','Streamline');
model.result('pg1').feature('stream').set('expr', {'2-x', '0', 'z'});
model.result('pg1').feature('stream').selection.set(2);
result.dataset.create('cutp1','CutPlane');
result('pg1').create('cont1','Contour');
result('pg1').feature('cont1').set('data','cutp1');
result('pg1').run;