model.component(
<ctag>).
material().move(<tag>,<position>);
model.component(<ctag>).material().create(<tag>) creates a new material for the model component with the tag
<ctag>.
model.component(<ctag>).material().create(<tag>,"Common") also creates a new material for the model component with the tag
<ctag>.
model.component(<ctag>).material().create(<tag>,"Switch") creates a material switch for the model component with the tag
<ctag>. You can add materials to the material switch:
model.component(<ctag>).material().create(<tag>,"Link") creates a material link for the model component with the tag
<ctag>.
model.component(<ctag>).material().create(<ptag>,"PorousMedia") also creates a new local porous material for the model component with the tag
<ctag>. Use
model.component(<ctag>).
material(<ptag>).feature().create(<subtag>,<subfeaturename>,<ctag>); where
<subfeaturename> is one of
"Fluid",
"Pellet",
"Solid", or
"ImFluid" to add a subfeature to the porous material feature representing a fluid, pellet, solid, or immobile fluid, respectively.
model.component(<ctag>).material().create(<tag>,"External") creates an external material that sets up an interface between a physics feature and functions in an external shared library (a DLL, .so, or .dylib file.). For an external material,
model.component(<ctag>).material(<tag>).set("path",<path to external material file>) sets the path to the external shared library. Also, use
model.material(<tag>).set("threadSafe", "off")if the DLL is not thread safe (default is,
"on"; that is, the DLL is thread safe).
model.material().create(<tag>,<type>) creates a global material, material switch, or material link.
model.component(<ctag>).material(<tag>).info(<itag>) returns an information item for a material.
model.component(<ctag>).material(<tag>).input() returns the list of model inputs.
For model.component(<ctag>).material().insert(...), see
Inserting Materials.
model.component(<ctag>).material(<tag>).materialType("solid") or
model.component(<ctag>).material(<tag>).materialType("nonSolid")sets the material type to a solid or a nonsolid (that is, fluid or liquid) material, respectively.
model.component(<ctag>).material(<tag>).propertyGroup(<mtag>) gets the property group named
<mtag> for the material.
model.component(<ctag>).material(<tag>).selection() returns the selection of the material. The selection determines which geometry the material belongs to.
model.component(<ctag>).material(<tag>).set("family",<appearance>) sets the appearance to a family of materials (as strings;
"water", for example):
air,
aluminum,
brick,
concrete,
copper,
defaultmaterial,
defaultplot,
gold,
iron,
lead,
magnesium,
plastic,
steel,
titanium,
water, as a few of the available material types, or
custom. You can set a
"color" property for
plastic,
defaultplot, and some other material types. With
custom you can set these additional parameters for the appearance:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No brush lines (0); brush lines around x, y, and z (1, 2, 3, respectively); brush lines along x, y, and z (4, 5, 6, respectively), if colornoise is true.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
phong | cooktorrance | simple
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The color blend, if colornoise is true.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No brush lines (0); brush lines around x, y, and z (1, 2, 3, respectively); brush lines along x, y, and z (4, 5, 6, respectively).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.component(<ctag>).material().move(<tag>,<position>) moves the material
<tag> to the zero-indexed position
<position> in the list.
For a material library link, model.component(<ctag>).material().create("mat1", "LibraryLink"); creates a material library link. As long as the link is active, you cannot change any material properties in the material library link or add any user-defined property groups. Otherwise, it supports the same API properties as a material. To reload the material properties from the material library (if they have changed there), use
model.component(<ctag>).material("mat3").set("materialPath", "comsol_basic_material_lib.silicon");
For a material link, model.component(<ctag>).material(<tag>).set("link",<linktag>); creates a material link from a component to the global material with the tag in
<linktag>. For example,
creates a material link in the component comp1 and then links it to the global material
mat1. The material link can also have a selection; for example,
model.material("matlnk1").selection().all();.
To import global materials as mat1,
mat2, and
mat3 from
myfile.xml, for example:
The insert method inserts materials from an MPH- or XML-file into the material list and returns the result of the operation as a double string array of length 3. The first array contains messages from the insert operation, the second array contains paths to the inserted objects, and the third array contains paths to the inserted references. An inserted reference is an object that an inserted object refers to and is not necessarily contained by any of the inserted objects. There can only be inserted references when importing from an MPH file. The first parameter is the filename, and the second is the tags of the materials to insert. For protected MPH files, you can supply a password as an optional third parameter.
See Materials in
The COMSOL File Formats chapter for information about the XML-file format for materials that you can import and export.
|
•
|
filename: The filename or model location URI used to identify a model version in a Model Manager database.
|
|
•
|
materials: The tags of the materials to export.
|
If successful, these commands can often produce an empty output: responses = {{}, {}};. Messages in the second string array are typically not a sign of problems.
See Materials in
The COMSOL File Formats chapter for information about the XML-file format for materials that you can import and export.
mm = model.component(<ctag>).material(<mtag>).propertyGroup().create(<tag>,<descr>) returns a property group with the given tag and description and stores it in the variable
mm. If
<tag> is equal to any of the known built-in types, a property group of that type is created, except if a built-in property group matching the tag/type already exists, in which case that property-group instance is returned.
mm = model.component(<ctag>).material(<mtag>).propertyGroup().create(<tag>,type,<descr>) creates and returns a property group of the type
type with the given tag and description. If
type is a built-in type and a property group of this type already exists in the model, the method throws an error.
model.component(<ctag>).material("mat1").propertyGroup("def").
set("density", String[] arg);
where arg is the string value to be defined. For a list of available physical property names (such as
density), see
Table 2-108.
mm.addInput(<quantity>) adds a new model input to the property group of the given quantity.
mm.descr(<pname>,<descr>) adds the description
<descr> to the local material property with the name
<pname>.
mm.func(<ftag>) returns the function object named
<ftag>. For information about how to add and modify functions, see
model.func().
mm.getMixingRule(<pname>) returns the mixing rule for the given material property.
mm.getPropertyInfo(<pname>) returns the property info (references, temperature conditions, and so on) for the given material property.
mm.getString(<pname>) returns the string value of the given property. If it is a vector or matrix quantity, the first value is returned.
mm.getStringArray(<pname>) returns the string array value of the given property. Matrix values are returned in a column-wise order.
mm.getValueType(<pname>)returns the main data type that a property can return. The data types are:
String,
StringArray, and
StringMatrix.
mm.hasParam(<pname>) returns true if the property is defined by the property group.
mm.info(<itag>) returns the information object for the property group.
mm.isOutput(<pname>) returns true if the given local material parameter is an output property. For user-defined property groups the method returns true for all predefined material properties known to all physics interfaces. For the specialized property groups, it can also return true for other properties.
mm.param() returns a list of all parameters stored in the property group.
mm.removeInput(<quantity>) removes the given quantity from the list of model inputs.
mm.set(<pname>,<expr>) sets the expression for the given property. The expression can use local names for the properties, parameters, and model inputs. For vector and matrix properties, the expression can be string arrays of varying size. Isotropic matrices only require one element or a string, diagonal matrices require three elements, and so forth. Vectors always require three elements.
mm.setMixingRule(<pname>,<mixRule>) sets the mixing rule for the given material property.
mm.setPropertyInfo(<pname>,<info>) sets the property info (references, temperature conditions, and so on) for the given material property.
mm.size(<pname>) returns the size of the stored property, which usually is 1-by-1, 3-by-1, or 3-by-3, but other sizes are supported.
model.component(<ctag>).material(<tag>).propertyGroup() returns a list of all property groups in the material.
model.component(<ctag>).material(<tag>).propertyGroup(<tag>).info().create(<tag>,<descr>) creates a new information object that can contain detailed information about this property group. This could, for example, be used by the Material Library to define the Phase/Condition and Orientation/Condition fields.
mm.info(<itag>).title(<title>) sets the title of the information object.
mm.info(<itag>).title() returns the title.
mm.info(<itag>).body(<body>) sets the body text of the information object.
mm.info(<itag>).body() returns the body text.
|
|
The term material model is sometimes used instead of property group in some contexts. The graphical user interface uses the term property group.
|