Material
A material, represented in the Model Builder by a Materials node, is a collection of property groups, where each property group defines a set of material properties, material functions, and model inputs that can be used to define, for example, a temperature-dependent material property. A property group usually defines properties used by a particular material model to compute a fundamental quantity.
To create a Materials node:
model.material().create("mat1", "Common", "comp1");
You can give the material a name, for example, Aluminum, as follows:
model.material("mat1").label("Aluminum");
The following lines of code shows how to create a basic material property group for heat transfer:
with(model.material("mat1").propertyGroup("def"));
  set("thermalconductivity", new String[]{"238[W/(m*K)]"});
  set("density", new String[]{"2700[kg/m^3]"});
  set("heatcapacity", new String[]{"900[J/(kg*K)]"});
endwith();
The built-in property groups have a read-only tag. In the above example, the tag def represents the property group Basic in the model tree.
The resulting model tree and Material node settings are shown in the figure below.
Note that some physics interfaces do not require a material to be defined. Instead, the corresponding properties can be accessed directly in the physics interface. This is also the case if the physics model settings are changed from From material to User defined. For example, for the Heat Transfer in Solids interface, this setting can be found in the Settings window of the subnode Solid, in the sections Heat Conduction, Solid and Thermodynamics, Solid, as shown in the figure below.
Use Record Code or any of the other tools for automatic generation of code to learn more about the syntax and methods for materials.