/*
 * saw_velocity_calculation.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 11 2026, 08:07 by COMSOL 6.4.0.417. */
public class saw_velocity_calculation {

  public static Model run() {
    Model model = ModelUtil.create("Model");

//    From the File menu, choose New.
//    In the New window, click Model Wizard.
//    Start by creating a new 2D model with three <l>Piezoelectricity</l> multiphysics interfaces for modeling free, IDT and grounded unit cells. Also select <l>Eigenfrequency</l> for the first study.
//    In the Model Wizard window, click 2D.
//    In the Select Physics tree, select AC/DC > Electromagnetics and Mechanics > Piezoelectricity > Piezoelectricity, Solid.
//    Click Add.
//    Click Add.
//    Click Add.
//    Click Study.
//    In the Select Study tree, select Preset Studies for Selected Multiphysics > Eigenfrequency.
//    Click Done.

    model.component().create("comp1", true);

    model.component("comp1").geom().create("geom1", 2);

    model.component("comp1").mesh().create("mesh1");

    model.component("comp1").physics().create("es", "Electrostatics", "geom1");
    model.component("comp1").physics("es").create("ccnp1", "ChargeConservationPiezo");
    model.component("comp1").physics("es").feature("ccnp1").selection().all();
    model.component("comp1").physics().create("solid", "SolidMechanics", "geom1");
    model.component("comp1").physics("solid").create("pzm1", "PiezoelectricMaterialModel");
    model.component("comp1").physics("solid").feature("pzm1").selection().all();
    model.component("comp1").physics().create("es2", "Electrostatics", "geom1");
    model.component("comp1").physics("es2").create("ccnp1", "ChargeConservationPiezo");
    model.component("comp1").physics("es2").feature("ccnp1").selection().all();
    model.component("comp1").physics().create("solid2", "SolidMechanics", "geom1");
    model.component("comp1").physics("solid2").create("pzm1", "PiezoelectricMaterialModel");
    model.component("comp1").physics("solid2").feature("pzm1").selection().all();
    model.component("comp1").physics().create("es3", "Electrostatics", "geom1");
    model.component("comp1").physics("es3").create("ccnp1", "ChargeConservationPiezo");
    model.component("comp1").physics("es3").feature("ccnp1").selection().all();
    model.component("comp1").physics().create("solid3", "SolidMechanics", "geom1");
    model.component("comp1").physics("solid3").create("pzm1", "PiezoelectricMaterialModel");
    model.component("comp1").physics("solid3").feature("pzm1").selection().all();

    model.component("comp1").multiphysics().create("pze1", "PiezoelectricEffect", 2);
    model.component("comp1").multiphysics("pze1").set("Solid_physics", "solid");
    model.component("comp1").multiphysics("pze1").set("Electrostatics_physics", "es");
    model.component("comp1").multiphysics().create("pze2", "PiezoelectricEffect", 2);
    model.component("comp1").multiphysics("pze2").set("Solid_physics", "solid2");
    model.component("comp1").multiphysics("pze2").set("Electrostatics_physics", "es2");
    model.component("comp1").multiphysics().create("pze3", "PiezoelectricEffect", 2);
    model.component("comp1").multiphysics("pze3").set("Solid_physics", "solid3");
    model.component("comp1").multiphysics("pze3").set("Electrostatics_physics", "es3");

    model.study().create("std1");
    model.study("std1").create("eig", "Eigenfrequency");
    model.study("std1").feature("eig").set("chkeigregion", true);
    model.study("std1").feature("eig").set("storefact", false);
    model.study("std1").feature("eig").set("linpsolnum", "auto");
    model.study("std1").feature("eig").set("solnum", "auto");
    model.study("std1").feature("eig").set("notsolnum", "auto");
    model.study("std1").feature("eig").set("outputmap", new String[]{});
    model.study("std1").feature("eig").set("ngenAUX", "1");
    model.study("std1").feature("eig").set("goalngenAUX", "1");
    model.study("std1").feature("eig").set("ngenAUX", "1");
    model.study("std1").feature("eig").set("goalngenAUX", "1");

    model.component("comp1").common().create("mpf1", "ParticipationFactors");

//    Define and specify the parameters of the model.
//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, locate the Parameters section.
//    In the table, enter the following settings:

    model.param().set("lambdaD", "8.97[um]");
    model.param().descr("lambdaD", "Design period");
    model.param().set("h_el", "100[nm]");
    model.param().descr("h_el", "Electrode height");
    model.param().set("l_el", "0.25*lambdaD");
    model.param().descr("l_el", "Electrode width");
    model.param().set("W", "100*lambdaD");
    model.param().descr("W", "Aperture");
    model.param().set("h_sub", "8*lambdaD");
    model.param().descr("h_sub", "Substrate height");
    model.param().set("L_PML", "3*lambdaD");
    model.param().descr("L_PML", "PML width");
    model.param().set("c_0", "3997.8[m/s]");
    model.param().descr("c_0", "Expected free SAW velocity");
    model.param().set("f_0", "0.98*c_0/lambdaD");
    model.param().descr("f_0", "Initial guess for eigenfrequency");

//    Create the geometry for the free unit cell. Use microns as the geometry unit.
//    In the Model Builder window, under Component 1 (comp1), click Geometry 1.
//    In the Settings window for Geometry, locate the Units section.
//    From the Length unit list, select µm.

    model.component("comp1").geom("geom1").lengthUnit("\u00b5m");

//    In the Geometry toolbar, click Rectangle.

    model.component("comp1").geom("geom1").create("r1", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type lambdaD.

    model.component("comp1").geom("geom1").feature("r1").set("size", new String[]{"lambdaD", "1"});

//    In the Height text field, type h_sub.

    model.component("comp1").geom("geom1").feature("r1").set("size", new String[]{"lambdaD", "h_sub"});

//    Click to expand the Layers section.
//    In the table, enter the following settings:

    model.component("comp1").geom("geom1").feature("r1").setIndex("layer", "L_PML", 0);

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("r1");

//    Create the geometry for the unit cell with IDT.
//    In the Geometry toolbar, click Transforms and choose Copy.

    model.component("comp1").geom("geom1").create("copy1", "Copy");

//    Select the object r1.

    model.component("comp1").geom("geom1").feature("copy1").selection("input").set("r1");

//    In the Settings window for Copy, locate the Displacement section.
//    In the x text field, type lambdaD*2.

    model.component("comp1").geom("geom1").feature("copy1").set("displx", "lambdaD*2");

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("copy1");

//    In the Geometry toolbar, click Rectangle.

    model.component("comp1").geom("geom1").create("r2", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type l_el.

    model.component("comp1").geom("geom1").feature("r2").set("size", new String[]{"l_el", "1"});

//    In the Height text field, type h_el.

    model.component("comp1").geom("geom1").feature("r2").set("size", new String[]{"l_el", "h_el"});

//    Locate the Position section.
//    In the x text field, type lambdaD*2+lambdaD/8.

    model.component("comp1").geom("geom1").feature("r2").set("pos", new String[]{"lambdaD*2+lambdaD/8", "0"});

//    In the y text field, type h_sub.

    model.component("comp1").geom("geom1").feature("r2").setIndex("pos", "h_sub", 1);

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("r2");

//    In the Geometry toolbar, click Transforms and choose Array.

    model.component("comp1").geom("geom1").create("arr1", "Array");

//    Select the object r2.

    model.component("comp1").geom("geom1").feature("arr1").selection("input").set("r2");

//    In the Settings window for Array, locate the Size section.
//    From the Array type list, select Linear.

    model.component("comp1").geom("geom1").feature("arr1").set("type", "linear");

//    In the Size text field, type 2.

    model.component("comp1").geom("geom1").feature("arr1").set("linearsize", 2);

//    Locate the Displacement section.
//    In the x text field, type lambdaD/2.

    model.component("comp1").geom("geom1").feature("arr1").set("displ", new String[]{"lambdaD/2", "0"});

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("arr1");

//    Create the geometry for the grounded unit cell.
//    In the Geometry toolbar, click Transforms and choose Copy.

    model.component("comp1").geom("geom1").create("copy2", "Copy");

//    Click the Select Box button in the Graphics toolbar.
//    Select the object r1.

    model.component("comp1").geom("geom1").feature("copy2").selection("input").set("r1");

//    In the Settings window for Copy, locate the Displacement section.
//    In the x text field, type lambdaD*4.

    model.component("comp1").geom("geom1").feature("copy2").set("displx", "lambdaD*4");

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("copy2");

//    Define selections for the various domains and boundaries.
//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel1", "Explicit");

    model.component("comp1").geom("geom1").run();

//    In the Settings window for Explicit, type Substrate in the Label text field.

    model.component("comp1").selection("sel1").label("Substrate");

//    Select Domains 1, 2, 3, 4, 7, 8.

    model.component("comp1").selection("sel1").set(1, 2, 3, 4, 7, 8);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel2", "Explicit");

//    In the Settings window for Explicit, type PML in the Label text field.

    model.component("comp1").selection("sel2").label("PML");

//    Select Domains 1, 3, 7.

    model.component("comp1").selection("sel2").set(1, 3, 7);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel3", "Explicit");

//    In the Settings window for Explicit, type IDT in the Label text field.

    model.component("comp1").selection("sel3").label("IDT");

//    Select Domains 5, 6.

    model.component("comp1").selection("sel3").set(5, 6);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel4", "Explicit");

//    In the Settings window for Explicit, type Free Unit Cell in the Label text field.

    model.component("comp1").selection("sel4").label("Free Unit Cell");

//    Click the Select Box button in the Graphics toolbar.
//    Select Domains 1, 2.

    model.component("comp1").selection("sel4").set(1, 2);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel5", "Explicit");

//    In the Settings window for Explicit, type IDT Unit Cell in the Label text field.

    model.component("comp1").selection("sel5").label("IDT Unit Cell");

//    Click the Select Box button in the Graphics toolbar.
//    Select Domains 3, 4, 5, 6.

    model.component("comp1").selection("sel5").set(3, 4, 5, 6);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel6", "Explicit");

//    In the Settings window for Explicit, type Grounded Unit Cell in the Label text field.

    model.component("comp1").selection("sel6").label("Grounded Unit Cell");

//    Click the Select Box button in the Graphics toolbar.
//    Select Domains 7, 8.

    model.component("comp1").selection("sel6").set(7, 8);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel7", "Explicit");

//    In the Settings window for Explicit, locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel7").geom(1);

//    In the Label text field, type Periodic.

    model.component("comp1").selection("sel7").label("Periodic");

//    Select Boundaries 1, 3, 6, 7, 8, 10, 23, 24, 25, 27, 30, 31.

    model.component("comp1").selection("sel7").set(1, 3, 6, 7, 8, 10, 23, 24, 25, 27, 30, 31);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel8", "Explicit");

//    In the Settings window for Explicit, type Fixed in the Label text field.

    model.component("comp1").selection("sel8").label("Fixed");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel8").geom(1);

//    Select Boundaries 2, 9, 26.

    model.component("comp1").selection("sel8").set(2, 9, 26);

//    Define operators that could be useful in results processing.
//    In the Definitions toolbar, click Nonlocal Couplings and choose Maximum.

    model.component("comp1").cpl().create("maxop1", "Maximum");

//    In the Settings window for Maximum, locate the Source Selection section.
//    From the Selection list, select Free Unit Cell.

    model.component("comp1").cpl("maxop1").selection().named("sel4");

//    In the Definitions toolbar, click Nonlocal Couplings and choose Maximum.

    model.component("comp1").cpl().create("maxop2", "Maximum");

//    In the Settings window for Maximum, locate the Source Selection section.
//    From the Selection list, select IDT Unit Cell.

    model.component("comp1").cpl("maxop2").selection().named("sel5");

//    In the Definitions toolbar, click Nonlocal Couplings and choose Maximum.

    model.component("comp1").cpl().create("maxop3", "Maximum");

//    In the Settings window for Maximum, locate the Source Selection section.
//    From the Selection list, select Grounded Unit Cell.

    model.component("comp1").cpl("maxop3").selection().named("sel6");

//    Define a rotated system for the 128 YX-cut lithium niobate.
//    In the Definitions toolbar, click Coordinate Systems and choose Rotated System.

    model.component("comp1").coordSystem().create("sys2", "Rotated");

//    In the Settings window for Rotated System, locate the Rotation section.
//    From the Input method list, select General rotation.

    model.component("comp1").coordSystem("sys2").set("method", "general");

//    Find the Euler angles subsection.
//    In the β text field, type -38[deg]-90[deg].

    model.component("comp1").coordSystem("sys2").set("angle", new String[]{"0", "-38[deg]-90[deg]", "0"});

//    Define a perfectly matched layer.
//    In the Definitions toolbar, click Perfectly Matched Layer.

    model.component("comp1").coordSystem().create("pml1", "PML");

//    In the Settings window for Perfectly Matched Layer, locate the Domain Selection section.
//    From the Selection list, select PML.

    model.component("comp1").coordSystem("pml1").selection().named("sel2");

//    Add materials and assign the domains they belong to.
//    In the Materials toolbar, click Add Material to open the Add Material window.
//    In the tree, select MEMS > Metals > Al - Aluminum.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").propertyGroup()
         .create("Enu", "Enu", "Young's modulus and Poisson's ratio");
    model.component("comp1").material("mat1").label("Al - Aluminum");
    model.component("comp1").material("mat1").set("family", "aluminum");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("electricconductivity", new String[]{"35.5e6[S/m]", "0", "0", "0", "35.5e6[S/m]", "0", "0", "0", "35.5e6[S/m]"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalexpansioncoefficient", new String[]{"23.1e-6[1/K]", "0", "0", "0", "23.1e-6[1/K]", "0", "0", "0", "23.1e-6[1/K]"});
    model.component("comp1").material("mat1").propertyGroup("def").set("heatcapacity", "904[J/(kg*K)]");
    model.component("comp1").material("mat1").propertyGroup("def").set("density", "2700[kg/m^3]");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalconductivity", new String[]{"237[W/(m*K)]", "0", "0", "0", "237[W/(m*K)]", "0", "0", "0", "237[W/(m*K)]"});
    model.component("comp1").material("mat1").propertyGroup("Enu").set("E", "70.0e9[Pa]");
    model.component("comp1").material("mat1").propertyGroup("Enu").set("nu", "0.35");

//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Selection list, select IDT.

    model.component("comp1").material("mat1").selection().named("sel3");

//    In the tree, select Piezoelectric > Lithium Niobate.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat2", "Common");
    model.component("comp1").material("mat2").propertyGroup()
         .create("StrainCharge", "StrainCharge", "Strain-charge form");
    model.component("comp1").material("mat2").propertyGroup()
         .create("StressCharge", "StressCharge", "Stress-charge form");
    model.component("comp1").material("mat2").label("Lithium Niobate");
    model.component("comp1").material("mat2").set("family", "custom");
    model.component("comp1").material("mat2").set("customspecular", new double[]{0.7843137254901961, 1, 1});
    model.component("comp1").material("mat2").set("diffuse", "custom");
    model.component("comp1").material("mat2")
         .set("customdiffuse", new double[]{0.7843137254901961, 0.7843137254901961, 0.7843137254901961});
    model.component("comp1").material("mat2").set("ambient", "custom");
    model.component("comp1").material("mat2")
         .set("customambient", new double[]{0.7843137254901961, 0.7843137254901961, 0.7843137254901961});
    model.component("comp1").material("mat2").set("noise", true);
    model.component("comp1").material("mat2").set("fresnel", 0.9);
    model.component("comp1").material("mat2").set("roughness", 0.1);
    model.component("comp1").material("mat2").set("diffusewrap", 0);
    model.component("comp1").material("mat2").set("reflectance", 0);
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("relpermittivity", new String[]{"43.6", "0", "0", "0", "43.6", "0", "0", "0", "29.16"});
    model.component("comp1").material("mat2").propertyGroup("def").set("density", "4700[kg/m^3]");
    model.component("comp1").material("mat2").propertyGroup("StrainCharge").label("Strain-charge form");
    model.component("comp1").material("mat2").propertyGroup("StrainCharge")
         .set("sE", new String[]{"5.78e-012[1/Pa]", "-1.01e-012[1/Pa]", "-1.47e-012[1/Pa]", "-1.02e-012[1/Pa]", "0[1/Pa]", "0[1/Pa]", "-1.01e-012[1/Pa]", "5.78e-012[1/Pa]", "-1.47e-012[1/Pa]", "1.02e-012[1/Pa]", 
         "0[1/Pa]", "0[1/Pa]", "-1.47e-012[1/Pa]", "-1.47e-012[1/Pa]", "5.02e-012[1/Pa]", "0[1/Pa]", "0[1/Pa]", "0[1/Pa]", "-1.02e-012[1/Pa]", "1.02e-012[1/Pa]", 
         "0[1/Pa]", "1.7e-011[1/Pa]", "0[1/Pa]", "0[1/Pa]", "0[1/Pa]", "0[1/Pa]", "0[1/Pa]", "0[1/Pa]", "1.7e-011[1/Pa]", "-2.04e-012[1/Pa]", 
         "0[1/Pa]", "0[1/Pa]", "0[1/Pa]", "0[1/Pa]", "-2.04e-012[1/Pa]", "1.36e-011[1/Pa]"});
    model.component("comp1").material("mat2").propertyGroup("StrainCharge")
         .set("dET", new String[]{"0[C/N]", "-2.1e-011[C/N]", "-1e-012[C/N]", "0[C/N]", "2.1e-011[C/N]", "-1e-012[C/N]", "0[C/N]", "0[C/N]", "6e-012[C/N]", "0[C/N]", 
         "6.8e-011[C/N]", "0[C/N]", "6.8e-011[C/N]", "0[C/N]", "0[C/N]", "-4.2e-011[C/N]", "0[C/N]", "0[C/N]"});
    model.component("comp1").material("mat2").propertyGroup("StrainCharge")
         .set("epsilonrT", new String[]{"84", "0", "0", "0", "84", "0", "0", "0", "30"});
    model.component("comp1").material("mat2").propertyGroup("StressCharge").label("Stress-charge form");
    model.component("comp1").material("mat2").propertyGroup("StressCharge")
         .set("cE", new String[]{"2.02897e+011[Pa]", "5.29177e+010[Pa]", "7.49098e+010[Pa]", "8.99874e+009[Pa]", "0[Pa]", "0[Pa]", "5.29177e+010[Pa]", "2.02897e+011[Pa]", "7.49098e+010[Pa]", "-8.99874e+009[Pa]", 
         "0[Pa]", "0[Pa]", "7.49098e+010[Pa]", "7.49098e+010[Pa]", "2.43075e+011[Pa]", "0[Pa]", "0[Pa]", "0[Pa]", "8.99874e+009[Pa]", "-8.99874e+009[Pa]", 
         "0[Pa]", "5.99034e+010[Pa]", "0[Pa]", "0[Pa]", "0[Pa]", "0[Pa]", "0[Pa]", "0[Pa]", "5.99018e+010[Pa]", "8.98526e+009[Pa]", 
         "0[Pa]", "0[Pa]", "0[Pa]", "0[Pa]", "8.98526e+009[Pa]", "7.48772e+010[Pa]"});
    model.component("comp1").material("mat2").propertyGroup("StressCharge")
         .set("eES", new String[]{"0[C/m^2]", "-2.53764[C/m^2]", "0.193644[C/m^2]", "0[C/m^2]", "2.53764[C/m^2]", "0.193644[C/m^2]", "0[C/m^2]", "0[C/m^2]", "1.30863[C/m^2]", "0[C/m^2]", 
         "3.69548[C/m^2]", "0[C/m^2]", "3.69594[C/m^2]", "0[C/m^2]", "0[C/m^2]", "-2.53384[C/m^2]", "0[C/m^2]", "0[C/m^2]"});
    model.component("comp1").material("mat2").propertyGroup("StressCharge")
         .set("epsilonrS", new String[]{"43.6", "0", "0", "0", "43.6", "0", "0", "0", "29.16"});

//    In the Materials toolbar, click Add Material to close the Add Material window.
//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Selection list, select Substrate.

    model.component("comp1").material("mat2").selection().named("sel1");

//    Specify the settings for the <l>Electrostatics</l> and <l>Solid Mechanics</l> interfaces in the free unit cell.
//    In the Model Builder window, under Component 1 (comp1), click Electrostatics (es).
//    In the Settings window for Electrostatics, locate the Domain Selection section.
//    From the Selection list, select Free Unit Cell.

    model.component("comp1").physics("es").selection().named("sel4");

//    Locate the Thickness section.
//    In the \[d\] text field, type W.

    model.component("comp1").physics("es").prop("d").set("d", "W");

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("es").create("pc1", "PeriodicCondition", 1);

//    In the Settings window for Periodic Condition, locate the Boundary Selection section.
//    From the Selection list, select Periodic.

    model.component("comp1").physics("es").feature("pc1").selection().named("sel7");

//    In the Model Builder window, under Component 1 (comp1), click Solid Mechanics (solid).
//    In the Settings window for Solid Mechanics, locate the Domain Selection section.
//    From the Selection list, select Free Unit Cell.

    model.component("comp1").physics("solid").selection().named("sel4");

//    Locate the 2D Approximation section.
//    Select the Out-of-plane mode extension (time-harmonic) checkbox.

    model.component("comp1").physics("solid").prop("Type2D").set("ModeExtension", true);

//    Locate the Thickness section.
//    In the \[d\] text field, type W.

    model.component("comp1").physics("solid").prop("d").set("d", "W");

//    In the Model Builder window, under Component 1 (comp1) > Solid Mechanics (solid), click Piezoelectric Material 1.
//    In the Settings window for Piezoelectric Material, locate the Coordinate System Selection section.
//    From the Coordinate system list, select Rotated System 2 (sys2).

    model.component("comp1").physics("solid").feature("pzm1").set("coordinateSystem", "sys2");

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("solid").create("pc1", "PeriodicCondition", 1);

//    In the Settings window for Periodic Condition, locate the Boundary Selection section.
//    From the Selection list, select Periodic.

    model.component("comp1").physics("solid").feature("pc1").selection().named("sel7");

//    In the Physics toolbar, click Boundaries and choose Fixed Constraint.

    model.component("comp1").physics("solid").create("fix1", "Fixed", 1);

//    In the Settings window for Fixed Constraint, locate the Boundary Selection section.
//    From the Selection list, select Fixed.

    model.component("comp1").physics("solid").feature("fix1").selection().named("sel8");

//    Specify the settings for the <l>Electrostatics</l> and <l>Solid Mechanics</l> interfaces in the IDT unit cell.
//    In the Model Builder window, under Component 1 (comp1), click Electrostatics 2 (es2).
//    In the Settings window for Electrostatics, locate the Domain Selection section.
//    From the Selection list, select IDT Unit Cell.

    model.component("comp1").physics("es2").selection().named("sel5");

//    Locate the Thickness section.
//    In the \[d\] text field, type W.

    model.component("comp1").physics("es2").prop("d").set("d", "W");

//    In the Physics toolbar, click Boundaries and choose Boundary Terminal.

    model.component("comp1").physics("es2").create("term1", "Terminal", 1);

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("es2").create("pc1", "PeriodicCondition", 1);

//    In the Settings window for Periodic Condition, locate the Boundary Selection section.
//    From the Selection list, select Periodic.

    model.component("comp1").physics("es2").feature("pc1").selection().named("sel7");

//    In the Model Builder window, click Charge Conservation, Piezoelectric 1.
//    In the Settings window for Charge Conservation, Piezoelectric, locate the Domain Selection section.
//    From the Selection list, select Substrate.

    model.component("comp1").physics("es2").feature("ccnp1").selection().named("sel1");

//    In the Model Builder window, click Boundary Terminal 1.
//    In the Settings window for Boundary Terminal, locate the Boundary Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 19 in the Selection text field.
//    Click OK.

    model.component("comp1").physics("es2").feature("term1").selection().set(19);

//    In the Settings window for Boundary Terminal, locate the Terminal section.
//    From the Terminal type list, select Voltage.

    model.component("comp1").physics("es2").feature("term1").set("TerminalType", "Voltage");

//    In the Physics toolbar, click Boundaries and choose Ground.

    model.component("comp1").physics("es2").create("gnd1", "Ground", 1);

//    In the Settings window for Ground, locate the Boundary Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 14 in the Selection text field.
//    Click OK.

    model.component("comp1").physics("es2").feature("gnd1").selection().set(14);

//    In the Model Builder window, under Component 1 (comp1), click Solid Mechanics 2 (solid2).
//    In the Settings window for Solid Mechanics, locate the Domain Selection section.
//    From the Selection list, select IDT Unit Cell.

    model.component("comp1").physics("solid2").selection().named("sel5");

//    Locate the 2D Approximation section.
//    Select the Out-of-plane mode extension (time-harmonic) checkbox.

    model.component("comp1").physics("solid2").prop("Type2D").set("ModeExtension", true);

//    Locate the Thickness section.
//    In the \[d\] text field, type W.

    model.component("comp1").physics("solid2").prop("d").set("d", "W");

//    In the Model Builder window, under Component 1 (comp1) > Solid Mechanics 2 (solid2), click Piezoelectric Material 1.
//    In the Settings window for Piezoelectric Material, locate the Domain Selection section.
//    From the Selection list, select Substrate.

    model.component("comp1").physics("solid2").feature("pzm1").selection().named("sel1");

//    Locate the Coordinate System Selection section.
//    From the Coordinate system list, select Rotated System 2 (sys2).

    model.component("comp1").physics("solid2").feature("pzm1").set("coordinateSystem", "sys2");

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("solid2").create("pc1", "PeriodicCondition", 1);

//    In the Settings window for Periodic Condition, locate the Boundary Selection section.
//    From the Selection list, select Periodic.

    model.component("comp1").physics("solid2").feature("pc1").selection().named("sel7");

//    In the Physics toolbar, click Boundaries and choose Fixed Constraint.

    model.component("comp1").physics("solid2").create("fix1", "Fixed", 1);

//    In the Settings window for Fixed Constraint, locate the Boundary Selection section.
//    From the Selection list, select Fixed.

    model.component("comp1").physics("solid2").feature("fix1").selection().named("sel8");

//    Specify the settings for the <l>Electrostatics</l> and <l>Solid Mechanics</l> interfaces in the grounded unit cell.
//    In the Model Builder window, under Component 1 (comp1), click Electrostatics 3 (es3).
//    In the Settings window for Electrostatics, locate the Domain Selection section.
//    From the Selection list, select Grounded Unit Cell.

    model.component("comp1").physics("es3").selection().named("sel6");

//    Locate the Thickness section.
//    In the \[d\] text field, type W.

    model.component("comp1").physics("es3").prop("d").set("d", "W");

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("es3").create("pc1", "PeriodicCondition", 1);

//    In the Settings window for Periodic Condition, locate the Boundary Selection section.
//    From the Selection list, select Periodic.

    model.component("comp1").physics("es3").feature("pc1").selection().named("sel7");

//    In the Physics toolbar, click Boundaries and choose Ground.

    model.component("comp1").physics("es3").create("gnd1", "Ground", 1);

//    Select Boundary 29.

    model.component("comp1").physics("es3").feature("gnd1").selection().set(29);

//    In the Model Builder window, under Component 1 (comp1), click Solid Mechanics 3 (solid3).
//    In the Settings window for Solid Mechanics, locate the Domain Selection section.
//    From the Selection list, select Grounded Unit Cell.

    model.component("comp1").physics("solid3").selection().named("sel6");

//    Locate the 2D Approximation section.
//    Select the Out-of-plane mode extension (time-harmonic) checkbox.

    model.component("comp1").physics("solid3").prop("Type2D").set("ModeExtension", true);

//    Locate the Thickness section.
//    In the \[d\] text field, type W.

    model.component("comp1").physics("solid3").prop("d").set("d", "W");

//    In the Model Builder window, under Component 1 (comp1) > Solid Mechanics 3 (solid3), click Piezoelectric Material 1.
//    In the Settings window for Piezoelectric Material, locate the Coordinate System Selection section.
//    From the Coordinate system list, select Rotated System 2 (sys2).

    model.component("comp1").physics("solid3").feature("pzm1").set("coordinateSystem", "sys2");

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("solid3").create("pc1", "PeriodicCondition", 1);

//    In the Settings window for Periodic Condition, locate the Boundary Selection section.
//    From the Selection list, select Periodic.

    model.component("comp1").physics("solid3").feature("pc1").selection().named("sel7");

//    In the Physics toolbar, click Boundaries and choose Fixed Constraint.

    model.component("comp1").physics("solid3").create("fix1", "Fixed", 1);

//    In the Settings window for Fixed Constraint, locate the Boundary Selection section.
//    From the Selection list, select Fixed.

    model.component("comp1").physics("solid3").feature("fix1").selection().named("sel8");

//    Create the mesh for the free, IDT and grounded unit cells.
//    In the Model Builder window, under Component 1 (comp1), click Mesh 1.
//    In the Settings window for Mesh, type Mesh Free in the Label text field.

    model.component("comp1").mesh("mesh1").label("Mesh Free");

    return model;
  }

  public static Model run2(Model model) {

//    Locate the Sequence Type section.
//    From the list, select User-controlled mesh.

    model.component("comp1").mesh("mesh1").automatic(false);

//    In the Model Builder window, under Component 1 (comp1) > Mesh Free, Ctrl-click to select Identical Mesh 1, Identical Mesh 2, Identical Mesh 3, Distribution 1, Free Triangular 1, Mapped 1.
//    Right-click and choose Delete.

    model.component("comp1").mesh("mesh1").feature().remove("id1");
    model.component("comp1").mesh("mesh1").feature().remove("id2");
    model.component("comp1").mesh("mesh1").feature().remove("id3");
    model.component("comp1").mesh("mesh1").feature().remove("dis1");
    model.component("comp1").mesh("mesh1").feature().remove("ftri1");
    model.component("comp1").mesh("mesh1").feature().remove("map1");

//    In the Settings window for Size, locate the Element Size section.
//    Click the Custom button.

    model.component("comp1").mesh("mesh1").feature("size").set("custom", true);

//    Locate the Element Size Parameters section.
//    In the Maximum element size text field, type lambdaD/20.

    model.component("comp1").mesh("mesh1").feature("size").set("hmax", "lambdaD/20");

//    In the Minimum element size text field, type lambdaD/20.

    model.component("comp1").mesh("mesh1").feature("size").set("hmin", "lambdaD/20");

//    In the Mesh toolbar, click More Generators and choose Edge.

    model.component("comp1").mesh("mesh1").create("edg1", "Edge");

//    Select Boundaries 1, 3, 6, 7.

    model.component("comp1").mesh("mesh1").feature("edg1").selection().set(1, 3, 6, 7);

//    Right-click Edge 1 and choose Distribution.

    model.component("comp1").mesh("mesh1").feature("edg1").create("dis1", "Distribution");

//    Select Boundaries 1, 6.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis1").selection().set(1, 6);

//    In the Settings window for Distribution, locate the Distribution section.
//    In the Number of elements text field, type 10.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis1").set("numelem", 10);

//    In the Mesh toolbar, click Mapped.

    model.component("comp1").mesh("mesh1").create("map1", "Map");

//    In the Settings window for Mapped, locate the Domain Selection section.
//    From the Geometric entity level list, select Domain.

    model.component("comp1").mesh("mesh1").feature("map1").selection().geom("geom1", 2);

//    Select Domains 1, 2.

    model.component("comp1").mesh("mesh1").feature("map1").selection().set(1, 2);

//    Click Build All.

    model.component("comp1").mesh("mesh1").run();

//    In the Mesh toolbar, click Add Mesh and choose Add Mesh.

    model.component("comp1").mesh().create("mesh2");

//    In the Settings window for Mesh, type Mesh IDT in the Label text field.

    model.component("comp1").mesh("mesh2").label("Mesh IDT");

//    Locate the Sequence Type section.
//    From the list, select User-controlled mesh.

    model.component("comp1").mesh("mesh2").automatic(false);

//    In the Model Builder window, under Component 1 (comp1) > Meshes > Mesh IDT, Ctrl-click to select Identical Mesh 1, Identical Mesh 2, Identical Mesh 3, Distribution 1, Free Triangular 1, Mapped 1.
//    Right-click and choose Delete.

    model.component("comp1").mesh("mesh2").feature().remove("id1");
    model.component("comp1").mesh("mesh2").feature().remove("id2");
    model.component("comp1").mesh("mesh2").feature().remove("id3");
    model.component("comp1").mesh("mesh2").feature().remove("dis1");
    model.component("comp1").mesh("mesh2").feature().remove("ftri1");
    model.component("comp1").mesh("mesh2").feature().remove("map1");

//    In the Settings window for Size, locate the Element Size section.
//    Click the Custom button.

    model.component("comp1").mesh("mesh2").feature("size").set("custom", true);

//    Locate the Element Size Parameters section.
//    In the Maximum element size text field, type lambdaD/20.

    model.component("comp1").mesh("mesh2").feature("size").set("hmax", "lambdaD/20");

//    In the Minimum element size text field, type lambdaD/20.

    model.component("comp1").mesh("mesh2").feature("size").set("hmin", "lambdaD/20");

//    In the Mesh toolbar, click More Generators and choose Edge.

    model.component("comp1").mesh("mesh2").create("edg1", "Edge");

//    Select Boundaries 8, 10.

    model.component("comp1").mesh("mesh2").feature("edg1").selection().set(8, 10);

//    Right-click Edge 1 and choose Distribution.

    model.component("comp1").mesh("mesh2").feature("edg1").create("dis1", "Distribution");

//    Select Boundary 8.

    model.component("comp1").mesh("mesh2").feature("edg1").feature("dis1").selection().set(8);

//    In the Settings window for Distribution, locate the Distribution section.
//    In the Number of elements text field, type 10.

    model.component("comp1").mesh("mesh2").feature("edg1").feature("dis1").set("numelem", 10);

//    In the Mesh toolbar, click Mapped.

    model.component("comp1").mesh("mesh2").create("map1", "Map");

//    In the Settings window for Mapped, locate the Domain Selection section.
//    From the Geometric entity level list, select Domain.

    model.component("comp1").mesh("mesh2").feature("map1").selection().geom("geom1", 2);

//    Click Paste Selection.
//    In the Paste Selection dialog, type 5 6 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh2").feature("map1").selection().set(5, 6);

//    Right-click Mapped 1 and choose Distribution.

    model.component("comp1").mesh("mesh2").feature("map1").create("dis1", "Distribution");

//    In the Settings window for Distribution, locate the Boundary Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 16 21 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh2").feature("map1").feature("dis1").selection().set(16, 21);

//    In the Settings window for Distribution, locate the Distribution section.
//    In the Number of elements text field, type 2.

    model.component("comp1").mesh("mesh2").feature("map1").feature("dis1").set("numelem", 2);

//    Click Build Selected.

    model.component("comp1").mesh("mesh2").run("map1");

//    In the Mesh toolbar, click More Generators and choose Edge.

    model.component("comp1").mesh("mesh2").create("edg2", "Edge");

//    In the Settings window for Edge, locate the Boundary Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 12 17 22 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh2").feature("edg2").selection().set(12, 17, 22);

//    In the Settings window for Edge, click Build Selected.

    model.component("comp1").mesh("mesh2").run("edg2");

//    In the Model Builder window, right-click Mesh IDT and choose Copying Operations > Copy Edge.

    model.component("comp1").mesh("mesh2").create("cpe1", "CopyEdge");
    model.component("comp1").mesh("mesh2").feature("cpe1").selection("source").geom(1);
    model.component("comp1").mesh("mesh2").feature("cpe1").selection("destination").geom(1);

//    In the Settings window for Copy Edge, locate the Source Boundaries section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 12 14 17 19 22 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh2").feature("cpe1").selection("source").set(12, 14, 17, 19, 22);

//    In the Settings window for Copy Edge, locate the Destination Boundaries section.
//    Select the Activate Selection toggle button.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 9 11 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh2").feature("cpe1").selection("destination").set(9, 11);

//    In the Settings window for Copy Edge, click Build Selected.

    model.component("comp1").mesh("mesh2").run("cpe1");

//    In the Mesh toolbar, click Mapped.

    model.component("comp1").mesh("mesh2").create("map2", "Map");

//    In the Settings window for Mapped, locate the Domain Selection section.
//    From the Geometric entity level list, select Domain.

    model.component("comp1").mesh("mesh2").feature("map2").selection().geom("geom1", 2);

//    Click Paste Selection.
//    In the Paste Selection dialog, type 3 4 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh2").feature("map2").selection().set(3, 4);

//    Right-click Mapped 2 and choose Distribution.

    model.component("comp1").mesh("mesh2").feature("map2").create("dis1", "Distribution");

//    In the Settings window for Distribution, locate the Boundary Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 8 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh2").feature("map2").feature("dis1").selection().set(8);

//    In the Settings window for Distribution, locate the Distribution section.
//    In the Number of elements text field, type 10.

    model.component("comp1").mesh("mesh2").feature("map2").feature("dis1").set("numelem", 10);

//    In the Model Builder window, right-click Mapped 2 and choose Build All.

    model.component("comp1").mesh("mesh2").run();

//    In the Model Builder window, right-click Component 1 (comp1) > Meshes > Mesh Free and choose Duplicate.

    model.component("comp1").mesh().duplicate("mesh3", "mesh1");

//    In the Settings window for Mesh, type Mesh Grounded in the Label text field.

    model.component("comp1").mesh("mesh3").label("Mesh Grounded");

//    In the Model Builder window, expand the Mesh Grounded node, then click Edge 1.
//    In the Settings window for Edge, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").mesh("mesh3").feature("edg1").selection().set();

//    Select Boundaries 25, 27, 30, 31.

    model.component("comp1").mesh("mesh3").feature("edg1").selection().set(25, 27, 30, 31);

//    In the Model Builder window, expand the Edge 1 node, then click Distribution 1.
//    In the Settings window for Distribution, locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").mesh("mesh3").feature("edg1").feature("dis1").selection().set();

//    Select Boundaries 25, 30.

    model.component("comp1").mesh("mesh3").feature("edg1").feature("dis1").selection().set(25, 30);

//    In the Model Builder window, under Component 1 (comp1) > Meshes > Mesh Grounded, click Mapped 1.
//    In the Settings window for Mapped, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").mesh("mesh3").feature("map1").selection().set();

//    Select Domains 7, 8.

    model.component("comp1").mesh("mesh3").feature("map1").selection().set(7, 8);

//    Click Build All.

    model.component("comp1").mesh("mesh3").run();

//    In the Model Builder window, click Study 1.
//    In the Settings window for Study, type Free in the Label text field.

    model.study("std1").label("Free");

//    Set up <l>Eigenfrequency</l> study to search around <c>f_0</c> MHz.
//    In the Model Builder window, under Free, click Step 1: Eigenfrequency.
//    In the Settings window for Eigenfrequency, locate the Study Settings section.
//    Select the Desired number of eigenfrequencies checkbox.

    model.study("std1").feature("eig").set("neigsactive", true);

//    In the associated text field, type 2.

    model.study("std1").feature("eig").set("neigs", 2);

//    From the Unit list, select MHz.

    model.study("std1").feature("eig").set("eigunit", "MHz");

//    In the Search for eigenfrequencies around shift text field, type f_0.

    model.study("std1").feature("eig").set("shift", "f_0");
    model.study("std1").feature("eig").setSolveFor("/physics/es2", false);

//    Locate the Physics and Variables Selection section.

    model.study("std1").feature("eig").setSolveFor("/physics/solid2", false);
    model.study("std1").feature("eig").setSolveFor("/physics/es3", false);
    model.study("std1").feature("eig").setSolveFor("/physics/solid3", false);
    model.study("std1").feature("eig").setSolveFor("/multiphysics/pze2", false);
    model.study("std1").feature("eig").setSolveFor("/multiphysics/pze3", false);

//    In the Solve for column of the table, under Component 1 (comp1), clear the checkboxes for Electrostatics 2 (es2), Solid Mechanics 2 (solid2), Electrostatics 3 (es3), Solid Mechanics 3 (solid3).
//    In the Solve for column of the table, under Component 1 (comp1) > Multiphysics, clear the checkboxes for Piezoelectricity 2 (pze2), Piezoelectricity 3 (pze3).
//    Instead of using all geometric entities, select only Free Unit Cell.
//    In the Study toolbar, click Show Default Solver.

    model.study("std1").showAutoSequences("all");

//    In the Model Builder window, expand the Solution 1 (sol1) node, then click Compile Equations: Eigenfrequency.
//    In the Settings window for Compile Equations, locate the Geometric Entity Selection section.
//    From the Use entities list, select Selected.

    model.sol("sol1").feature("st1").set("useent", "selected");

//    Under Selections, click Add.
//    In the Add dialog, select Free Unit Cell in the Selections list.
//    Click OK.

    model.sol("sol1").feature("st1").set("entsel", new String[]{"sel4"});

//    In the Study toolbar, click Compute.

    model.study("std1").createAutoSequences("all");

    model.sol("sol1").runAll();

    model.result().create("pg1", "PlotGroup2D");
    model.result("pg1").label("Electric Potential (es)");
    model.result("pg1").set("frametype", "spatial");
    model.result("pg1").set("showlegendsmaxmin", true);
    model.result("pg1").feature().create("surf1", "Surface");
    model.result("pg1").feature("surf1").set("solutionparams", "parent");
    model.result("pg1").feature("surf1").set("colortable", "Dipole");
    model.result("pg1").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg1").feature("surf1").set("data", "parent");
    model.result("pg1").feature().create("str1", "Streamline");
    model.result("pg1").feature("str1").set("solutionparams", "parent");
    model.result("pg1").feature("str1").set("titletype", "none");
    model.result("pg1").feature("str1").set("posmethod", "uniform");
    model.result("pg1").feature("str1").set("udensity", 6.5);
    model.result("pg1").feature("str1").set("color", "custom");
    model.result("pg1").feature("str1")
         .set("customcolor", new double[]{0.3764705955982208, 0.3764705955982208, 0.3764705955982208});
    model.result("pg1").feature("str1").set("evaluationsettings", "parent");
    model.result("pg1").feature("str1").set("maxlen", 0.4);
    model.result("pg1").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg1").feature("str1").set("inheritcolor", false);
    model.result("pg1").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg1").feature("str1").set("data", "parent");
    model.result("pg1").feature("str1").selection().geom("geom1", 1);
    model.result("pg1").feature("str1").selection().set(1, 2, 3, 4, 5, 6, 7);
    model.result("pg1").feature("str1").set("inheritplot", "surf1");
    model.result("pg1").feature("str1").feature().create("filt1", "Filter");
    model.result("pg1").feature("str1").feature("filt1").set("expr", "!isScalingSystemDomain");
    model.result().create("pg2", "PlotGroup2D");
    model.result("pg2").label("Electric Field (es)");
    model.result("pg2").set("frametype", "spatial");
    model.result("pg2").set("showlegendsmaxmin", true);
    model.result("pg2").feature().create("surf1", "Surface");
    model.result("pg2").feature("surf1").set("solutionparams", "parent");
    model.result("pg2").feature("surf1").set("expr", "es.normE");
    model.result("pg2").feature("surf1").set("colortable", "Prism");
    model.result("pg2").feature("surf1").set("colortabletrans", "nonlinear");
    model.result("pg2").feature("surf1").set("colorcalibration", -0.8);
    model.result("pg2").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg2").feature("surf1").set("data", "parent");
    model.result("pg2").feature().create("str1", "Streamline");
    model.result("pg2").feature("str1").set("solutionparams", "parent");
    model.result("pg2").feature("str1").set("titletype", "none");
    model.result("pg2").feature("str1").set("posmethod", "uniform");
    model.result("pg2").feature("str1").set("udensity", 6.5);
    model.result("pg2").feature("str1").set("color", "custom");
    model.result("pg2").feature("str1")
         .set("customcolor", new double[]{0.3764705955982208, 0.3764705955982208, 0.3764705955982208});
    model.result("pg2").feature("str1").set("evaluationsettings", "parent");
    model.result("pg2").feature("str1").set("maxlen", 0.4);
    model.result("pg2").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg2").feature("str1").set("inheritcolor", false);
    model.result("pg2").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg2").feature("str1").set("data", "parent");
    model.result("pg2").feature("str1").selection().geom("geom1", 1);
    model.result("pg2").feature("str1").selection().set(1, 2, 3, 4, 5, 6, 7);
    model.result("pg2").feature("str1").set("inheritplot", "surf1");
    model.result("pg2").feature("str1").feature().create("filt1", "Filter");
    model.result("pg2").feature("str1").feature("filt1").set("expr", "!isScalingSystemDomain");
    model.result().create("pg3", "PlotGroup2D");
    model.result("pg3").set("data", "dset1");
    model.result("pg3").setIndex("looplevel", 1, 0);
    model.result("pg3").label("Mode Shape (solid)");
    model.result("pg3").set("showlegends", false);
    model.result("pg3").create("surf1", "Surface");
    model.result("pg3").feature("surf1").set("expr", new String[]{"solid.disp"});
    model.result("pg3").feature("surf1").set("threshold", "manual");
    model.result("pg3").feature("surf1").set("thresholdvalue", 0.2);
    model.result("pg3").feature("surf1").set("colortable", "Rainbow");
    model.result("pg3").feature("surf1").set("colortabletrans", "none");
    model.result("pg3").feature("surf1").set("colorscalemode", "linear");
    model.result("pg3").feature("surf1").set("colortable", "AuroraBorealis");
    model.result("pg3").feature("surf1").create("def", "Deform");
    model.result("pg3").feature("surf1").feature("def").set("expr", new String[]{"u", "v"});
    model.result("pg3").feature("surf1").feature("def").set("descr", "Displacement field");
    model.result().evaluationGroup().create("std1EvgFrq", "EvaluationGroup");
    model.result().evaluationGroup("std1EvgFrq").set("data", "dset1");
    model.result().evaluationGroup("std1EvgFrq").label("Eigenfrequencies (Free)");
    model.result().evaluationGroup("std1EvgFrq").create("gev1", "EvalGlobal");
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("expr", "2*pi*freq", 0);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("unit", "rad/s", 0);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("descr", "Angular frequency", 0);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("expr", "imag(freq)/abs(freq)", 1);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("unit", "1", 1);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("descr", "Damping ratio", 1);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("expr", "abs(freq)/imag(freq)/2", 2);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("unit", "1", 2);
    model.result().evaluationGroup("std1EvgFrq").feature("gev1").setIndex("descr", "Quality factor", 2);
    model.result().evaluationGroup("std1EvgFrq").run();
    model.result().evaluationGroup().create("std1mpf1", "EvaluationGroup");
    model.result().evaluationGroup("std1mpf1").set("data", "dset1");
    model.result().evaluationGroup("std1mpf1").label("Participation Factors (Free)");
    model.result().evaluationGroup("std1mpf1").create("gev1", "EvalGlobal");
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormX", 0);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "1", 0);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, X-translation", 0);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormY", 1);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "1", 1);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Y-translation", 1);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormZ", 2);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "1", 2);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Z-translation", 2);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormX", 3);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "1", 3);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, X-rotation", 3);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormY", 4);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "1", 4);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Y-rotation", 4);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormZ", 5);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "1", 5);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Z-rotation", 5);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLX", 6);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "kg", 6);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, X-translation", 6);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLY", 7);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "kg", 7);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Y-translation", 7);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLZ", 8);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "kg", 8);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Z-translation", 8);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRX", 9);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "kg*m^2", 9);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, X-rotation", 9);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRY", 10);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "kg*m^2", 10);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Y-rotation", 10);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRZ", 11);
    model.result().evaluationGroup("std1mpf1").feature("gev1").setIndex("unit", "kg*m^2", 11);
    model.result().evaluationGroup("std1mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Z-rotation", 11);
    model.result().evaluationGroup("std1mpf1").run();
    model.result("pg1").run();
    model.result("pg3").run();

//    From the Home menu, choose Add Study.
//    Find the Studies subsection.
//    In the Select Study tree, select Preset Studies for Selected Multiphysics > Eigenfrequency.
//    Find the Physics interfaces in study subsection.
//    In the table, enter the following settings:
//    Find the Multiphysics couplings in study subsection.
//    In the table, enter the following settings:
//    Click Add Study in the window toolbar.

    model.study().create("std2");
    model.study("std2").create("eig", "Eigenfrequency");
    model.study("std2").feature("eig").set("chkeigregion", true);
    model.study("std2").feature("eig").set("storefact", false);
    model.study("std2").feature("eig").set("linpsolnum", "auto");
    model.study("std2").feature("eig").set("plotgrouparr", new String[]{"Default"});
    model.study("std2").feature("eig").set("solnum", "auto");
    model.study("std2").feature("eig").set("notsolnum", "auto");
    model.study("std2").feature("eig").set("outputmap", new String[]{});
    model.study("std2").feature("eig").set("ngenAUX", "1");
    model.study("std2").feature("eig").set("goalngenAUX", "1");
    model.study("std2").feature("eig").set("ngenAUX", "1");
    model.study("std2").feature("eig").set("goalngenAUX", "1");
    model.study("std2").feature("eig").setSolveFor("/physics/es", false);
    model.study("std2").feature("eig").setSolveFor("/physics/solid", false);
    model.study("std2").feature("eig").setSolveFor("/physics/es3", false);
    model.study("std2").feature("eig").setSolveFor("/physics/solid3", false);
    model.study("std2").feature("eig").setSolveFor("/multiphysics/pze1", false);
    model.study("std2").feature("eig").setSolveFor("/multiphysics/pze3", false);

//    From the Home menu, choose Add Study.
//    In the Settings window for Study, type IDT in the Label text field.

    model.study("std2").label("IDT");

//    Set up <l>Eigenfrequency</l> study to search around <c>f_0</c> MHz.
//    In the Model Builder window, expand the Mode Shape (solid) node, then click IDT > Step 1: Eigenfrequency.
//    In the Settings window for Eigenfrequency, locate the Study Settings section.
//    Select the Desired number of eigenfrequencies checkbox.

    model.study("std2").feature("eig").set("neigsactive", true);

//    In the associated text field, type 2.

    model.study("std2").feature("eig").set("neigs", 2);

//    From the Unit list, select MHz.

    model.study("std2").feature("eig").set("eigunit", "MHz");

//    In the Search for eigenfrequencies around shift text field, type f_0.

    model.study("std2").feature("eig").set("shift", "f_0");

//    Click to expand the Mesh Selection section.
//    In the table, enter the following settings:

    model.study("std2").feature("eig").setEntry("mesh", "geom1", "mesh2");

//    Instead of using all geometric entities, select only IDT Unit Cell.
//    In the Study toolbar, click Show Default Solver.

    model.study("std2").showAutoSequences("all");

//    In the Model Builder window, expand the Solution 2 (sol2) node, then click Compile Equations: Eigenfrequency.
//    In the Settings window for Compile Equations, locate the Geometric Entity Selection section.
//    From the Use entities list, select Selected.

    model.sol("sol2").feature("st1").set("useent", "selected");

//    Under Selections, click Add.
//    In the Add dialog, select IDT Unit Cell in the Selections list.
//    Click OK.

    model.sol("sol2").feature("st1").set("entsel", new String[]{"sel5"});

//    In the Study toolbar, click Compute.

    model.study("std2").createAutoSequences("all");

    model.sol("sol2").runAll();

    model.result().create("pg4", "PlotGroup2D");
    model.result("pg4").label("Electric Potential (es2)");
    model.result("pg4").set("data", "dset2");
    model.result("pg4").setIndex("looplevel", 1, 0);
    model.result("pg4").set("frametype", "spatial");
    model.result("pg4").set("showlegendsmaxmin", true);
    model.result("pg4").feature().create("surf1", "Surface");
    model.result("pg4").feature("surf1").set("solutionparams", "parent");
    model.result("pg4").feature("surf1").set("expr", "V2");
    model.result("pg4").feature("surf1").set("colortable", "Dipole");
    model.result("pg4").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg4").feature("surf1").set("data", "parent");
    model.result("pg4").feature().create("str1", "Streamline");
    model.result("pg4").feature("str1").set("solutionparams", "parent");
    model.result("pg4").feature("str1").set("expr", new String[]{"es2.Ex", "es2.Ey"});
    model.result("pg4").feature("str1").set("titletype", "none");
    model.result("pg4").feature("str1").set("posmethod", "uniform");
    model.result("pg4").feature("str1").set("udensity", 6.5);
    model.result("pg4").feature("str1").set("color", "custom");
    model.result("pg4").feature("str1")
         .set("customcolor", new double[]{0.3764705955982208, 0.3764705955982208, 0.3764705955982208});
    model.result("pg4").feature("str1").set("evaluationsettings", "parent");
    model.result("pg4").feature("str1").set("maxlen", 0.4);
    model.result("pg4").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg4").feature("str1").set("inheritcolor", false);
    model.result("pg4").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg4").feature("str1").set("data", "parent");
    model.result("pg4").feature("str1").selection().geom("geom1", 1);
    model.result("pg4").feature("str1").selection()
         .set(8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24);
    model.result("pg4").feature("str1").set("inheritplot", "surf1");
    model.result("pg4").feature("str1").feature().create("filt1", "Filter");
    model.result("pg4").feature("str1").feature("filt1").set("expr", "!isScalingSystemDomain");
    model.result().create("pg5", "PlotGroup2D");
    model.result("pg5").label("Electric Field (es2)");
    model.result("pg5").set("data", "dset2");
    model.result("pg5").setIndex("looplevel", 1, 0);
    model.result("pg5").set("frametype", "spatial");
    model.result("pg5").set("showlegendsmaxmin", true);
    model.result("pg5").feature().create("surf1", "Surface");
    model.result("pg5").feature("surf1").set("solutionparams", "parent");
    model.result("pg5").feature("surf1").set("expr", "es2.normE");
    model.result("pg5").feature("surf1").set("colortable", "Prism");
    model.result("pg5").feature("surf1").set("colortabletrans", "nonlinear");
    model.result("pg5").feature("surf1").set("colorcalibration", -0.8);
    model.result("pg5").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg5").feature("surf1").set("data", "parent");
    model.result("pg5").feature().create("str1", "Streamline");
    model.result("pg5").feature("str1").set("solutionparams", "parent");
    model.result("pg5").feature("str1").set("expr", new String[]{"es2.Ex", "es2.Ey"});
    model.result("pg5").feature("str1").set("titletype", "none");
    model.result("pg5").feature("str1").set("posmethod", "uniform");
    model.result("pg5").feature("str1").set("udensity", 6.5);
    model.result("pg5").feature("str1").set("color", "custom");
    model.result("pg5").feature("str1")
         .set("customcolor", new double[]{0.3764705955982208, 0.3764705955982208, 0.3764705955982208});
    model.result("pg5").feature("str1").set("evaluationsettings", "parent");

    return model;
  }

  public static Model run3(Model model) {
    model.result("pg5").feature("str1").set("maxlen", 0.4);
    model.result("pg5").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg5").feature("str1").set("inheritcolor", false);
    model.result("pg5").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg5").feature("str1").set("data", "parent");
    model.result("pg5").feature("str1").selection().geom("geom1", 1);
    model.result("pg5").feature("str1").selection()
         .set(8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24);
    model.result("pg5").feature("str1").set("inheritplot", "surf1");
    model.result("pg5").feature("str1").feature().create("filt1", "Filter");
    model.result("pg5").feature("str1").feature("filt1").set("expr", "!isScalingSystemDomain");
    model.result().create("pg6", "PlotGroup2D");
    model.result("pg6").set("data", "dset2");
    model.result("pg6").setIndex("looplevel", 1, 0);
    model.result("pg6").label("Mode Shape (solid2)");
    model.result("pg6").set("showlegends", false);
    model.result("pg6").create("surf1", "Surface");
    model.result("pg6").feature("surf1").set("expr", new String[]{"solid2.disp"});
    model.result("pg6").feature("surf1").set("threshold", "manual");
    model.result("pg6").feature("surf1").set("thresholdvalue", 0.2);
    model.result("pg6").feature("surf1").set("colortable", "Rainbow");
    model.result("pg6").feature("surf1").set("colortabletrans", "none");
    model.result("pg6").feature("surf1").set("colorscalemode", "linear");
    model.result("pg6").feature("surf1").set("colortable", "AuroraBorealis");
    model.result("pg6").feature("surf1").create("def", "Deform");
    model.result("pg6").feature("surf1").feature("def").set("expr", new String[]{"u2", "v2"});
    model.result("pg6").feature("surf1").feature("def").set("descr", "Displacement field");
    model.result().evaluationGroup().create("std2EvgFrq", "EvaluationGroup");
    model.result().evaluationGroup("std2EvgFrq").set("data", "dset2");
    model.result().evaluationGroup("std2EvgFrq").label("Eigenfrequencies (IDT)");
    model.result().evaluationGroup("std2EvgFrq").create("gev1", "EvalGlobal");
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("expr", "2*pi*freq", 0);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("unit", "rad/s", 0);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("descr", "Angular frequency", 0);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("expr", "imag(freq)/abs(freq)", 1);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("unit", "1", 1);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("descr", "Damping ratio", 1);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("expr", "abs(freq)/imag(freq)/2", 2);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("unit", "1", 2);
    model.result().evaluationGroup("std2EvgFrq").feature("gev1").setIndex("descr", "Quality factor", 2);
    model.result().evaluationGroup("std2EvgFrq").run();
    model.result().evaluationGroup().create("std2mpf1", "EvaluationGroup");
    model.result().evaluationGroup("std2mpf1").set("data", "dset2");
    model.result().evaluationGroup("std2mpf1").label("Participation Factors (IDT)");
    model.result().evaluationGroup("std2mpf1").create("gev1", "EvalGlobal");
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormX", 0);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "1", 0);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, X-translation", 0);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormY", 1);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "1", 1);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Y-translation", 1);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormZ", 2);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "1", 2);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Z-translation", 2);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormX", 3);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "1", 3);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, X-rotation", 3);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormY", 4);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "1", 4);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Y-rotation", 4);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormZ", 5);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "1", 5);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Z-rotation", 5);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLX", 6);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "kg", 6);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, X-translation", 6);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLY", 7);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "kg", 7);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Y-translation", 7);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLZ", 8);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "kg", 8);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Z-translation", 8);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRX", 9);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "kg*m^2", 9);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, X-rotation", 9);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRY", 10);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "kg*m^2", 10);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Y-rotation", 10);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRZ", 11);
    model.result().evaluationGroup("std2mpf1").feature("gev1").setIndex("unit", "kg*m^2", 11);
    model.result().evaluationGroup("std2mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Z-rotation", 11);
    model.result().evaluationGroup("std2mpf1").run();
    model.result("pg4").run();
    model.result("pg6").run();

//    From the Home menu, choose Add Study.
//    Find the Studies subsection.
//    In the Select Study tree, select Preset Studies for Selected Multiphysics > Eigenfrequency.
//    Find the Physics interfaces in study subsection.
//    In the table, enter the following settings:
//    Find the Multiphysics couplings in study subsection.
//    In the table, enter the following settings:
//    Click Add Study in the window toolbar.

    model.study().create("std3");
    model.study("std3").create("eig", "Eigenfrequency");
    model.study("std3").feature("eig").set("chkeigregion", true);
    model.study("std3").feature("eig").set("storefact", false);
    model.study("std3").feature("eig").set("linpsolnum", "auto");
    model.study("std3").feature("eig").set("plotgrouparr", new String[]{"Default"});
    model.study("std3").feature("eig").set("solnum", "auto");
    model.study("std3").feature("eig").set("notsolnum", "auto");
    model.study("std3").feature("eig").set("outputmap", new String[]{});
    model.study("std3").feature("eig").set("ngenAUX", "1");
    model.study("std3").feature("eig").set("goalngenAUX", "1");
    model.study("std3").feature("eig").set("ngenAUX", "1");
    model.study("std3").feature("eig").set("goalngenAUX", "1");
    model.study("std3").feature("eig").setSolveFor("/physics/es", false);
    model.study("std3").feature("eig").setSolveFor("/physics/solid", false);
    model.study("std3").feature("eig").setSolveFor("/physics/es2", false);
    model.study("std3").feature("eig").setSolveFor("/physics/solid2", false);
    model.study("std3").feature("eig").setSolveFor("/multiphysics/pze1", false);
    model.study("std3").feature("eig").setSolveFor("/multiphysics/pze2", false);

//    From the Home menu, choose Add Study.
//    In the Settings window for Study, type Grounded in the Label text field.

    model.study("std3").label("Grounded");

//    Set up <l>Eigenfrequency</l> study to search around <c>f_0</c> MHz.
//    In the Model Builder window, expand the Mode Shape (solid2) node, then click Grounded > Step 1: Eigenfrequency.
//    In the Settings window for Eigenfrequency, locate the Study Settings section.
//    Select the Desired number of eigenfrequencies checkbox.

    model.study("std3").feature("eig").set("neigsactive", true);

//    In the associated text field, type 2.

    model.study("std3").feature("eig").set("neigs", 2);

//    From the Unit list, select MHz.

    model.study("std3").feature("eig").set("eigunit", "MHz");

//    In the Search for eigenfrequencies around shift text field, type f_0.

    model.study("std3").feature("eig").set("shift", "f_0");

//    Locate the Mesh Selection section.
//    In the table, enter the following settings:
//    Instead of using all geometric entities, select only Grounded Unit Cell.
//    In the Study toolbar, click Show Default Solver.

    model.study("std3").showAutoSequences("all");

//    In the Model Builder window, expand the Solution 3 (sol3) node, then click Compile Equations: Eigenfrequency.
//    In the Settings window for Compile Equations, locate the Geometric Entity Selection section.
//    From the Use entities list, select Selected.

    model.sol("sol3").feature("st1").set("useent", "selected");

//    Under Selections, click Add.
//    In the Add dialog, select Grounded Unit Cell in the Selections list.
//    Click OK.

    model.sol("sol3").feature("st1").set("entsel", new String[]{"sel6"});

//    In the Study toolbar, click Compute.

    model.study("std3").createAutoSequences("all");

    model.sol("sol3").runAll();

    model.result().create("pg7", "PlotGroup2D");
    model.result("pg7").label("Electric Potential (es3)");
    model.result("pg7").set("data", "dset3");
    model.result("pg7").setIndex("looplevel", 1, 0);
    model.result("pg7").set("frametype", "spatial");
    model.result("pg7").set("showlegendsmaxmin", true);
    model.result("pg7").feature().create("surf1", "Surface");
    model.result("pg7").feature("surf1").set("solutionparams", "parent");
    model.result("pg7").feature("surf1").set("expr", "V3");
    model.result("pg7").feature("surf1").set("colortable", "Dipole");
    model.result("pg7").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg7").feature("surf1").set("data", "parent");
    model.result("pg7").feature().create("str1", "Streamline");
    model.result("pg7").feature("str1").set("solutionparams", "parent");
    model.result("pg7").feature("str1").set("expr", new String[]{"es3.Ex", "es3.Ey"});
    model.result("pg7").feature("str1").set("titletype", "none");
    model.result("pg7").feature("str1").set("posmethod", "uniform");
    model.result("pg7").feature("str1").set("udensity", 6.5);
    model.result("pg7").feature("str1").set("color", "custom");
    model.result("pg7").feature("str1")
         .set("customcolor", new double[]{0.3764705955982208, 0.3764705955982208, 0.3764705955982208});
    model.result("pg7").feature("str1").set("evaluationsettings", "parent");
    model.result("pg7").feature("str1").set("maxlen", 0.4);
    model.result("pg7").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg7").feature("str1").set("inheritcolor", false);
    model.result("pg7").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg7").feature("str1").set("data", "parent");
    model.result("pg7").feature("str1").selection().geom("geom1", 1);
    model.result("pg7").feature("str1").selection().set(25, 26, 27, 28, 29, 30, 31);
    model.result("pg7").feature("str1").set("inheritplot", "surf1");
    model.result("pg7").feature("str1").feature().create("filt1", "Filter");
    model.result("pg7").feature("str1").feature("filt1").set("expr", "!isScalingSystemDomain");
    model.result().create("pg8", "PlotGroup2D");
    model.result("pg8").label("Electric Field (es3)");
    model.result("pg8").set("data", "dset3");
    model.result("pg8").setIndex("looplevel", 1, 0);
    model.result("pg8").set("frametype", "spatial");
    model.result("pg8").set("showlegendsmaxmin", true);
    model.result("pg8").feature().create("surf1", "Surface");
    model.result("pg8").feature("surf1").set("solutionparams", "parent");
    model.result("pg8").feature("surf1").set("expr", "es3.normE");
    model.result("pg8").feature("surf1").set("colortable", "Prism");
    model.result("pg8").feature("surf1").set("colortabletrans", "nonlinear");
    model.result("pg8").feature("surf1").set("colorcalibration", -0.8);
    model.result("pg8").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg8").feature("surf1").set("data", "parent");
    model.result("pg8").feature().create("str1", "Streamline");
    model.result("pg8").feature("str1").set("solutionparams", "parent");
    model.result("pg8").feature("str1").set("expr", new String[]{"es3.Ex", "es3.Ey"});
    model.result("pg8").feature("str1").set("titletype", "none");
    model.result("pg8").feature("str1").set("posmethod", "uniform");
    model.result("pg8").feature("str1").set("udensity", 6.5);
    model.result("pg8").feature("str1").set("color", "custom");
    model.result("pg8").feature("str1")
         .set("customcolor", new double[]{0.3764705955982208, 0.3764705955982208, 0.3764705955982208});
    model.result("pg8").feature("str1").set("evaluationsettings", "parent");
    model.result("pg8").feature("str1").set("maxlen", 0.4);
    model.result("pg8").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg8").feature("str1").set("inheritcolor", false);
    model.result("pg8").feature("str1").set("maxtime", Double.POSITIVE_INFINITY);
    model.result("pg8").feature("str1").set("data", "parent");
    model.result("pg8").feature("str1").selection().geom("geom1", 1);
    model.result("pg8").feature("str1").selection().set(25, 26, 27, 28, 29, 30, 31);
    model.result("pg8").feature("str1").set("inheritplot", "surf1");
    model.result("pg8").feature("str1").feature().create("filt1", "Filter");
    model.result("pg8").feature("str1").feature("filt1").set("expr", "!isScalingSystemDomain");
    model.result().create("pg9", "PlotGroup2D");
    model.result("pg9").set("data", "dset3");
    model.result("pg9").setIndex("looplevel", 1, 0);
    model.result("pg9").label("Mode Shape (solid3)");
    model.result("pg9").set("showlegends", false);
    model.result("pg9").create("surf1", "Surface");
    model.result("pg9").feature("surf1").set("expr", new String[]{"solid3.disp"});
    model.result("pg9").feature("surf1").set("threshold", "manual");
    model.result("pg9").feature("surf1").set("thresholdvalue", 0.2);
    model.result("pg9").feature("surf1").set("colortable", "Rainbow");
    model.result("pg9").feature("surf1").set("colortabletrans", "none");
    model.result("pg9").feature("surf1").set("colorscalemode", "linear");
    model.result("pg9").feature("surf1").set("colortable", "AuroraBorealis");
    model.result("pg9").feature("surf1").create("def", "Deform");
    model.result("pg9").feature("surf1").feature("def").set("expr", new String[]{"u3", "v3"});
    model.result("pg9").feature("surf1").feature("def").set("descr", "Displacement field");
    model.result().evaluationGroup().create("std3EvgFrq", "EvaluationGroup");
    model.result().evaluationGroup("std3EvgFrq").set("data", "dset3");
    model.result().evaluationGroup("std3EvgFrq").label("Eigenfrequencies (Grounded)");
    model.result().evaluationGroup("std3EvgFrq").create("gev1", "EvalGlobal");
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("expr", "2*pi*freq", 0);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("unit", "rad/s", 0);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("descr", "Angular frequency", 0);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("expr", "imag(freq)/abs(freq)", 1);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("unit", "1", 1);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("descr", "Damping ratio", 1);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("expr", "abs(freq)/imag(freq)/2", 2);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("unit", "1", 2);
    model.result().evaluationGroup("std3EvgFrq").feature("gev1").setIndex("descr", "Quality factor", 2);
    model.result().evaluationGroup("std3EvgFrq").run();
    model.result().evaluationGroup().create("std3mpf1", "EvaluationGroup");
    model.result().evaluationGroup("std3mpf1").set("data", "dset3");
    model.result().evaluationGroup("std3mpf1").label("Participation Factors (Grounded)");
    model.result().evaluationGroup("std3mpf1").create("gev1", "EvalGlobal");
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormX", 0);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "1", 0);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, X-translation", 0);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormY", 1);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "1", 1);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Y-translation", 1);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.pfLnormZ", 2);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "1", 2);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Z-translation", 2);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormX", 3);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "1", 3);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, X-rotation", 3);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormY", 4);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "1", 4);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Y-rotation", 4);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.pfRnormZ", 5);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "1", 5);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Participation factor, normalized, Z-rotation", 5);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLX", 6);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "kg", 6);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, X-translation", 6);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLY", 7);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "kg", 7);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Y-translation", 7);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.mEffLZ", 8);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "kg", 8);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Z-translation", 8);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRX", 9);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "kg*m^2", 9);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, X-rotation", 9);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRY", 10);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "kg*m^2", 10);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Y-rotation", 10);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("expr", "mpf1.mEffRZ", 11);
    model.result().evaluationGroup("std3mpf1").feature("gev1").setIndex("unit", "kg*m^2", 11);
    model.result().evaluationGroup("std3mpf1").feature("gev1")
         .setIndex("descr", "Effective modal mass, Z-rotation", 11);
    model.result().evaluationGroup("std3mpf1").run();
    model.result("pg7").run();
    model.result("pg9").run();

//    Add an evaluation group for evaluating parameters such as velocity, eigenfrequency, k^2, and kp.
//    In the Model Builder window, expand the Mode Shape (solid3) node.
//    Right-click Results and choose Evaluation Group.

    model.result().evaluationGroup().create("eg1", "EvaluationGroup");

//    In the Settings window for Evaluation Group, type Frequencies, Velocities, and Coefficients in the Label text field.

    model.result().evaluationGroup("eg1").label("Frequencies, Velocities, and Coefficients");

//    Locate the Transformation section.
//    Select the Transpose checkbox.

    model.result().evaluationGroup("eg1").set("transpose", true);

//    Click to expand the Format section.
//    From the Include parameters list, select Off.

    model.result().evaluationGroup("eg1").set("includeparameters", false);

//    Right-click Frequencies, Velocities, and Coefficients and choose Global Evaluation.

    model.result().evaluationGroup("eg1").create("gev1", "EvalGlobal");

//    In the Settings window for Global Evaluation, locate the Expressions section.
//    In the table, enter the following settings:

    model.result().evaluationGroup("eg1").feature("gev1")
         .setIndex("expr", "0.5*lambdaD*(withsol('sol1',real(freq),setind(lambda,1))+withsol('sol1',real(freq),setind(lambda,2)))", 0);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("descr", "Velocity, free", 0);
    model.result().evaluationGroup("eg1").feature("gev1")
         .setIndex("expr", "withsol('sol1',real(freq),setind(lambda,1))", 1);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("unit", "MHz", 1);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("descr", "f1 free", 1);
    model.result().evaluationGroup("eg1").feature("gev1")
         .setIndex("expr", "withsol('sol1',real(freq),setind(lambda,2))", 2);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("unit", "MHz", 2);
    model.result().evaluationGroup("eg1").feature("gev1").setIndex("descr", "f2 free", 2);

//    Locate the Data section.
//    From the Dataset list, select Free/Solution 1 (sol1).

    model.result().evaluationGroup("eg1").feature("gev1").set("data", "dset1");

//    From the Eigenfrequency selection list, select Last.

    model.result().evaluationGroup("eg1").feature("gev1").setIndex("looplevelinput", "last", 0);

//    Right-click Global Evaluation 1 and choose Duplicate.

    model.result().evaluationGroup("eg1").feature().duplicate("gev2", "gev1");

//    In the Settings window for Global Evaluation, locate the Data section.
//    From the Dataset list, select IDT/Solution 2 (sol2).

    model.result().evaluationGroup("eg1").feature("gev2").set("data", "dset2");

//    Locate the Expressions section.
//    In the table, enter the following settings:

    model.result().evaluationGroup("eg1").feature("gev2")
         .setIndex("expr", "0.5*lambdaD*(withsol('sol2',real(freq),setind(lambda,1))+withsol('sol2',real(freq),setind(lambda,2)))", 0);
    model.result().evaluationGroup("eg1").feature("gev2").setIndex("descr", "Velocity, IDT", 0);
    model.result().evaluationGroup("eg1").feature("gev2")
         .setIndex("expr", "withsol('sol2',real(freq),setind(lambda,1))", 1);
    model.result().evaluationGroup("eg1").feature("gev2").setIndex("descr", "f1 IDT", 1);
    model.result().evaluationGroup("eg1").feature("gev2")
         .setIndex("expr", "withsol('sol2',real(freq),setind(lambda,2))", 2);
    model.result().evaluationGroup("eg1").feature("gev2").setIndex("descr", "f2 IDT", 2);

//    Right-click Global Evaluation 2 and choose Duplicate.

    model.result().evaluationGroup("eg1").feature().duplicate("gev3", "gev2");

//    In the Settings window for Global Evaluation, locate the Data section.
//    From the Dataset list, select Grounded/Solution 3 (sol3).

    model.result().evaluationGroup("eg1").feature("gev3").set("data", "dset3");

//    Locate the Expressions section.
//    In the table, enter the following settings:

    model.result().evaluationGroup("eg1").feature("gev3")
         .setIndex("expr", "0.5*lambdaD*(withsol('sol3',real(freq),setind(lambda,1))+withsol('sol3',real(freq),setind(lambda,2)))", 0);
    model.result().evaluationGroup("eg1").feature("gev3").setIndex("descr", "Velocity, grounded", 0);
    model.result().evaluationGroup("eg1").feature("gev3")
         .setIndex("expr", "withsol('sol3',real(freq),setind(lambda,1))", 1);
    model.result().evaluationGroup("eg1").feature("gev3").setIndex("descr", "f1 grounded", 1);
    model.result().evaluationGroup("eg1").feature("gev3")
         .setIndex("expr", "withsol('sol3',real(freq),setind(lambda,2))", 2);
    model.result().evaluationGroup("eg1").feature("gev3").setIndex("descr", "f2 grounded", 2);

//    Right-click Global Evaluation 3 and choose Duplicate.

    model.result().evaluationGroup("eg1").feature().duplicate("gev4", "gev3");

//    In the Settings window for Global Evaluation, locate the Data section.
//    From the Eigenfrequency selection list, select First.

    model.result().evaluationGroup("eg1").feature("gev4").setIndex("looplevelinput", "first", 0);

//    Locate the Expressions section.
//    Click Clear Table.

    model.result().evaluationGroup("eg1").feature("gev4").set("expr", new String[]{});
    model.result().evaluationGroup("eg1").feature("gev4").set("descr", new String[]{});

//    In the table, enter the following settings:

    model.result().evaluationGroup("eg1").feature("gev4")
         .setIndex("expr", "2*(0.5*lambdaD*(withsol('sol1',real(freq),setind(lambda,1))+withsol('sol1',real(freq),setind(lambda,2)))-0.5*lambdaD*(withsol('sol3',real(freq),setind(lambda,1))+withsol('sol3',real(freq),setind(lambda,2))))/(0.5*lambdaD*(withsol('sol1',real(freq),setind(lambda,1))+withsol('sol1',real(freq),setind(lambda,2))))", 0);
    model.result().evaluationGroup("eg1").feature("gev4").setIndex("descr", "k^2", 0);

//    Right-click Global Evaluation 4 and choose Duplicate.

    model.result().evaluationGroup("eg1").feature().duplicate("gev5", "gev4");

//    In the Settings window for Global Evaluation, locate the Expressions section.
//    Click Clear Table.

    model.result().evaluationGroup("eg1").feature("gev5").set("expr", new String[]{});
    model.result().evaluationGroup("eg1").feature("gev5").set("descr", new String[]{});

//    In the table, enter the following settings:

    model.result().evaluationGroup("eg1").feature("gev5")
         .setIndex("expr", "pi*abs(withsol('sol2',real(freq),setind(lambda,2))-withsol('sol2',real(freq),setind(lambda,1)))/withsol('sol1',real(freq),setind(lambda,1))", 0);
    model.result().evaluationGroup("eg1").feature("gev5").setIndex("descr", "kp", 0);

//    In the Model Builder window, click Frequencies, Velocities, and Coefficients.
//    In the Frequencies, Velocities, and Coefficients toolbar, click Evaluate.

    model.result().evaluationGroup("eg1").run();
    model.result("pg9").run();
    model.result("pg9").feature("surf1").set("colortable", "Rainbow");
    model.result("pg9").run();
    model.result("pg9").feature("surf1").feature("def").set("scaleactive", true);
    model.result("pg9").feature("surf1").feature("def").set("scale", "1E14");
    model.result("pg9").run();
    model.result("pg9").run();
    model.result("pg9").feature("surf1").set("colortable", "AuroraBorealis");

    model.title("Surface Acoustic Wave Velocity Calculations from a Unit Cell");

    model
         .description("This tutorial demonstrates how to obtain a surface acoustic wave (SAW) velocity and parameters such as the electromechanical coupling coefficient or reflectivity for different configurations. Such parameters are input data for various analytical and semi-analytical methods of SAW device design such the Delta-Function model or the COM method. In this model, the unit cell for a center frequency of about 433\u00a0MHz on 128\u00b0\u00a0YX cut lithium niobate (LiNbO3) crystal with aluminum interdigital transducer (IDT) is investigated for three configurations: free surface, with IDT electrodes, and with fully grounded surface.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    model = run2(model);
    run3(model);
  }

}
