In this example, a distributed resistance material using free-area ratio is defined and assigned to a part:
m = new Material("Resistance");
m.name = "baffle";
p = m.property("Through-Flow K");
v = p.variation("Free Area Ratio");
v.setValue(0.25);
p.apply(v);
p = m.property("Normal Direction 1 K");
v = p.variation("Free Area Ratio");
v.setValue(0);
p.apply(v);
p = m.property("Normal Direction 2 K");
v = p.variation("Free Area Ratio");
v.setValue(0);
p.apply(v);
p = m.property("Conductivity");
v = p.variation("Constant");
v.setValue(5.18, "W/in-K");
m.alignment = "Cartesian";
m.setDirections("Global Z", "Global X", "Global Y");
a.select("BAFFLE");
a.applyMaterial(m);
A line-by-line description follows:
A new material object, m, is created, and Resistance is set as the material type. The material name is set to “baffle”. This is analogous to entering a name in the Name field on the Material Editor:
m = new Material("Resistance");
m.name = "baffle";
Creates a property object called “p”, and selects Through-Flow K as the property to edit:
p = m.property("Through-Flow K");
Creates a variation object called “v”, and sets the variation method to Free Area Ratio. The value of 0.25 is then assigned:
v = p.variation("Free Area Ratio");
v.setValue(0.25);
This step assigns the completed variation back to the property. It is the equivalent to hitting the Apply button on the Material Editor:
p.apply(v);
Normal Directions 1 and 2 to both vary with Free Area Ratio, and to both have a value of 0:
p = m.property("Normal Direction 1 K");
v = p.variation("Free Area Ratio");
v.setValue(0);
p.apply(v);
p = m.property("Normal Direction 2 K");
v = p.variation("Free Area Ratio");
v.setValue(0);
p.apply(v);
The thermal conductivity is set to a value of 5.2 W/in-K:
p = m.property("Conductivity");
v = p.variation("Constant");
v.setValue(5.2, "W/in-K");
The material is assigned to the part called “Baffle.” Cartesian is set as the orientation of the part, and the throughflow, and normal directions are set:
m.alignment = "Cartesian";
m.setDirections("Global Z", "Global X", "Global Y");
a.select("BAFFLE");
a.applyMaterial(m);