/*
 * mosfet_small_signal.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 12 2026, 08:22 by COMSOL 6.4.0.418. */
public class mosfet_small_signal {

  public static Model run() {
    Model model = ModelUtil.create("Model");

//    Load the mosfet model.
//    From the File menu, choose Application Libraries.
//    In the Application Libraries window, select Semiconductor Module > Transistors > mosfet in the tree.
//    Click Open.

    model.component().create("comp1", true);

    model.component("comp1").geom().create("geom1", 2);

    model.component("comp1").mesh().create("mesh1");

    model.component("comp1").physics().create("semi", "Semiconductor", "geom1");

    model.study().create("std1");
    model.study("std1").create("stat", "Stationary");

    model.param().set("Vd", "10[mV]");
    model.param().descr("Vd", "Drain voltage");
    model.param().set("Vg", "2[V]");
    model.param().descr("Vg", "Gate voltage");

    model.component("comp1").geom("geom1").lengthUnit("\u00b5m");
    model.component("comp1").geom("geom1").create("r1", "Rectangle");
    model.component("comp1").geom("geom1").feature("r1").set("size", new double[]{3, 0.7});
    model.component("comp1").geom("geom1").run("r1");
    model.component("comp1").geom("geom1").create("pol1", "Polygon");
    model.component("comp1").geom("geom1").feature("pol1").set("source", "table");
    model.component("comp1").geom("geom1").feature("pol1").set("type", "closed");
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0, 0, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.67, 0, 1);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0, 1, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.7, 1, 1);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.5, 2, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.7, 2, 1);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.7, 3, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.7, 3, 1);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 2.3, 4, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.7, 4, 1);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 2.5, 5, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.7, 5, 1);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 3, 6, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.7, 6, 1);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 3, 7, 0);
    model.component("comp1").geom("geom1").feature("pol1").setIndex("table", 0.67, 7, 1);
    model.component("comp1").geom("geom1").run("fin");
    model.component("comp1").geom("geom1").create("mce1", "MeshControlEdges");
    model.component("comp1").geom("geom1").feature("mce1").selection("input").set("fin", 4);
    model.component("comp1").geom("geom1").runPre("fin");
    model.component("comp1").geom("geom1").run();

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").propertyGroup()
         .create("AroraMobilityModel", "AroraMobilityModel", "Arora mobility model");
    model.component("comp1").material("mat1").propertyGroup()
         .create("PowerLawMobilityModel", "PowerLawMobilityModel", "Power law mobility model");
    model.component("comp1").material("mat1").propertyGroup().create("Auger", "Auger", "Auger recombination");
    model.component("comp1").material("mat1").propertyGroup().create("Direct", "Direct", "Direct recombination");
    model.component("comp1").material("mat1").propertyGroup()
         .create("SRH", "SRH", "Shockley\u2013Read\u2013Hall recombination");
    model.component("comp1").material("mat1").propertyGroup()
         .create("FletcherMobilityModel", "FletcherMobilityModel", "Fletcher mobility model");
    model.component("comp1").material("mat1").propertyGroup()
         .create("CaugheyThomasMobilityModel", "CaugheyThomasMobilityModel", "Caughey\u2013Thomas mobility model");
    model.component("comp1").material("mat1").propertyGroup()
         .create("SemicondMaterial", "SemicondMaterial", "Semiconductor material");
    model.component("comp1").material("mat1").propertyGroup()
         .create("LombardiSurfaceMobilityModel", "LombardiSurfaceMobilityModel", "Lombardi surface mobility model");
    model.component("comp1").material("mat1").propertyGroup()
         .create("ImpactIonization", "ImpactIonization", "Impact ionization");
    model.component("comp1").material("mat1").propertyGroup()
         .create("SlotboomModel", "SlotboomModel", "Slotboom model");
    model.component("comp1").material("mat1").propertyGroup()
         .create("JainRoulstonModel", "JainRoulstonModel", "Jain\u2013Roulston model");
    model.component("comp1").material("mat1").propertyGroup()
         .create("KlaassenUnifiedMobilityModel", "KlaassenUnifiedMobilityModel", "Klaassen unified mobility model");
    model.component("comp1").material("mat1").label("Si - Silicon");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermittivity", new String[]{"11.7", "0", "0", "0", "11.7", "0", "0", "0", "11.7"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalconductivity", new String[]{"131[W/(m*K)]", "0", "0", "0", "131[W/(m*K)]", "0", "0", "0", "131[W/(m*K)]"});
    model.component("comp1").material("mat1").propertyGroup("def").set("density", "2329[kg/m^3]");
    model.component("comp1").material("mat1").propertyGroup("def").set("heatcapacity", "700[J/(kg*K)]");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel")
         .set("mun0_ref_arora", "1252[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel")
         .set("mup0_ref_arora", "407[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel")
         .set("mun_min_ref_arora", "88[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel")
         .set("mup_min_ref_arora", "54.3[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel")
         .set("Nn0_ref_arora", "1.26e17[1/cm^3]");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel")
         .set("Np0_ref_arora", "2.35e17[1/cm^3]");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel").set("alpha0_arora", "0.88");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel").set("beta1_arora", "-0.57");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel").set("beta2_arora", "-2.33");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel").set("beta3_arora", "-2.33");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel").set("beta4_arora", "-0.146");
    model.component("comp1").material("mat1").propertyGroup("AroraMobilityModel").set("Tref_arora", "300[K]");
    model.component("comp1").material("mat1").propertyGroup("PowerLawMobilityModel")
         .set("mun0_pl", "1448[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("PowerLawMobilityModel")
         .set("mup0_pl", "473[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("PowerLawMobilityModel").set("alphan_pl", "2.33");
    model.component("comp1").material("mat1").propertyGroup("PowerLawMobilityModel").set("alphap_pl", "2.23");
    model.component("comp1").material("mat1").propertyGroup("PowerLawMobilityModel").set("Tref_pl", "300[K]");
    model.component("comp1").material("mat1").propertyGroup("Auger").set("Cn", "2.8e-31[cm^6/s]");
    model.component("comp1").material("mat1").propertyGroup("Auger").set("Cp", "9.9e-32[cm^6/s]");
    model.component("comp1").material("mat1").propertyGroup("Direct").set("C", "0[cm^3/s]");
    model.component("comp1").material("mat1").propertyGroup("SRH").set("taun", "10[us]");
    model.component("comp1").material("mat1").propertyGroup("SRH").set("taup", "10[us]");
    model.component("comp1").material("mat1").propertyGroup("FletcherMobilityModel")
         .set("F1_fl", "1.04e21[1/(cm^1*V*s)]");
    model.component("comp1").material("mat1").propertyGroup("FletcherMobilityModel").set("F2_fl", "7.45e13[1/cm^2]");
    model.component("comp1").material("mat1").propertyGroup("FletcherMobilityModel").set("Tref_fl", "300[K]");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("alphan0_ct", "1.11");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("alphap0_ct", "1.21");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("vn0_ct", "1e7[cm/s]");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel")
         .set("vp0_ct", "8.37e6[cm/s]");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("betan1_ct", "0.66");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("betap1_ct", "0.17");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("betan2_ct", "-0.87");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("betap2_ct", "-0.52");
    model.component("comp1").material("mat1").propertyGroup("CaugheyThomasMobilityModel").set("Tref_ct", "300[K]");
    model.component("comp1").material("mat1").propertyGroup("SemicondMaterial").set("Eg0", "1.12[V]");
    model.component("comp1").material("mat1").propertyGroup("SemicondMaterial").set("chi0", "4.05[V]");
    model.component("comp1").material("mat1").propertyGroup("SemicondMaterial")
         .set("Nv", "(T/300[K])^(3/2)*1.04e19[1/cm^3]");
    model.component("comp1").material("mat1").propertyGroup("SemicondMaterial")
         .set("Nc", "(T/300[K])^(3/2)*2.8e19[1/cm^3]");
    model.component("comp1").material("mat1").propertyGroup("SemicondMaterial").set("mun", "1450[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("SemicondMaterial").set("mup", "500[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("SemicondMaterial").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("deltan_ls", "5.82e14[V/s]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("deltap_ls", "2.05e14[V/s]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("mun1_ls", "4.75e7[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("mup1_ls", "9.93e7[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("mun2_ls", "1.74e5[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("mup2_ls", "8.84e5[cm^2/(V*s)]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel").set("alphan_ls", "0.125");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("alphap_ls", "0.0317");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel").set("Tref_ls", "1[K]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel").set("Eref_ls", "1[V/cm]");
    model.component("comp1").material("mat1").propertyGroup("LombardiSurfaceMobilityModel")
         .set("Nref_ls", "1[1/cm^3]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("an", "0.426[1/V]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("ap", "0.243[1/V]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("bn", "4.81E5[V/cm]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("bp", "6.53E5[V/cm]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("cnii", "3.05E-4[1/K]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("cpii", "5.35E-4[1/K]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("dn", "6.86E-4[1/K]");
    model.component("comp1").material("mat1").propertyGroup("ImpactIonization").set("dp", "5.67E-4[1/K]");
    model.component("comp1").material("mat1").propertyGroup("SlotboomModel").set("Eref_sb", "0.00692[V]");
    model.component("comp1").material("mat1").propertyGroup("SlotboomModel").set("Nref_sb", "1.3e17[1/cm^3]");
    model.component("comp1").material("mat1").propertyGroup("SlotboomModel").set("alpha_sb", "0.5");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("An_jr", "3.5e-8[V]");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("Bn_jr", "0[V]");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("Cn_jr", "0[V]");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("Ap_jr", "3.5e-8[V]");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("Bp_jr", "0[V]");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("Cp_jr", "0[V]");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("Nref_jr", "1[1/cm^3]");
    model.component("comp1").material("mat1").propertyGroup("JainRoulstonModel").set("alpha_jr", "0.5");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("T_ref_kl", "300[K]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("mu_e_max_kl", "1414.0[cm^2/V/s]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("mu_h_max_kl", "470.5[cm^2/V/s]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("mu_e_min_kl", "68.5[cm^2/V/s]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("mu_h_min_kl", "44.9[cm^2/V/s]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("theta_e_kl", "2.285");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("theta_h_kl", "2.247");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("alpha_e_1_kl", "0.711");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("alpha_h_1_kl", "0.719");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("N_ref_e_1_kl", "9.20e16[cm^-3]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("N_ref_h_1_kl", "2.23e17[cm^-3]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("c_D_kl", "0.21");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("c_A_kl", "0.50");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("N_ref_D_kl", "4.0e20[cm^-3]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("N_ref_A_kl", "7.2e20[cm^-3]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("f_BH_kl", "3.828");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("f_CW_kl", "2.459");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("N_BH_kl", "1.36e20[cm^-3]");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("P_CW_kl", "3.97e13");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("s_1_kl", "0.89233");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("s_2_kl", "0.41372");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("s_3_kl", "0.19778");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("s_4_kl", "0.28227");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("s_5_kl", "0.005978");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("s_6_kl", "1.80618");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("s_7_kl", "0.72169");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("r_1_kl", "0.7643");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("r_2_kl", "2.2999");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("r_3_kl", "6.5502");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("r_4_kl", "2.3670");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("r_5_kl", "-0.01552");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("r_6_kl", "0.6478");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel").set("m_e_kl", "me_const");
    model.component("comp1").material("mat1").propertyGroup("KlaassenUnifiedMobilityModel")
         .set("m_h_kl", "1.258*me_const");

    model.component("comp1").physics("semi").prop("ModelProperties").set("CarrierStatistics", "FermiDirac");
    model.component("comp1").physics("semi").create("adm1", "AnalyticDopingModel", 2);
    model.component("comp1").physics("semi").feature("adm1").set("NAc", "1e17[1/cm^3]");
    model.component("comp1").physics("semi").feature("adm1").selection().all();
    model.component("comp1").physics("semi").create("adm2", "AnalyticDopingModel", 2);
    model.component("comp1").physics("semi").feature("adm2").selection().all();
    model.component("comp1").physics("semi").feature("adm2").set("impurityDistribution", "box");
    model.component("comp1").physics("semi").feature("adm2").set("rb", new String[]{"0[um]", "0.6[um]", "0"});
    model.component("comp1").physics("semi").feature("adm2").set("jwidth", "0.6[um]");
    model.component("comp1").physics("semi").feature("adm2").set("jdepth", "0.1[um]");
    model.component("comp1").physics("semi").feature("adm2").set("impurityType", "donor");
    model.component("comp1").physics("semi").feature("adm2").set("NDc", "1e20[1/cm^3]");
    model.component("comp1").physics("semi").feature("adm2").set("AsymmetricJunctionDepth", true);
    model.component("comp1").physics("semi").feature("adm2").set("jda", new String[]{"0.2[um]", "0.25[um]", "0"});
    model.component("comp1").physics("semi").feature("adm2").set("Nb_src", "root.comp1.semi.adm1.NAc");
    model.component("comp1").physics("semi").feature().duplicate("adm3", "adm2");
    model.component("comp1").physics("semi").feature("adm3").set("rb", new String[]{"2.4[um]", "0.6[um]", "0"});
    model.component("comp1").physics("semi").create("mc1", "MetalContact", 1);
    model.component("comp1").physics("semi").feature("mc1").selection().set(3);
    model.component("comp1").physics("semi").create("mc2", "MetalContact", 1);
    model.component("comp1").physics("semi").feature("mc2").selection().set(7);
    model.component("comp1").physics("semi").feature("mc2").set("V0", "Vd");
    model.component("comp1").physics("semi").create("mc3", "MetalContact", 1);
    model.component("comp1").physics("semi").feature("mc3").selection().set(2);
    model.component("comp1").physics("semi").create("gc1", "GateContact", 1);
    model.component("comp1").physics("semi").feature("gc1").set("V0", "Vg");
    model.component("comp1").physics("semi").feature("gc1").set("epsilon_ins", 4.5);
    model.component("comp1").physics("semi").feature("gc1").set("d_ins", "30[nm]");
    model.component("comp1").physics("semi").feature("gc1").selection().set(5);
    model.component("comp1").physics("semi").create("tar1", "TrapAssistedRecombination", 2);
    model.component("comp1").physics("semi").feature("tar1").selection().all();
    model.component("comp1").physics("semi").feature("smm1").set("BandGapNarrowing", "jain");

    model.component("comp1").mesh("mesh1").automatic(false);
    model.component("comp1").mesh("mesh1").feature("size").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("size").set("hgrad", 1.05);
    model.component("comp1").mesh("mesh1").feature().remove("size1");
    model.component("comp1").mesh("mesh1").feature().remove("size2");
    model.component("comp1").mesh("mesh1").feature().remove("ftri1");
    model.component("comp1").mesh("mesh1").create("edg1", "Edge");
    model.component("comp1").mesh("mesh1").feature("edg1").selection().set(3, 4, 5, 6, 7);
    model.component("comp1").mesh("mesh1").feature("edg1").set("smoothcontrol", false);
    model.component("comp1").mesh("mesh1").feature("edg1").create("size1", "Size");
    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("table", "semi");
    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("custom", true);
    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("hmaxactive", true);
    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("hmax", 0.03);
    model.component("comp1").mesh("mesh1").create("map1", "Map");
    model.component("comp1").mesh("mesh1").feature("map1").selection().geom("geom1", 2);
    model.component("comp1").mesh("mesh1").feature("map1").selection().set(2);
    model.component("comp1").mesh("mesh1").feature("map1").set("smoothcontrol", false);
    model.component("comp1").mesh("mesh1").feature("map1").set("adjustedgdistr", true);
    model.component("comp1").mesh("mesh1").feature("map1").create("dis1", "Distribution");
    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").selection().set(9);
    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").set("type", "predefined");
    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").set("elemcount", 8);
    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").set("elemratio", 9);
    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").set("growthrate", "exponential");
    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").set("reverse", true);
    model.component("comp1").mesh("mesh1").create("ftri1", "FreeTri");
    model.component("comp1").mesh("mesh1").feature("ftri1").set("smoothcontrol", false);
    model.component("comp1").mesh("mesh1").run();

    model.study("std1").setGenPlots(false);
    model.study("std1").createAutoSequences("sol");
    model.study("std1").createAutoSequences("jobs");

    model.sol("sol1").runFromTo("st1", "v1");

    model.result().create("pg1", "PlotGroup2D");
    model.result("pg1").run();
    model.result("pg1").create("surf1", "Surface");
    model.result("pg1").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg1").feature("surf1").set("expr", "semi.Nd-semi.Na");
    model.result("pg1").feature("surf1").set("unit", "1/cm^3");
    model.result("pg1").run();
    model.result("pg1").run();
    model.result("pg1").label("Signed Dopant Concentration");

    model.study("std1").feature("stat").set("useparam", true);
    model.study("std1").feature("stat").set("sweeptype", "filled");
    model.study("std1").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std1").feature("stat").setIndex("plistarr", "", 0);
    model.study("std1").feature("stat").setIndex("punit", "V", 0);
    model.study("std1").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std1").feature("stat").setIndex("plistarr", "", 0);
    model.study("std1").feature("stat").setIndex("punit", "V", 0);
    model.study("std1").feature("stat").setIndex("plistarr", 0.01, 0);
    model.study("std1").feature("stat").setIndex("pname", "Vg", 1);
    model.study("std1").feature("stat").setIndex("plistarr", "", 1);
    model.study("std1").feature("stat").setIndex("punit", "V", 1);
    model.study("std1").feature("stat").setIndex("pname", "Vg", 1);
    model.study("std1").feature("stat").setIndex("plistarr", "", 1);
    model.study("std1").feature("stat").setIndex("punit", "V", 1);
    model.study("std1").feature("stat").setIndex("plistarr", "range(0,0.2,1.4) 2 3 4", 1);
    model.study("std1").createAutoSequences("all");

    model.sol("sol1").runAll();

    model.result("pg1").run();
    model.result().create("pg2", "PlotGroup1D");
    model.result("pg2").run();
    model.result("pg2").set("legendpos", "upperleft");
    model.result("pg2").create("glob1", "Global");
    model.result("pg2").feature("glob1").set("markerpos", "datapoints");
    model.result("pg2").feature("glob1").set("linewidth", "preference");
    model.result("pg2").feature("glob1").set("expr", new String[]{"semi.I0_2"});
    model.result("pg2").feature("glob1").set("descr", new String[]{"Terminal current"});
    model.result("pg2").feature("glob1").set("unit", new String[]{"A"});
    model.result("pg2").feature("glob1").setIndex("unit", "uA", 0);
    model.result("pg2").feature("glob1").setIndex("descr", "Terminal current", 0);
    model.result("pg2").run();
    model.result("pg2").run();
    model.result("pg2").label("Id vs. Vg (Vd=10mV)");

    model.study().create("std2");
    model.study("std2").create("stat", "Stationary");
    model.study("std2").feature("stat").set("useinitsol", true);
    model.study("std2").feature("stat").set("initmethod", "sol");
    model.study("std2").feature("stat").set("initstudy", "std1");
    model.study("std2").feature("stat").set("solnum", 9);
    model.study("std2").feature("stat").set("useparam", true);
    model.study("std2").feature("stat").set("sweeptype", "filled");
    model.study("std2").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std2").feature("stat").setIndex("plistarr", "", 0);
    model.study("std2").feature("stat").setIndex("punit", "V", 0);
    model.study("std2").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std2").feature("stat").setIndex("plistarr", "", 0);
    model.study("std2").feature("stat").setIndex("punit", "V", 0);
    model.study("std2").feature("stat").setIndex("pname", "Vg", 0);
    model.study("std2").feature("stat").setIndex("plistarr", "", 0);
    model.study("std2").feature("stat").setIndex("punit", "V", 0);
    model.study("std2").feature("stat").setIndex("plistarr", "range(2,1,4)", 0);
    model.study("std2").feature("stat").setIndex("pname", "Vd", 1);
    model.study("std2").feature("stat").setIndex("plistarr", "", 1);
    model.study("std2").feature("stat").setIndex("punit", "V", 1);
    model.study("std2").feature("stat").setIndex("pname", "Vd", 1);
    model.study("std2").feature("stat").setIndex("plistarr", "", 1);
    model.study("std2").feature("stat").setIndex("punit", "V", 1);
    model.study("std2").feature("stat").setIndex("plistarr", "range(0,0.25,1.5) 2 3 4 5", 1);
    model.study("std2").feature("stat").setIndex("punit", "V", 1);
    model.study("std2").feature("stat").set("preusesol", "auto");
    model.study("std2").createAutoSequences("all");

    model.sol("sol2").runAll();

    model.result().create("pg3", "PlotGroup2D");
    model.result("pg3").label("Electron Concentration (semi)");
    model.result("pg3").set("data", "dset2");
    model.result("pg3").setIndex("looplevel", 11, 0);
    model.result("pg3").setIndex("looplevel", 3, 1);
    model.result("pg3").set("showlegendsmaxmin", true);
    model.result("pg3").feature().create("surf1", "Surface");
    model.result("pg3").feature("surf1").set("expr", "semi.N");
    model.result("pg3").feature("surf1").set("unit", "1/cm^3");
    model.result("pg3").feature("surf1").set("colortable", "Prism");
    model.result("pg3").feature("surf1").set("colorscalemode", "logarithmic");
    model.result("pg3").feature("surf1").set("resolution", "norefine");
    model.result("pg3").feature("surf1").set("smooth", "internal");
    model.result("pg3").feature("surf1").set("data", "parent");
    model.result().create("pg4", "PlotGroup2D");
    model.result("pg4").label("Hole Concentration (semi)");
    model.result("pg4").set("data", "dset2");
    model.result("pg4").setIndex("looplevel", 11, 0);
    model.result("pg4").setIndex("looplevel", 3, 1);
    model.result("pg4").set("showlegendsmaxmin", true);
    model.result("pg4").feature().create("surf1", "Surface");
    model.result("pg4").feature("surf1").set("expr", "semi.P");
    model.result("pg4").feature("surf1").set("unit", "1/cm^3");
    model.result("pg4").feature("surf1").set("colortable", "Prism");
    model.result("pg4").feature("surf1").set("colorscalemode", "logarithmic");
    model.result("pg4").feature("surf1").set("resolution", "norefine");
    model.result("pg4").feature("surf1").set("smooth", "internal");
    model.result("pg4").feature("surf1").set("data", "parent");
    model.result().create("pg5", "PlotGroup2D");
    model.result("pg5").label("Electric Potential (semi)");
    model.result("pg5").set("data", "dset2");
    model.result("pg5").setIndex("looplevel", 11, 0);
    model.result("pg5").setIndex("looplevel", 3, 1);
    model.result("pg5").feature().create("surf1", "Surface");
    model.result("pg5").feature("surf1").set("expr", "V");
    model.result("pg5").feature("surf1").set("resolution", "norefine");
    model.result("pg5").feature("surf1").set("smooth", "internal");
    model.result("pg5").feature("surf1").set("data", "parent");
    model.result().create("pg6", "PlotGroup2D");
    model.result("pg6").set("data", "dset2");
    model.result("pg6").create("surf2", "Surface");
    model.result("pg6").create("surf1", "Surface");
    model.result("pg6").feature("surf2").set("expr", "semi.Nnetdop");
    model.result("pg6").feature("surf2").set("unit", "1/cm^3");
    model.result("pg6").feature("surf2").set("coloring", "gradient");
    model.result("pg6").feature("surf2").set("colorscalemode", "logarithmic");
    model.result("pg6").feature("surf2").set("topcolor", "red");
    model.result("pg6").feature("surf2").set("bottomcolor", "custom");
    model.result("pg6").feature("surf2").set("custombottomcolor", new double[]{1, 0.8, 0.8});
    model.result("pg6").feature("surf2").set("smooth", "internal");
    model.result("pg6").feature("surf2").set("data", "parent");
    model.result("pg6").feature("surf2").set("titletype", "none");
    model.result("pg6").feature("surf2").feature().create("filt1", "Filter");
    model.result("pg6").feature("surf2").feature("filt1").set("expr", "semi.Na-semi.Nd > 1[1/cm^3]");
    model.result("pg6").feature("surf2").feature("filt1").set("useder", true);
    model.result("pg6").feature("surf1").set("expr", "semi.Nnetdop");
    model.result("pg6").feature("surf1").set("unit", "1/cm^3");
    model.result("pg6").feature("surf1").set("coloring", "gradient");
    model.result("pg6").feature("surf1").set("colorscalemode", "logarithmic");
    model.result("pg6").feature("surf1").set("topcolor", "blue");
    model.result("pg6").feature("surf1").set("bottomcolor", "custom");
    model.result("pg6").feature("surf1").set("custombottomcolor", new double[]{0.8, 0.8, 1});
    model.result("pg6").feature("surf1").set("smooth", "internal");
    model.result("pg6").feature("surf1").set("data", "parent");
    model.result("pg6").feature("surf1").set("titletype", "none");
    model.result("pg6").feature("surf1").feature().create("filt1", "Filter");
    model.result("pg6").feature("surf1").feature("filt1").set("expr", "semi.Nd-semi.Na > 1[1/cm^3]");

    return model;
  }

  public static Model run2(Model model) {
    model.result("pg6").feature("surf1").feature("filt1").set("useder", true);
    model.result("pg6").set("titletype", "manual");
    model.result("pg6")
         .set("title", "Net Dopant Concentration \\vert N<sub>d</sub> - N<sub>a</sub>\\vert: P-type (Red), N-type (Blue)");
    model.result("pg6").set("showlegendsmaxmin", true);
    model.result("pg6").set("showlegendsunit", true);
    model.result("pg6").set("legendpos", "alternating");
    model.result("pg6").feature("surf2").label("P-Type");
    model.result("pg6").feature("surf1").label("N-Type");
    model.result("pg6").label("Net Dopant Concentration (semi)");
    model.result("pg3").run();
    model.result("pg3").setIndex("looplevel", 1, 0);
    model.result("pg3").run();
    model.result("pg3").setIndex("looplevel", 5, 0);
    model.result("pg3").run();
    model.result("pg5").run();
    model.result("pg5").setIndex("looplevel", 1, 0);
    model.result("pg5").run();
    model.result("pg5").setIndex("looplevel", 5, 0);
    model.result("pg5").run();
    model.result().create("pg7", "PlotGroup1D");
    model.result("pg7").run();
    model.result("pg7").set("data", "dset2");
    model.result("pg7").set("legendpos", "center");
    model.result("pg7").create("glob1", "Global");
    model.result("pg7").feature("glob1").set("markerpos", "datapoints");
    model.result("pg7").feature("glob1").set("linewidth", "preference");
    model.result("pg7").feature("glob1").set("expr", new String[]{"semi.I0_2"});
    model.result("pg7").feature("glob1").set("descr", new String[]{"Terminal current"});
    model.result("pg7").feature("glob1").set("unit", new String[]{"A"});
    model.result("pg7").feature("glob1").setIndex("unit", "uA", 0);
    model.result("pg7").feature("glob1").setIndex("descr", "Terminal current", 0);
    model.result("pg7").run();
    model.result("pg7").run();
    model.result("pg7").label("Id vs. Vd");

    model.title("DC Characteristics of a MOS Transistor (MOSFET)");

    model
         .description("This example calculates the DC characteristics of a simple MOSFET. The drain current versus gate voltage characteristics are first computed in order to determine the threshold voltage for the device. Then the drain current vs. drain voltage characteristics are computed for several gate voltages. The linear and saturation regions for the device can be identified from these plots.");

    model.label("mosfet.mph");

    model.result("pg7").run();

//    Add the small signal analysis parameters.
//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, locate the Parameters section.
//    In the table, enter the following settings:

    model.param().set("Vac", "1[mV]");
    model.param().descr("Vac", "Small signal voltage");
    model.param().set("freq", "10[MHz]");
    model.param().descr("freq", "Small signal frequency");

//    In the Model Builder window, expand the Component 1 (comp1) node.
//    Add the harmonic perturbation to the drain and to the gate. They will be enabled/disabled in the study settings later.
//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Model Builder window, expand the Component 1 (comp1) > Semiconductor (semi) node, then click Metal Contact 2.
//    In the Physics toolbar, click Attributes and choose Harmonic Perturbation.

    model.component("comp1").physics("semi").feature("mc2").create("hp1", "HarmonicPerturbation", 1);

//    In the Settings window for Harmonic Perturbation, locate the Terminal section.
//    In the \[V_0\] text field, type Vac.

    model.component("comp1").physics("semi").feature("mc2").feature("hp1").set("V0", "Vac");

//    In the Model Builder window, under Component 1 (comp1) > Semiconductor (semi), click Thin Insulator Gate 1.
//    In the Physics toolbar, click Attributes and choose Harmonic Perturbation.

    model.component("comp1").physics("semi").feature("gc1").create("hp1", "HarmonicPerturbation", 1);

//    In the Settings window for Harmonic Perturbation, locate the Terminal section.
//    In the \[V_0\] text field, type Vac.

    model.component("comp1").physics("semi").feature("gc1").feature("hp1").set("V0", "Vac");

//    Rename study 1 and study 2.
//    In the Model Builder window, right-click Study 1 and choose Rename.
//    In the Rename Study dialog, type Id vs. Vg in the New label text field.
//    Click OK.

    model.study("std1").label("Id vs. Vg");

//    In the Model Builder window, right-click Study 2 and choose Rename.
//    In the Rename Study dialog, type Id vs. Vd in the New label text field.
//    Click OK.

    model.study("std2").label("Id vs. Vd");

//    Change the value for the Vd parameter to 2V.
//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, locate the Parameters section.
//    In the table, enter the following settings:

    model.param().set("Vd", "2[V]");

//    Add a new study to compute the transconductance, gm. The study will consist of a stationary step followed by a frequency-domain, perturbation step. Both steps will compute values for a range of Vg potentials and a set Vd potential of 2V.
//    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("std3");
    model.study("std3").create("stat", "Stationary");

//    In the Home toolbar, click Add Study to close the Add Study window.
//    In order to get the solution to converge it is often useful to provide a good initial starting point for the solver.
//    In the Settings window for Stationary, click to expand the Values of Dependent Variables section.
//    Find the Initial values of variables solved for subsection.
//    From the Settings list, select User controlled.

    model.study("std3").feature("stat").set("useinitsol", true);

//    From the Method list, select Solution.

    model.study("std3").feature("stat").set("initmethod", "sol");

//    From the Study list, select Id vs. Vg, Stationary.

    model.study("std3").feature("stat").set("initstudy", "std1");

//    From the Parameter value (Vg (V),Vd (V)) list, select 1: Vg=0 V, Vd=0.01 V.

    model.study("std3").feature("stat").set("solnum", 1);

//    In the Model Builder window, click Study 3.
//    In the Settings window for Study, type gm vs. Id in the Label text field.

    model.study("std3").label("gm vs. Id");

//    Locate the Study Settings section.
//    Clear the Generate default plots checkbox.

    model.study("std3").setGenPlots(false);

//    Set up an auxiliary continuation sweep for the 'Vg' parameter.
//    In the Model Builder window, click Step 1: Stationary.
//    In the Settings window for Stationary, click to expand the Study Extensions section.
//    Select the Auxiliary sweep checkbox.

    model.study("std3").feature("stat").set("useparam", true);

//    Click Add.

    model.study("std3").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std3").feature("stat").setIndex("plistarr", "", 0);
    model.study("std3").feature("stat").setIndex("punit", "V", 0);
    model.study("std3").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std3").feature("stat").setIndex("plistarr", "", 0);
    model.study("std3").feature("stat").setIndex("punit", "V", 0);

//    In the table, enter the following settings:

    model.study("std3").feature("stat").setIndex("pname", "Vg", 0);
    model.study("std3").feature("stat").setIndex("plistarr", "range(0,0.4,8)", 0);

//    In the Study toolbar, click More Study Steps and choose Frequency Domain > Frequency-Domain Perturbation.

    model.study("std3").create("frlin", "Frequencylinearized");

//    In the Settings window for Frequency-Domain Perturbation, locate the Study Settings section.
//    In the Frequencies text field, type freq.

    model.study("std3").feature("frlin").set("plist", "freq");

//    Click to expand the Study Extensions section.
//    Select the Auxiliary sweep checkbox.

    model.study("std3").feature("frlin").set("useparam", true);

//    Click Add.

    model.study("std3").feature("frlin").setIndex("pname_aux", "Vd", 0);
    model.study("std3").feature("frlin").setIndex("plistarr_aux", "", 0);
    model.study("std3").feature("frlin").setIndex("punit_aux", "V", 0);
    model.study("std3").feature("frlin").setIndex("pname_aux", "Vd", 0);
    model.study("std3").feature("frlin").setIndex("plistarr_aux", "", 0);
    model.study("std3").feature("frlin").setIndex("punit_aux", "V", 0);

//    In the table, enter the following settings:

    model.study("std3").feature("frlin").setIndex("pname_aux", "Vg", 0);
    model.study("std3").feature("frlin").setIndex("plistarr_aux", "range(0,0.4,8)", 0);

//    Locate the Physics and Variables Selection section.
//    Select the Modify model configuration for study step checkbox.

    model.study("std3").feature("frlin").set("useadvanceddisable", true);

//    In the tree, select Component 1 (comp1) > Semiconductor (semi) > Metal Contact 2 > Harmonic Perturbation 1.
//    Right-click and choose Disable.

    model.study("std3").feature("frlin").set("disabledphysics", new String[]{"semi/mc2/hp1"});

//    In the Study toolbar, click Compute.

    model.study("std3").createAutoSequences("all");

    model.sol("sol3").runAll();

//    Add a 1d plot to show the transconductance.
//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg8", "PlotGroup1D");
    model.result("pg8").run();

//    In the Settings window for 1D Plot Group, type gm vs. Id in the Label text field.

    model.result("pg8").label("gm vs. Id");

//    Locate the Data section.
//    From the Dataset list, select gm vs. Id/Solution 3 (sol3).

    model.result("pg8").set("data", "dset3");

//    Locate the Plot Settings section.
//    Select the x-axis label checkbox.

    model.result("pg8").set("xlabelactive", true);

//    In the associated text field, type Drain current (uA).

    model.result("pg8").set("xlabel", "Drain current (uA)");

//    Select the y-axis label checkbox.

    model.result("pg8").set("ylabelactive", true);

//    In the associated text field, type Transconductance (uS).

    model.result("pg8").set("ylabel", "Transconductance (uS)");

//    Right-click gm vs. Id and choose Global.

    model.result("pg8").create("glob1", "Global");
    model.result("pg8").feature("glob1").set("markerpos", "datapoints");
    model.result("pg8").feature("glob1").set("linewidth", "preference");

//    In the Settings window for Global, locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg8").feature("glob1").setIndex("expr", "semi.I0_2/Vac", 0);
    model.result("pg8").feature("glob1").setIndex("unit", "uS", 0);
    model.result("pg8").feature("glob1").setIndex("descr", "", 0);

//    Select the Compute differential checkbox.

    model.result("pg8").feature("glob1").set("differential", true);

//    Locate the x-Axis Data section.
//    From the Parameter list, select Expression.

    model.result("pg8").feature("glob1").set("xdata", "expr");

//    Click Replace Expression in the upper-right corner of the x-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Semiconductor > Terminals > semi.I0_2 - Terminal current - A.

    model.result("pg8").feature("glob1").set("xdataexpr", "semi.I0_2");
    model.result("pg8").feature("glob1").set("xdatadescr", "Terminal current");

//    Locate the x-Axis Data section.
//    From the Expression evaluated for list, select Static solution.

    model.result("pg8").feature("glob1").set("xdataevalmethod", "linpoint");

//    Click to expand the Legends section.
//    From the Legends list, select Manual.

    model.result("pg8").feature("glob1").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg8").feature("glob1").setIndex("legends", "Vg=2[V]", 0);

//    Locate the x-Axis Data section.
//    From the Unit list, select µA.

    model.result("pg8").feature("glob1").set("xdataunit", "\u00b5A");

//    In the gm vs. Id toolbar, click Plot.

    model.result("pg8").run();

//    Add a new study to compute the output conductance, g0. The study will consist of a stationary step followed by a frequency-domain, perturbation step. Both steps will compute values for a range of Vd potentials and a set Vg potential of 2V.
//    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("std4");
    model.study("std4").create("stat", "Stationary");

//    In the Home toolbar, click Add Study to close the Add Study window.
//    In the Settings window for Study, type g0 vs. Id in the Label text field.

    model.study("std4").label("g0 vs. Id");

//    Locate the Study Settings section.
//    Clear the Generate default plots checkbox.

    model.study("std4").setGenPlots(false);

//    Set up an auxiliary continuation sweep for the 'Vd' parameter.
//    In the Model Builder window, under g0 vs. Id, click Step 1: Stationary.
//    In the Settings window for Stationary, locate the Study Extensions section.
//    Select the Auxiliary sweep checkbox.

    model.study("std4").feature("stat").set("useparam", true);

//    Click Add.

    model.study("std4").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std4").feature("stat").setIndex("plistarr", "", 0);
    model.study("std4").feature("stat").setIndex("punit", "V", 0);
    model.study("std4").feature("stat").setIndex("pname", "Vd", 0);
    model.study("std4").feature("stat").setIndex("plistarr", "", 0);
    model.study("std4").feature("stat").setIndex("punit", "V", 0);

//    In the table, enter the following settings:

    model.study("std4").feature("stat").setIndex("plistarr", "range(0,0.05,0.6) range(1,0.5,4)", 0);

//    In the Study toolbar, click More Study Steps and choose Frequency Domain > Frequency-Domain Perturbation.

    model.study("std4").create("frlin", "Frequencylinearized");

//    In the Settings window for Frequency-Domain Perturbation, locate the Study Settings section.
//    In the Frequencies text field, type freq.

    model.study("std4").feature("frlin").set("plist", "freq");

//    Locate the Study Extensions section.
//    Select the Auxiliary sweep checkbox.

    model.study("std4").feature("frlin").set("useparam", true);

//    Click Add.

    model.study("std4").feature("frlin").setIndex("pname_aux", "Vd", 0);
    model.study("std4").feature("frlin").setIndex("plistarr_aux", "", 0);
    model.study("std4").feature("frlin").setIndex("punit_aux", "V", 0);
    model.study("std4").feature("frlin").setIndex("pname_aux", "Vd", 0);
    model.study("std4").feature("frlin").setIndex("plistarr_aux", "", 0);
    model.study("std4").feature("frlin").setIndex("punit_aux", "V", 0);

//    In the table, enter the following settings:

    model.study("std4").feature("frlin").setIndex("plistarr_aux", "range(0,0.05,0.6) range(1,0.5,4)", 0);

//    Locate the Physics and Variables Selection section.
//    Select the Modify model configuration for study step checkbox.

    model.study("std4").feature("frlin").set("useadvanceddisable", true);

//    In the tree, select Component 1 (comp1) > Semiconductor (semi) > Thin Insulator Gate 1 > Harmonic Perturbation 1.
//    Right-click and choose Disable.

    model.study("std4").feature("frlin").set("disabledphysics", new String[]{"semi/gc1/hp1"});

//    Add a 1d plot to show the output conductance.
//    In the Study toolbar, click Compute.

    model.study("std4").createAutoSequences("all");

    model.sol("sol5").runAll();

//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg9", "PlotGroup1D");
    model.result("pg9").run();

//    In the Settings window for 1D Plot Group, type g0 vs. Id in the Label text field.

    model.result("pg9").label("g0 vs. Id");

//    Locate the Data section.
//    From the Dataset list, select g0 vs. Id/Solution 5 (sol5).

    model.result("pg9").set("data", "dset5");

//    Locate the Plot Settings section.
//    Select the x-axis label checkbox.

    model.result("pg9").set("xlabelactive", true);

//    In the associated text field, type Drain current (uA).

    model.result("pg9").set("xlabel", "Drain current (uA)");

//    Select the y-axis label checkbox.

    model.result("pg9").set("ylabelactive", true);

//    In the associated text field, type Output conductance (uS).

    model.result("pg9").set("ylabel", "Output conductance (uS)");

//    Right-click g0 vs. Id and choose Global.

    model.result("pg9").create("glob1", "Global");
    model.result("pg9").feature("glob1").set("markerpos", "datapoints");
    model.result("pg9").feature("glob1").set("linewidth", "preference");

//    In the Settings window for Global, locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg9").feature("glob1").setIndex("expr", "semi.I0_2/Vac", 0);
    model.result("pg9").feature("glob1").setIndex("unit", "uS", 0);
    model.result("pg9").feature("glob1").setIndex("descr", "", 0);

//    Select the Compute differential checkbox.

    model.result("pg9").feature("glob1").set("differential", true);

//    Locate the x-Axis Data section.
//    From the Parameter list, select Expression.

    model.result("pg9").feature("glob1").set("xdata", "expr");

//    Click Replace Expression in the upper-right corner of the x-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Semiconductor > Terminals > semi.I0_2 - Terminal current - A.

    model.result("pg9").feature("glob1").set("xdataexpr", "semi.I0_2");
    model.result("pg9").feature("glob1").set("xdatadescr", "Terminal current");

//    Locate the x-Axis Data section.
//    From the Unit list, select µA.

    model.result("pg9").feature("glob1").set("xdataunit", "\u00b5A");

//    From the Expression evaluated for list, select Static solution.

    model.result("pg9").feature("glob1").set("xdataevalmethod", "linpoint");

//    Locate the Legends section.
//    From the Legends list, select Manual.

    model.result("pg9").feature("glob1").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg9").feature("glob1").setIndex("legends", "Vg=2[V]", 0);

//    In the g0 vs. Id toolbar, click Plot.

    model.result("pg9").run();

    model.title("Small-Signal Analysis of a MOSFET");

    model
         .description("This example shows how to compute the AC characteristics of a MOSFET. Both the output conductance and the transconductance are computed as a function of the drain current.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    run2(model);
  }

}
