/*
 * transformation_diagram_computation.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 15 2026, 14:22 by COMSOL 6.4.0.421. */
public class transformation_diagram_computation {

  public static Model run() {
    Model model = ModelUtil.create("Model");

//    From the File menu, choose New.
//    In the New window, click Model Wizard.
//    In the Model Wizard window, click 0D.
//    In the Select Physics tree, select Heat Transfer > Metal Processing > Austenite Decomposition (audc).
//    Click Add.
//    Click Study.
//    In the Select Study tree, select General Studies > Time Dependent.
//    Click Done.

    model.component().create("comp1", true);

    model.component("comp1").physics().create("audc", "GlobalAusteniteDecomposition");

    model.study().create("std1");
    model.study("std1").create("time", "Transient");

//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, locate the Parameters section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file transformation_diagram_computation_parameters.txt.
//    To import content from file, use:
//    model.param().loadFile("FILENAME");
    model.param().set("highT", "900[degC]", "Highest transformation temperature");
    model.param().set("lowT", "100[degC]", "Lowest transformation temperature");
    model.param().set("startFraction", "0.01", "Phase fraction indicating transformation start");
    model.param().set("rateT", "1[K/s]", "Cooling rate parameter");
    model.param().set("T0", "highT", "Cooling temperature parameter");
    model.param().set("nRates", "10", "Number of cooling rates per decade for CCT");
    model.param().set("highRate", "100[K/s]", "Highest cooling rate for CCT");
    model.param().set("lowRate", "0.01[K/s]", "Lowest cooling rate for CCT");
    model.param().set("nTemps", "50", "Number of temperatures for TTT");
    model.param().set("maxTime", "2500[s]", "Maximum transformation time");

//    Add two definitions for the temperature used in the CCT and TTT computations.
//    In the Model Builder window, expand the Component 1 (comp1) > Definitions node.
//    Right-click Definitions and choose Variables.

    model.component("comp1").variable().create("var1");

//    In the Settings window for Variables, type CCT in the Label text field.

    model.component("comp1").variable("var1").label("CCT");

//    Locate the Variables section.
//    In the table, enter the following settings:

    model.component("comp1").variable("var1").set("T", "T0-rateT*t");
    model.component("comp1").variable("var1").descr("T", "Temperature for CCT");

//    Right-click Definitions and choose Variables.

    model.component("comp1").variable().create("var2");

//    In the Settings window for Variables, type TTT in the Label text field.

    model.component("comp1").variable("var2").label("TTT");

//    Locate the Variables section.
//    In the table, enter the following settings:

    model.component("comp1").variable("var2").set("T", "T0", "Temperature for CCT");
    model.component("comp1").variable("var2").descr("T", "Temperature for TTT");

//    In the Home toolbar, click Functions and choose Local > Interpolation.

    model.component("comp1").func().create("int1", "Interpolation");

//    In the Settings window for Interpolation, locate the Definition section.
//    In the Function name text field, type K_Austenite_to_Ferrite.

    model.component("comp1").func("int1").set("funcname", "K_Austenite_to_Ferrite");

//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file transformation_diagram_computation_K_Austenite_to_Ferrite.txt.

    model.component("comp1").func("int1")
         .set("table", new String[][]{{"0", "0"}, 
         {"550", "0"}, 
         {"620", "0.002"}, 
         {"700", "0.001"}, 
         {"750", "0"}, 
         {"1000", "0"}, 
         {"", ""}});

//    Locate the Interpolation and Extrapolation section.
//    From the Interpolation list, select Piecewise cubic.

    model.component("comp1").func("int1").set("interp", "piecewisecubic");

//    Locate the Units section.
//    In the Argument table, enter the following settings:

    model.component("comp1").func("int1").setIndex("argunit", "degC", 0);
    model.component("comp1").func("int1").setIndex("fununit", "1/s", 0);

//    In the Function table, enter the following settings:
//    In the Home toolbar, click Functions and choose Local > Interpolation.

    model.component("comp1").func().create("int2", "Interpolation");

//    In the Settings window for Interpolation, locate the Definition section.
//    In the Function name text field, type L_Austenite_to_Ferrite.

    model.component("comp1").func("int2").set("funcname", "L_Austenite_to_Ferrite");

//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file transformation_diagram_computation_L_Austenite_to_Ferrite.txt.

    model.component("comp1").func("int2")
         .set("table", new String[][]{{"0", "0"}, {"600", "0"}, {"620", "0.0002"}, {"800", "0.002"}, {"1000", "0.002"}});

//    Locate the Interpolation and Extrapolation section.
//    From the Interpolation list, select Piecewise cubic.

    model.component("comp1").func("int2").set("interp", "piecewisecubic");

//    Locate the Units section.
//    In the Argument table, enter the following settings:

    model.component("comp1").func("int2").setIndex("argunit", "degC", 0);
    model.component("comp1").func("int2").setIndex("fununit", "1/s", 0);

//    In the Function table, enter the following settings:
//    In the Home toolbar, click Functions and choose Local > Interpolation.

    model.component("comp1").func().create("int3", "Interpolation");

//    In the Settings window for Interpolation, locate the Definition section.
//    In the Function name text field, type K_Austenite_to_Bainite.

    model.component("comp1").func("int3").set("funcname", "K_Austenite_to_Bainite");

//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file transformation_diagram_computation_K_Austenite_to_Bainite.txt.

    model.component("comp1").func("int3")
         .set("table", new String[][]{{"0", "0"}, 
         {"380", "0"}, 
         {"400", "0.0005"}, 
         {"490", "0.005"}, 
         {"580", "0.00005"}, 
         {"600", "0"}});

//    Locate the Interpolation and Extrapolation section.
//    From the Interpolation list, select Piecewise cubic.

    model.component("comp1").func("int3").set("interp", "piecewisecubic");

//    Locate the Units section.
//    In the Argument table, enter the following settings:

    model.component("comp1").func("int3").setIndex("argunit", "degC", 0);
    model.component("comp1").func("int3").setIndex("fununit", "1/s", 0);

//    In the Function table, enter the following settings:
//    In the Home toolbar, click Functions and choose Local > Interpolation.

    model.component("comp1").func().create("int4", "Interpolation");

//    In the Settings window for Interpolation, locate the Definition section.
//    In the Function name text field, type L_Austenite_to_Bainite.

    model.component("comp1").func("int4").set("funcname", "L_Austenite_to_Bainite");

//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file transformation_diagram_computation_L_Austenite_to_Bainite.txt.

    model.component("comp1").func("int4")
         .set("table", new String[][]{{"0", "0"}, {"400", "0.0"}, {"500", "0.0002"}, {"580", "0.002"}, {"600", "0.002"}});

//    Locate the Interpolation and Extrapolation section.
//    From the Interpolation list, select Piecewise cubic.

    model.component("comp1").func("int4").set("interp", "piecewisecubic");

//    Locate the Units section.
//    In the Argument table, enter the following settings:

    model.component("comp1").func("int4").setIndex("argunit", "degC", 0);
    model.component("comp1").func("int4").setIndex("fununit", "1/s", 0);

//    In the Function table, enter the following settings:
//    In the Model Builder window, under Component 1 (comp1), click Austenite Decomposition (audc).
//    In the Settings window for Austenite Decomposition, locate the Temperature section.
//    In the \[T\] text field, type T.

    model.component("comp1").physics("audc").prop("Temperature").set("T", "T");

//    In the Model Builder window, under Component 1 (comp1) > Austenite Decomposition (audc), click Ferrite.
//    In the Settings window for Metallurgical Phase, locate the Transformation Times section.
//    Select the Compute transformation times checkbox.

    model.component("comp1").physics("audc").feature("phase2").set("computetimes", true);

//    In the Model Builder window, click Bainite.
//    In the Settings window for Metallurgical Phase, locate the Transformation Times section.
//    Select the Compute transformation times checkbox.

    model.component("comp1").physics("audc").feature("phase4").set("computetimes", true);

//    In the Model Builder window, click Austenite to Ferrite.
//    In the Settings window for Phase Transformation, locate the Phase Transformation section.
//    In the \[K_{\mathrm{s}\rightarrow \mathrm{d}}\] text field, type K_Austenite_to_Ferrite(audc.T).

    model.component("comp1").physics("audc").feature("ptran1").set("K", "K_Austenite_to_Ferrite(audc.T)");

//    In the \[L_{\mathrm{s}\rightarrow \mathrm{d}}\] text field, type L_Austenite_to_Ferrite(audc.T).

    model.component("comp1").physics("audc").feature("ptran1").set("L", "L_Austenite_to_Ferrite(audc.T)");

//    In the Model Builder window, click Austenite to Bainite.
//    In the Settings window for Phase Transformation, locate the Phase Transformation section.
//    In the \[K_{\mathrm{s}\rightarrow \mathrm{d}}\] text field, type K_Austenite_to_Bainite(audc.T).

    model.component("comp1").physics("audc").feature("ptran3").set("K", "K_Austenite_to_Bainite(audc.T)");

//    In the \[L_{\mathrm{s}\rightarrow \mathrm{d}}\] text field, type L_Austenite_to_Bainite(audc.T).

    model.component("comp1").physics("audc").feature("ptran3").set("L", "L_Austenite_to_Bainite(audc.T)");

//    In the Model Builder window, right-click Austenite to Pearlite and choose Disable.

    model.component("comp1").physics("audc").feature("ptran2").active(false);

//    In the Model Builder window, right-click Pearlite and choose Disable.

    model.component("comp1").physics("audc").feature("phase3").active(false);

//    In the Model Builder window, right-click Austenite to Martensite and choose Disable.

    model.component("comp1").physics("audc").feature("ptran4").active(false);

//    In the Model Builder window, right-click Martensite and choose Disable.

    model.component("comp1").physics("audc").feature("phase5").active(false);

//    In the Model Builder window, click Study 1.
//    In the Settings window for Study, type CCT in the Label text field.

    model.study("std1").label("CCT");

//    In the Study toolbar, click Parametric Sweep.

    model.study("std1").create("param", "Parametric");

//    In the Settings window for Parametric Sweep, locate the Study Settings section.
//    Click Add.

    model.study("std1").feature("param").setIndex("pname", "audc.beta", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "1/K", 0);
    model.study("std1").feature("param").setIndex("pname", "audc.beta", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "1/K", 0);

//    In the table, enter the following settings:

    model.study("std1").feature("param").setIndex("pname", "rateT", 0);

//    In the table, click to select the cell at row number 1 and column number 2.
//    Click Range.
//    In the Range dialog, choose Logarithmic from the Entry method list.
//    In the Start text field, type highRate.
//    In the Stop text field, type lowRate.
//    In the Steps per decade text field, type nRates.
//    Click Add.

    model.study("std1").feature("param")
         .setIndex("plistarr", "10^{range(log10(highRate),-(1/nRates),log10(lowRate))}", 0);

//    In the Model Builder window, click Step 1: Time Dependent.
//    In the Settings window for Time Dependent, locate the Study Settings section.
//    Click Range.
//    In the Range dialog, choose Number of values from the Entry method list.
//    In the Stop text field, type (T0-lowT)/rateT.
//    In the Number of values text field, type 50.
//    Click Replace.

    model.study("std1").feature("time").set("tlist", "range(0,((T0-lowT)/rateT-0)/49,(T0-lowT)/rateT)");

//    In the Settings window for Time Dependent, locate the Physics and Variables Selection section.
//    Select the Modify model configuration for study step checkbox.

    model.study("std1").feature("time").set("useadvanceddisable", true);

//    In the tree, select Component 1 (comp1) > Definitions > TTT.
//    Right-click and choose Disable.

    model.study("std1").feature("time").set("disabledvariables", new String[]{"var2"});

//    In the Study toolbar, click Compute.

    model.study("std1").createAutoSequences("all");

    model.sol().create("sol2");
    model.sol("sol2").study("std1");
    model.sol("sol2").label("Parametric Solutions 1");

    model.batch("p1").feature("so1").set("psol", "sol2");
    model.batch("p1").run("compute");

    model.result().create("pg1", "PlotGroup1D");
    model.result("pg1").set("data", "dset2");
    model.result("pg1").create("glob1", "Global");
    model.result("pg1").feature("glob1").set("unit", new String[]{"", "", ""});
    model.result("pg1").feature("glob1")
         .set("expr", new String[]{"audc.phase1.xi", "audc.phase2.xi", "audc.phase4.xi"});
    model.result("pg1").feature("glob1")
         .set("descr", new String[]{"Phase fraction", "Phase fraction", "Phase fraction"});
    model.result("pg1").label("Phase Composition (audc)");
    model.result("pg1").feature("glob1").set("descr", new String[]{"Austenite", "Ferrite", "Bainite"});
    model.result("pg1").feature("glob1").set("title", "Phase composition");
    model.result("pg1").set("twoyaxes", true);
    model.result("pg1").set("legendlayout", "outside");
    model.result("pg1").create("glob2", "Global");
    model.result("pg1").feature("glob2").set("plotonsecyaxis", true);
    model.result("pg1").feature("glob2").setIndex("expr", "audc.T", 0);
    model.result("pg1").feature("glob2").set("linestyle", "dotted");
    model.result().create("pg2", "PlotGroup1D");
    model.result("pg2").set("data", "dset2");
    model.result("pg2").label("Transformation Diagram (audc)");
    model.result("pg2").set("innerinput", "last");
    model.result("pg2").set("xlog", true);
    model.result("pg2").set("legendpos", "lowerright");
    model.result("pg2").set("xlabel", "Time");
    model.result("pg2").set("ylabel", "Temperature");
    model.result("pg2").create("glob1", "Global");
    model.result("pg2").feature("glob1").set("expr", new String[]{"audc.phase2.temperature_1"});
    model.result("pg2").feature("glob1").set("titletype", "none");
    model.result("pg2").feature("glob1").set("xdata", "expr");
    model.result("pg2").feature("glob1").set("xdataexpr", "audc.phase2.time_1");
    model.result("pg2").feature("glob1").set("legendmethod", "manual");
    model.result("pg2").feature("glob1").setIndex("legends", "Ferrite 0.01", 0);
    model.result("pg2").feature("glob1").set("linemarker", "cycle");
    model.result("pg2").feature("glob1").set("markerpos", "datapoints");
    model.result("pg2").feature("glob1").set("xdatasolnumtype", "all");
    model.result("pg2").create("glob2", "Global");
    model.result("pg2").feature("glob2").set("expr", new String[]{"audc.phase2.temperature_2"});
    model.result("pg2").feature("glob2").set("titletype", "none");
    model.result("pg2").feature("glob2").set("xdata", "expr");
    model.result("pg2").feature("glob2").set("xdataexpr", "audc.phase2.time_2");
    model.result("pg2").feature("glob2").set("legendmethod", "manual");
    model.result("pg2").feature("glob2").setIndex("legends", "Ferrite 0.99", 0);
    model.result("pg2").feature("glob2").set("linemarker", "cycle");
    model.result("pg2").feature("glob2").set("markerpos", "datapoints");
    model.result("pg2").feature("glob2").set("xdatasolnumtype", "all");
    model.result("pg2").create("glob3", "Global");
    model.result("pg2").feature("glob3").set("expr", new String[]{"audc.phase4.temperature_1"});
    model.result("pg2").feature("glob3").set("titletype", "none");
    model.result("pg2").feature("glob3").set("xdata", "expr");
    model.result("pg2").feature("glob3").set("xdataexpr", "audc.phase4.time_1");
    model.result("pg2").feature("glob3").set("legendmethod", "manual");
    model.result("pg2").feature("glob3").setIndex("legends", "Bainite 0.01", 0);
    model.result("pg2").feature("glob3").set("linemarker", "cycle");
    model.result("pg2").feature("glob3").set("markerpos", "datapoints");
    model.result("pg2").feature("glob3").set("xdatasolnumtype", "all");
    model.result("pg2").create("glob4", "Global");
    model.result("pg2").feature("glob4").set("expr", new String[]{"audc.phase4.temperature_2"});
    model.result("pg2").feature("glob4").set("titletype", "none");
    model.result("pg2").feature("glob4").set("xdata", "expr");
    model.result("pg2").feature("glob4").set("xdataexpr", "audc.phase4.time_2");
    model.result("pg2").feature("glob4").set("legendmethod", "manual");
    model.result("pg2").feature("glob4").setIndex("legends", "Bainite 0.99", 0);
    model.result("pg2").feature("glob4").set("linemarker", "cycle");
    model.result("pg2").feature("glob4").set("markerpos", "datapoints");
    model.result("pg2").feature("glob4").set("xdatasolnumtype", "all");
    model.result("pg1").run();

//    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 > Time Dependent.
//    Click Add Study in the window toolbar.

    model.study().create("std2");
    model.study("std2").create("time", "Transient");

//    In the Home toolbar, click Add Study to close the Add Study window.
//    In the Settings window for Study, type TTT in the Label text field.

    model.study("std2").label("TTT");

//    In the Study toolbar, click Parametric Sweep.

    model.study("std2").create("param", "Parametric");

//    In the Settings window for Parametric Sweep, locate the Study Settings section.
//    From the Sweep type list, select All combinations.

    model.study("std2").feature("param").set("sweeptype", "filled");

//    Click Add.

    model.study("std2").feature("param").setIndex("pname", "audc.beta", 0);
    model.study("std2").feature("param").setIndex("plistarr", "", 0);
    model.study("std2").feature("param").setIndex("punit", "1/K", 0);
    model.study("std2").feature("param").setIndex("pname", "audc.beta", 0);
    model.study("std2").feature("param").setIndex("plistarr", "", 0);
    model.study("std2").feature("param").setIndex("punit", "1/K", 0);

//    In the table, enter the following settings:

    model.study("std2").feature("param").setIndex("pname", "T0", 0);

//    In the table, click to select the cell at row number 1 and column number 2.
//    Click Range.
//    In the Range dialog, choose Number of values from the Entry method list.
//    In the Start text field, type highT.
//    In the Stop text field, type lowT.
//    In the Number of values text field, type nTemps.
//    Click Add.

    model.study("std2").feature("param").setIndex("plistarr", "range(highT,(lowT-(highT))/(nTemps-1),lowT)", 0);

//    In the Model Builder window, click Step 1: Time Dependent.
//    In the Settings window for Time Dependent, locate the Study Settings section.
//    In the Output times text field, type range(0,maxTime/99,maxTime).

    model.study("std2").feature("time").set("tlist", "range(0,maxTime/99,maxTime)");

//    Locate the Physics and Variables Selection section.
//    Select the Modify model configuration for study step checkbox.

    model.study("std2").feature("time").set("useadvanceddisable", true);

//    In the tree, select Component 1 (comp1) > Definitions > CCT.
//    Right-click and choose Disable.

    model.study("std2").feature("time").set("disabledvariables", new String[]{"var1"});

//    In the Study toolbar, click Compute.

    model.study("std2").createAutoSequences("all");

    model.sol().create("sol45");
    model.sol("sol45").study("std2");
    model.sol("sol45").label("Parametric Solutions 2");

    model.batch("p2").feature("so1").set("psol", "sol45");
    model.batch("p2").run("compute");

    model.result().create("pg3", "PlotGroup1D");
    model.result("pg3").set("data", "dset4");
    model.result("pg3").create("glob1", "Global");
    model.result("pg3").feature("glob1").set("unit", new String[]{"", "", ""});
    model.result("pg3").feature("glob1")
         .set("expr", new String[]{"audc.phase1.xi", "audc.phase2.xi", "audc.phase4.xi"});
    model.result("pg3").feature("glob1")
         .set("descr", new String[]{"Phase fraction", "Phase fraction", "Phase fraction"});
    model.result("pg3").label("Phase Composition (audc) 1");
    model.result("pg3").feature("glob1").set("descr", new String[]{"Austenite", "Ferrite", "Bainite"});
    model.result("pg3").feature("glob1").set("title", "Phase composition");
    model.result("pg3").set("twoyaxes", true);
    model.result("pg3").set("legendlayout", "outside");
    model.result("pg3").create("glob2", "Global");
    model.result("pg3").feature("glob2").set("plotonsecyaxis", true);
    model.result("pg3").feature("glob2").setIndex("expr", "audc.T", 0);
    model.result("pg3").feature("glob2").set("linestyle", "dotted");
    model.result().create("pg4", "PlotGroup1D");
    model.result("pg4").set("data", "dset4");
    model.result("pg4").label("Transformation Diagram (audc) 1");
    model.result("pg4").set("innerinput", "last");
    model.result("pg4").set("xlog", true);
    model.result("pg4").set("legendpos", "lowerright");
    model.result("pg4").set("xlabel", "Time");
    model.result("pg4").set("ylabel", "Temperature");
    model.result("pg4").create("glob1", "Global");
    model.result("pg4").feature("glob1").set("expr", new String[]{"audc.phase2.temperature_1"});
    model.result("pg4").feature("glob1").set("titletype", "none");
    model.result("pg4").feature("glob1").set("xdata", "expr");
    model.result("pg4").feature("glob1").set("xdataexpr", "audc.phase2.time_1");
    model.result("pg4").feature("glob1").set("legendmethod", "manual");
    model.result("pg4").feature("glob1").setIndex("legends", "Ferrite 0.01", 0);
    model.result("pg4").feature("glob1").set("linemarker", "cycle");
    model.result("pg4").feature("glob1").set("markerpos", "datapoints");
    model.result("pg4").feature("glob1").set("xdatasolnumtype", "all");
    model.result("pg4").create("glob2", "Global");
    model.result("pg4").feature("glob2").set("expr", new String[]{"audc.phase2.temperature_2"});
    model.result("pg4").feature("glob2").set("titletype", "none");
    model.result("pg4").feature("glob2").set("xdata", "expr");
    model.result("pg4").feature("glob2").set("xdataexpr", "audc.phase2.time_2");
    model.result("pg4").feature("glob2").set("legendmethod", "manual");
    model.result("pg4").feature("glob2").setIndex("legends", "Ferrite 0.99", 0);
    model.result("pg4").feature("glob2").set("linemarker", "cycle");
    model.result("pg4").feature("glob2").set("markerpos", "datapoints");
    model.result("pg4").feature("glob2").set("xdatasolnumtype", "all");
    model.result("pg4").create("glob3", "Global");
    model.result("pg4").feature("glob3").set("expr", new String[]{"audc.phase4.temperature_1"});
    model.result("pg4").feature("glob3").set("titletype", "none");
    model.result("pg4").feature("glob3").set("xdata", "expr");
    model.result("pg4").feature("glob3").set("xdataexpr", "audc.phase4.time_1");
    model.result("pg4").feature("glob3").set("legendmethod", "manual");
    model.result("pg4").feature("glob3").setIndex("legends", "Bainite 0.01", 0);
    model.result("pg4").feature("glob3").set("linemarker", "cycle");
    model.result("pg4").feature("glob3").set("markerpos", "datapoints");
    model.result("pg4").feature("glob3").set("xdatasolnumtype", "all");
    model.result("pg4").create("glob4", "Global");
    model.result("pg4").feature("glob4").set("expr", new String[]{"audc.phase4.temperature_2"});
    model.result("pg4").feature("glob4").set("titletype", "none");
    model.result("pg4").feature("glob4").set("xdata", "expr");
    model.result("pg4").feature("glob4").set("xdataexpr", "audc.phase4.time_2");
    model.result("pg4").feature("glob4").set("legendmethod", "manual");
    model.result("pg4").feature("glob4").setIndex("legends", "Bainite 0.99", 0);
    model.result("pg4").feature("glob4").set("linemarker", "cycle");
    model.result("pg4").feature("glob4").set("markerpos", "datapoints");
    model.result("pg4").feature("glob4").set("xdatasolnumtype", "all");
    model.result("pg3").run();

//    Set default units for result presentation.
//    In the Model Builder window, expand the Results node.
//    Right-click Results and choose Preferred Units.

    model.result().configuration().create("prfu1", "PreferredUnits");

//    In the Settings window for Preferred Units, locate the Units section.
//    Click Add Physical Quantity.
//    In the Physical Quantity dialog, select General > Temperature (K) in the tree.
//    Click OK.

    model.result().configuration("prfu1")
         .setIndex("quantityunits", new String[]{"temperature", "Temperature", "K", "K"}, 0);

//    In the Settings window for Preferred Units, locate the Units section.
//    In the table, enter the following settings:

    model.result().configuration("prfu1").setIndex("quantityunits", "\u00b0C", 0, 3);

//    Click Apply.

    model.result().configuration("prfu1").apply();
    model.result("pg2").run();

//    In the Model Builder window, expand the Results > Transformation Diagram (audc) node.
//    Right-click Transformation Diagram (audc) and choose Global.

    model.result("pg2").create("glob5", "Global");
    model.result("pg2").feature("glob5").set("markerpos", "datapoints");
    model.result("pg2").feature("glob5").set("linewidth", "preference");

//    In the Settings window for Global, locate the Data section.
//    From the Dataset list, select CCT/Parametric Solutions 1 (sol2).

    model.result("pg2").feature("glob5").set("data", "dset2");

//    From the Parameter selection (rateT) list, select From list.

    model.result("pg2").feature("glob5").setIndex("looplevelinput", "manual", 1);

//    In the Parameter values (rateT (K/s)) list, select 100.

    model.result("pg2").feature("glob5").setIndex("looplevel", new int[]{1}, 1);

//    select 100 in the Parameter values (rateT (K/s)) list.
//    Locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg2").feature("glob5").setIndex("expr", "audc.T", 0);

//    Click to expand the Title section.
//    From the Title type list, select None.

    model.result("pg2").feature("glob5").set("titletype", "none");

//    Right-click Global 5 and choose Duplicate.

    model.result("pg2").feature().duplicate("glob6", "glob5");
    model.result("pg2").run();

//    In the Settings window for Global, locate the Data section.
//    In the Parameter values (rateT (K/s)) list, select 10.

    model.result("pg2").feature("glob6").setIndex("looplevel", new int[]{11}, 1);

//    select 10 in the Parameter values (rateT (K/s)) list.
//    Right-click Global 6 and choose Duplicate.

    model.result("pg2").feature().duplicate("glob7", "glob6");
    model.result("pg2").run();

//    In the Settings window for Global, locate the Data section.
//    In the Parameter values (rateT (K/s)) list, select 1.

    model.result("pg2").feature("glob7").setIndex("looplevel", new int[]{21}, 1);

//    select 1 in the Parameter values (rateT (K/s)) list.
//    In the Transformation Diagram (audc) toolbar, click Plot.

    model.result("pg2").run();
    model.result("pg2").run();
    model.result("pg4").run();
    model.result("pg4").run();

    model.title("Transformation Diagram Computation");

    model
         .description("During quenching of steel, austenite decomposes into phases such as ferrite, pearlite, bainite, and martensite. A common way to illustrate the phase transformation characteristics of a particular steel alloy is to use transformation diagrams. Two of the most commonly used diagram types are the CCT (Continuous Cooling Transformation) and the TTT (Time Temperature Transformation) diagrams. This example shows how to compute CCT and TTT diagrams based on temperature-dependent phase transformation data.");

    return model;
  }

  public static void main(String[] args) {
    run();
  }

}
