/*
 * igbt_joule_heating.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 12 2026, 09:21 by COMSOL 6.4.0.418. */
public class igbt_joule_heating {

  public static Model run() {
    Model model = ModelUtil.create("Model");

    model.component().create("comp1", true);

    model.component("comp1").geom().create("geom1", 3);
    model.component("comp1").geom("geom1").geomRep("comsol");

    model.component("comp1").mesh().create("mesh1");
    model.component("comp1").mesh("mesh1").contribute("geom/detail", true);

    model.param().set("I_col", "1.8[kA]");
    model.param().descr("I_col", "Rated collector current (entire module)");
    model.param().set("th_met", "4[um]");
    model.param().descr("th_met", "Metalization layer thickness (diode and IGBT die)");
    model.param().set("th_igbt", "140[um]");
    model.param().descr("th_igbt", "IGBT die thickness");
    model.param().set("h_air", "50[W/(m^2*K)]");
    model.param().descr("h_air", "Heat transfer coefficient, air (forced convection)");
    model.param().set("T_air", "60[degC]");
    model.param().descr("T_air", "Ambient temperature, air (forced convection)");
    model.param().set("T_trm", "70[degC]");
    model.param().descr("T_trm", "Ambient temperature, terminals (conduction)");

    model.component("comp1").geom("geom1").geomRep("cadps");
    model.component("comp1").geom("geom1").designBooleans(true);
    model.component("comp1").geom("geom1").create("imp1", "Import");
    model.component("comp1").geom("geom1").feature("imp1").set("type", "cad");
    model.component("comp1").geom("geom1").feature("imp1").set("filename", "igbt_joule_heating_geom.step");
    model.component("comp1").geom("geom1").feature("imp1").importData();

    model.component("comp1").view("view1").set("renderwireframe", true);

    model.component("comp1").geom("geom1").feature("imp1").set("selcadshownamesfromfileobj", true);
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadnameobj", "imp1_Color_1", "IGBT Die");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_1", true);
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadnameobj", "imp1_Color_2", "Diode Die");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_2", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_3", "Plastic Enclosure");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_3", true);
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadnameobj", "imp1_Color_4", "Bond Wires");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_4", true);
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadnameobj", "imp1_Color_5", "Heat Sink");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_5", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_6", "DCB Bottom Cu Layer");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_6", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_7", "DCB Upper Cu Layer");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_7", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_8", "Collector Busbar");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_8", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_9", "Emitter Busbar");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_9", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_10", "Backing Plate");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_10", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_11", "DCB Aluminum Oxide Layer");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_11", true);
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadnameobj", "imp1_Color_12", "DCB Solder");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_12", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_13", "Diode Solder");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_13", true);
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadnameobj", "imp1_Color_14", "IGBT Solder");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_14", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_15", "Busbar Solder");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_15", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnameobj", "imp1_Color_16", "Thermal Paste");
    model.component("comp1").geom("geom1").feature("imp1").setEntry("selcadkeepobj", "imp1_Color_16", true);
    model.component("comp1").geom("geom1").feature("imp1").set("selcadshownamesfromfilebnd", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnamebnd", "imp1_Boundary_color_1.bnd", "Forced Convection");
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadkeepbnd", "imp1_Boundary_color_1.bnd", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnamebnd", "imp1_Boundary_color_2.bnd", "Ground");
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadkeepbnd", "imp1_Boundary_color_2.bnd", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnamebnd", "imp1_Boundary_color_3.bnd", "IGBT Upper Electrode");
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadkeepbnd", "imp1_Boundary_color_3.bnd", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnamebnd", "imp1_Boundary_color_4.bnd", "Remaining Electrodes");
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadkeepbnd", "imp1_Boundary_color_4.bnd", true);
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadnamebnd", "imp1_Boundary_color_5.bnd", "Terminal");
    model.component("comp1").geom("geom1").feature("imp1")
         .setEntry("selcadkeepbnd", "imp1_Boundary_color_5.bnd", true);

    model.component("comp1").view("view1").set("renderwireframe", false);

    model.component("comp1").geom("geom1").feature().create("ext1", "Extrude");
    model.component("comp1").geom("geom1").feature("ext1").label("IGBT Integration Domain");
    model.component("comp1").geom("geom1").feature("ext1").selection("inputface").named("imp1_Boundary_color_3");
    model.component("comp1").geom("geom1").feature("ext1").set("inputhandling", "keep");
    model.component("comp1").geom("geom1").feature("ext1").setIndex("distance", "th_igbt", 0);
    model.component("comp1").geom("geom1").feature("ext1").set("reverse", true);
    model.component("comp1").geom("geom1").feature("ext1").set("selresult", true);
    model.component("comp1").geom("geom1").feature("ext1").set("propagatesel", false);
    model.component("comp1").geom("geom1").run("fin");
    model.component("comp1").geom("geom1").create("unisel1", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel1").label("Aluminum (Metalization)");
    model.component("comp1").geom("geom1").feature("unisel1").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("unisel1")
         .set("input", new String[]{"imp1_Boundary_color_3", "imp1_Boundary_color_4"});
    model.component("comp1").geom("geom1").run("unisel1");
    model.component("comp1").geom("geom1").create("unisel2", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel2").label("Copper");
    model.component("comp1").geom("geom1").feature("unisel2")
         .set("input", new String[]{"imp1_Color_6", "imp1_Color_7", "imp1_Color_8", "imp1_Color_9", "imp1_Color_10"});
    model.component("comp1").geom("geom1").run("unisel2");
    model.component("comp1").geom("geom1").create("unisel3", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel3").label("Solder (SnAgCu305)");
    model.component("comp1").geom("geom1").feature("unisel3")
         .set("input", new String[]{"imp1_Color_12", "imp1_Color_13", "imp1_Color_14", "imp1_Color_15"});
    model.component("comp1").geom("geom1").run("unisel3");
    model.component("comp1").geom("geom1").create("unisel4", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel4").label("Aluminum");
    model.component("comp1").geom("geom1").feature("unisel4")
         .set("input", new String[]{"imp1_Color_4", "imp1_Color_5"});
    model.component("comp1").geom("geom1").nodeGroup().create("grp1");
    model.component("comp1").geom("geom1").nodeGroup("grp1").placeAfter("fin");
    model.component("comp1").geom("geom1").nodeGroup("grp1").add("unisel1");
    model.component("comp1").geom("geom1").nodeGroup("grp1").add("unisel2");
    model.component("comp1").geom("geom1").nodeGroup("grp1").add("unisel3");
    model.component("comp1").geom("geom1").nodeGroup("grp1").add("unisel4");
    model.component("comp1").geom("geom1").nodeGroup("grp1").label("Materials Selections");
    model.component("comp1").geom("geom1").run("unisel4");
    model.component("comp1").geom("geom1").create("unisel5", "UnionSelection");
    model.component("comp1").geom("geom1").nodeGroup("grp1").remove("unisel5", false);
    model.component("comp1").geom("geom1").feature("unisel5").label("Electric Current Domains");
    model.component("comp1").geom("geom1").feature("unisel5")
         .set("input", new String[]{"imp1_Color_1", "imp1_Color_2", "imp1_Color_4", "imp1_Color_7", "imp1_Color_8", "imp1_Color_9", "imp1_Color_13", "imp1_Color_14", "imp1_Color_15"});
    model.component("comp1").geom("geom1").run("unisel5");
    model.component("comp1").geom("geom1").create("comsel1", "ComplementSelection");
    model.component("comp1").geom("geom1").feature("comsel1").label("Heat Transfer Domains");
    model.component("comp1").geom("geom1").feature("comsel1").set("input", new String[]{"imp1_Color_3"});
    model.component("comp1").geom("geom1").run("comsel1");
    model.component("comp1").geom("geom1").create("unisel6", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel6").label("Fixed Temperature");
    model.component("comp1").geom("geom1").feature("unisel6").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("unisel6")
         .set("input", new String[]{"imp1_Boundary_color_2", "imp1_Boundary_color_5"});
    model.component("comp1").geom("geom1").nodeGroup().create("grp2");
    model.component("comp1").geom("geom1").nodeGroup("grp2").placeAfter("fin");
    model.component("comp1").geom("geom1").nodeGroup("grp2").add("unisel5");
    model.component("comp1").geom("geom1").nodeGroup("grp2").add("comsel1");
    model.component("comp1").geom("geom1").nodeGroup("grp2").add("unisel6");
    model.component("comp1").geom("geom1").nodeGroup("grp2").label("Physics Selections");
    model.component("comp1").geom("geom1").run("unisel6");
    model.component("comp1").geom("geom1").create("unisel7", "UnionSelection");
    model.component("comp1").geom("geom1").nodeGroup("grp2").remove("unisel7", false);
    model.component("comp1").geom("geom1").feature("unisel7").label("DCB Base Layers");
    model.component("comp1").geom("geom1").feature("unisel7")
         .set("input", new String[]{"imp1_Color_6", "imp1_Color_11", "imp1_Color_12"});
    model.component("comp1").geom("geom1").run("unisel7");
    model.component("comp1").geom("geom1").create("unisel8", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel8").label("Busbars");
    model.component("comp1").geom("geom1").feature("unisel8")
         .set("input", new String[]{"imp1_Color_8", "imp1_Color_9"});
    model.component("comp1").geom("geom1").run("unisel8");
    model.component("comp1").geom("geom1").create("unisel9", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel9").label("IGBT and Diode Solder");
    model.component("comp1").geom("geom1").feature("unisel9")
         .set("input", new String[]{"imp1_Color_13", "imp1_Color_14"});
    model.component("comp1").geom("geom1").run("unisel9");
    model.component("comp1").geom("geom1").create("unisel10", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel10").label("IGBT and Diode Die");
    model.component("comp1").geom("geom1").feature("unisel10")
         .set("input", new String[]{"imp1_Color_1", "imp1_Color_2"});
    model.component("comp1").geom("geom1").run("unisel10");
    model.component("comp1").geom("geom1").create("unisel11", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel11").label("IGBT and Diode Die and Solder");
    model.component("comp1").geom("geom1").feature("unisel11").set("input", new String[]{"unisel9", "unisel10"});
    model.component("comp1").geom("geom1").run("unisel11");
    model.component("comp1").geom("geom1").create("unisel12", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel12").label("Busbars and Solder");
    model.component("comp1").geom("geom1").feature("unisel12")
         .set("input", new String[]{"imp1_Color_7", "imp1_Color_15", "unisel8"});
    model.component("comp1").geom("geom1").run("unisel12");
    model.component("comp1").geom("geom1").create("unisel13", "UnionSelection");
    model.component("comp1").geom("geom1").feature("unisel13").label("Swept 2");
    model.component("comp1").geom("geom1").feature("unisel13")
         .set("input", new String[]{"imp1_Color_16", "unisel7"});
    model.component("comp1").geom("geom1").run("unisel13");
    model.component("comp1").geom("geom1").create("adjsel1", "AdjacentSelection");
    model.component("comp1").geom("geom1").feature("adjsel1").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("adjsel1").set("input", new String[]{"imp1_Color_4"});
    model.component("comp1").geom("geom1").feature("adjsel1").set("selshow", false);
    model.component("comp1").geom("geom1").run("adjsel1");
    model.component("comp1").geom("geom1").create("adjsel2", "AdjacentSelection");
    model.component("comp1").geom("geom1").feature("adjsel2").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("adjsel2").set("input", new String[]{"adjsel1"});
    model.component("comp1").geom("geom1").feature("adjsel2").set("selshow", false);
    model.component("comp1").geom("geom1").run("adjsel2");
    model.component("comp1").geom("geom1").create("adjsel3", "AdjacentSelection");
    model.component("comp1").geom("geom1").feature("adjsel3").set("input", new String[]{"unisel10"});
    model.component("comp1").geom("geom1").feature("adjsel3").set("selshow", false);
    model.component("comp1").geom("geom1").run("adjsel3");
    model.component("comp1").geom("geom1").create("exprsel1", "LogicalExpressionSelection");
    model.component("comp1").geom("geom1").feature("exprsel1").label("Free Triangular 1");
    model.component("comp1").geom("geom1").feature("exprsel1").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("exprsel1")
         .set("expression", "adjsel1 || (adjsel2 && adjsel3 && !imp1_Color_4)");

    model.component("comp1").view("view1").set("renderwireframe", true);

    model.component("comp1").geom("geom1").run("exprsel1");
    model.component("comp1").geom("geom1").create("difsel1", "DifferenceSelection");
    model.component("comp1").geom("geom1").feature("difsel1").label("Boundary Layers 1");
    model.component("comp1").geom("geom1").feature("difsel1").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("difsel1").set("add", new String[]{"exprsel1"});
    model.component("comp1").geom("geom1").feature("difsel1").set("subtract", new String[]{"adjsel1"});
    model.component("comp1").geom("geom1").run("difsel1");
    model.component("comp1").geom("geom1").create("adjsel4", "AdjacentSelection");
    model.component("comp1").geom("geom1").feature("adjsel4").label("Boundary Layer Properties");
    model.component("comp1").geom("geom1").feature("adjsel4").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("adjsel4").set("input", new String[]{"exprsel1"});
    model.component("comp1").geom("geom1").feature("adjsel4").set("outputdim", 1);
    model.component("comp1").geom("geom1").feature("adjsel4").set("exterior", false);
    model.component("comp1").geom("geom1").feature("adjsel4").set("interior", true);
    model.component("comp1").geom("geom1").run("adjsel4");
    model.component("comp1").geom("geom1").create("boxsel1", "BoxSelection");
    model.component("comp1").geom("geom1").feature("boxsel1").label("Free Tetrahedral 3: Size 1");
    model.component("comp1").geom("geom1").feature("boxsel1").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("boxsel1").set("xmin", -0.05);
    model.component("comp1").geom("geom1").feature("boxsel1").set("xmax", 0.05);
    model.component("comp1").geom("geom1").feature("boxsel1").set("ymin", -0.09);
    model.component("comp1").geom("geom1").feature("boxsel1").set("ymax", 0.09);
    model.component("comp1").geom("geom1").feature("boxsel1").set("zmin", -0.001);
    model.component("comp1").geom("geom1").feature("boxsel1").set("zmax", 0.001);
    model.component("comp1").geom("geom1").feature("boxsel1").set("condition", "allvertices");
    model.component("comp1").geom("geom1").nodeGroup().create("grp3");
    model.component("comp1").geom("geom1").nodeGroup("grp3").placeAfter("fin");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("unisel7");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("unisel8");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("unisel9");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("unisel10");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("unisel11");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("unisel12");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("unisel13");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("adjsel1");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("adjsel2");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("adjsel3");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("exprsel1");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("difsel1");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("adjsel4");
    model.component("comp1").geom("geom1").nodeGroup("grp3").add("boxsel1");
    model.component("comp1").geom("geom1").nodeGroup("grp3").label("Mesh Selections");
    model.component("comp1").geom("geom1").run("boxsel1");
    model.component("comp1").geom("geom1").create("boxsel2", "BoxSelection");
    model.component("comp1").geom("geom1").nodeGroup("grp3").remove("boxsel2", false);
    model.component("comp1").geom("geom1").feature("boxsel2").label("Set of Dies (Domain)");
    model.component("comp1").geom("geom1").feature("boxsel2").set("xmin", -0.0465);
    model.component("comp1").geom("geom1").feature("boxsel2").set("xmax", 0);
    model.component("comp1").geom("geom1").feature("boxsel2").set("ymin", -0.085);
    model.component("comp1").geom("geom1").feature("boxsel2").set("ymax", -0.06);
    model.component("comp1").geom("geom1").feature("boxsel2").set("zmin", 0.009);
    model.component("comp1").geom("geom1").feature("boxsel2").set("zmax", 0.02);
    model.component("comp1").geom("geom1").feature("boxsel2").set("condition", "allvertices");
    model.component("comp1").geom("geom1").run("boxsel2");
    model.component("comp1").geom("geom1").create("adjsel5", "AdjacentSelection");
    model.component("comp1").geom("geom1").feature("adjsel5").label("Set of Dies (Boundary)");
    model.component("comp1").geom("geom1").feature("adjsel5").set("input", new String[]{"boxsel2"});
    model.component("comp1").geom("geom1").feature("adjsel5").set("interior", true);
    model.component("comp1").geom("geom1").run("adjsel5");
    model.component("comp1").geom("geom1").create("difsel2", "DifferenceSelection");
    model.component("comp1").geom("geom1").feature("difsel2").label("Set of Dies (Not Metalization)");
    model.component("comp1").geom("geom1").feature("difsel2").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("difsel2").set("add", new String[]{"adjsel5"});
    model.component("comp1").geom("geom1").feature("difsel2").set("subtract", new String[]{"unisel1"});
    model.component("comp1").geom("geom1").run("difsel2");
    model.component("comp1").geom("geom1").create("intsel1", "IntersectionSelection");
    model.component("comp1").geom("geom1").feature("intsel1").label("Set of Dies (Metalization)");
    model.component("comp1").geom("geom1").feature("intsel1").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("intsel1").set("input", new String[]{"unisel1", "adjsel5"});
    model.component("comp1").geom("geom1").run("intsel1");
    model.component("comp1").geom("geom1").create("boxsel3", "BoxSelection");
    model.component("comp1").geom("geom1").feature("boxsel3").label("Module Section (Domain)");
    model.component("comp1").geom("geom1").feature("boxsel3").set("xmin", -0.0465);
    model.component("comp1").geom("geom1").feature("boxsel3").set("xmax", 0);
    model.component("comp1").geom("geom1").feature("boxsel3").set("ymin", -0.085);
    model.component("comp1").geom("geom1").feature("boxsel3").set("ymax", -0.0275);
    model.component("comp1").geom("geom1").feature("boxsel3").set("zmin", 0.009);
    model.component("comp1").geom("geom1").feature("boxsel3").set("zmax", 0.02);
    model.component("comp1").geom("geom1").feature("boxsel3").set("condition", "allvertices");
    model.component("comp1").geom("geom1").run("boxsel3");
    model.component("comp1").geom("geom1").create("adjsel6", "AdjacentSelection");
    model.component("comp1").geom("geom1").feature("adjsel6").label("Module Section (Boundary)");
    model.component("comp1").geom("geom1").feature("adjsel6").set("input", new String[]{"boxsel3"});
    model.component("comp1").geom("geom1").feature("adjsel6").set("interior", true);
    model.component("comp1").geom("geom1").run("adjsel6");
    model.component("comp1").geom("geom1").create("difsel3", "DifferenceSelection");
    model.component("comp1").geom("geom1").feature("difsel3").label("Module Section (Not Metalization)");
    model.component("comp1").geom("geom1").feature("difsel3").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("difsel3").set("add", new String[]{"adjsel6"});
    model.component("comp1").geom("geom1").feature("difsel3").set("subtract", new String[]{"unisel1"});
    model.component("comp1").geom("geom1").run("difsel3");
    model.component("comp1").geom("geom1").create("intsel2", "IntersectionSelection");
    model.component("comp1").geom("geom1").feature("intsel2").label("Module Section (Metalization)");
    model.component("comp1").geom("geom1").feature("intsel2").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("intsel2").set("input", new String[]{"unisel1", "adjsel6"});
    model.component("comp1").geom("geom1").run("intsel2");
    model.component("comp1").geom("geom1").create("difsel4", "DifferenceSelection");
    model.component("comp1").geom("geom1").feature("difsel4").label("All Domains (Not EC)");
    model.component("comp1").geom("geom1").feature("difsel4").set("add", new String[]{"comsel1"});
    model.component("comp1").geom("geom1").feature("difsel4").set("subtract", new String[]{"unisel5"});
    model.component("comp1").geom("geom1").run("difsel4");
    model.component("comp1").geom("geom1").create("adjsel7", "AdjacentSelection");
    model.component("comp1").geom("geom1").feature("adjsel7").label("All Domains (EC, Boundary)");
    model.component("comp1").geom("geom1").feature("adjsel7").set("input", new String[]{"unisel5"});
    model.component("comp1").geom("geom1").run("adjsel7");
    model.component("comp1").geom("geom1").create("difsel5", "DifferenceSelection");
    model.component("comp1").geom("geom1").feature("difsel5").label("All Domains (EC, Not Metalization)");
    model.component("comp1").geom("geom1").feature("difsel5").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("difsel5").set("add", new String[]{"adjsel7"});
    model.component("comp1").geom("geom1").feature("difsel5").set("subtract", new String[]{"unisel1"});
    model.component("comp1").geom("geom1").run("difsel5");
    model.component("comp1").geom("geom1").create("intsel3", "IntersectionSelection");
    model.component("comp1").geom("geom1").feature("intsel3").label("All Domains (EC, Metalization)");
    model.component("comp1").geom("geom1").feature("intsel3").set("entitydim", 2);
    model.component("comp1").geom("geom1").feature("intsel3").set("input", new String[]{"unisel1", "adjsel7"});
    model.component("comp1").geom("geom1").nodeGroup().create("grp4");
    model.component("comp1").geom("geom1").nodeGroup("grp4").placeAfter("fin");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("boxsel2");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("adjsel5");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("difsel2");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("intsel1");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("boxsel3");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("adjsel6");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("difsel3");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("intsel2");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("difsel4");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("adjsel7");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("difsel5");
    model.component("comp1").geom("geom1").nodeGroup("grp4").add("intsel3");
    model.component("comp1").geom("geom1").nodeGroup("grp4").label("Results Selections");
    model.component("comp1").geom("geom1").run("intsel3");
    model.component("comp1").geom("geom1").create("rmd1", "RemoveDetails");
    model.component("comp1").geom("geom1").nodeGroup("grp4").remove("rmd1", false);
    model.component("comp1").geom("geom1").feature("rmd1").set("selection", "entities");
    model.component("comp1").geom("geom1").feature("rmd1").selection("input").named("imp1_Color_4");
    model.component("comp1").geom("geom1").feature("rmd1").set("contvertices", false);
    model.component("comp1").geom("geom1").feature("rmd1").set("shortedges", false);
    model.component("comp1").geom("geom1").feature("rmd1").set("smallfaces", false);
    model.component("comp1").geom("geom1").feature("rmd1").set("sliverfaces", false);
    model.component("comp1").geom("geom1").feature("rmd1").set("thindomains", false);
    model.component("comp1").geom("geom1").feature("rmd1").set("detailsizetype", "absolute");
    model.component("comp1").geom("geom1").feature("rmd1").set("maxabssize", 1.70005E-5);
    model.component("comp1").geom("geom1").run("rmd1");

    model.component("comp1").view("view1").hideObjects().create("hide1");
    model.component("comp1").view("view1").hideObjects("hide1").init(3);
    model.component("comp1").view("view1").hideObjects("hide1").named("imp1_Color_3");

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").label("Solder (SnAgCu305)");
    model.component("comp1").material("mat1").selection().named("geom1_unisel3");
    model.component("comp1").material().create("mat2", "Common");
    model.component("comp1").material("mat2").label("Copper (Internal)");
    model.component("comp1").material("mat2").selection().named("geom1_unisel2");
    model.component("comp1").material().create("mat3", "Common");
    model.component("comp1").material("mat3").label("Aluminium (Metalization)");
    model.component("comp1").material("mat3").selection().geom("geom1", 2);
    model.component("comp1").material("mat3").selection().named("geom1_unisel1");
    model.component("comp1").material().create("mat4", "Common");
    model.component("comp1").material("mat4").label("Diode (Closed)");
    model.component("comp1").material("mat4").selection().named("geom1_imp1_Color_2_dom");
    model.component("comp1").material().create("mat5", "Common");
    model.component("comp1").material("mat5").label("IGBT (Open)");
    model.component("comp1").material("mat5").selection().named("geom1_imp1_Color_1_dom");
    model.component("comp1").material().create("mat6", "Common");
    model.component("comp1").material("mat6").label("Aluminum");
    model.component("comp1").material("mat6").selection().named("geom1_unisel4");
    model.component("comp1").material().create("mat7", "Common");
    model.component("comp1").material("mat7").label("Aluminum Oxide");
    model.component("comp1").material("mat7").selection().named("geom1_imp1_Color_11_dom");
    model.component("comp1").material().create("mat8", "Common");
    model.component("comp1").material("mat8").label("Thermal Paste");
    model.component("comp1").material("mat8").selection().named("geom1_imp1_Color_16_dom");

    model.component("comp1").mesh("mesh1").automatic(false);
    model.component("comp1").mesh("mesh1").feature("size").set("hmin", "0.1288[mm]");
    model.component("comp1").mesh("mesh1").feature().remove("size1");
    model.component("comp1").mesh("mesh1").feature("ftet1").selection().geom("geom1", 3);
    model.component("comp1").mesh("mesh1").feature("ftet1").selection().named("geom1_imp1_Color_4_dom");
    model.component("comp1").mesh("mesh1").feature("ftet1").create("size1", "Size");
    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size1").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size1").set("hminactive", true);
    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size1").set("hmin", "0.009[mm]");
    model.component("comp1").mesh("mesh1").create("ftri1", "FreeTri");
    model.component("comp1").mesh("mesh1").feature("ftri1").selection().named("geom1_exprsel1");
    model.component("comp1").mesh("mesh1").feature("ftri1").create("size1", "Size");
    model.component("comp1").mesh("mesh1").feature("ftri1").feature("size1").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("ftri1").feature("size1").set("hmaxactive", true);
    model.component("comp1").mesh("mesh1").feature("ftri1").feature("size1").set("hmax", "1[mm]");
    model.component("comp1").mesh("mesh1").feature("ftri1").feature("size1").set("hgradactive", true);
    model.component("comp1").mesh("mesh1").feature("ftri1").feature("size1").set("hgrad", 1.15);
    model.component("comp1").mesh("mesh1").create("bl1", "BndLayer");
    model.component("comp1").mesh("mesh1").feature("bl1").create("blp", "BndLayerProp");
    model.component("comp1").mesh("mesh1").feature("bl1").selection().geom("geom1", 2);

    return model;
  }

  public static Model run2(Model model) {
    model.component("comp1").mesh("mesh1").feature("bl1").selection().named("geom1_difsel1");
    model.component("comp1").mesh("mesh1").feature("bl1").feature("blp").selection().named("geom1_adjsel4");
    model.component("comp1").mesh("mesh1").feature("bl1").feature("blp").set("blnlayers", 3);
    model.component("comp1").mesh("mesh1").feature("bl1").feature("blp").set("inittype", "blhmin");
    model.component("comp1").mesh("mesh1").feature("bl1").feature("blp").set("blhmin", "0.05[mm]");
    model.component("comp1").mesh("mesh1").create("swe1", "Sweep");
    model.component("comp1").mesh("mesh1").feature("swe1").selection().geom("geom1", 3);
    model.component("comp1").mesh("mesh1").feature("swe1").selection().named("geom1_unisel11");
    model.component("comp1").mesh("mesh1").feature("swe1").set("element", "prism");
    model.component("comp1").mesh("mesh1").feature("swe1").create("dis1", "Distribution");
    model.component("comp1").mesh("mesh1").feature("swe1").feature("dis1").set("type", "predefined");
    model.component("comp1").mesh("mesh1").feature("swe1").feature("dis1").set("elemcount", 3);
    model.component("comp1").mesh("mesh1").feature("swe1").feature("dis1").set("elemratio", 3);
    model.component("comp1").mesh("mesh1").feature("swe1").create("dis2", "Distribution");
    model.component("comp1").mesh("mesh1").feature("swe1").feature("dis2").selection().named("geom1_unisel9");
    model.component("comp1").mesh("mesh1").feature("swe1").feature("dis2").set("numelem", 2);
    model.component("comp1").mesh("mesh1").create("ftet2", "FreeTet");
    model.component("comp1").mesh("mesh1").feature("ftet2").selection().geom("geom1", 3);
    model.component("comp1").mesh("mesh1").feature("ftet2").selection().named("geom1_unisel12");
    model.component("comp1").mesh("mesh1").feature("ftet2").create("size1", "Size");
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").selection().named("geom1_unisel8");
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").set("hmaxactive", true);
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").set("hmax", "1[mm]");
    model.component("comp1").mesh("mesh1").feature("ftet2").create("size2", "Size");
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").selection()
         .named("geom1_imp1_Color_15_dom");
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").set("hgradactive", true);
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").set("hgrad", 2);
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").set("hcurveactive", true);
    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").set("hcurve", 0.8);
    model.component("comp1").mesh("mesh1").create("swe2", "Sweep");
    model.component("comp1").mesh("mesh1").feature("swe2").selection().geom("geom1", 3);
    model.component("comp1").mesh("mesh1").feature("swe2").selection().named("geom1_unisel13");
    model.component("comp1").mesh("mesh1").feature("swe2").set("element", "prism");
    model.component("comp1").mesh("mesh1").feature("swe2").create("size1", "Size");
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size1").selection().named("geom1_unisel7");
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size1").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size1").set("hmaxactive", true);
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size1").set("hmax", "1[mm]");
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size1").set("hminactive", true);
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size1").set("hmin", "0.4[mm]");
    model.component("comp1").mesh("mesh1").feature("swe2").create("size2", "Size");
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size2").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size2").set("hmaxactive", true);
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size2").set("hmax", "3[mm]");
    model.component("comp1").mesh("mesh1").feature("swe2").feature("size2").selection()
         .named("geom1_imp1_Color_16_dom");
    model.component("comp1").mesh("mesh1").feature("swe2").create("dis1", "Distribution");
    model.component("comp1").mesh("mesh1").feature("swe2").feature("dis1").selection().named("geom1_unisel7");
    model.component("comp1").mesh("mesh1").feature("swe2").feature("dis1").set("numelem", 3);
    model.component("comp1").mesh("mesh1").create("ftet3", "FreeTet");
    model.component("comp1").mesh("mesh1").feature("ftet3").create("size1", "Size");
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size1").selection().geom("geom1", 2);
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size1").selection().named("geom1_boxsel1");
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size1").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size1").set("hminactive", true);
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size1").set("hmin", "0.5[mm]");
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size1").set("hcurveactive", true);
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size1").set("hcurve", 0.1);
    model.component("comp1").mesh("mesh1").feature("ftet3").create("size2", "Size");
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size2").selection().geom("geom1", 3);
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size2").selection()
         .named("geom1_imp1_Color_5_dom");
    model.component("comp1").mesh("mesh1").feature("ftet3").feature("size2").set("hauto", 7);
    model.component("comp1").mesh("mesh1").run();

    model.title("Thermal Analysis of a High-Power IGBT Module \u2014 Introduction");

    model
         .description("This introduction gives the instructions for setting up the geometry, selections, and mesh for an industrial-scale proof-of-concept (POC) model that demonstrates how to perform an electric\u2013thermal analysis of a high-power insulated-gate bipolar transistor module (IGBT module).");

    model.label("igbt_joule_heating_introduction.mph");

//    From the <l>File</l> menu, choose <l>Open</l>.
//    Browse to the model's Application Libraries folder and double-click the file <c>igbt_joule_heating_introduction.mph</c>.
//    From the <l>File</l> menu, choose <l>Save As</l>.
//    Browse to a suitable folder and type the filename <c>igbt_joule_heating.mph</c>.
//    Now, proceed with the setup of the physics interfaces. This model is centered around the <em>Electric Currents</em> and <em>Heat Transfer in Solids</em> interfaces. The two interfaces will be connected using the <em>Electromagnetic Heating</em> multiphysics coupling, feeding the electromagnetic loss as a heat source into the thermal analysis.
//    In the Home toolbar, click Add Physics to open the Add Physics window.
//    In the tree, select AC/DC > Electric Fields and Currents > Electric Currents (ec).
//    Click Add to Component 1 in the window toolbar.

    model.component("comp1").physics().create("ec", "ConductiveMedia", "geom1");

//    In the Settings window for Electric Currents, locate the Domain Selection section.
//    From the Selection list, select Electric Current Domains.

    model.component("comp1").physics("ec").selection().named("geom1_unisel5");

//    Click to expand the Discretization section.
//    From the Electric potential list, select Linear.

    model.component("comp1").physics("ec").prop("ShapeProperty").set("order_electricpotential", 1);

//    In the Physics toolbar, click Boundaries and choose Ground.

    model.component("comp1").physics("ec").create("gnd1", "Ground", 2);

//    In the Settings window for Ground, locate the Boundary Selection section.
//    From the Selection list, select Ground (Import 1).

    model.component("comp1").physics("ec").feature("gnd1").selection().named("geom1_imp1_Boundary_color_2_bnd");

//    In the Physics toolbar, click Boundaries and choose Boundary Terminal.

    model.component("comp1").physics("ec").create("term1", "Terminal", 2);

//    In the Settings window for Boundary Terminal, locate the Boundary Selection section.
//    From the Selection list, select Terminal (Import 1).

    model.component("comp1").physics("ec").feature("term1").selection().named("geom1_imp1_Boundary_color_5_bnd");

//    Locate the Terminal section.
//    In the \[I_\textrm{0}\] text field, type I_col.

    model.component("comp1").physics("ec").feature("term1").set("I0", "I_col");

//    In the Physics toolbar, click Boundaries and choose Electric Shielding.

    model.component("comp1").physics("ec").create("es1", "ElectricShielding", 2);

//    In the Settings window for Electric Shielding, locate the Boundary Selection section.
//    From the Selection list, select Aluminum (Metalization).

    model.component("comp1").physics("ec").feature("es1").selection().named("geom1_unisel1");

//    Locate the Thickness section.
//    In the \[d_\textrm{s}\] text field, type th_met.

    model.component("comp1").physics("ec").feature("es1").set("ds", "th_met");

//    In the tree, select Heat Transfer > Heat Transfer in Solids (ht).
//    Click Add to Component 1 in the window toolbar.

    model.component("comp1").physics().create("ht", "HeatTransfer", "geom1");

//    In the Settings window for Heat Transfer in Solids, locate the Domain Selection section.
//    From the Selection list, select Heat Transfer Domains.

    model.component("comp1").physics("ht").selection().named("geom1_comsel1");

//    Click to expand the Discretization section.
//    From the Temperature list, select Linear.

    model.component("comp1").physics("ht").prop("ShapeProperty").set("order_temperature", 1);

//    In the Model Builder window, under Component 1 (comp1) > Heat Transfer in Solids (ht), click Initial Values 1.
//    In the Settings window for Initial Values, locate the Initial Values section.
//    In the \[T\] text field, type T_trm.

    model.component("comp1").physics("ht").feature("init1").set("Tinit", "T_trm");

//    In the Physics toolbar, click Boundaries and choose Temperature.

    model.component("comp1").physics("ht").create("temp1", "TemperatureBoundary", 2);

//    In the Settings window for Temperature, locate the Boundary Selection section.
//    From the Selection list, select Fixed Temperature.

    model.component("comp1").physics("ht").feature("temp1").selection().named("geom1_unisel6");

//    Locate the Temperature section.
//    In the \[T_{\textrm{0}}\] text field, type T_trm.

    model.component("comp1").physics("ht").feature("temp1").set("T0", "T_trm");

//    In the Physics toolbar, click Boundaries and choose Heat Flux.

    model.component("comp1").physics("ht").create("hf1", "HeatFluxBoundary", 2);

//    In the Settings window for Heat Flux, locate the Boundary Selection section.
//    From the Selection list, select Forced Convection (Import 1).

    model.component("comp1").physics("ht").feature("hf1").selection().named("geom1_imp1_Boundary_color_1_bnd");

//    Locate the Heat Flux section.
//    From the Flux type list, select Convective heat flux.

    model.component("comp1").physics("ht").feature("hf1").set("HeatFluxType", "ConvectiveHeatFlux");

//    In the \[h\] text field, type h_air.

    model.component("comp1").physics("ht").feature("hf1").set("h", "h_air");

//    In the \[T_{\textrm{ext}}\] text field, type T_air.

    model.component("comp1").physics("ht").feature("hf1").set("Text", "T_air");

//    In the Physics toolbar, click Boundaries and choose Thin Layer.

    model.component("comp1").physics("ht").create("sls1", "SolidLayeredShell", 2);

//    In the Settings window for Thin Layer, locate the Boundary Selection section.
//    From the Selection list, select Aluminum (Metalization).

    model.component("comp1").physics("ht").feature("sls1").selection().named("geom1_unisel1");

//    Locate the Shell Properties section.
//    From the Shell type list, select Nonlayered shell.

    model.component("comp1").physics("ht").feature("sls1").set("lth_mat", "userdef");

//    In the \[L_\textrm{th}\] text field, type th_met.

    model.component("comp1").physics("ht").feature("sls1").set("lth", "th_met");

//    Locate the Layer Model section.
//    From the Layer type list, select Thermally thin approximation.

    model.component("comp1").physics("ht").feature("sls1").set("UserDefThicknessLayerType", "Conductive");

//    In the Physics toolbar, click Multiphysics Couplings and choose Domain > Electromagnetic Heating.

    model.component("comp1").multiphysics().create("emh1", "ElectromagneticHeating", 3);

//    In the Home toolbar, click Functions and choose Global > Analytic.

    model.func().create("an1", "Analytic");

//    In the Settings window for Analytic, type Collector-Emitter Voltage IGBT (Open) in the Label text field.

    model.func("an1").label("Collector-Emitter Voltage IGBT (Open)");

//    In the Function name text field, type V_col.

    model.func("an1").set("funcname", "V_col");

//    Locate the Definition section.
//    In the Expression text field, type -0.00235[V/degC]*T+0.544[V].

    model.func("an1").set("expr", "-0.00235[V/degC]*T+0.544[V]");

//    In the Arguments text field, type T.

    model.func("an1").set("args", "T");

//    Locate the Units section.
//    In the Function text field, type V.

    model.func("an1").set("fununit", "V");

//    In the table, enter the following settings:

    model.func("an1").setIndex("argunit", "degC", 0);
    model.func("an1").setIndex("plotargs", "0[degC]", 0, 1);

//    Locate the Plot Parameters section.
//    In the table, enter the following settings:

    model.func("an1").setIndex("plotargs", "150[degC]", 0, 2);

//    Click Plot.
//    Add a nonlocal coupling to determine the average current density and the average temperature at the IGBT junction.
//    In the Definitions toolbar, click Nonlocal Couplings and choose Average.

    model.component("comp1").cpl().create("aveop1", "Average");
    model.component("comp1").cpl("aveop1").set("axisym", true);

//    In the Settings window for Average, type Domain Average IGBT in the Label text field.

    model.component("comp1").cpl("aveop1").label("Domain Average IGBT");

//    In the Operator name text field, type av_igbt.

    model.component("comp1").cpl("aveop1").set("opname", "av_igbt");

//    Locate the Source Selection section.
//    From the Selection list, select IGBT Integration Domain.

    model.component("comp1").cpl("aveop1").selection().named("geom1_ext1_dom");

//    Now, add a global equation to add a degree of freedom for the average current density in the IGBT.
//    In the tree, select Mathematics > ODE and DAE Interfaces > Global ODEs and DAEs (ge).
//    Click Add to Component 1 in the window toolbar.

    model.component("comp1").physics().create("ge", "GlobalEquations", "geom1");
    model.component("comp1").physics("ge").prop("EquationForm").set("form", "Automatic");

//    In the Home toolbar, click Add Physics to close the Add Physics window.
//    In the Settings window for Global Equations, type Current Density IGBT in the Label text field.

    model.component("comp1").physics("ge").feature("ge1").label("Current Density IGBT");

//    Locate the Global Equations section.
//    In the table, enter the following settings:

    model.component("comp1").physics("ge").feature("ge1").setIndex("name", "J_igbt", 0, 0);
    model.component("comp1").physics("ge").feature("ge1").setIndex("equation", "J_igbt-av_igbt(ec.normJ)", 0, 0);
    model.component("comp1").physics("ge").feature("ge1").setIndex("initialValueU", "I_col/(24*(13.5[mm])^2)", 0, 0);
    model.component("comp1").physics("ge").feature("ge1")
         .setIndex("description", "Current density across junction (average)", 0, 0);

//    Locate the Units section.
//    Click Select Dependent Variable Quantity.
//    In the Physical Quantity dialog, select Electromagnetics > Current density (A/m^2) in the tree.
//    Click OK.

    model.component("comp1").physics("ge").feature("ge1").set("DependentVariableQuantity", "currentdensity");

//    In the Settings window for Global Equations, locate the Units section.
//    Click Select Source Term Quantity.
//    In the Physical Quantity dialog, select Electromagnetics > Current density (A/m^2) in the tree.
//    Click OK.

    model.component("comp1").physics("ge").feature("ge1").set("SourceTermQuantity", "currentdensity");

//    In the Global ODEs and DAEs toolbar, click Global Equations.

    model.component("comp1").physics("ge").create("ge2", "GlobalEquations", -1);

//    In the Settings window for Global Equations, type Temperature IGBT in the Label text field.

    model.component("comp1").physics("ge").feature("ge2").label("Temperature IGBT");

//    Locate the Global Equations section.
//    In the table, enter the following settings:

    model.component("comp1").physics("ge").feature("ge2").setIndex("name", "T_igbt", 0, 0);
    model.component("comp1").physics("ge").feature("ge2").setIndex("equation", "T_igbt-av_igbt(T)", 0, 0);
    model.component("comp1").physics("ge").feature("ge2").setIndex("initialValueU", "T_trm", 0, 0);
    model.component("comp1").physics("ge").feature("ge2")
         .setIndex("description", "Junction temperature (average)", 0, 0);

//    Locate the Units section.
//    Click Select Dependent Variable Quantity.
//    In the Physical Quantity dialog, select General > Temperature (K) in the tree.
//    Click OK.

    model.component("comp1").physics("ge").feature("ge2").set("DependentVariableQuantity", "temperature");

//    In the Settings window for Global Equations, locate the Units section.
//    Click Select Source Term Quantity.
//    In the Physical Quantity dialog, select General > Temperature (K) in the tree.
//    Click OK.

    model.component("comp1").physics("ge").feature("ge2").set("SourceTermQuantity", "temperature");

//    Define the collector-emitter voltage at the average junction temperature as well as the effective conductivity.
//    In the Definitions toolbar, click Local Variables.

    model.component("comp1").variable().create("var1");

//    In the Settings window for Variables, type Effective Conductivity IGBT in the Label text field.

    model.component("comp1").variable("var1").label("Effective Conductivity IGBT");

//    Locate the Variables section.
//    In the table, enter the following settings:

    model.component("comp1").variable("var1").set("V_igbt", "V_col(T_igbt)");
    model.component("comp1").variable("var1").descr("V_igbt", "Collector-emitter voltage IGBT (open, approximate)");
    model.component("comp1").variable("var1").set("s_igbt", "J_igbt/(V_igbt/th_igbt)");
    model.component("comp1").variable("var1").descr("s_igbt", "Effective conductivity IGBT (open, approximate)");

//    Materials
//    Now, you will see that COMSOL starts detecting missing material properties. The properties that should be added are listed in the following table. Please check all of them for the correct value, even the ones that are already filled in.
//    Furthermore, note that material properties marked with an “<c>x</c>” are not used at all (they may be present, but their value is irrelevant). Common practice is to include the unit when typing: “<c>57[W/(m*K)]</c>”.
//    In the <l>Model Builder</l> window, under <l>Component 1 (comp1)</l> &gt; <l>Materials</l>, add the following material properties:

    model.component("comp1").material("mat1").propertyGroup("def")
         .set("electricconductivity", new String[]{"1/(1.04e-1[mohm*mm])"});
    model.component("comp1").material("mat1").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalconductivity", new String[]{"57[W/(m*K)]"});
    model.component("comp1").material("mat1").propertyGroup("def").set("density", new String[]{"7.30e3[kg/m^3]"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("heatcapacity", new String[]{"230[J/(kg*K)]"});
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("electricconductivity", new String[]{"1/(1.68e-2[mohm*mm])"});
    model.component("comp1").material("mat2").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("thermalconductivity", new String[]{"400[W/(m*K)]"});
    model.component("comp1").material("mat2").propertyGroup("def").set("density", new String[]{"8.92e3[kg/m^3]"});
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("heatcapacity", new String[]{"380[J/(kg*K)]"});
    model.component("comp1").material("mat3").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("electricconductivity", new String[]{"1/(2.65e-2[mohm*mm])"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("thermalconductivity", new String[]{"237[W/(m*K)]"});
    model.component("comp1").material("mat3").propertyGroup("def").set("density", new String[]{"2.70e3[kg/m^3]"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("heatcapacity", new String[]{"900[J/(kg*K)]"});
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("electricconductivity", new String[]{"10[S/m]"});
    model.component("comp1").material("mat4").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("thermalconductivity", new String[]{"148[W/(m*K)]"});
    model.component("comp1").material("mat4").propertyGroup("def").set("density", new String[]{"2.33e3[kg/m^3]"});
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("heatcapacity", new String[]{"700[J/(kg*K)]"});
    model.component("comp1").material("mat5").propertyGroup("def")
         .set("electricconductivity", new String[]{"s_igbt"});
    model.component("comp1").material("mat5").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat5").propertyGroup("def")
         .set("thermalconductivity", new String[]{"148[W/(m*K)]"});
    model.component("comp1").material("mat5").propertyGroup("def").set("density", new String[]{"2.33e3[kg/m^3]"});
    model.component("comp1").material("mat5").propertyGroup("def")
         .set("heatcapacity", new String[]{"700[J/(kg*K)]"});
    model.component("comp1").material("mat6").propertyGroup("def")
         .set("electricconductivity", new String[]{"1/(2.65e-2[mohm*mm])"});
    model.component("comp1").material("mat6").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat6").propertyGroup("def")
         .set("thermalconductivity", new String[]{"237[W/(m*K)]"});
    model.component("comp1").material("mat6").propertyGroup("def").set("density", new String[]{"2.70e3[kg/m^3]"});
    model.component("comp1").material("mat6").propertyGroup("def")
         .set("heatcapacity", new String[]{"900[J/(kg*K)]"});
    model.component("comp1").material("mat7").propertyGroup("def")
         .set("thermalconductivity", new String[]{"20[W/(m*K)]"});
    model.component("comp1").material("mat7").propertyGroup("def").set("density", new String[]{"3.96e3[kg/m^3]"});
    model.component("comp1").material("mat7").propertyGroup("def")
         .set("heatcapacity", new String[]{"753[J/(kg*K)]"});
    model.component("comp1").material("mat8").propertyGroup("def")
         .set("thermalconductivity", new String[]{"3.5[W/(m*K)]"});
    model.component("comp1").material("mat8").propertyGroup("def").set("density", new String[]{"3.7[g/cm^3]"});
    model.component("comp1").material("mat8").propertyGroup("def").set("heatcapacity", new String[]{"1.2[J/(g*K)]"});

//    In the Model Builder window, expand the Component 1 (comp1) > Definitions > View 1 node.
//    Right-click Hide for Geometry 1 and choose Disable.

    model.component("comp1").view("view1").hideObjects("hide1").active(false);

//    With the physics and the materials ready, it is now time to add a study. The module will be analyzed in its ‘on’ state, which corresponds to a nominal current of 1800 A and a rated voltage of 1200 V. The electric potential and temperature distribution will be computed and global equations are included to find the effective conductivity of the IGBT chips. The study will assume stationary conditions.
//    In the Home toolbar, click Add Study to open the Add Study window.
//    Find the Studies subsection.
//    In the Select Study tree, select General Studies > Stationary.
//    Click Add Study in the window toolbar.

    model.study().create("std1");
    model.study("std1").create("stat", "Stationary");

//    In the Home toolbar, click Add Study to close the Add Study window.
//    Now, edit the default solver to improve convergence speed and robustness.
//    In the Study toolbar, click Show Default Solver.

    model.study("std1").showAutoSequences("all");

//    In the Model Builder window, expand the Solution 1 (sol1) node.
//    In the Model Builder window, expand the Study 1 > Solver Configurations > Solution 1 (sol1) > Stationary Solver 1 node.
//    In the Model Builder window, expand the Study 1 > Solver Configurations > Solution 1 (sol1) > Stationary Solver 1 > Segregated 1 node, then click Electric Currents.
//    In the Settings window for Segregated Step, click to expand the Method and Termination section.
//    In the Damping factor text field, type 1.

    model.sol("sol1").feature("s1").feature("se1").feature("ss1").set("subdamp", "1");

//    In the Model Builder window, under Study 1 > Solver Configurations > Solution 1 (sol1) > Stationary Solver 1 > Segregated 1, click Temperature.
//    In the Settings window for Segregated Step, locate the Method and Termination section.
//    In the Damping factor text field, type 1.

    model.sol("sol1").feature("s1").feature("se1").feature("ss3").set("subdamp", "1");

//    Right-click Study 1 > Solver Configurations > Solution 1 (sol1) > Stationary Solver 1 > Segregated 1 > Temperature and choose Move Up.

    model.sol("sol1").feature("s1").feature("se1").feature().move("ss3", 1);

//    Right-click Study 1 > Solver Configurations > Solution 1 (sol1) > Stationary Solver 1 > Segregated 1 > Lower Limit 1 and choose Move Up.

    model.sol("sol1").feature("s1").feature("se1").feature().move("ll1", 2);

//    In the Model Builder window, click Study 1.
//    In the Settings window for Study, locate the Study Settings section.
//    Clear the Generate default plots checkbox.

    model.study("std1").setGenPlots(false);

//    In the Study toolbar, click Compute.

    model.study("std1").createAutoSequences("all");

    model.sol("sol1").runAll();

//    In the Model Builder window, click Results.
//    In the Settings window for Results, locate the Update of Results section.
//    Select the Only plot when requested checkbox.

    model.result().setOnlyPlotWhenRequested(true);

//    , since the resulting plots will take a while to evaluate.
//    The results will be divided into three node groups, one for a single set of dies, one for a section of the module, and one for the entire model. Create and modify three datasets corresponding to these groups.
//    In the Model Builder window, expand the Results node.
//    In the Model Builder window, expand the Results > Datasets node.
//    Right-click Results > Datasets > Study 1/Solution 1 (sol1) and choose Duplicate.

    model.result().dataset().duplicate("dset2", "dset1");

//    In the Model Builder window, right-click Study 1/Solution 1 (2) (sol1) and choose Duplicate.

    model.result().dataset().duplicate("dset3", "dset2");

//    In the Results toolbar, click Attributes and choose Selection.
//    In the Settings window for Selection, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Domain.

    model.result().dataset("dset1").selection().geom("geom1", 3);

//    From the Selection list, select Set of Dies (Domain).

    model.result().dataset("dset1").selection().named("geom1_boxsel2");

//    In the Model Builder window, under Results > Datasets, click Study 1/Solution 1 (2) (sol1).
//    In the Results toolbar, click Attributes and choose Selection.
//    In the Settings window for Selection, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Domain.

    model.result().dataset("dset2").selection().geom("geom1", 3);

//    From the Selection list, select Module Section (Domain).

    model.result().dataset("dset2").selection().named("geom1_boxsel3");

//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg1", "PlotGroup3D");

//    In the Settings window for 3D Plot Group, type Electric Potential (ec) in the Label text field.

    model.result("pg1").label("Electric Potential (ec)");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg1").set("edges", false);

//    Locate the Color Legend section.
//    Select the Show maximum and minimum values checkbox.

    model.result("pg1").set("showlegendsmaxmin", true);

//    Click to expand the Quality section.
//    From the Smoothing list, select Inside geometry domains.

    model.result("pg1").set("smooth", "internal");

//    Right-click Electric Potential (ec) and choose Surface.

    model.result("pg1").create("surf1", "Surface");
    model.result("pg1").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Coloring and Style section.
//    From the Color table list, select Dipole.

    model.result("pg1").feature("surf1").set("colortable", "Dipole");

//    From the Color table transformation list, select Nonlinear symmetric.

    model.result("pg1").feature("surf1").set("colortabletrans", "nonlinearsymmetric");

//    In the Color calibration parameter text field, type 0.8.

    model.result("pg1").feature("surf1").set("colorcalibration", 0.8);

//    In the Model Builder window, right-click Electric Potential (ec) and choose Line.

    model.result("pg1").create("line1", "Line");
    model.result("pg1").feature("line1").set("evaluationsettings", "parent");

//    In the Settings window for Line, locate the Expression section.
//    In the Expression text field, type 0.

    model.result("pg1").feature("line1").set("expr", "0");

//    Click to expand the Title section.
//    From the Title type list, select None.

    model.result("pg1").feature("line1").set("titletype", "none");

//    Locate the Coloring and Style section.
//    From the Coloring list, select Uniform.

    model.result("pg1").feature("line1").set("coloring", "uniform");

//    From the Color list, select Black.

    model.result("pg1").feature("line1").set("color", "black");

//    Click to expand the Quality section.
//    From the Evaluation settings list, select Manual.

    model.result("pg1").feature("line1").set("evaluationsettings", "manual");

//    Right-click Line 1 and choose Transparency.

    model.result("pg1").feature("line1").create("tran1", "Transparency");

//    In the Settings window for Transparency, locate the Transparency section.
//    Find the Transparency subsection.

    return model;
  }

  public static Model run3(Model model) {
//    In the Transparency text field, type 0.75.

    model.result("pg1").feature("line1").feature("tran1").set("transparency", 0.75);

//    Click the Show More Options button in the Model Builder toolbar.
//    In the Show More Options dialog, select Results > Views in the tree.
//    In the tree, select the checkbox for the Results > Views node.
//    Click OK.
//    In the Model Builder window, right-click Results > Views and choose View 3D.

    model.view().create("view2", 3);

//    Click the Show Grid button in the Graphics toolbar.

    model.view("view2").set("showgrid", false);

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Model Builder window, expand the View 3D 2 node, then click Camera.
//    In the Settings window for Camera, click Update.
//    In the Model Builder window, under Results, click Electric Potential (ec).
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select View 3D 2.

    model.result("pg1").set("view", "view2");

//    In the Electric Potential (ec) toolbar, click Plot.

    model.result("pg1").run();

//    Click the Go to Default View button in the Graphics toolbar.
//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg2", "PlotGroup3D");

//    In the Settings window for 3D Plot Group, type Current Density Norm (ec) in the Label text field.

    model.result("pg2").label("Current Density Norm (ec)");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg2").set("edges", false);

//    Locate the Color Legend section.
//    Select the Show maximum and minimum values checkbox.

    model.result("pg2").set("showlegendsmaxmin", true);

//    Locate the Quality section.
//    From the Smoothing list, select Inside geometry domains.

    model.result("pg2").set("smooth", "internal");

//    Right-click Current Density Norm (ec) and choose Surface.

    model.result("pg2").create("surf1", "Surface");
    model.result("pg2").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type ec.normJ.

    model.result("pg2").feature("surf1").set("expr", "ec.normJ");

//    Locate the Coloring and Style section.
//    From the Color table list, select GrayBodyLight.

    model.result("pg2").feature("surf1").set("colortable", "GrayBodyLight");

//    From the Color table transformation list, select Nonlinear.

    model.result("pg2").feature("surf1").set("colortabletrans", "nonlinear");

//    In the Color calibration parameter text field, type -0.8.

    model.result("pg2").feature("surf1").set("colorcalibration", -0.8);

//    Click to expand the Quality section.
//    From the Evaluation settings list, select Manual.

    model.result("pg2").feature("surf1").set("evaluationsettings", "manual");

//    Right-click Surface 1 and choose Selection.

    model.result("pg2").feature("surf1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Set of Dies (Not Metalization).

    model.result("pg2").feature("surf1").feature("sel1").selection().named("geom1_difsel2");

//    In the Model Builder window, right-click Current Density Norm (ec) and choose Surface.

    model.result("pg2").create("surf2", "Surface");
    model.result("pg2").feature("surf2").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type ec.normJs/th_met.

    model.result("pg2").feature("surf2").set("expr", "ec.normJs/th_met");

//    Click to expand the Title section.
//    From the Title type list, select None.

    model.result("pg2").feature("surf2").set("titletype", "none");

//    Locate the Quality section.
//    From the Evaluation settings list, select Manual.

    model.result("pg2").feature("surf2").set("evaluationsettings", "manual");

//    Click to expand the Inherit Style section.
//    From the Plot list, select Surface 1.

    model.result("pg2").feature("surf2").set("inheritplot", "surf1");

//    Right-click Surface 2 and choose Selection.

    model.result("pg2").feature("surf2").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Set of Dies (Metalization).

    model.result("pg2").feature("surf2").feature("sel1").selection().named("geom1_intsel1");

//    In the Model Builder window, right-click Current Density Norm (ec) and choose Line.

    model.result("pg2").create("line1", "Line");
    model.result("pg2").feature("line1").set("evaluationsettings", "parent");

//    In the Settings window for Line, locate the Expression section.
//    In the Expression text field, type 0.

    model.result("pg2").feature("line1").set("expr", "0");

//    Locate the Title section.
//    From the Title type list, select None.

    model.result("pg2").feature("line1").set("titletype", "none");

//    Locate the Coloring and Style section.
//    From the Coloring list, select Uniform.

    model.result("pg2").feature("line1").set("coloring", "uniform");

//    From the Color list, select Black.

    model.result("pg2").feature("line1").set("color", "black");

//    Locate the Quality section.
//    From the Evaluation settings list, select Manual.

    model.result("pg2").feature("line1").set("evaluationsettings", "manual");

//    Right-click Line 1 and choose Transparency.

    model.result("pg2").feature("line1").create("tran1", "Transparency");

//    In the Settings window for Transparency, locate the Transparency section.
//    Find the Transparency subsection.
//    In the Transparency text field, type 0.75.

    model.result("pg2").feature("line1").feature("tran1").set("transparency", 0.75);

//    In the Model Builder window, under Results, click Current Density Norm (ec).
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select View 3D 2.

    model.result("pg2").set("view", "view2");

//    In the Current Density Norm (ec) toolbar, click Plot.

    model.result("pg2").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    Note that only a small portion of the current leaks through the freewheeling diodes.
//    In the Home toolbar, click Add Plot Group and choose 3D Plot Group.

    model.result().create("pg3", "PlotGroup3D");

//    In the Settings window for 3D Plot Group, type Temperature (ht) in the Label text field.

    model.result("pg3").label("Temperature (ht)");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg3").set("edges", false);

//    Locate the Color Legend section.
//    Select the Show maximum and minimum values checkbox.

    model.result("pg3").set("showlegendsmaxmin", true);

//    Locate the Quality section.
//    From the Smoothing list, select Inside geometry domains.

    model.result("pg3").set("smooth", "internal");

//    Right-click Temperature (ht) and choose Surface.

    model.result("pg3").create("surf1", "Surface");
    model.result("pg3").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type T.

    model.result("pg3").feature("surf1").set("expr", "T");

//    From the Unit list, select °C.

    model.result("pg3").feature("surf1").set("unit", "\u00b0C");

//    Locate the Coloring and Style section.
//    From the Color table list, select HeatCameraLight.

    model.result("pg3").feature("surf1").set("colortable", "HeatCameraLight");

//    From the Color table transformation list, select Nonlinear.

    model.result("pg3").feature("surf1").set("colortabletrans", "nonlinear");

//    In the Color calibration parameter text field, type -0.8.

    model.result("pg3").feature("surf1").set("colorcalibration", -0.8);

//    Locate the Quality section.
//    From the Evaluation settings list, select Manual.

    model.result("pg3").feature("surf1").set("evaluationsettings", "manual");

//    In the Model Builder window, right-click Temperature (ht) and choose Line.

    model.result("pg3").create("line1", "Line");
    model.result("pg3").feature("line1").set("evaluationsettings", "parent");

//    In the Settings window for Line, locate the Expression section.
//    In the Expression text field, type 0.

    model.result("pg3").feature("line1").set("expr", "0");

//    Locate the Title section.
//    From the Title type list, select None.

    model.result("pg3").feature("line1").set("titletype", "none");

//    Locate the Coloring and Style section.
//    From the Coloring list, select Uniform.

    model.result("pg3").feature("line1").set("coloring", "uniform");

//    From the Color list, select Black.

    model.result("pg3").feature("line1").set("color", "black");

//    Locate the Quality section.
//    From the Evaluation settings list, select Manual.

    model.result("pg3").feature("line1").set("evaluationsettings", "manual");

//    Right-click Line 1 and choose Transparency.

    model.result("pg3").feature("line1").create("tran1", "Transparency");

//    In the Settings window for Transparency, locate the Transparency section.
//    Find the Transparency subsection.
//    In the Transparency text field, type 0.75.

    model.result("pg3").feature("line1").feature("tran1").set("transparency", 0.75);

//    In the Model Builder window, under Results, click Temperature (ht).
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select View 3D 2.

    model.result("pg3").set("view", "view2");

//    In the Temperature (ht) toolbar, click Plot.

    model.result("pg3").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    The plot shows that the highest temperatures are reached in the bond wires.
//    Now, group the plots for better readability.
//    In the Model Builder window, under Results, Ctrl-click to select Electric Potential (ec), Current Density Norm (ec), Temperature (ht).
//    Right-click and choose Group.

    model.nodeGroup().create("grp1", "Results");
    model.nodeGroup("grp1").set("type", "plotgroup");
    model.nodeGroup("grp1").add("plotgroup", "pg1");
    model.nodeGroup("grp1").add("plotgroup", "pg2");
    model.nodeGroup("grp1").add("plotgroup", "pg3");

//    In the Settings window for Group, type Set of Dies in the Label text field.

    model.nodeGroup("grp1").label("Set of Dies");

//    The following steps will help you to set up a new set of plots, similar to the previous ones, but showing larger parts of the module.
//    Right-click Set of Dies and choose Duplicate.

    model.nodeGroup().duplicate("grp2", "grp1");

//    In the Model Builder window, click Set of Dies 1.
//    In the Settings window for Group, type Module Section in the Label text field.

    model.nodeGroup("grp2").label("Module Section");

//    In the Model Builder window, click Electric Potential (ec) 1.
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Dataset list, select Study 1/Solution 1 (2) (sol1).

    model.result("pg4").set("data", "dset2");

//    In the Electric Potential (ec) 1 toolbar, click Plot.

    model.result("pg4").run();

//    In the Model Builder window, right-click Results > Views and choose View 3D.

    model.view().create("view3", 3);

//    Click the Show Grid button in the Graphics toolbar.

    model.view("view3").set("showgrid", false);

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Model Builder window, expand the View 3D 3 node, then click Camera.
//    In the Settings window for Camera, click Update.
//    In the Model Builder window, under Results > Module Section, click Electric Potential (ec) 1.
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select View 3D 3.

    model.result("pg4").set("view", "view3");

//    In the Electric Potential (ec) 1 toolbar, click Plot.

    model.result("pg4").run();

//    Click the Go to Default View button in the Graphics toolbar.
//    In the Model Builder window, click Current Density Norm (ec) 1.
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Dataset list, select Study 1/Solution 1 (2) (sol1).

    model.result("pg5").set("data", "dset2");

//    In the Model Builder window, expand the Current Density Norm (ec) 1 node.
//    In the Model Builder window, expand the Results > Module Section > Current Density Norm (ec) 1 > Surface 1 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Module Section (Not Metalization).

    model.result("pg5").feature("surf1").feature("sel1").selection().named("geom1_difsel3");

//    In the Model Builder window, expand the Results > Module Section > Current Density Norm (ec) 1 > Surface 2 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Module Section (Metalization).

    model.result("pg5").feature("surf2").feature("sel1").selection().named("geom1_intsel2");

//    In the Model Builder window, under Results > Module Section, click Current Density Norm (ec) 1.
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select View 3D 3.

    model.result("pg5").set("view", "view3");

//    In the Current Density Norm (ec) 1 toolbar, click Plot.

    model.result("pg5").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    The figure suggests that the highest current densities occur in proximity to the bonding wires' attachment points. This explains why these areas are of interest when it comes to analyzing the long term effects of heat generation and temperature in an IGBT module.
//    In the Model Builder window, click Temperature (ht) 1.
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Dataset list, select Study 1/Solution 1 (2) (sol1).

    model.result("pg6").set("data", "dset2");

//    Locate the Plot Settings section.
//    From the View list, select View 3D 3.

    model.result("pg6").set("view", "view3");

//    In the Temperature (ht) 1 toolbar, click Plot.

    model.result("pg6").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Model Builder window, right-click Set of Dies and choose Duplicate.

    model.nodeGroup().duplicate("grp3", "grp1");

//    In the Settings window for Group, type All Domains in the Label text field.

    model.nodeGroup("grp3").label("All Domains");

//    In the Model Builder window, expand the All Domains node, then click Electric Potential (ec) 2.
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Dataset list, select Study 1/Solution 1 (3) (sol1).

    model.result("pg7").set("data", "dset3");

//    In the Model Builder window, expand the Electric Potential (ec) 2 node.
//    Right-click Surface 1 and choose Selection.

    model.result("pg7").feature("surf1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Geometric entity level list, select Domain.

    model.result("pg7").feature("surf1").feature("sel1").selection().geom("geom1", 3);

//    From the Selection list, select Electric Current Domains.

    model.result("pg7").feature("surf1").feature("sel1").selection().named("geom1_unisel5");

//    In the Model Builder window, expand the Results > All Domains > Electric Potential (ec) 2 > Line 1 node.
//    Right-click Line 1 and choose Selection.

    model.result("pg7").feature("line1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Geometric entity level list, select Domain.

    model.result("pg7").feature("line1").feature("sel1").selection().geom("geom1", 3);

//    From the Selection list, select Heat Transfer Domains.

    model.result("pg7").feature("line1").feature("sel1").selection().named("geom1_comsel1");

//    In the Model Builder window, under Results > All Domains, click Electric Potential (ec) 2.
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select Automatic.

    model.result("pg7").set("view", "auto");

//    In the Electric Potential (ec) 2 toolbar, click Plot.

    model.result("pg7").run();

//    Click the Go to Default View button in the Graphics toolbar.
//    In the Model Builder window, click Current Density Norm (ec) 2.
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Dataset list, select Study 1/Solution 1 (3) (sol1).

    model.result("pg8").set("data", "dset3");

//    In the Model Builder window, expand the Current Density Norm (ec) 2 node.
//    In the Model Builder window, expand the Results > All Domains > Current Density Norm (ec) 2 > Surface 1 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select All Domains (EC, Not Metalization).

    model.result("pg8").feature("surf1").feature("sel1").selection().named("geom1_difsel5");

//    In the Model Builder window, expand the Results > All Domains > Current Density Norm (ec) 2 > Surface 2 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select All Domains (EC, Metalization).

    model.result("pg8").feature("surf2").feature("sel1").selection().named("geom1_intsel3");

//    In the Model Builder window, expand the Results > All Domains > Current Density Norm (ec) 2 > Line 1 node.
//    Right-click Line 1 and choose Selection.

    model.result("pg8").feature("line1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Geometric entity level list, select Domain.

    model.result("pg8").feature("line1").feature("sel1").selection().geom("geom1", 3);

//    From the Selection list, select Heat Transfer Domains.

    model.result("pg8").feature("line1").feature("sel1").selection().named("geom1_comsel1");

//    In the Model Builder window, under Results > All Domains, click Current Density Norm (ec) 2.
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select Automatic.

    model.result("pg8").set("view", "auto");

//    In the Current Density Norm (ec) 2 toolbar, click Plot.

    model.result("pg8").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Model Builder window, click Temperature (ht) 2.
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Dataset list, select Study 1/Solution 1 (3) (sol1).

    model.result("pg9").set("data", "dset3");

//    In the Model Builder window, expand the Temperature (ht) 2 node.
//    Right-click Surface 1 and choose Selection.

    model.result("pg9").feature("surf1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Geometric entity level list, select Domain.

    model.result("pg9").feature("surf1").feature("sel1").selection().geom("geom1", 3);

//    From the Selection list, select Heat Transfer Domains.

    model.result("pg9").feature("surf1").feature("sel1").selection().named("geom1_comsel1");

//    Right-click Surface 1 and choose Duplicate.

    model.result("pg9").feature().duplicate("surf2", "surf1");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type 0.

    model.result("pg9").feature("surf2").set("expr", "0");

//    Locate the Title section.
//    From the Title type list, select None.

    model.result("pg9").feature("surf2").set("titletype", "none");

//    In the Model Builder window, expand the Surface 2 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Plastic Enclosure (Import 1).

    model.result("pg9").feature("surf2").feature("sel1").selection().named("geom1_imp1_Color_3_dom");

//    In the Model Builder window, right-click Surface 2 and choose Filter.

    model.result("pg9").feature("surf2").create("filt1", "Filter");

//    In the Settings window for Filter, locate the Element Selection section.
//    In the Logical expression for inclusion text field, type y>0.045.

    model.result("pg9").feature("surf2").feature("filt1").set("expr", "y>0.045");

//    Right-click Surface 2 and choose Material Appearance.

    model.result("pg9").feature("surf2").create("mtrl1", "MaterialAppearance");

//    In the Settings window for Material Appearance, locate the Appearance section.
//    From the Appearance list, select Custom.

    model.result("pg9").feature("surf2").feature("mtrl1").set("appearance", "custom");

//    From the Color list, select Black.

    model.result("pg9").feature("surf2").feature("mtrl1").set("color", "black");

//    Right-click Surface 2 and choose Duplicate.

    model.result("pg9").feature().duplicate("surf3", "surf2");

//    In the Model Builder window, expand the Surface 3 node, then click Filter 1.
//    In the Settings window for Filter, locate the Element Selection section.
//    In the Logical expression for inclusion text field, type x>0.022.

    model.result("pg9").feature("surf3").feature("filt1").set("expr", "x>0.022");

//    In the Model Builder window, expand the Results > All Domains > Temperature (ht) 2 > Line 1 node.
//    Right-click Line 1 and choose Selection.

    model.result("pg9").feature("line1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Geometric entity level list, select Domain.

    model.result("pg9").feature("line1").feature("sel1").selection().geom("geom1", 3);

//    From the Selection list, select Heat Transfer Domains.

    model.result("pg9").feature("line1").feature("sel1").selection().named("geom1_comsel1");

//    In the Model Builder window, under Results > All Domains, click Temperature (ht) 2.
//    In the Settings window for 3D Plot Group, locate the Plot Settings section.
//    From the View list, select Automatic.

    model.result("pg9").set("view", "auto");

//    In the Temperature (ht) 2 toolbar, click Plot.

    model.result("pg9").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Results toolbar, click Evaluation Group.

    model.result().evaluationGroup().create("eg1", "EvaluationGroup");

//    Right-click Evaluation Group 1 and choose Global Evaluation.

    model.result().evaluationGroup("eg1").create("gev1", "EvalGlobal");

//    In the Settings window for Global Evaluation, locate the Expressions section.
//    In the table, enter the following settings:

    model.result().evaluationGroup("eg1").feature("gev1").setIndex("unit", "kA/m^2", 0);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("unit", "degC", 1);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("expr", "V_igbt", 2);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("unit", "mV", 2);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("expr", "s_igbt", 3);

//    In the Model Builder window, click Evaluation Group 1.
//    In the Settings window for Evaluation Group, locate the Transformation section.
//    Select the Transpose checkbox.

    model.result().evaluationGroup("eg1").set("transpose", true);

//    In the Evaluation Group 1 toolbar, click Evaluate.

    model.result().evaluationGroup("eg1").run();

//    This should result in a current density of 526 kA/m<sup>2</sup>, a junction temperature of 93.5°C, a voltage drop of 324 mV, and a conductivity of 227 S/m. Your values may vary slightly. The derived conductivity for the semiconductor explains why a majority of the current passes through the IGBT chips instead of the FWDs which, for reference, had a conductivity defined at 10 S/m. Note also that the collector–emitter voltage makes up the majority of the total voltage drop over the current path.

    model.title("Thermal Analysis of a High-Power IGBT Module");

    model
         .description("This industrial-scale proof of concept (POC) model demonstrates how to perform an electric\u2013thermal analysis of a high-power insulated-gate bipolar transistor module (IGBT module). The module has a rated voltage of 1200 V, and nominal current of 1800 A.\n\nUsing a stationary study the device is modeled in the 'on' state, where strong currents pass through the IGBT dies and only a small portion of the current is leaking back through the freewheeling diodes (FWDs). The generated heat is dissipated through a heat sink, and both the currents and the temperature profile are evaluated in the semiconductors, the metalization layers, and the bond wires.\n\nThe model uses the Joule Heating multiphysics interface, that combines Electric Currents and Heat Transfer in Solids, together with the Electromagnetic Heating multiphysics coupling. The electric properties of the semiconductor material have been included as a macroscopic effect: an effective conductivity is applied such that the potential drop across the junction agrees with a predetermined (temperature dependent) value.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    model = run2(model);
    run3(model);
  }

}
