/*
 * air_cooled_bess.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 14 2026, 08:18 by COMSOL 6.4.0.420. */
public class air_cooled_bess {

  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 3D.
//    In the Select Physics tree, select Fluid Flow > Nonisothermal Flow > Turbulent Flow > Turbulent Flow, Algebraic yPlus.
//    Click Add.
//    Click Study.
//    In the Select Study tree, select Preset Studies for Selected Multiphysics > Stationary, One-Way with Initialization NITF.
//    Click Done.

    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.component("comp1").physics().create("spf", "TurbulentFlowAlgebraicYplus", "geom1");
    model.component("comp1").physics("spf").prop("AdvancedSettingProperty").set("UsePseudoTime", "1");
    model.component("comp1").physics("spf").prop("PhysicalModelProperty")
         .set("Compressibility", "WeaklyCompressible");
    model.component("comp1").physics().create("ht", "HeatTransferInFluids", "geom1");
    model.component("comp1").physics("ht").prop("ShapeProperty").set("order_temperature", "1");

    model.component("comp1").multiphysics().create("nitf1", "NonIsothermalFlow", 3);
    model.component("comp1").multiphysics("nitf1").set("Fluid_physics", "spf");
    model.component("comp1").multiphysics("nitf1").set("Heat_physics", "ht");

    model.study().create("std1");
    model.study("std1").create("wdi", "WallDistanceInitialization");
    model.study("std1").feature("wdi").set("solnum", "auto");
    model.study("std1").feature("wdi").set("notsolnum", "auto");
    model.study("std1").feature("wdi").set("outputmap", new String[]{});
    model.study("std1").feature("wdi").set("ngenAUX", "1");
    model.study("std1").feature("wdi").set("goalngenAUX", "1");
    model.study("std1").feature("wdi").set("ngenAUX", "1");
    model.study("std1").feature("wdi").set("goalngenAUX", "1");
    model.study("std1").feature("wdi").setSolveFor("/physics/ht", false);
    model.study("std1").feature("wdi").setSolveFor("/multiphysics/nitf1", false);
    model.study("std1").create("stat", "Stationary");
    model.study("std1").feature("stat").set("solnum", "auto");
    model.study("std1").feature("stat").set("notsolnum", "auto");
    model.study("std1").feature("stat").set("outputmap", new String[]{});
    model.study("std1").feature("stat").set("ngenAUX", "1");
    model.study("std1").feature("stat").set("goalngenAUX", "1");
    model.study("std1").feature("stat").set("ngenAUX", "1");
    model.study("std1").feature("stat").set("goalngenAUX", "1");
    model.study("std1").feature("stat").setSolveFor("/physics/ht", false);
    model.study("std1").feature("stat").setSolveFor("/multiphysics/nitf1", false);
    model.study("std1").create("stat2", "Stationary");
    model.study("std1").feature("stat2").set("solnum", "auto");
    model.study("std1").feature("stat2").set("notsolnum", "auto");
    model.study("std1").feature("stat2").set("outputmap", new String[]{});
    model.study("std1").feature("stat2").set("ngenAUX", "1");
    model.study("std1").feature("stat2").set("goalngenAUX", "1");
    model.study("std1").feature("stat2").set("ngenAUX", "1");
    model.study("std1").feature("stat2").set("goalngenAUX", "1");
    model.study("std1").feature("stat2").setSolveFor("/physics/spf", false);

//    Note that the <l>Geometry representation</l> must be set to <l>COMSOL kernel</l> to fit with the numbering of the boundaries used in these instructions.
//    In the Geometry toolbar, click Insert Sequence and choose Insert Sequence.

    model.component("comp1").geom("geom1").insertFile("air_cooled_bess_geom_sequence.mph", "geom1");

//    Browse to the model's Application Library folder and double-click the file air_cooled_bess_geom_sequence.mph.
//    The application's Application Library folder is shown in the <l>Application Library path</l> section immediately before the current section. Note that the path given there is relative to the COMSOL Application Library root.
//    In the Geometry toolbar, click Build All.

    model.component("comp1").geom("geom1").run("fin");

//    Next, load parameter definitions and material properties.
//    In the Model Builder window, collapse the Geometry 1 node.
//    Change the view settings to improve the rendering of 3D plots.
//    In the Model Builder window, expand the Component 1 (comp1) > Definitions node.
//    In the Model Builder window, expand the Component 1 (comp1) > Definitions > View 1 node, then click View 1.
//    In the Settings window for View, locate the View section.
//    Clear the Show grid checkbox.

    model.component("comp1").view("view1").set("showgrid", false);

//    Clear the Show axis orientation checkbox.

    model.component("comp1").view("view1").set("showaxisorientation", false);

//    Click to expand the Visual Effects section.
//    Select the Ambient occlusion checkbox.

    model.component("comp1").view("view1").set("ssao", true);

//    Set the Shadow strength value to 0.7.

    model.component("comp1").view("view1").set("ssaomagnitude", 0.7);

//    In the Shadow strength text field, type 0.75.

    model.component("comp1").view("view1").set("ssaomagnitude", 0.75);

//    Select the Direct shadows checkbox.

    model.component("comp1").view("view1").set("shadowmapping", true);

//    In the Shadow softness text field, type 0.2.

    model.component("comp1").view("view1").set("shadowmappingsoftness", 0.2);

//    In the Shadow strength text field, type 0.25.

    model.component("comp1").view("view1").set("shadowmappingstrength", 0.25);

//    From the Quality preset list, select High quality.

    model.component("comp1").view("view1").set("shadowmappingpreset", "high");

//    Click to expand the Environment section.
//    From the Environment map list, select Outdoor.

    model.component("comp1").view("view1").set("environmentmap", "Outdoor");

//    In the View 1 toolbar, click Headlight.

    model.component("comp1").view("view1").light().create("lgt4", "HeadLight");

//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, type Geometry Parameters in the Label text field.

    model.param().label("Geometry Parameters");

//    In the Home toolbar, click Parameters and choose Add > Parameters.

    model.param().create("par2");

//    In the Settings window for Parameters, type Model Parameters in the Label text field.

    model.param("par2").label("Model Parameters");

//    Locate the Parameters section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file air_cooled_bess_model_parameters.txt.
//    To import content from file, use:
//    model.param("par2").loadFile("FILENAME");
    model.param("par2").set("k_tl", "1[W/(m*K)]", "Through-layer thermal conductivity of the battery cells");
    model.param("par2").set("k_il", "30[W/(m*K)]", "In-layer thermal conductivity of the battery cells");
    model.param("par2").set("rho_eff", "2000[kg/m^3]", "Density of the battery cells");
    model.param("par2").set("Cp_eff", "1400[J/(kg*K)]", "Heat capacity of the battery cells");
    model.param("par2").set("sigma", "0.36", "Solidity of module screen");
    model.param("par2").set("P0", "12[W]", "Power of the battery cell");
    model.param("par2").set("T_amb", "20[degC]", "Ambient temperature");
    model.param("par2").set("u_init", "-1[m/s]", "Initial guess for the velocity");
    model.param("par2").set("Q0", "P0/(L_cell*H_cell*W_cell)", "Volumetric heat source of the battery cells");

//    Add a node for the ambient properties in the model. The default temperature value is 293.15 K. It is possible to edit the ambient temperature value or to define it using the meteorological data, which gives access to climate data from more than 8600 stations in the world.
//    In the Physics toolbar, click Shared Properties and choose Ambient Properties.

    model.component("comp1").common().create("ampr1", "AmbientProperties");

//    In the Settings window for Ambient Properties, locate the Ambient Conditions section.
//    In the \[T_{\textrm{amb}}\] text field, type T_amb.

    model.component("comp1").common("ampr1").set("T_amb", "T_amb");

//    Next, add materials.
//    In the Materials toolbar, click Add Material to open the Add Material window.
//    In the tree, select Built-in > Air.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("eta", "Piecewise");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("Cp", "Piecewise");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("rho", "Analytic");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("k", "Piecewise");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("cs", "Analytic");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("an1", "Analytic");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("an2", "Analytic");
    model.component("comp1").material("mat1").propertyGroup()
         .create("RefractiveIndex", "RefractiveIndex", "Refractive index");
    model.component("comp1").material("mat1").propertyGroup()
         .create("NonlinearModel", "NonlinearModel", "Nonlinear model");
    model.component("comp1").material("mat1").propertyGroup().create("idealGas", "idealGas", "Ideal gas");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func().create("Cp", "Piecewise");
    model.component("comp1").material("mat1").label("Air");
    model.component("comp1").material("mat1").set("family", "air");
    model.component("comp1").material("mat1").propertyGroup("def").func("eta").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("def").func("eta")
         .set("pieces", new String[][]{{"200.0", "1600.0", "-8.38278E-7+8.35717342E-8*T^1-7.69429583E-11*T^2+4.6437266E-14*T^3-1.06585607E-17*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("eta").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("def").func("eta").set("fununit", "Pa*s");
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp")
         .set("pieces", new String[][]{{"200.0", "1600.0", "1047.63657-0.372589265*T^1+9.45304214E-4*T^2-6.02409443E-7*T^3+1.2858961E-10*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp").set("fununit", "J/(kg*K)");
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("expr", "pA*0.02897/R_const[K*mol/J]/T");
    model.component("comp1").material("mat1").propertyGroup("def").func("rho").set("args", new String[]{"pA", "T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho").set("fununit", "kg/m^3");
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("argunit", new String[]{"Pa", "K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("plotaxis", new String[]{"off", "on"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("plotfixedvalue", new String[]{"101325", "273.15"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("plotargs", new String[][]{{"pA", "101325", "101325"}, {"T", "273.15", "293.15"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("k").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("def").func("k")
         .set("pieces", new String[][]{{"200.0", "1600.0", "-0.00227583562+1.15480022E-4*T^1-7.90252856E-8*T^2+4.11702505E-11*T^3-7.43864331E-15*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("k").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("def").func("k").set("fununit", "W/(m*K)");
    model.component("comp1").material("mat1").propertyGroup("def").func("cs")
         .set("expr", "sqrt(1.4*R_const[K*mol/J]/0.02897*T)");
    model.component("comp1").material("mat1").propertyGroup("def").func("cs").set("args", new String[]{"T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("cs").set("fununit", "m/s");
    model.component("comp1").material("mat1").propertyGroup("def").func("cs").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("cs")
         .set("plotfixedvalue", new String[]{"273.15"});
    model.component("comp1").material("mat1").propertyGroup("def").func("cs")
         .set("plotargs", new String[][]{{"T", "273.15", "373.15"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("funcname", "alpha_p");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("expr", "-1/rho(pA,T)*d(rho(pA,T),T)");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("args", new String[]{"pA", "T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("fununit", "1/K");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("argunit", new String[]{"Pa", "K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotaxis", new String[]{"off", "on"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotfixedvalue", new String[]{"101325", "273.15"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotargs", new String[][]{{"pA", "101325", "101325"}, {"T", "273.15", "373.15"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("funcname", "muB");
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("expr", "0.6*eta(T)");
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("args", new String[]{"T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("fununit", "Pa*s");
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2")
         .set("plotfixedvalue", new String[]{"200"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2")
         .set("plotargs", new String[][]{{"T", "200", "1600"}});
    model.component("comp1").material("mat1").propertyGroup("def").set("thermalexpansioncoefficient", "");
    model.component("comp1").material("mat1").propertyGroup("def").set("molarmass", "");
    model.component("comp1").material("mat1").propertyGroup("def").set("bulkviscosity", "");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalexpansioncoefficient", new String[]{"alpha_p(pA,T)", "0", "0", "0", "alpha_p(pA,T)", "0", "0", "0", "alpha_p(pA,T)"});
    model.component("comp1").material("mat1").propertyGroup("def").set("molarmass", "0.02897[kg/mol]");
    model.component("comp1").material("mat1").propertyGroup("def").set("bulkviscosity", "muB(T)");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermeability", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermittivity", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("def").set("dynamicviscosity", "eta(T)");
    model.component("comp1").material("mat1").propertyGroup("def").set("ratioofspecificheat", "1.4");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("electricconductivity", new String[]{"0[S/m]", "0", "0", "0", "0[S/m]", "0", "0", "0", "0[S/m]"});
    model.component("comp1").material("mat1").propertyGroup("def").set("heatcapacity", "Cp(T)");
    model.component("comp1").material("mat1").propertyGroup("def").set("density", "rho(pA,T)");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalconductivity", new String[]{"k(T)", "0", "0", "0", "k(T)", "0", "0", "0", "k(T)"});
    model.component("comp1").material("mat1").propertyGroup("def").set("soundspeed", "cs(T)");
    model.component("comp1").material("mat1").propertyGroup("def").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("def").addInput("pressure");
    model.component("comp1").material("mat1").propertyGroup("RefractiveIndex")
         .set("n", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("NonlinearModel").set("BA", "def.gamma-1");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").label("Piecewise 2");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp")
         .set("pieces", new String[][]{{"200.0", "1600.0", "1047.63657-0.372589265*T^1+9.45304214E-4*T^2-6.02409443E-7*T^3+1.2858961E-10*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").set("fununit", "J/(kg*K)");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("Rs", "R_const/Mn");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("heatcapacity", "Cp(T)");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("ratioofspecificheat", "1.4");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("molarmass", "0.02897[kg/mol]");
    model.component("comp1").material("mat1").propertyGroup("idealGas").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("idealGas").addInput("pressure");
    model.component("comp1").material("mat1").materialType("nonSolid");

//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Selection list, select Air.

    model.component("comp1").material("mat1").selection().named("geom1_difsel5");

//    In the tree, select Built-in > Acrylic plastic.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat2", "Common");
    model.component("comp1").material("mat2").propertyGroup()
         .create("Enu", "Enu", "Young's modulus and Poisson's ratio");
    model.component("comp1").material("mat2").label("Acrylic plastic");
    model.component("comp1").material("mat2").set("family", "custom");
    model.component("comp1").material("mat2")
         .set("customspecular", new double[]{0.9803921568627451, 0.9803921568627451, 0.9803921568627451});
    model.component("comp1").material("mat2").set("diffuse", "custom");
    model.component("comp1").material("mat2")
         .set("customdiffuse", new double[]{0.39215686274509803, 0.7843137254901961, 0.39215686274509803});
    model.component("comp1").material("mat2").set("ambient", "custom");
    model.component("comp1").material("mat2")
         .set("customambient", new double[]{0.39215686274509803, 0.7843137254901961, 0.39215686274509803});
    model.component("comp1").material("mat2").set("noise", true);
    model.component("comp1").material("mat2").set("lighting", "phong");
    model.component("comp1").material("mat2").set("shininess", 1000);
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("thermalexpansioncoefficient", new String[]{"7.0e-5[1/K]", "0", "0", "0", "7.0e-5[1/K]", "0", "0", "0", "7.0e-5[1/K]"});
    model.component("comp1").material("mat2").propertyGroup("def").set("heatcapacity", "1470[J/(kg*K)]");
    model.component("comp1").material("mat2").propertyGroup("def").set("density", "1190[kg/m^3]");
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("thermalconductivity", new String[]{"0.18[W/(m*K)]", "0", "0", "0", "0.18[W/(m*K)]", "0", "0", "0", "0.18[W/(m*K)]"});
    model.component("comp1").material("mat2").propertyGroup("Enu").set("E", "3.2[GPa]");
    model.component("comp1").material("mat2").propertyGroup("Enu").set("nu", "0.35");

//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Selection list, select Gaps.

    model.component("comp1").material("mat2").selection().named("geom1_blk3_dom");

//    In the tree, select Built-in > Aluminum.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat3", "Common");
    model.component("comp1").material("mat3").propertyGroup()
         .create("Enu", "Enu", "Young's modulus and Poisson's ratio");
    model.component("comp1").material("mat3").propertyGroup().create("Murnaghan", "Murnaghan", "Murnaghan");
    model.component("comp1").material("mat3").label("Aluminum");
    model.component("comp1").material("mat3").set("family", "aluminum");
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("relpermeability", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat3").propertyGroup("def").set("heatcapacity", "900[J/(kg*K)]");
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("thermalconductivity", new String[]{"238[W/(m*K)]", "0", "0", "0", "238[W/(m*K)]", "0", "0", "0", "238[W/(m*K)]"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("electricconductivity", new String[]{"3.774e7[S/m]", "0", "0", "0", "3.774e7[S/m]", "0", "0", "0", "3.774e7[S/m]"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("relpermittivity", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("thermalexpansioncoefficient", new String[]{"23e-6[1/K]", "0", "0", "0", "23e-6[1/K]", "0", "0", "0", "23e-6[1/K]"});
    model.component("comp1").material("mat3").propertyGroup("def").set("density", "2700[kg/m^3]");
    model.component("comp1").material("mat3").propertyGroup("Enu").set("E", "70[GPa]");
    model.component("comp1").material("mat3").propertyGroup("Enu").set("nu", "0.33");
    model.component("comp1").material("mat3").propertyGroup("Murnaghan").set("l", "-250[GPa]");
    model.component("comp1").material("mat3").propertyGroup("Murnaghan").set("m", "-330[GPa]");
    model.component("comp1").material("mat3").propertyGroup("Murnaghan").set("n", "-350[GPa]");

//    In the Materials toolbar, click Add Material to close the Add Material window.
//    Click the Wireframe Rendering button in the Graphics toolbar.

    model.component("comp1").view("view1").set("renderwireframe", true);

//     to see the interior walls selection in the next steps.
//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").material("mat3").selection().geom("geom1", 2);

//    From the Selection list, select All Aluminum Walls.

    model.component("comp1").material("mat3").selection().named("geom1_unisel5");

//    Now set up the fluid flow simulation. Start by specifying a selection for the fluid domain and setting up the model parameters.
//    In the Model Builder window, under Component 1 (comp1), click Turbulent Flow, Algebraic yPlus (spf).
//    In the Settings window for Turbulent Flow, Algebraic yPlus, locate the Domain Selection section.
//    From the Selection list, select Air.

    model.component("comp1").physics("spf").selection().named("geom1_difsel5");

//    Locate the Turbulence section.
//    From the Wall treatment list, select Low Re.

    model.component("comp1").physics("spf").prop("TurbulenceModelProperty")
         .set("WallTreatment", "LowReynoldsNumber");

//    In the Model Builder window, under Component 1 (comp1) > Turbulent Flow, Algebraic yPlus (spf), click Initial Values 1.
//    In the Settings window for Initial Values, locate the Initial Values section.
//    Specify the \[\mathbf{u}\] vector as

    model.component("comp1").physics("spf").feature("init1").set("u_init", new String[]{"u_init", "0", "0"});

//    In the Physics toolbar, click Boundaries and choose Interior Wall.

    model.component("comp1").physics("spf").create("iwbc1", "InteriorWallBC", 2);

//    In the Settings window for Interior Wall, locate the Boundary Selection section.
//    From the Selection list, select Module Walls.

    model.component("comp1").physics("spf").feature("iwbc1").selection().named("geom1_difsel1");

//    In the Physics toolbar, click Boundaries and choose Symmetry.

    model.component("comp1").physics("spf").create("sym1", "Symmetry", 2);

//    In the Settings window for Symmetry, locate the Boundary Selection section.
//    From the Selection list, select Symmetry.

    model.component("comp1").physics("spf").feature("sym1").selection().named("geom1_blk5_bnd");

//    In the Physics toolbar, click Boundaries and choose Fan.

    model.component("comp1").physics("spf").create("fan1", "ExtFan", 2);

//    Select Boundary 6.

    model.component("comp1").physics("spf").feature("fan1").selection().set(6);

//    In the Settings window for Fan, locate the Flow Direction section.
//    From the Flow direction list, select Outlet.

    model.component("comp1").physics("spf").feature("fan1").set("FlowDirection", "Outlet");

//    Locate the Parameters section.
//    From the Flow condition list, select Static pressure curve, data.

    model.component("comp1").physics("spf").feature("fan1").set("FlowCondition", "StaticPressureCurveData");

//    Locate the Static Pressure Curve Data section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file air_cooled_bess_cabinet_fan_curve.txt.

    model.component("comp1").physics("spf").feature("fan1")
         .set("V0data", new String[]{"90.425", "86.838", "81.175", "76.833", "72.869", "65.884", "60.220", "53.424", "48.139", "44.929", 
         "40.21", "37.378", "33.036", "28.317", "22.465", "15.102", "8.117", "0.566"});
    model.component("comp1").physics("spf").feature("fan1")
         .set("spcd", new double[]{0.456041987, 15.32458331, 40.68645854, 53.81120714, 67.37103027, 83.12894083, 94.94933945, 104.154049, 108.9835511, 110.3088685, 108.5834223, 105.1019523, 104.6852243, 109.9489273, 122.2070214, 137.0930356, 155.0350553, 171.6692304});

//    Locate the Units section.
//    From the Flux list, select dm^3/s.

    model.component("comp1").physics("spf").feature("fan1").set("FluxUnit", "(dm^3)/s");

//    Right-click Fan 1 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("fan2", "fan1");

//    In the Settings window for Fan, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("fan2").selection().set();

//    Select Boundary 5.

    model.component("comp1").physics("spf").feature("fan2").selection().set(5);

//    In the Model Builder window, under Component 1 (comp1) > Turbulent Flow, Algebraic yPlus (spf), Ctrl-click to select Fan 1, Fan 2.
//    Right-click and choose Group.

    model.nodeGroup().create("grp1", "Physics", "spf");
    model.nodeGroup("grp1").placeAfter("sym1");
    model.nodeGroup("grp1").add("fan1");
    model.nodeGroup("grp1").add("fan2");

//    In the Settings window for Group, type Cabinet Fans in the Label text field.

    model.nodeGroup("grp1").label("Cabinet Fans");

//    In the Physics toolbar, click Boundaries and choose Grille.

    model.component("comp1").physics("spf").create("grille1", "Grille", 2);

//    Select Boundary 882.

    model.component("comp1").physics("spf").feature("grille1").selection().set(882);

//    In the Settings window for Grille, locate the Parameters section.
//    From the Flow condition list, select Grille type.

    model.component("comp1").physics("spf").feature("grille1").set("FlowCondition", "GrilleType");

//    Right-click Grille 1 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("grille2", "grille1");

//    In the Settings window for Grille, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("grille2").selection().set();

//    Select Boundary 881.

    model.component("comp1").physics("spf").feature("grille2").selection().set(881);

//    Right-click Grille 2 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("grille3", "grille2");

//    In the Settings window for Grille, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("grille3").selection().set();

//    Select Boundary 880.

    model.component("comp1").physics("spf").feature("grille3").selection().set(880);

//    Right-click Grille 3 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("grille4", "grille3");

//    In the Settings window for Grille, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("grille4").selection().set();

//    Select Boundary 879.

    model.component("comp1").physics("spf").feature("grille4").selection().set(879);

//    In the Model Builder window, under Component 1 (comp1) > Turbulent Flow, Algebraic yPlus (spf), Ctrl-click to select Grille 1, Grille 2, Grille 3, Grille 4.
//    Right-click and choose Group.

    model.nodeGroup().create("grp2", "Physics", "spf");
    model.nodeGroup("grp2").placeAfter("sym1");
    model.nodeGroup("grp2").add("grille1");
    model.nodeGroup("grp2").add("grille2");
    model.nodeGroup("grp2").add("grille3");
    model.nodeGroup("grp2").add("grille4");

//    In the Settings window for Group, type Cabinet Grilles in the Label text field.

    model.nodeGroup("grp2").label("Cabinet Grilles");

//    In the Physics toolbar, click Boundaries and choose Interior Fan.

    model.component("comp1").physics("spf").create("ifan1", "InteriorFan", 2);

//    Select Boundary 32.

    model.component("comp1").physics("spf").feature("ifan1").selection().set(32);

//    In the Settings window for Interior Fan, locate the Parameters section.
//    From the Flow condition list, select Static pressure curve, data.

    model.component("comp1").physics("spf").feature("ifan1").set("FlowCondition", "StaticPressureCurveData");

//    Locate the Static Pressure Curve Data section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file air_cooled_bess_module_fan_curve.txt.

    model.component("comp1").physics("spf").feature("ifan1")
         .set("V0data", new String[]{"54.982", "53.0", "51.017", "47.006", "43.985", "40.021", "37.001", "33.980", "31.998", "28.978", 
         "26.995", "25.013", "22.984", "20.011", "15.008", "9.014", "6.985", "0.00"});
    model.component("comp1").physics("spf").feature("ifan1")
         .set("spcd", new double[]{0, 22.751, 53.25, 103.95, 137.783, 167.694, 185.248, 190.445, 187.209, 189.17, 191.132, 189.759, 191.132, 207.313, 258.699, 335.387, 355.491, 404.328});

//    Locate the Units section.
//    From the Flux list, select dm^3/s.

    return model;
  }

  public static Model run2(Model model) {

    model.component("comp1").physics("spf").feature("ifan1").set("FluxUnit", "(dm^3)/s");

//    Right-click Interior Fan 1 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("ifan2", "ifan1");

//    In the Settings window for Interior Fan, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("ifan2").selection().set();

//    Select Boundary 31.

    model.component("comp1").physics("spf").feature("ifan2").selection().set(31);

//    Right-click Interior Fan 2 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("ifan3", "ifan2");

//    In the Settings window for Interior Fan, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("ifan3").selection().set();

//    Select Boundary 30.

    model.component("comp1").physics("spf").feature("ifan3").selection().set(30);

//    Right-click Interior Fan 3 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("ifan4", "ifan3");

//    In the Settings window for Interior Fan, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("ifan4").selection().set();

//    Select Boundary 29.

    model.component("comp1").physics("spf").feature("ifan4").selection().set(29);

//    Right-click Interior Fan 4 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("ifan5", "ifan4");

//    In the Settings window for Interior Fan, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("ifan5").selection().set();

//    Select Boundary 28.

    model.component("comp1").physics("spf").feature("ifan5").selection().set(28);

//    In the Model Builder window, under Component 1 (comp1) > Turbulent Flow, Algebraic yPlus (spf), Ctrl-click to select Interior Fan 1, Interior Fan 2, Interior Fan 3, Interior Fan 4, Interior Fan 5.
//    Right-click and choose Group.

    model.nodeGroup().create("grp3", "Physics", "spf");
    model.nodeGroup("grp3").placeAfter("sym1");
    model.nodeGroup("grp3").add("ifan1");
    model.nodeGroup("grp3").add("ifan2");
    model.nodeGroup("grp3").add("ifan3");
    model.nodeGroup("grp3").add("ifan4");
    model.nodeGroup("grp3").add("ifan5");

//    In the Settings window for Group, type Module Fans in the Label text field.

    model.nodeGroup("grp3").label("Module Fans");

//    In the Physics toolbar, click Boundaries and choose Screen.

    model.component("comp1").physics("spf").create("sc1", "Screen", 2);

//    Select Boundary 877.

    model.component("comp1").physics("spf").feature("sc1").selection().set(877);

//    In the Settings window for Screen, locate the Screen Type section.
//    From the Screen type list, select Perforated plate.

    model.component("comp1").physics("spf").feature("sc1").set("ScreenType", "PerforatedPlate");

//    Locate the Parameters section.
//    In the \[\sigma_{\textrm{s}}\] text field, type sigma.

    model.component("comp1").physics("spf").feature("sc1").set("solidity", "sigma");

//    From the Refraction list, select User defined.

    model.component("comp1").physics("spf").feature("sc1").set("Refraction", "userdef");

//    In the \[\eta\] text field, type 1.

    model.component("comp1").physics("spf").feature("sc1").set("refractionCoeff", 1);

//    Right-click Screen 1 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("sc2", "sc1");

//    In the Settings window for Screen, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("sc2").selection().set();

//    Select Boundary 876.

    model.component("comp1").physics("spf").feature("sc2").selection().set(876);

//    Right-click Screen 2 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("sc3", "sc2");

//    In the Settings window for Screen, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("sc3").selection().set();

//    Select Boundary 875.

    model.component("comp1").physics("spf").feature("sc3").selection().set(875);

//    Right-click Screen 3 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("sc4", "sc3");

//    In the Settings window for Screen, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("sc4").selection().set();

//    Select Boundary 874.

    model.component("comp1").physics("spf").feature("sc4").selection().set(874);

//    Right-click Screen 4 and choose Duplicate.

    model.component("comp1").physics("spf").feature().duplicate("sc5", "sc4");

//    In the Settings window for Screen, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("spf").feature("sc5").selection().set();

//    Select Boundary 873.

    model.component("comp1").physics("spf").feature("sc5").selection().set(873);

//    In the Model Builder window, under Component 1 (comp1) > Turbulent Flow, Algebraic yPlus (spf), Ctrl-click to select Screen 1, Screen 2, Screen 3, Screen 4, Screen 5.
//    Right-click and choose Group.

    model.nodeGroup().create("grp4", "Physics", "spf");
    model.nodeGroup("grp4").placeAfter("sym1");
    model.nodeGroup("grp4").add("sc1");
    model.nodeGroup("grp4").add("sc2");
    model.nodeGroup("grp4").add("sc3");
    model.nodeGroup("grp4").add("sc4");
    model.nodeGroup("grp4").add("sc5");

//    In the Settings window for Group, type Module Screens in the Label text field.

    model.nodeGroup("grp4").label("Module Screens");

//    In the Model Builder window, collapse the Component 1 (comp1) > Turbulent Flow, Algebraic yPlus (spf) node.
//    In the Model Builder window, under Component 1 (comp1) > Heat Transfer in Fluids (ht), click Initial Values 1.
//    In the Settings window for Initial Values, locate the Initial Values section.
//    From the \[T\] list, select Ambient temperature (ampr1).

    model.component("comp1").physics("ht").feature("init1").set("Tinit_src", "root.comp1.ampr1.T_amb");

//    In the Physics toolbar, click Domains and choose Solid.

    model.component("comp1").physics("ht").create("solid1", "SolidHeatTransferModel", 3);

//    In the Settings window for Solid, locate the Domain Selection section.
//    From the Selection list, select Gaps.

    model.component("comp1").physics("ht").feature("solid1").selection().named("geom1_blk3_dom");

//    Now define thermal properties of the battery units.
//    In the Physics toolbar, click Domains and choose Battery Layers.

    model.component("comp1").physics("ht").create("bl1", "BatteryLayers", 3);

//    In the Settings window for Battery Layers, locate the Domain Selection section.
//    From the Selection list, select Cells.

    model.component("comp1").physics("ht").feature("bl1").selection().named("geom1_blk2_dom");

//    Locate the Battery Layers section.
//    In the \[k_\textrm{tl}\] text field, type k_tl.

    model.component("comp1").physics("ht").feature("bl1").set("ThroughLayerConductivity", "k_tl");

//    In the \[k_\textrm{il}\] text field, type k_il.

    model.component("comp1").physics("ht").feature("bl1").set("InLayerConductivity", "k_il");

//    In the \[\rho_\textrm{eff}\] text field, type rho_eff.

    model.component("comp1").physics("ht").feature("bl1").set("Density", "rho_eff");

//    In the \[C_{p,\textrm{eff}}\] text field, type Cp_eff.

    model.component("comp1").physics("ht").feature("bl1").set("HeatCapacity", "Cp_eff");

//    Next, use the <c>Q0</c> parameter to define the heat source in the battery units.
//    In the Physics toolbar, click Domains and choose Heat Source.

    model.component("comp1").physics("ht").create("hs1", "HeatSource", 3);

//    In the Settings window for Heat Source, locate the Domain Selection section.
//    From the Selection list, select Cells.

    model.component("comp1").physics("ht").feature("hs1").selection().named("geom1_blk2_dom");

//    Locate the Heat Source section.
//    In the \[Q_0\] text field, type Q0.

    model.component("comp1").physics("ht").feature("hs1").set("Q0", "Q0");

//    In the Physics toolbar, click Boundaries and choose Inflow.

    model.component("comp1").physics("ht").create("ifl1", "Inflow", 2);

//    In the Settings window for Inflow, locate the Boundary Selection section.
//    From the Selection list, select Cabinet Grills (Work Plane 3).

    model.component("comp1").physics("ht").feature("ifl1").selection().named("geom1_wp3_r1_bnd");

//    Locate the Upstream Properties section.
//    From the \[T_\textrm{ustr}\] list, select Ambient temperature (ampr1).

    model.component("comp1").physics("ht").feature("ifl1").set("Tustr_src", "root.comp1.ampr1.T_amb");

//    The ambient temperature is defined in the <l>Ambient Properties</l> node under <l>Shared Properties</l>.
//    In the Physics toolbar, click Boundaries and choose Outflow.

    model.component("comp1").physics("ht").create("ofl1", "ConvectiveOutflow", 2);

//    In the Settings window for Outflow, locate the Boundary Selection section.
//    From the Selection list, select Cabinet Fans (Work Plane 3).

    model.component("comp1").physics("ht").feature("ofl1").selection().named("geom1_wp3_c1_bnd");

//    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 Cabinet Side Walls.

    model.component("comp1").physics("ht").feature("hf1").selection().named("geom1_difsel4");

//    Locate the Heat Flux section.
//    From the Flux type list, select Convective heat flux.

    model.component("comp1").physics("ht").feature("hf1").set("HeatFluxType", "ConvectiveHeatFlux");

//    From the Heat transfer coefficient list, select External natural convection.

    model.component("comp1").physics("ht").feature("hf1").set("HeatTransferCoefficientType", "ExtNaturalConvection");

//    In the \[L\] text field, type H_cabinet.

    model.component("comp1").physics("ht").feature("hf1").set("Lwall", "H_cabinet");

//    From the \[p_\textrm{A}\] list, select Ambient absolute pressure (ampr1).

    model.component("comp1").physics("ht").feature("hf1").set("pA_src", "root.comp1.ampr1.p_amb");

//    From the \[T_{\textrm{ext}}\] list, select Ambient temperature (ampr1).

    model.component("comp1").physics("ht").feature("hf1").set("Text_src", "root.comp1.ampr1.T_amb");

//    In the Physics toolbar, click Boundaries and choose Heat Flux.

    model.component("comp1").physics("ht").create("hf2", "HeatFluxBoundary", 2);

//    In the Settings window for Heat Flux, locate the Boundary Selection section.
//    From the Selection list, select Cabinet Top.

    model.component("comp1").physics("ht").feature("hf2").selection().named("geom1_boxsel1");

//    Locate the Heat Flux section.
//    From the Flux type list, select Convective heat flux.

    model.component("comp1").physics("ht").feature("hf2").set("HeatFluxType", "ConvectiveHeatFlux");

//    From the Heat transfer coefficient list, select External natural convection.

    model.component("comp1").physics("ht").feature("hf2").set("HeatTransferCoefficientType", "ExtNaturalConvection");

//    From the list, select Horizontal plate, upside.

    model.component("comp1").physics("ht").feature("hf2").set("ExtNaturalConvectionType", "HorizontalPlateUp");

//    In the \[L\] text field, type L_cabinet*W_cabinet/(2*(L_cabinet+W_cabinet)).

    model.component("comp1").physics("ht").feature("hf2")
         .set("Ldia", "L_cabinet*W_cabinet/(2*(L_cabinet+W_cabinet))");

//    From the \[p_\textrm{A}\] list, select Ambient absolute pressure (ampr1).

    model.component("comp1").physics("ht").feature("hf2").set("pA_src", "root.comp1.ampr1.p_amb");

//    From the \[T_{\textrm{ext}}\] list, select Ambient temperature (ampr1).

    model.component("comp1").physics("ht").feature("hf2").set("Text_src", "root.comp1.ampr1.T_amb");

//    In the Physics toolbar, click Boundaries and choose Symmetry.

    model.component("comp1").physics("ht").create("sym1", "Symmetry", 2);

//    In the Settings window for Symmetry, locate the Boundary Selection section.
//    From the Selection list, select Symmetry.

    model.component("comp1").physics("ht").feature("sym1").selection().named("geom1_blk5_bnd");

//    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 All Aluminum Walls.

    model.component("comp1").physics("ht").feature("sls1").selection().named("geom1_unisel5");

//    Locate the Layer Model section.
//    From the Layer type list, select General.

    model.component("comp1").physics("ht").feature("sls1").set("LayerType", "General");

//    In the Model Builder window, click Initial Values 1a.
//    In the Settings window for Initial Values, locate the Initial Values section.
//    From the \[T\] list, select Ambient temperature (ampr1).

    model.component("comp1").physics("ht").feature("sls1").feature("init1")
         .set("Tinit_src", "root.comp1.ampr1.T_amb");

//    In the Model Builder window, under Component 1 (comp1) > Materials, click Aluminum (mat3).
//    In the Settings window for Material, locate the Material Contents section.
//    In the table, enter the following settings:

    model.component("comp1").material("mat3").propertyGroup().create("shell", "shell", "Shell");
    model.component("comp1").material("mat3").propertyGroup("shell").set("lth", new String[]{"2[mm]"});

//    Now create the mesh. Use manual settings to create a proper mesh for this model.
//    In the Mesh toolbar, click Free Tetrahedral.

    model.component("comp1").mesh("mesh1").create("ftet1", "FreeTet");

//    In the Settings window for Free Tetrahedral, locate the Domain Selection section.
//    From the Geometric entity level list, select Domain.

    model.component("comp1").mesh("mesh1").feature("ftet1").selection().geom("geom1", 3);

//    From the Selection list, select Battery Module.

    model.component("comp1").mesh("mesh1").feature("ftet1").selection().named("geom1_unisel1_dom");

//    Right-click Free Tetrahedral 1 and choose Size.

    model.component("comp1").mesh("mesh1").feature("ftet1").create("size1", "Size");

//    In the Settings window for Size, locate the Element Size section.
//    From the Calibrate for list, select Fluid dynamics.

    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size1").set("table", "cfd");

//    In the Model Builder window, right-click Free Tetrahedral 1 and choose Size.

    model.component("comp1").mesh("mesh1").feature("ftet1").create("size2", "Size");

//    In the Settings window for Size, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size2").selection().geom("geom1", 2);

//    From the Selection list, select Module Fan (Work Plane 1).

    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size2").selection().named("geom1_wp1_c1_bnd");

//    Locate the Element Size section.
//    From the Calibrate for list, select Fluid dynamics.

    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size2").set("table", "cfd");

//    From the Predefined list, select Finer.

    model.component("comp1").mesh("mesh1").feature("ftet1").feature("size2").set("hauto", 3);

//    In the Mesh toolbar, click Free Tetrahedral.

    model.component("comp1").mesh("mesh1").create("ftet2", "FreeTet");

//    Right-click Free Tetrahedral 2 and choose Size.

    model.component("comp1").mesh("mesh1").feature("ftet2").create("size1", "Size");

//    In the Settings window for Size, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").selection().geom("geom1", 2);

//    From the Selection list, select Cabinet Selection.

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").selection().named("geom1_unisel2_bnd");

//    Locate the Element Size section.
//    From the Calibrate for list, select Fluid dynamics.

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").set("table", "cfd");

//    From the Predefined list, select Fine.

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size1").set("hauto", 4);

//    In the Model Builder window, right-click Free Tetrahedral 2 and choose Size.

    model.component("comp1").mesh("mesh1").feature("ftet2").create("size2", "Size");

//    In the Settings window for Size, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").selection().geom("geom1", 2);

//    From the Selection list, select Cabinet Fans (Work Plane 3).

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").selection().named("geom1_wp3_c1_bnd");

//    Locate the Element Size section.
//    From the Calibrate for list, select Fluid dynamics.

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").set("table", "cfd");

//    From the Predefined list, select Extra fine.

    model.component("comp1").mesh("mesh1").feature("ftet2").feature("size2").set("hauto", 2);

//    In the Mesh toolbar, click Boundary Layers.

    model.component("comp1").mesh("mesh1").create("bl1", "BndLayer");
    model.component("comp1").mesh("mesh1").feature("bl1").create("blp", "BndLayerProp");

//    In the Settings window for Boundary Layers, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Domain.

    model.component("comp1").mesh("mesh1").feature("bl1").selection().geom("geom1", 3);

//    From the Selection list, select Air.

    model.component("comp1").mesh("mesh1").feature("bl1").selection().named("geom1_difsel5");

//    Click to expand the Corner Settings section.
//    From the Handling of sharp edges list, select Trimming.

    model.component("comp1").mesh("mesh1").feature("bl1").set("sharpcorners", "trim");

//    In the Model Builder window, click Boundary Layer Properties.
//    In the Settings window for Boundary Layer Properties, locate the Boundary Selection section.
//    From the Selection list, select All Walls.

    model.component("comp1").mesh("mesh1").feature("bl1").feature("blp").selection().named("geom1_unisel4");

//    Locate the Layers section.
//    In the Number of layers text field, type 3.

    model.component("comp1").mesh("mesh1").feature("bl1").feature("blp").set("blnlayers", 3);

//    In the Thickness adjustment factor text field, type 0.05.

    model.component("comp1").mesh("mesh1").feature("bl1").feature("blp").set("blhminfact", 0.05);

//    Click Build All.

    model.component("comp1").mesh("mesh1").run();

//    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, 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, type temperature in the text field.
//    In the tree, select General > Temperature (K).
//    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);

//    In the Model Builder window, expand the Results > Datasets node.
//    Right-click Results > Datasets and choose More Datasets > Layered Material.

    model.result().dataset().create("lshl1", "LayeredMaterial");

//    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 Boundary.

    model.result().dataset("lshl1").selection().geom("geom1", 2);

//    From the Selection list, select Middle Modules.

    model.result().dataset("lshl1").selection().named("geom1_boxsel3");

//    In the Results toolbar, click Cut Plane.

    model.result().dataset().create("cpl1", "CutPlane");

//    In the Settings window for Cut Plane, locate the Plane Data section.
//    From the Plane list, select xy-planes.

    model.result().dataset("cpl1").set("quickplane", "xy");

//    In the z-coordinate text field, type Gap_bottom_modules+H_module/2.

    model.result().dataset("cpl1").set("quickz", "Gap_bottom_modules+H_module/2");

//    In the Results toolbar, click Table.

    model.result().table().create("tbl1", "Table");

//    In the Settings window for Table, type Cabinet Fan Curve in the Label text field.

    model.result().table("tbl1").label("Cabinet Fan Curve");

//    Locate the Data section.
//    Click Import.
//    Browse to the model's Application Library folder and double-click the file air_cooled_bess_cabinet_fan_curve.txt.

    model.result().table("tbl1").importData("air_cooled_bess_cabinet_fan_curve.txt");

//    Locate the Column Headers section.
//    In the table, enter the following settings:

    model.result().table("tbl1").setIndex("headers", "Flux, l/s", 0, 1);
    model.result().table("tbl1").setIndex("headers", "Pressure, Pa", 1, 1);

//    In the Results toolbar, click Table.

    model.result().table().create("tbl2", "Table");

//    In the Settings window for Table, type Module Fan Curve in the Label text field.

    model.result().table("tbl2").label("Module Fan Curve");

//    Locate the Data section.
//    Click Import.
//    Browse to the model's Application Library folder and double-click the file air_cooled_bess_module_fan_curve.txt.

    model.result().table("tbl2").importData("air_cooled_bess_module_fan_curve.txt");

//    Locate the Column Headers section.
//    In the table, enter the following settings:

    model.result().table("tbl2").setIndex("headers", "Flux, l/s", 0, 1);
    model.result().table("tbl2").setIndex("headers", "Pressure, Pa", 1, 1);

//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg1", "PlotGroup1D");
    model.result("pg1").run();

//    In the Settings window for 1D Plot Group, type Fan Curves in the Label text field.

    model.result("pg1").label("Fan Curves");

//    Click to expand the Title section.
//    From the Title type list, select Manual.

    model.result("pg1").set("titletype", "manual");

//    In the Title text area, type Fan curves.

    model.result("pg1").set("title", "Fan curves");

//    Right-click Fan Curves and choose Table Graph.

    model.result("pg1").create("tblp1", "Table");
    model.result("pg1").feature("tblp1").set("markerpos", "datapoints");
    model.result("pg1").feature("tblp1").set("linewidth", "preference");

//    In the Settings window for Table Graph, type Cabinet Fan Curve in the Label text field.

    model.result("pg1").feature("tblp1").label("Cabinet Fan Curve");

//    Locate the Coloring and Style section.
//    From the Width list, select 2.

    model.result("pg1").feature("tblp1").set("linewidth", 2);

//    Find the Line markers subsection.
//    From the Marker list, select Point.

    model.result("pg1").feature("tblp1").set("linemarker", "point");

//    Click to expand the Legends section.
//    Find the Include subsection.
//    Select the Label checkbox.

    model.result("pg1").feature("tblp1").set("autoplotlabel", true);

//    Clear the Headers checkbox.

    model.result("pg1").feature("tblp1").set("autoheaders", false);

//    Select the Show legends checkbox.

    model.result("pg1").feature("tblp1").set("legend", true);

//    Right-click Cabinet Fan Curve and choose Duplicate.

    model.result("pg1").feature().duplicate("tblp2", "tblp1");
    model.result("pg1").run();

//    In the Settings window for Table Graph, type Module Fan Curve in the Label text field.

    model.result("pg1").feature("tblp2").label("Module Fan Curve");

//    Locate the Data section.
//    From the Table list, select Module Fan Curve.

    model.result("pg1").feature("tblp2").set("table", "tbl2");

//    In the Fan Curves toolbar, click Plot.

    model.result("pg1").run();

//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg2", "PlotGroup3D");
    model.result("pg2").run();

//    In the Settings window for 3D Plot Group, type BESS Geometry in the Label text field.

    model.result("pg2").label("BESS Geometry");

//    Click to expand the Title section.
//    From the Title type list, select Manual.

    model.result("pg2").set("titletype", "manual");

//    In the Title text area, type BESS geometry.

    model.result("pg2").set("title", "BESS geometry");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg2").set("edges", false);

//    Right-click BESS Geometry 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 1.

    model.result("pg2").feature("surf1").set("expr", "1");

//    Right-click Surface 1 and choose Material Appearance.

    model.result("pg2").feature("surf1").create("mtrl1", "MaterialAppearance");

//    In the Settings window for Material Appearance, locate the Appearance section.
//    From the Material list, select Aluminum (mat3).

    model.result("pg2").feature("surf1").feature("mtrl1").set("material", "mat3");
    model.result("pg2").run();

//    In the Model Builder window, 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 Cabinet Walls.

    model.result("pg2").feature("surf1").feature("sel1").selection().named("geom1_difsel3");
    model.result("pg2").run();

//    Right-click Surface 1 and choose Duplicate.

    model.result("pg2").feature().duplicate("surf2", "surf1");
    model.result("pg2").run();
    model.result("pg2").run();

//    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 Middle Modules.

    model.result("pg2").feature("surf2").feature("sel1").selection().named("geom1_boxsel3");
    model.result("pg2").run();

//    In the Model Builder window, right-click BESS Geometry and choose Surface.

    model.result("pg2").create("surf3", "Surface");
    model.result("pg2").feature("surf3").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type 1.

    model.result("pg2").feature("surf3").set("expr", "1");

//    Right-click Surface 3 and choose Material Appearance.

    model.result("pg2").feature("surf3").create("mtrl1", "MaterialAppearance");

//    In the Settings window for Material Appearance, locate the Appearance section.
//    From the Material list, select Acrylic plastic (mat2).

    model.result("pg2").feature("surf3").feature("mtrl1").set("material", "mat2");
    model.result("pg2").run();

//    In the Model Builder window, right-click BESS Geometry and choose Surface.

    model.result("pg2").create("surf4", "Surface");
    model.result("pg2").feature("surf4").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type 1.

    model.result("pg2").feature("surf4").set("expr", "1");

//    Locate the Coloring and Style section.
//    From the Coloring list, select Uniform.

    model.result("pg2").feature("surf4").set("coloring", "uniform");

//    From the Color list, select Blue.

    model.result("pg2").feature("surf4").set("color", "blue");

//    Right-click Surface 4 and choose Selection.

    model.result("pg2").feature("surf4").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Cells.

    model.result("pg2").feature("surf4").feature("sel1").selection().named("geom1_blk2_bnd");

//    In the BESS Geometry toolbar, click Plot.

    model.result("pg2").run();

//    In the Model Builder window, collapse the Results > BESS Geometry node.
//    In the Results toolbar, click Result Templates to open the Result Templates window.
//    In the tree, select Study 1/Solution 1 (sol1) > Turbulent Flow, Algebraic yPlus > Wall Resolution (spf).
//    Click Add Result Template in the window toolbar.

    model.result().create("pg3", "PlotGroup3D");
    model.result("pg3").label("Wall Resolution (spf)");
    model.result("pg3").set("frametype", "spatial");
    model.result("pg3").set("smooth", "internal");
    model.result("pg3").feature().create("surf1", "Surface");
    model.result("pg3").feature("surf1").set("expr", "spf.Delta_wPlus");
    model.result("pg3").feature("surf1").set("smooth", "internal");
    model.result("pg3").feature("surf1").set("data", "parent");
    model.result("pg3").feature("surf1").feature().create("sel1", "Selection");
    model.result("pg3").feature("surf1").feature("sel1").selection().geom("geom1", 2);

    return model;
  }

  public static Model run3(Model model) {
    model.result("pg3").feature("surf1").feature("sel1").selection()
         .set(1, 3, 4, 7, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 99, 100, 101, 103, 104, 105, 107, 108, 109, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 124, 125, 126, 128, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 161, 162, 163, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 178, 179, 180, 182, 183, 184, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 197, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 223, 225, 226, 227, 228, 229, 230, 231, 232, 234, 235, 236, 238, 239, 240, 242, 243, 244, 246, 247, 248, 250, 251, 252, 253, 254, 255, 256, 257, 259, 260, 261, 263, 264, 265, 267, 268, 269, 271, 272, 273, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 288, 289, 290, 292, 293, 294, 296, 297, 298, 300, 301, 302, 303, 304, 305, 306, 307, 319, 320, 321, 323, 324, 325, 327, 328, 329, 331, 332, 333, 335, 336, 337, 338, 339, 340, 341, 342, 344, 345, 346, 348, 349, 350, 352, 353, 354, 356, 357, 358, 360, 361, 362, 363, 364, 365, 366, 367, 369, 370, 371, 373, 374, 375, 377, 378, 379, 381, 382, 383, 385, 386, 387, 388, 389, 390, 391, 392, 394, 395, 396, 398, 399, 400, 402, 403, 404, 406, 407, 408, 410, 411, 412, 413, 414, 415, 416, 417, 429, 430, 431, 433, 434, 435, 437, 438, 439, 441, 442, 443, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 458, 459, 460, 462, 463, 464, 466, 467, 468, 470, 471, 472, 473, 474, 475, 476, 477, 479, 480, 481, 483, 484, 485, 487, 488, 489, 491, 492, 493, 495, 496, 497, 498, 499, 500, 501, 502, 504, 505, 506, 508, 509, 510, 512, 513, 514, 516, 517, 518, 520, 521, 522, 523, 524, 525, 526, 527, 539, 540, 541, 543, 544, 545, 547, 548, 549, 551, 552, 553, 555, 556, 557, 558, 559, 560, 561, 562, 564, 565, 566, 568, 569, 570, 572, 573, 574, 576, 577, 578, 580, 581, 582, 583, 584, 585, 586, 587, 589, 590, 591, 593, 594, 595, 597, 598, 599, 601, 602, 603, 605, 606, 607, 608, 609, 610, 611, 612, 614, 615, 616, 618, 619, 620, 622, 623, 624, 626, 627, 628, 630, 631, 632, 633, 634, 635, 636, 637, 649, 650, 651, 653, 654, 655, 657, 658, 659, 661, 662, 663, 665, 666, 667, 668, 669, 670, 671, 672, 674, 675, 676, 678, 679, 680, 682, 683, 684, 686, 687, 688, 690, 691, 692, 693, 694, 695, 696, 697, 699, 700, 701, 703, 704, 705, 707, 708, 709, 711, 712, 713, 715, 716, 717, 718, 719, 720, 721, 722, 724, 725, 726, 728, 729, 730, 732, 733, 734, 736, 737, 738, 740, 741, 742, 743, 744, 745, 746, 747, 759, 760, 761, 763, 764, 765, 767, 768, 769, 771, 772, 773, 775, 776, 777, 778, 779, 780, 781, 782, 784, 785, 786, 788, 789, 790, 792, 793, 794, 796, 797, 798, 800, 801, 802, 803, 804, 805, 806, 807, 809, 810, 811, 813, 814, 815, 817, 818, 819, 821, 822, 823, 825, 826, 827, 828, 829, 830, 831, 832, 834, 835, 836, 838, 839, 840, 842, 843, 844, 846, 847, 848, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 878);
    model.result("pg3").feature().create("slit1", "SurfaceSlit");
    model.result("pg3").feature("slit1").set("upexpr", "spf.Delta_wPlus_u");
    model.result("pg3").feature("slit1").set("downexpr", "spf.Delta_wPlus_d");
    model.result("pg3").feature("slit1").set("smooth", "internal");
    model.result("pg3").feature("slit1").set("data", "parent");
    model.result("pg3").feature("slit1").feature().create("sel1", "Selection");
    model.result("pg3").feature("slit1").feature("sel1").selection().geom("geom1", 2);
    model.result("pg3").feature("slit1").feature("sel1").selection()
         .set(8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 868, 869, 870, 871, 872);
    model.result("pg3").feature("slit1").set("inheritplot", "surf1");
    model.result("pg3").label("Wall Resolution (spf)");
    model.result("pg3").run();

//    In the Results toolbar, click Result Templates to close the Result Templates window.
//    In the Settings window for 3D Plot Group, locate the Title section.
//    From the Title type list, select Manual.

    model.result("pg3").set("titletype", "manual");

//    In the Title text area, type Wall resolution in viscous units.

    model.result("pg3").set("title", "Wall resolution in viscous units");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg3").set("edges", false);

//    In the Wall Resolution (spf) toolbar, click Plot.

    model.result("pg3").run();
    model.result("pg3").run();

//    In the Model Builder window, expand the Wall Resolution (spf) node, then click Surface 1.
//    In the Settings window for Surface, locate the Coloring and Style section.
//    From the Color table list, select Prism.

    model.result("pg3").feature("surf1").set("colortable", "Prism");

//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg4", "PlotGroup3D");
    model.result("pg4").run();

//    In the Settings window for 3D Plot Group, type Temperature and Fluid Flow in the Label text field.

    model.result("pg4").label("Temperature and Fluid Flow");

//    Locate the Title section.
//    From the Title type list, select Manual.

    model.result("pg4").set("titletype", "manual");

//    In the Title text area, type Temperature and fluid flow.

    model.result("pg4").set("title", "Temperature and fluid flow");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg4").set("edges", false);

//    Locate the Color Legend section.
//    Select the Show maximum and minimum values checkbox.

    model.result("pg4").set("showlegendsmaxmin", true);

//    Select the Show units checkbox.

    model.result("pg4").set("showlegendsunit", true);

//    From the Position list, select Right double.

    model.result("pg4").set("legendpos", "rightdouble");

//    Right-click Temperature and Fluid Flow and choose Volume.

    model.result("pg4").create("vol1", "Volume");
    model.result("pg4").feature("vol1").set("evaluationsettings", "parent");

//    In the Settings window for Volume, locate the Expression section.
//    In the Expression text field, type T.

    model.result("pg4").feature("vol1").set("expr", "T");

//    Locate the Coloring and Style section.
//    From the Color table list, select HeatCameraLight.

    model.result("pg4").feature("vol1").set("colortable", "HeatCameraLight");

//    Right-click Volume 1 and choose Selection.

    model.result("pg4").feature("vol1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Cells.

    model.result("pg4").feature("vol1").feature("sel1").selection().named("geom1_blk2_dom");
    model.result("pg4").run();

//    In the Model Builder window, right-click Temperature and Fluid Flow and choose Volume.

    model.result("pg4").create("vol2", "Volume");
    model.result("pg4").feature("vol2").set("evaluationsettings", "parent");

//    In the Settings window for Volume, locate the Data section.
//    From the Dataset list, select Layered Material 1.

    model.result("pg4").feature("vol2").set("data", "lshl1");

//    Locate the Expression section.
//    In the Expression text field, type T.

    model.result("pg4").feature("vol2").set("expr", "T");

//    Click to expand the Inherit Style section.
//    From the Plot list, select Volume 1.

    model.result("pg4").feature("vol2").set("inheritplot", "vol1");
    model.result("pg4").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    Right-click Temperature and Fluid Flow and choose Streamline.

    model.result("pg4").create("str1", "Streamline");
    model.result("pg4").feature("str1").set("evaluationsettings", "parent");

//    In the Settings window for Streamline, locate the Streamline Positioning section.
//    In the Number text field, type 30.

    model.result("pg4").feature("str1").set("selnumber", 30);

//    Locate the Selection section.
//    From the Selection list, select Cabinet Grills (Work Plane 3).

    model.result("pg4").feature("str1").selection().named("geom1_wp3_r1_bnd");

//    Locate the Coloring and Style section.
//    Find the Line style subsection.
//    From the Type list, select Ribbon.

    model.result("pg4").feature("str1").set("linetype", "ribbon");

//    In the Width expression text field, type 1[mm].

    model.result("pg4").feature("str1").set("widthexpr", "1[mm]");

//    Select the Width scale factor checkbox.

    model.result("pg4").feature("str1").set("widthscaleactive", true);

//    In the associated text field, type 5.

    model.result("pg4").feature("str1").set("widthscale", 5);

//    Find the Point style subsection.
//    From the Type list, select Arrow.

    model.result("pg4").feature("str1").set("pointtype", "arrow");

//    Select the Scale factor checkbox.

    model.result("pg4").feature("str1").set("arrowscaleactive", true);

//    In the associated text field, type 0.02.

    model.result("pg4").feature("str1").set("arrowscale", 0.02);

//    Right-click Streamline 1 and choose Color Expression.

    model.result("pg4").feature("str1").create("col1", "Color");
    model.result("pg4").run();

//    In the Settings window for Color Expression, locate the Coloring and Style section.
//    From the Color table list, select Prism.

    model.result("pg4").feature("str1").feature("col1").set("colortable", "Prism");

//    From the Color table transformation list, select Nonlinear.

    model.result("pg4").feature("str1").feature("col1").set("colortabletrans", "nonlinear");

//    In the Color calibration parameter text field, type -0.7.

    model.result("pg4").feature("str1").feature("col1").set("colorcalibration", -0.7);
    model.result("pg4").run();

//    In the Model Builder window, right-click Streamline 1 and choose Material Appearance.

    model.result("pg4").feature("str1").create("mtrl1", "MaterialAppearance");

//    In the Settings window for Material Appearance, locate the Appearance section.
//    From the Appearance list, select Custom.

    model.result("pg4").feature("str1").feature("mtrl1").set("appearance", "custom");

//    From the Material type list, select Plastic (shiny).

    model.result("pg4").feature("str1").feature("mtrl1").set("family", "plasticshiny");

//    Locate the Color section.
//    Select the Use the plot's color checkbox.

    model.result("pg4").feature("str1").feature("mtrl1").set("useplotcolors", true);
    model.result("pg4").run();

//    Right-click Streamline 1 and choose Duplicate.

    model.result("pg4").feature().duplicate("str2", "str1");
    model.result("pg4").run();

//    In the Settings window for Streamline, locate the Selection section.
//    From the Selection list, select Module Grill (Work Plane 1).

    model.result("pg4").feature("str2").selection().named("geom1_wp1_r1_bnd");

//    Click to expand the Inherit Style section.
//    From the Plot list, select Streamline 1.

    model.result("pg4").feature("str2").set("inheritplot", "str1");
    model.result("pg4").run();

//    In the Model Builder window, right-click Temperature and Fluid Flow and choose Surface.

    model.result("pg4").create("surf1", "Surface");
    model.result("pg4").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type 1.

    model.result("pg4").feature("surf1").set("expr", "1");

//    Right-click Surface 1 and choose Material Appearance.

    model.result("pg4").feature("surf1").create("mtrl1", "MaterialAppearance");

//    In the Settings window for Material Appearance, locate the Appearance section.
//    From the Material list, select Aluminum (mat3).

    model.result("pg4").feature("surf1").feature("mtrl1").set("material", "mat3");
    model.result("pg4").run();

//    In the Model Builder window, right-click Surface 1 and choose Selection.

    model.result("pg4").feature("surf1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Cabinet Frontside Walls.

    model.result("pg4").feature("surf1").feature("sel1").selection().named("geom1_difsel6");
    model.result("pg4").run();

//    Right-click Surface 1 and choose Duplicate.

    model.result("pg4").feature().duplicate("surf2", "surf1");
    model.result("pg4").run();
    model.result("pg4").run();

//    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 Cabinet Backside.

    model.result("pg4").feature("surf2").feature("sel1").selection().named("geom1_boxsel10");
    model.result("pg4").run();

//    In the Model Builder window, right-click Surface 2 and choose Transparency.

    model.result("pg4").feature("surf2").create("tran1", "Transparency");
    model.result("pg4").run();

//    In the Settings window for Transparency, locate the Transparency section.
//    Find the Transparency subsection.
//    Set the Transparency value to 0.7.

    model.result("pg4").feature("surf2").feature("tran1").set("transparency", 0.7);
    model.result("pg4").run();

//    In the Model Builder window, right-click Temperature and Fluid Flow and choose Annotation.

    model.result("pg4").create("ann1", "Annotation");

//    In the Settings window for Annotation, locate the Annotation section.
//    In the Text text field, type Bulk temperature: eval(ht.ofl1.Tave,°C,3) °C.

    model.result("pg4").feature("ann1").set("text", "Bulk temperature: eval(ht.ofl1.Tave,\u00b0C,3) \u00b0C");

//    Locate the Position section.
//    In the y text field, type W_cabinet/2-W_cabinet/(Ny_cabinet_fans+1).

    model.result("pg4").feature("ann1").set("posyexpr", "W_cabinet/2-W_cabinet/(Ny_cabinet_fans+1)");

//    In the z text field, type H_cabinet-0.1*R_fan_cabinet.

    model.result("pg4").feature("ann1").set("poszexpr", "H_cabinet-0.1*R_fan_cabinet");

//    Locate the Coloring and Style section.
//    Clear the Show point checkbox.

    model.result("pg4").feature("ann1").set("showpoint", false);

//    From the Anchor point list, select Lower left.

    model.result("pg4").feature("ann1").set("anchorpoint", "lowerleft");

//    In the Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg4").run();
    model.result("pg4").run();

//    Right-click Temperature and Fluid Flow and choose Annotation.

    model.result("pg4").create("ann2", "Annotation");

//    In the Settings window for Annotation, locate the Annotation section.
//    In the Text text field, type Inflow: eval(abs(spf.grille4.volumeFlowRate),l/s, 3) l/s.

    model.result("pg4").feature("ann2").set("text", "Inflow: eval(abs(spf.grille4.volumeFlowRate),l/s, 3) l/s");

//    Locate the Position section.
//    In the x text field, type L_cabinet.

    model.result("pg4").feature("ann2").set("posxexpr", "L_cabinet");

//    In the z text field, type Gap_bottom_modules+H_module+Gap_z_modules/2.

    model.result("pg4").feature("ann2").set("poszexpr", "Gap_bottom_modules+H_module+Gap_z_modules/2");

//    Locate the Coloring and Style section.
//    Clear the Show point checkbox.

    model.result("pg4").feature("ann2").set("showpoint", false);

//    From the Anchor point list, select Middle left.

    model.result("pg4").feature("ann2").set("anchorpoint", "middleleft");

//    In the Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg4").run();

//    Right-click Annotation 2 and choose Duplicate.

    model.result("pg4").feature().duplicate("ann3", "ann2");
    model.result("pg4").run();

//    In the Settings window for Annotation, locate the Annotation section.
//    In the Text text field, type Inflow: eval(abs(spf.grille3.volumeFlowRate),l/s, 3) l/s.

    model.result("pg4").feature("ann3").set("text", "Inflow: eval(abs(spf.grille3.volumeFlowRate),l/s, 3) l/s");

//    Locate the Position section.
//    In the z text field, type Gap_bottom_modules+2*H_module+1.5*Gap_z_modules.

    model.result("pg4").feature("ann3").set("poszexpr", "Gap_bottom_modules+2*H_module+1.5*Gap_z_modules");

//    In the Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg4").run();

//    Right-click Annotation 3 and choose Duplicate.

    model.result("pg4").feature().duplicate("ann4", "ann3");
    model.result("pg4").run();

//    In the Settings window for Annotation, locate the Annotation section.
//    In the Text text field, type Inflow: eval(abs(spf.grille2.volumeFlowRate),l/s, 3) l/s.

    model.result("pg4").feature("ann4").set("text", "Inflow: eval(abs(spf.grille2.volumeFlowRate),l/s, 3) l/s");

//    Locate the Position section.
//    In the z text field, type Gap_bottom_modules+3*H_module+2.5*Gap_z_modules.

    model.result("pg4").feature("ann4").set("poszexpr", "Gap_bottom_modules+3*H_module+2.5*Gap_z_modules");

//    In the Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg4").run();

//    Right-click Annotation 4 and choose Duplicate.

    model.result("pg4").feature().duplicate("ann5", "ann4");
    model.result("pg4").run();

//    In the Settings window for Annotation, locate the Annotation section.
//    In the Text text field, type Inflow: eval(abs(spf.grille1.volumeFlowRate),l/s, 3) l/s.

    model.result("pg4").feature("ann5").set("text", "Inflow: eval(abs(spf.grille1.volumeFlowRate),l/s, 3) l/s");

//    Locate the Position section.
//    In the z text field, type Gap_bottom_modules+4*H_module+3.5*Gap_z_modules.

    model.result("pg4").feature("ann5").set("poszexpr", "Gap_bottom_modules+4*H_module+3.5*Gap_z_modules");

//    In the Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg4").run();

//    In the Model Builder window, collapse the Results > Temperature and Fluid Flow node.
//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg5", "PlotGroup3D");
    model.result("pg5").run();

//    In the Settings window for 3D Plot Group, type Module Temperature and Fluid Flow in the Label text field.

    model.result("pg5").label("Module Temperature and Fluid Flow");

//    Locate the Title section.
//    From the Title type list, select Manual.

    model.result("pg5").set("titletype", "manual");

//    In the Title text area, type Module temperature and fluid flow.

    model.result("pg5").set("title", "Module temperature and fluid flow");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg5").set("edges", false);

//    Locate the Color Legend section.
//    Select the Show maximum and minimum values checkbox.

    model.result("pg5").set("showlegendsmaxmin", true);

//    Select the Show units checkbox.

    model.result("pg5").set("showlegendsunit", true);

//    Right-click Module Temperature and Fluid Flow and choose Volume.

    model.result("pg5").create("vol1", "Volume");
    model.result("pg5").feature("vol1").set("evaluationsettings", "parent");

//    In the Settings window for Volume, locate the Expression section.
//    In the Expression text field, type T.

    model.result("pg5").feature("vol1").set("expr", "T");

//    Locate the Coloring and Style section.
//    From the Color table list, select HeatCameraLight.

    model.result("pg5").feature("vol1").set("colortable", "HeatCameraLight");

//    Right-click Volume 1 and choose Selection.

    model.result("pg5").feature("vol1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Bottom Cells.

    model.result("pg5").feature("vol1").feature("sel1").selection().named("geom1_boxsel5");
    model.result("pg5").run();

//    In the Model Builder window, right-click Module Temperature and Fluid Flow and choose Surface.

    model.result("pg5").create("surf1", "Surface");
    model.result("pg5").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type 1.

    model.result("pg5").feature("surf1").set("expr", "1");

//    Right-click Surface 1 and choose Material Appearance.

    model.result("pg5").feature("surf1").create("mtrl1", "MaterialAppearance");

//    In the Settings window for Material Appearance, locate the Appearance section.
//    From the Material list, select Aluminum (mat3).

    model.result("pg5").feature("surf1").feature("mtrl1").set("material", "mat3");
    model.result("pg5").run();

//    In the Model Builder window, right-click Surface 1 and choose Selection.

    model.result("pg5").feature("surf1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Bottom Module.

    model.result("pg5").feature("surf1").feature("sel1").selection().named("geom1_boxsel4");
    model.result("pg5").run();

//    Right-click Surface 1 and choose Duplicate.

    model.result("pg5").feature().duplicate("surf2", "surf1");
    model.result("pg5").run();
    model.result("pg5").run();

//    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 Cabinet Frontside Walls.

    model.result("pg5").feature("surf2").feature("sel1").selection().named("geom1_difsel6");

//    In the Module Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg5").run();
    model.result("pg5").run();

//    In the Model Builder window, right-click Module Temperature and Fluid Flow and choose Streamline.

    model.result("pg5").create("str1", "Streamline");
    model.result("pg5").feature("str1").set("evaluationsettings", "parent");

//    In the Settings window for Streamline, locate the Streamline Positioning section.
//    In the Number text field, type 40.

    model.result("pg5").feature("str1").set("selnumber", 40);

//    Locate the Selection section.
//    From the Selection list, select Bottom Module Openings.

    model.result("pg5").feature("str1").selection().named("geom1_boxsel6");

//    Locate the Coloring and Style section.
//    Find the Line style subsection.
//    From the Type list, select Ribbon.

    model.result("pg5").feature("str1").set("linetype", "ribbon");

//    In the Width expression text field, type 1[mm].

    model.result("pg5").feature("str1").set("widthexpr", "1[mm]");

//    Select the Width scale factor checkbox.

    model.result("pg5").feature("str1").set("widthscaleactive", true);

//    In the associated text field, type 3.

    model.result("pg5").feature("str1").set("widthscale", 3);

//    Find the Point style subsection.
//    From the Type list, select Arrow.

    model.result("pg5").feature("str1").set("pointtype", "arrow");

//    Select the Scale factor checkbox.

    model.result("pg5").feature("str1").set("arrowscaleactive", true);

//    In the associated text field, type 0.02.

    model.result("pg5").feature("str1").set("arrowscale", 0.02);

//    Locate the Inherit Style section.
//    From the Plot list, select Volume 1.

    model.result("pg5").feature("str1").set("inheritplot", "vol1");

//    Right-click Streamline 1 and choose Color Expression.

    model.result("pg5").feature("str1").create("col1", "Color");
    model.result("pg5").run();

//    In the Settings window for Color Expression, locate the Expression section.
//    In the Expression text field, type T.

    model.result("pg5").feature("str1").feature("col1").set("expr", "T");

//    In the Home toolbar, click Add Plot Group and choose 2D Plot Group.

    model.result().create("pg6", "PlotGroup2D");
    model.result("pg6").run();
    model.result("pg5").run();

//    In the Model Builder window, right-click Module Temperature and Fluid Flow and choose Line.

    model.result("pg5").create("line1", "Line");
    model.result("pg5").feature("line1").set("evaluationsettings", "parent");

//    In the Settings window for Line, locate the Expression section.
//    In the Expression text field, type 1.

    model.result("pg5").feature("line1").set("expr", "1");

//    Locate the Coloring and Style section.
//    From the Coloring list, select Uniform.

    model.result("pg5").feature("line1").set("coloring", "uniform");

//    From the Color list, select Black.

    model.result("pg5").feature("line1").set("color", "black");

//    Right-click Line 1 and choose Selection.

    model.result("pg5").feature("line1").create("sel1", "Selection");

//    In the Settings window for Selection, locate the Selection section.
//    From the Geometric entity level list, select Boundary.

    model.result("pg5").feature("line1").feature("sel1").selection().geom("geom1", 2);

//    From the Selection list, select Bottom Module.

    model.result("pg5").feature("line1").feature("sel1").selection().named("geom1_boxsel4");

//    In the Module Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg5").run();
    model.result("pg5").run();

//    In the Model Builder window, right-click Results > Module Temperature and Fluid Flow > Volume 1 and choose Duplicate.

    model.result("pg5").feature().duplicate("vol2", "vol1");
    model.result("pg5").run();

//    In the Settings window for Volume, locate the Inherit Style section.
//    From the Plot list, select Volume 1.

    model.result("pg5").feature("vol2").set("inheritplot", "vol1");
    model.result("pg5").run();

//    In the Model Builder window, expand the Volume 2 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Top Cells.

    model.result("pg5").feature("vol2").feature("sel1").selection().named("geom1_boxsel8");
    model.result("pg5").run();

//    In the Model Builder window, right-click Results > Module Temperature and Fluid Flow > Surface 1 and choose Duplicate.

    model.result("pg5").feature().duplicate("surf3", "surf1");
    model.result("pg5").run();
    model.result("pg5").run();

//    In the Model Builder window, expand the Surface 3 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Top Module.

    model.result("pg5").feature("surf3").feature("sel1").selection().named("geom1_boxsel7");
    model.result("pg5").run();

//    In the Model Builder window, right-click Results > Module Temperature and Fluid Flow > Line 1 and choose Duplicate.

    model.result("pg5").feature().duplicate("line2", "line1");
    model.result("pg5").run();
    model.result("pg5").run();

//    In the Model Builder window, expand the Line 2 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Top Module.

    model.result("pg5").feature("line2").feature("sel1").selection().named("geom1_boxsel7");
    model.result("pg5").run();

//    In the Model Builder window, right-click Results > Module Temperature and Fluid Flow > Streamline 1 and choose Duplicate.

    model.result("pg5").feature().duplicate("str2", "str1");
    model.result("pg5").run();

//    In the Model Builder window, click Streamline 2.
//    In the Settings window for Streamline, locate the Selection section.
//    From the Selection list, select Top Module Openings.

    model.result("pg5").feature("str2").selection().named("geom1_boxsel9");

//    In the Module Temperature and Fluid Flow toolbar, click Plot.

    model.result("pg5").run();
    model.result("pg6").run();

//    In the Model Builder window, under Results, click 2D Plot Group 6.
//    In the Settings window for 2D Plot Group, type Cross Section of the Bottom Module in the Label text field.

    model.result("pg6").label("Cross Section of the Bottom Module");

//    Click to expand the Title section.
//    From the Title type list, select Manual.

    model.result("pg6").set("titletype", "manual");

//    In the Title text area, type Temperature and velocity field at cross section of the bottom module.

    model.result("pg6").set("title", "Temperature and velocity field at cross section of the bottom module");

//    Locate the Color Legend section.
//    Select the Show maximum and minimum values checkbox.

    model.result("pg6").set("showlegendsmaxmin", true);

//    Select the Show units checkbox.

    model.result("pg6").set("showlegendsunit", true);

//    From the Position list, select Right double.

    model.result("pg6").set("legendpos", "rightdouble");

//    Right-click Cross Section of the Bottom Module and choose Surface.

    model.result("pg6").create("surf1", "Surface");
    model.result("pg6").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type T.

    model.result("pg6").feature("surf1").set("expr", "T");

//    Locate the Coloring and Style section.
//    From the Color table list, select HeatCameraLight.

    model.result("pg6").feature("surf1").set("colortable", "HeatCameraLight");
    model.result("pg6").run();

//    Right-click Cross Section of the Bottom Module and choose Arrow Surface.

    model.result("pg6").create("arws1", "ArrowSurface");
    model.result("pg6").feature("arws1").set("planecoordsys", "cartesian");
    model.result("pg6").feature("arws1").set("expr", new String[]{"u", "v", "w"});
    model.result("pg6").feature("arws1").set("descr", "Velocity field");
    model.result("pg6").feature("arws1").set("evaluationsettings", "parent");

//    In the Settings window for Arrow Surface, locate the Arrow Positioning section.
//    Find the x grid points subsection.
//    In the Points text field, type 30.

    model.result("pg6").feature("arws1").set("xnumber", 30);

//    Find the y grid points subsection.
//    In the Points text field, type 30.

    model.result("pg6").feature("arws1").set("ynumber", 30);

//    Locate the Coloring and Style section.
//    From the Arrow length list, select Normalized.

    model.result("pg6").feature("arws1").set("arrowlength", "normalized");

//    Right-click Arrow Surface 1 and choose Color Expression.

    model.result("pg6").feature("arws1").create("col1", "Color");
    model.result("pg6").run();

//    In the Settings window for Color Expression, locate the Coloring and Style section.
//    From the Color table list, select Prism.

    model.result("pg6").feature("arws1").feature("col1").set("colortable", "Prism");

//    From the Color table transformation list, select Nonlinear.

    model.result("pg6").feature("arws1").feature("col1").set("colortabletrans", "nonlinear");

//    In the Color calibration parameter text field, type -0.7.

    model.result("pg6").feature("arws1").feature("col1").set("colorcalibration", -0.7);

//    In the Cross Section of the Bottom Module toolbar, click Plot.

    model.result("pg6").run();
    model.result("pg4").run();

    model.title("Air-Cooled Battery Energy Storage System");

    model
         .description("This tutorial model of a cooling system for a battery energy storage system (BESS) includes conjugate heat transfer with turbulent flow, fan curves, internal screens, and grilles.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    model = run2(model);
    run3(model);
  }

}
