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 a 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.
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,
gold,
iron,
lead,
magnesium,
plastic,
steel,
titanium,
water, or
custom. With
custom, you can set these additional parameters for the appearance:
model.component(<ctag>).material().move(<tag>,<position>) moves the material
<tag> to the zero-indexed position
<position> in the list.
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();.
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 the messages from 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.
mm = model.component(<ctag>).material(<tag>).propertyGroup().create(<tag>,<descr>) creates a new property group and stores it in the variable
mm.
where arg is the string value to be defined. For a list of available physical property names (such as
density), see
Table 2-90.
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.getString(<pname>) returns the string value of the given parameter. If it is a vector or matrix quantity, the first value is returned.
mm.getStringArray(<pname>) returns the string array value of the given parameter. Matrix values are returned in a column-wise order.
mm.hasParam(<pname>) returns true if the parameter 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.size(<pname>) returns the size of the stored parameter, 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>).body(<body>) sets the body text of the information object.