/*
 * fresnel_equations.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 15 2026, 12:35 by COMSOL 6.4.0.421. */
public class fresnel_equations {

  public static Model run() {
    Model model = ModelUtil.create("Model");

//    From the File menu, choose New.
//    In the New window, click Model Wizard.
//    In the Model Wizard window, click 3D.
//    In the Select Physics tree, select Radio Frequency > Electromagnetic Waves, Frequency Domain (emw).
//    Click Add.
//    Click Study.
//    In the Select Study tree, select General Studies > Frequency Domain.
//    Click Done.

    model.component().create("comp1", true);

    model.component("comp1").geom().create("geom1", 3);
    model.component("comp1").geom("geom1").geomRep("comsol");

    model.component("comp1").mesh().create("mesh1");
    model.component("comp1").mesh("mesh1").contribute("geom/detail", true);

    model.component("comp1").physics().create("emw", "ElectromagneticWaves", "geom1");

    model.study().create("std1");
    model.study("std1").create("freq", "Frequency");
    model.study("std1").feature("freq").set("solnum", "auto");
    model.study("std1").feature("freq").set("notsolnum", "auto");
    model.study("std1").feature("freq").set("outputmap", new String[]{});
    model.study("std1").feature("freq").set("ngenAUX", "1");
    model.study("std1").feature("freq").set("goalngenAUX", "1");
    model.study("std1").feature("freq").set("ngenAUX", "1");
    model.study("std1").feature("freq").set("goalngenAUX", "1");

//    Define some parameters that are useful when setting up the geometry and the study.
//    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("n_air", "1");
    model.param().descr("n_air", "Refractive index, air");
    model.param().set("n_slab", "1.5");
    model.param().descr("n_slab", "Refractive index, slab");
    model.param().set("lda0", "1[m]");
    model.param().descr("lda0", "Wavelength");
    model.param().set("f0", "c_const/lda0");
    model.param().descr("f0", "Frequency");
    model.param().set("alpha", "70[deg]");
    model.param().descr("alpha", "Angle of incidence");
    model.param().set("beta", "asin(n_air*sin(alpha)/n_slab)");
    model.param().descr("beta", "Refraction angle");
    model.param().set("alpha_brewster", "atan(n_slab/n_air)");
    model.param().descr("alpha_brewster", "Brewster angle, TM only");
    model.param().set("r_s", "(n_air*cos(alpha)-n_slab*cos(beta))/(n_air*cos(alpha)+n_slab*cos(beta))");
    model.param().descr("r_s", "Reflection coefficient, TE");
    model.param().set("r_p", "(n_slab*cos(alpha)-n_air*cos(beta))/(n_air*cos(beta)+n_slab*cos(alpha))");
    model.param().descr("r_p", "Reflection coefficient, TM");
    model.param().set("t_s", "(2*n_air*cos(alpha))/(n_air*cos(alpha)+n_slab*cos(beta))");
    model.param().descr("t_s", "Transmission coefficient, TE");
    model.param().set("t_p", "(2*n_air*cos(alpha))/(n_air*cos(beta)+n_slab*cos(alpha))");
    model.param().descr("t_p", "Transmission coefficient, TM");

//    The angle of incidence is updated while running the parametric sweep. The refraction (transmitted) angle is defined by Snell's law with the updated angle of incidence. The Brewster angle exists only for TM incidence, p-polarization (polarization is in the plane of incidence).
//    In the Model Builder window, click Study 1.
//    In the Settings window for Study, type Study 1 (TE) in the Label text field.

    model.study("std1").label("Study 1 (TE)");

//    In the Model Builder window, under Study 1 (TE), click Step 1: Frequency Domain.
//    In the Settings window for Frequency Domain, locate the Study Settings section.
//    In the Frequencies text field, type f0.

    model.study("std1").feature("freq").set("plist", "f0");

//    First, create a block composed of two domains. Use layers to split the block.
//    In the Geometry toolbar, click Block.

    model.component("comp1").geom("geom1").create("blk1", "Block");

//    In the Settings window for Block, locate the Size and Shape section.
//    In the Width text field, type 0.2.

    model.component("comp1").geom("geom1").feature("blk1").set("size", new double[]{0.2, 1, 1});

//    In the Depth text field, type 0.2.

    model.component("comp1").geom("geom1").feature("blk1").set("size", new double[]{0.2, 0.2, 1});

//    In the Height text field, type 0.8.

    model.component("comp1").geom("geom1").feature("blk1").set("size", new double[]{0.2, 0.2, 0.8});

//    Click to expand the Layers section.
//    In the table, enter the following settings:

    model.component("comp1").geom("geom1").feature("blk1").setIndex("layer", 0.4, 0);

//    Click Build All Objects.

    model.component("comp1").geom("geom1").runPre("fin");

//    Click the Zoom Extents button in the Graphics toolbar.
//    Choose wireframe rendering to get a better view of each boundary.
//    Click the Wireframe Rendering button in the Graphics toolbar.

    model.component("comp1").view("view1").set("renderwireframe", true);

//    Set up the physics based on the direction of propagation and the E-field polarization. First, assume a TE-polarized wave which is equivalent to s-polarization or perpendicular polarization. <eqv>E<sub>x</sub></eqv> and <eqv>E<sub>z</sub></eqv> are zero while <eqv>E<sub>y</sub></eqv> is dominant.

    model.component("comp1").geom("geom1").run();

//    In the Model Builder window, under Component 1 (comp1), click Electromagnetic Waves, Frequency Domain (emw).
//    In the Settings window for Electromagnetic Waves, Frequency Domain, type Electromagnetic Waves, Frequency Domain (TE) in the Label text field.

    model.component("comp1").physics("emw").label("Electromagnetic Waves, Frequency Domain (TE)");

//    In the Physics toolbar, click Domains and choose Periodic Structure.

    model.component("comp1").physics("emw").create("ps1", "PeriodicStructure", 3);

//    In the Settings window for Periodic Structure, locate the Port Mode Settings section.
//    In the \[\alpha_{1}\] text field, type alpha.

    model.component("comp1").physics("emw").feature("ps1").set("alpha1_inc", "alpha");

//    The <l>Periodic Structure</l> node automatically adds and configures its port and periodic condition subnodes.
//    In the Model Builder window, expand the Periodic Structure 1 node, then click Wave Equation, Electric 1.
//    In the Settings window for Wave Equation, Electric, locate the Electric Displacement Field section.
//    From the Electric displacement field model list, select Refractive index.

    model.component("comp1").physics("emw").feature("ps1").feature("wee1")
         .set("DisplacementFieldModel", "RefractiveIndex");

//    Now set up the material properties based on refractive index. The top half is filled with air.
//    In the Model Builder window, right-click Component 1 (comp1) > Materials and choose Blank Material.

    model.component("comp1").material().create("mat1", "Common");

//    In the Settings window for Material, type Air in the Label text field.

    model.component("comp1").material("mat1").label("Air");

//    Select Domain 2.

    model.component("comp1").material("mat1").selection().set(2);

//    Locate the Material Contents section.
//    In the table, enter the following settings:

    model.component("comp1").material("mat1").propertyGroup()
         .create("RefractiveIndex", "RefractiveIndex", "Refractive_index");
    model.component("comp1").material("mat1").propertyGroup("RefractiveIndex").set("n", new String[]{"n_air"});

//    The bottom half is glass.
//    Right-click Materials and choose Blank Material.

    model.component("comp1").material().create("mat2", "Common");

//    In the Settings window for Material, type Glass in the Label text field.

    model.component("comp1").material("mat2").label("Glass");

//    Select Domain 1.

    model.component("comp1").material("mat2").selection().set(1);

//    Locate the Material Contents section.
//    In the table, enter the following settings:

    model.component("comp1").material("mat2").propertyGroup()
         .create("RefractiveIndex", "RefractiveIndex", "Refractive_index");
    model.component("comp1").material("mat2").propertyGroup("RefractiveIndex").set("n", new String[]{"n_slab"});

//    In the Model Builder window, right-click Component 1 (comp1) > Mesh 1 and choose Build All.

    model.component("comp1").mesh("mesh1").run();

//    In the Study toolbar, click Parametric Sweep.

    model.study("std1").create("param", "Parametric");

//    In the Settings window for Parametric Sweep, locate the Study Settings section.
//    Click Add.

    model.study("std1").feature("param").setIndex("pname", "n_air", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "", 0);
    model.study("std1").feature("param").setIndex("pname", "n_air", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "", 0);

//    In the table, enter the following settings:

    model.study("std1").feature("param").setIndex("pname", "alpha", 0);
    model.study("std1").feature("param").setIndex("plistarr", "range(0,2[deg],88[deg])", 0);
    model.study("std1").feature("param").setIndex("punit", "deg", 0);

//    In the Study toolbar, click Compute.

    model.study("std1").createAutoSequences("all");

    model.component("comp1").probe("emw_pport1_probe").genResult("none");

    model.sol("sol1").runAll();

    model.result().create("pg2", "PlotGroup3D");
    model.result("pg2").set("data", "dset1");
    model.result("pg2").setIndex("looplevel", 45, 0);
    model.result("pg2").create("mslc1", "Multislice");
    model.result("pg2").feature("mslc1").set("expr", new String[]{"emw.normE"});
    model.result("pg2").set("showlegendsmaxmin", true);
    model.result("pg2").feature("mslc1").set("colortable", "RainbowLight");
    model.result("pg2").label("Electric Field (emw)");
    model.result().create("pg3", "PlotGroup1D");
    model.result("pg3").set("data", "dset1");
    model.result("pg3").create("glob1", "Global");
    model.result("pg3").feature("glob1").set("unit", new String[]{"", ""});
    model.result("pg3").feature("glob1").set("expr", new String[]{"emw.S11dB", "emw.S21dB"});
    model.result("pg3").feature("glob1").set("descr", new String[]{"S11", "S21"});
    model.result("pg3").label("S-Parameter (emw)");
    model.result("pg3").feature("glob1").set("titletype", "none");
    model.result("pg3").feature("glob1").set("xdata", "expr");
    model.result("pg3").set("ylabelactive", true);
    model.result("pg3").set("ylabel", "S-parameter (dB)");
    model.result("pg3").feature("glob1").set("xdataexpr", "alpha");
    model.result("pg3").feature("glob1").set("xdataunit", "deg");
    model.result("pg3").feature("glob1").set("markerpos", "datapoints");
    model.result("pg3").feature("glob1").set("xdatasolnumtype", "all");
    model.result().create("pg4", "SmithGroup");
    model.result("pg4").set("data", "dset1");
    model.result("pg4").create("rgr1", "ReflectionGraph");
    model.result("pg4").feature("rgr1").set("unit", new String[]{""});
    model.result("pg4").feature("rgr1").set("expr", new String[]{"emw.S11"});
    model.result("pg4").feature("rgr1").set("descr", new String[]{"S11"});
    model.result("pg4").label("Smith Plot (emw)");
    model.result("pg4").feature("rgr1").set("titletype", "manual");
    model.result("pg4").feature("rgr1").set("title", "Reflection Graph: S-parameter, Color: Frequency (GHz)");
    model.result("pg4").feature("rgr1").set("linemarker", "point");
    model.result("pg4").feature("rgr1").set("markerpos", "datapoints");
    model.result("pg4").feature("rgr1").create("col1", "Color");
    model.result("pg4").feature("rgr1").feature("col1").set("expr", "emw.freq/1e9");
    model.result("pg4").feature("rgr1").feature("col1").set("colortable", "Spectrum");
    model.result().create("pg5", "PlotGroup3D");
    model.result("pg5").set("data", "dset1");
    model.result("pg5").label("Electric Field, Logarithmic (emw)");
    model.result("pg5").selection().geom("geom1", 3);
    model.result("pg5").selection().set(1, 2);
    model.result("pg5").set("applyselectiontodatasetedges", true);
    model.result("pg5").create("surf1", "Surface");
    model.result("pg5").feature("surf1").set("expr", "emw.normE");
    model.result("pg5").feature("surf1").create("sel1", "Selection");
    model.result("pg5").feature("surf1").feature("sel1").selection().set(6);
    model.result("pg5").feature("surf1").set("colortable", "Dipole");
    model.result("pg5").feature("surf1").set("colorscalemode", "logarithmic");
    model.result("pg5").feature("surf1").create("tran1", "Transparency");
    model.result("pg5").feature("surf1").feature("tran1").set("transparency", 0.3);
    model.result("pg5").create("surf2", "Surface");
    model.result("pg5").feature("surf2").set("expr", "emw.normE");
    model.result("pg5").feature("surf2").create("sel1", "Selection");
    model.result("pg5").feature("surf2").feature("sel1").selection().set(1, 2, 3, 4, 5, 7, 8, 9, 10, 11);
    model.result("pg5").feature("surf2").set("colortable", "Dipole");
    model.result("pg5").feature("surf2").set("colorscalemode", "logarithmic");
    model.result("pg5").feature("surf2").create("tran1", "Transparency");
    model.result("pg5").feature("surf2").feature("tran1").set("transparency", 0.7);

    model.component("comp1").view().create("view2", "geom1");
    model.component("comp1").view("view2").camera().set("position", new double[]{-0.95, -1.29, 1.17});
    model.component("comp1").view("view2").set("environmentmap", "Indoor");
    model.component("comp1").view("view2").camera().set("zoomanglefull", 60.199999999999996);

    model.result("pg5").set("view", "view2");
    model.result().create("pg6", "PlotGroup1D");
    model.result("pg6").label("Polarization Plot (emw)");
    model.result("pg6").set("data", "dset1");
    model.result("pg6").set("titletype", "manual");
    model.result("pg6").set("title", "Polarization states, Color: Phase (Radians)");
    model.result("pg6").setIndex("looplevelinput", "manual", 0);
    model.result("pg6").setIndex("looplevel", "1", 0);
    model.result("pg6").create("plz1", "Polarization");
    model.result("pg6").feature("plz1").set("normalization", "allorders");
    model.result("pg6").feature("plz1").set("linestyle", "dotted");
    model.result("pg6").feature("plz1").set("linewidth", 2);
    model.result("pg6").feature("plz1").set("display", "2");
    model.result("pg6").feature("plz1").create("col1", "Color");
    model.result("pg6").feature("plz1").feature("col1").set("colortable", "Cyclic");
    model.result("pg6").feature("plz1").feature("col1").set("colorlegend", true);
    model.result("pg6").feature("plz1").set("legend", true);
    model.result("pg6").feature("plz1").set("legendmethod", "manual");
    model.result("pg6").feature("plz1").setIndex("legends", "Input field", 0);
    model.result("pg6").create("plz2", "Polarization");
    model.result("pg6").feature("plz2").set("normalization", "allorders");
    model.result("pg6").feature("plz2").set("linestyle", "solid");
    model.result("pg6").feature("plz2").set("linewidth", 2);
    model.result("pg6").feature("plz2").set("display", "1");
    model.result("pg6").feature("plz2").create("col1", "Color");
    model.result("pg6").feature("plz2").feature("col1").set("colortable", "Cyclic");
    model.result("pg6").feature("plz2").feature("col1").set("colorlegend", false);
    model.result("pg6").feature("plz2").set("legend", true);
    model.result("pg6").feature("plz2").set("legendmethod", "manual");
    model.result("pg6").feature("plz2").setIndex("legends", "Reflection", 0);
    model.result("pg6").create("plz3", "Polarization");
    model.result("pg6").feature("plz3").set("normalization", "allorders");
    model.result("pg6").feature("plz3").set("linestyle", "dashed");
    model.result("pg6").feature("plz3").set("linewidth", 2);
    model.result("pg6").feature("plz3").set("display", "0");
    model.result("pg6").feature("plz3").create("col1", "Color");
    model.result("pg6").feature("plz3").feature("col1").set("colortable", "Cyclic");
    model.result("pg6").feature("plz3").feature("col1").set("colorlegend", false);
    model.result("pg6").feature("plz3").set("legend", true);
    model.result("pg6").feature("plz3").set("legendmethod", "manual");
    model.result("pg6").feature("plz3").setIndex("legends", "Transmission", 0);
    model.result("pg6").create("plz4", "Polarization");
    model.result("pg6").feature("plz4").label("Propagation Limit, Reflection Side");
    model.result("pg6").feature("plz4").set("planewave", "manual");
    model.result("pg6").feature("plz4")
         .set("xexpr", "emw.aAxisR*cos(emw.thetaAxisR)-j*emw.bAxisR*sin(emw.thetaAxisR)");
    model.result("pg6").feature("plz4")
         .set("yexpr", "emw.aAxisR*sin(emw.thetaAxisR)+j*emw.bAxisR*cos(emw.thetaAxisR)");
    model.result("pg6").feature("plz4").set("normalization", "manual");
    model.result("pg6").feature("plz4").set("plotscale", "1");
    model.result("pg6").feature("plz4").set("centerpos", "user");
    model.result("pg6").feature("plz4").set("xcenter", "emw.mOriginR");
    model.result("pg6").feature("plz4").set("ycenter", "emw.nOriginR");
    model.result("pg6").feature("plz4").set("showrotdir", false);
    model.result("pg6").feature("plz4").set("showorder", false);
    model.result("pg6").feature("plz4").set("legend", true);
    model.result("pg6").feature("plz4").set("legendmethod", "manual");
    model.result("pg6").feature("plz4").setIndex("legends", "Propagation limit, reflection side", 0);
    model.result("pg6").feature("plz4").active(false);
    model.result("pg6").create("plz5", "Polarization");
    model.result("pg6").feature("plz5").label("Propagation Limit, Transmission Side");
    model.result("pg6").feature("plz5").set("planewave", "manual");
    model.result("pg6").feature("plz5")
         .set("xexpr", "emw.aAxisT*cos(emw.thetaAxisT)-j*emw.bAxisT*sin(emw.thetaAxisT)");
    model.result("pg6").feature("plz5")
         .set("yexpr", "emw.aAxisT*sin(emw.thetaAxisT)+j*emw.bAxisT*cos(emw.thetaAxisT)");
    model.result("pg6").feature("plz5").set("normalization", "manual");
    model.result("pg6").feature("plz5").set("plotscale", "1");
    model.result("pg6").feature("plz5").set("centerpos", "user");
    model.result("pg6").feature("plz5").set("xcenter", "emw.mOriginT");
    model.result("pg6").feature("plz5").set("ycenter", "emw.nOriginT");
    model.result("pg6").feature("plz5").set("showrotdir", false);
    model.result("pg6").feature("plz5").set("showorder", false);
    model.result("pg6").feature("plz5").set("legend", true);
    model.result("pg6").feature("plz5").set("legendmethod", "manual");
    model.result("pg6").feature("plz5").setIndex("legends", "Propagation limit, transmission side", 0);
    model.result("pg6").feature("plz5").active(false);
    model.result("pg2").run();

//    In the Settings window for 3D Plot Group, type Electric Field (emw, TE) in the Label text field.

    model.result("pg2").label("Electric Field (emw, TE)");

//    The default plot is the E-field norm for the last solution, which corresponds to almost tangential incidence. Replace the expression with <eqv>E<sub>y</sub></eqv>, add an arrow plot of the power flow (Poynting vector), and choose a more interesting angle of incidence for the plot.

    model.result("pg2").run();

//    In the Model Builder window, expand the Electric Field (emw, TE) node, then click Multislice 1.
//    In the Settings window for Multislice, click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Electromagnetic Waves, Frequency Domain (TE) > Electric > Electric field - V/m > emw.Ey - Electric field, y-component.

    model.result("pg2").feature("mslc1").set("expr", "emw.Ey");
    model.result("pg2").feature("mslc1").set("descr", "Electric field, y-component");

//    Locate the Multiplane Data section.
//    Find the X-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg2").feature("mslc1").set("xnumber", "0");

//    Find the Z-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg2").feature("mslc1").set("znumber", "0");

//    Locate the Coloring and Style section.
//    From the Color table list, select WaveLight.

    model.result("pg2").feature("mslc1").set("colortable", "WaveLight");
    model.result("pg2").run();

//    In the Model Builder window, right-click Electric Field (emw, TE) and choose Arrow Volume.

    model.result("pg2").create("arwv1", "ArrowVolume");
    model.result("pg2").feature("arwv1").set("evaluationsettings", "parent");

//    In the Settings window for Arrow Volume, click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Electromagnetic Waves, Frequency Domain (TE) > Energy and power > emw.Poavx,...,emw.Poavz - Power flow, time average.

    model.result("pg2").feature("arwv1").set("expr", new String[]{"emw.Poavx", "emw.Poavy", "emw.Poavz"});
    model.result("pg2").feature("arwv1").set("descr", "Power flow, time average");

//    Locate the Arrow Positioning section.
//    Find the Y grid points subsection.
//    In the Points text field, type 1.

    model.result("pg2").feature("arwv1").set("ynumber", 1);

//    Locate the Coloring and Style section.
//    From the Color list, select Green.

    model.result("pg2").feature("arwv1").set("color", "green");
    model.result("pg2").run();

//    In the Model Builder window, click Electric Field (emw, TE).
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Parameter value (alpha (deg)) list, select 70.

    model.result("pg2").setIndex("looplevel", 36, 0);

//    In the Electric Field (emw, TE) toolbar, click Plot.

    model.result("pg2").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    A 1D plot with the reflection and transmission versus the angle of incidence is added by default.

    model.result("pg3").run();

//    In the Model Builder window, under Results, click S-Parameter (emw).
//    In the Settings window for 1D Plot Group, type S-Parameter (emw, TE) in the Label text field.

    model.result("pg3").label("S-Parameter (emw, TE)");

//    Click to expand the Title section.
//    From the Title type list, select None.

    model.result("pg3").set("titletype", "none");

//    Locate the Plot Settings section.
//    Select the x-axis label checkbox.

    model.result("pg3").set("xlabelactive", true);

//    Replace the dB-scale variables with the linear-scale S-parameter variables.
//    In the y-axis label text field, type S-parameter.

    model.result("pg3").set("ylabel", "S-parameter");

//    Locate the Legend section.
//    From the Position list, select Middle left.

    model.result("pg3").set("legendpos", "middleleft");
    model.result("pg3").run();

//    In the Model Builder window, expand the S-Parameter (emw, TE) node, then click Global 1.
//    In the Settings window for Global, locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg3").feature("glob1").setIndex("expr", "abs(emw.S11)^2", 0);
    model.result("pg3").feature("glob1").setIndex("unit", 1, 0);
    model.result("pg3").feature("glob1").setIndex("descr", "Reflectance", 0);
    model.result("pg3").feature("glob1").setIndex("expr", "abs(emw.S21)^2", 1);
    model.result("pg3").feature("glob1").setIndex("unit", 1, 1);
    model.result("pg3").feature("glob1").setIndex("descr", "Transmittance", 1);

//    In the S-Parameter (emw, TE) toolbar, click Plot.

    model.result("pg3").run();

//    Click to expand the Coloring and Style section.
//    Find the Line style subsection.
//    From the Line list, select None.

    model.result("pg3").feature("glob1").set("linestyle", "none");

//    Find the Line markers subsection.
//    From the Marker list, select Cycle.

    model.result("pg3").feature("glob1").set("linemarker", "cycle");

//    From the Positioning list, select Interpolated.

    model.result("pg3").feature("glob1").set("markerpos", "interp");
    model.result("pg3").run();

//    In the Model Builder window, right-click S-Parameter (emw, TE) and choose Global.

    model.result("pg3").create("glob2", "Global");
    model.result("pg3").feature("glob2").set("markerpos", "datapoints");
    model.result("pg3").feature("glob2").set("linewidth", "preference");

//    In the Settings window for Global, locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg3").feature("glob2").setIndex("expr", "abs(r_s)^2", 0);
    model.result("pg3").feature("glob2").setIndex("descr", "Reflectance, analytic", 0);
    model.result("pg3").feature("glob2").setIndex("expr", "n_slab*cos(beta)/(n_air*cos(alpha))*abs(t_s)^2", 1);
    model.result("pg3").feature("glob2").setIndex("descr", "Transmittance, analytic", 1);

//    Locate the x-Axis Data section.
//    From the Unit list, select °.

    model.result("pg3").feature("glob2").set("xdataparamunit", "\u00b0");

//    Click to expand the Legends section.
//    From the Legends list, select Manual.

    model.result("pg3").feature("glob2").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg3").feature("glob2").setIndex("legends", "Reflectance, analytic", 0);
    model.result("pg3").feature("glob2").setIndex("legends", "Transmittance, analytic", 1);

//    In the S-Parameter (emw, TE) toolbar, click Plot.

    model.result("pg3").run();
    model.result("pg4").run();

//    In the Model Builder window, under Results, click Smith Plot (emw).
//    In the Settings window for Smith Plot Group, type Smith Plot (emw, TE) in the Label text field.

    model.result("pg4").label("Smith Plot (emw, TE)");

//    In the Model Builder window, expand the Smith Plot (emw, TE) node.

    model.result("pg4").run();

//    In the Model Builder window, expand the Results > Smith Plot (emw, TE) > Reflection Graph 1 node, then click Color Expression 1.
//    In the Settings window for Color Expression, locate the Expression section.
//    In the Expression text field, type alpha.

    model.result("pg4").feature("rgr1").feature("col1").set("expr", "alpha");

//    From the Unit list, select °.

    model.result("pg4").feature("rgr1").feature("col1").set("unit", "\u00b0");
    model.result("pg4").run();

//    In the Model Builder window, under Results, click Smith Plot (emw, TE).
//    In the Settings window for Smith Plot Group, click to expand the Title section.
//    From the Title type list, select Manual.

    model.result("pg4").set("titletype", "manual");

//    In the Title text area, type Reflection Graph: S-parameter, Color: Angle of incidence (deg).

    model.result("pg4").set("title", "Reflection Graph: S-parameter, Color: Angle of incidence (deg)");

//    In the Smith Plot (emw, TE) toolbar, click Plot.

    model.result("pg4").run();
    model.result("pg6").run();

//    In the Model Builder window, under Results, click Polarization Plot (emw).
//    In the Settings window for 1D Plot Group, type Polarization Plot (emw, TE) in the Label text field.

    model.result("pg6").label("Polarization Plot (emw, TE)");

//    In the Polarization Plot (emw, TE) toolbar, click Plot.

    model.result("pg6").run();

//    The polarization plot shows that the field is linearly polarized, with a pure out-of-plane polarization. The out-of-plane component of the Jones vector represents the amplitude of a wave polarized in the <eqv>y</eqv> direction, whereas the in-plane component represents the amplitude of a wave with a polarization that is orthogonal to both the out-of-plane direction and the propagation direction, resulting in a polarization in the <eqv>x-z</eqv> plane.
//    The following instructions are for the case of a TM-polarized wave (p-polarization or parallel polarization). In this case, <eqv>E<sub>y</sub></eqv> is zero while <eqv>E<sub>x</sub></eqv> and <eqv>E<sub>z</sub></eqv> characterize the wave. In other words, <eqv>H<sub>y</sub></eqv> is dominant while <eqv>H<sub>x</sub></eqv> and <eqv>H<sub>z</sub></eqv> are zero.
//    In the Model Builder window, right-click Component 1 (comp1) > Electromagnetic Waves, Frequency Domain (TE) (emw) and choose Copy.
//    In the Model Builder window, right-click Component 1 (comp1) and choose Paste Electromagnetic Waves, Frequency Domain.

    model.component("comp1").physics().copy("emw2", "emw");

//    In the Messages from Paste dialog, click OK.
//    In the Settings window for Electromagnetic Waves, Frequency Domain, type Electromagnetic Waves, Frequency Domain (TM) in the Label text field.

    model.component("comp1").physics("emw2").label("Electromagnetic Waves, Frequency Domain (TM)");

    model.study("std1").feature("freq").setSolveFor("/physics/emw2", false);

//    In the Model Builder window, under Study 1 (TE), click Step 1: Frequency Domain.
//    In the Settings window for Frequency Domain, locate the Physics and Variables Selection section.
//    In the Solve for column of the table, under Component 1 (comp1), clear the checkbox for Electromagnetic Waves, Frequency Domain (TM) (emw2).
//    In the Model Builder window, expand the Component 1 (comp1) > Electromagnetic Waves, Frequency Domain (TM) (emw2) node, then click Periodic Structure 1.
//    In the Settings window for Periodic Structure, locate the Port Mode Settings section.
//    From the list, select Transverse magnetic (TM).

    model.component("comp1").physics("emw2").feature("ps1").set("LinearPol", "TM");

//    . This will change the port mode fields to be polarized parallel to the plane of incidence.
//    In the Home toolbar, click Add Study to open the Add Study window.
//    Find the Studies subsection.
//    In the Select Study tree, select General Studies > Frequency Domain.
//    Click Add Study in the window toolbar.

    model.study().create("std2");
    model.study("std2").create("freq", "Frequency");
    model.study("std2").feature("freq").set("plotgrouparr", new String[]{"Default"});
    model.study("std2").feature("freq").set("solnum", "auto");
    model.study("std2").feature("freq").set("notsolnum", "auto");
    model.study("std2").feature("freq").set("outputmap", new String[]{});
    model.study("std2").feature("freq").set("ngenAUX", "1");
    model.study("std2").feature("freq").set("goalngenAUX", "1");
    model.study("std2").feature("freq").set("ngenAUX", "1");
    model.study("std2").feature("freq").set("goalngenAUX", "1");

//    In the Home toolbar, click Add Study to close the Add Study window.
//    In the Settings window for Frequency Domain, locate the Study Settings section.
//    In the Frequencies text field, type f0.

    model.study("std2").feature("freq").set("plist", "f0");
    model.study("std2").feature("freq").setSolveFor("/physics/emw", false);

//    Locate the Physics and Variables Selection section.
//    In the Solve for column of the table, under Component 1 (comp1), clear the checkbox for Electromagnetic Waves, Frequency Domain (TE) (emw).
//    In the Solve for column of the table, under Component 1 (comp1), select the checkbox for Electromagnetic Waves, Frequency Domain (TM) (emw2).
//    In the Model Builder window, click Study 2.
//    In the Settings window for Study, type Study 2 (TM) in the Label text field.

    model.study("std2").label("Study 2 (TM)");

//    In the Study toolbar, click Parametric Sweep.

    model.study("std2").create("param", "Parametric");

    return model;
  }

  public static Model run2(Model model) {

//    In the Settings window for Parametric Sweep, locate the Study Settings section.
//    Click Add.

    model.study("std2").feature("param").setIndex("pname", "n_air", 0);
    model.study("std2").feature("param").setIndex("plistarr", "", 0);
    model.study("std2").feature("param").setIndex("punit", "", 0);
    model.study("std2").feature("param").setIndex("pname", "n_air", 0);
    model.study("std2").feature("param").setIndex("plistarr", "", 0);
    model.study("std2").feature("param").setIndex("punit", "", 0);

//    In the table, enter the following settings:

    model.study("std2").feature("param").setIndex("pname", "alpha", 0);
    model.study("std2").feature("param").setIndex("plistarr", "range(0,2[deg],88[deg])", 0);
    model.study("std2").feature("param").setIndex("punit", "deg", 0);

//    In the Study toolbar, click Compute.

    model.study("std2").createAutoSequences("all");

    model.component("comp1").probe("emw_pport1_probe").genResult("none");
    model.component("comp1").probe("emw2_pport1_probe").genResult("none");

    model.sol("sol2").runAll();

    model.result().create("pg7", "PlotGroup3D");
    model.result("pg7").set("data", "dset3");
    model.result("pg7").setIndex("looplevel", 45, 0);
    model.result("pg7").create("mslc1", "Multislice");
    model.result("pg7").feature("mslc1").set("expr", new String[]{"emw2.normE"});
    model.result("pg7").set("showlegendsmaxmin", true);
    model.result("pg7").feature("mslc1").set("colortable", "RainbowLight");
    model.result("pg7").label("Electric Field (emw2)");
    model.result().create("pg8", "PlotGroup1D");
    model.result("pg8").set("data", "dset3");
    model.result("pg8").create("glob1", "Global");
    model.result("pg8").feature("glob1").set("unit", new String[]{"", ""});
    model.result("pg8").feature("glob1").set("expr", new String[]{"emw2.S11dB", "emw2.S21dB"});
    model.result("pg8").feature("glob1").set("descr", new String[]{"S11", "S21"});
    model.result("pg8").label("S-Parameter (emw2)");
    model.result("pg8").feature("glob1").set("titletype", "none");
    model.result("pg8").feature("glob1").set("xdata", "expr");
    model.result("pg8").set("ylabelactive", true);
    model.result("pg8").set("ylabel", "S-parameter (dB)");
    model.result("pg8").feature("glob1").set("xdataexpr", "alpha");
    model.result("pg8").feature("glob1").set("xdataunit", "deg");
    model.result("pg8").feature("glob1").set("markerpos", "datapoints");
    model.result("pg8").feature("glob1").set("xdatasolnumtype", "all");
    model.result().create("pg9", "SmithGroup");
    model.result("pg9").set("data", "dset3");
    model.result("pg9").create("rgr1", "ReflectionGraph");
    model.result("pg9").feature("rgr1").set("unit", new String[]{""});
    model.result("pg9").feature("rgr1").set("expr", new String[]{"emw2.S11"});
    model.result("pg9").feature("rgr1").set("descr", new String[]{"S11"});
    model.result("pg9").label("Smith Plot (emw2)");
    model.result("pg9").feature("rgr1").set("titletype", "manual");
    model.result("pg9").feature("rgr1").set("title", "Reflection Graph: S-parameter, Color: Frequency (GHz)");
    model.result("pg9").feature("rgr1").set("linemarker", "point");
    model.result("pg9").feature("rgr1").set("markerpos", "datapoints");
    model.result("pg9").feature("rgr1").create("col1", "Color");
    model.result("pg9").feature("rgr1").feature("col1").set("expr", "emw2.freq/1e9");
    model.result("pg9").feature("rgr1").feature("col1").set("colortable", "Spectrum");
    model.result().create("pg10", "PlotGroup3D");
    model.result("pg10").set("data", "dset3");
    model.result("pg10").label("Electric Field, Logarithmic (emw2)");
    model.result("pg10").selection().geom("geom1", 3);
    model.result("pg10").selection().set(1, 2);
    model.result("pg10").set("applyselectiontodatasetedges", true);
    model.result("pg10").create("surf1", "Surface");
    model.result("pg10").feature("surf1").set("expr", "emw2.normE");
    model.result("pg10").feature("surf1").create("sel1", "Selection");
    model.result("pg10").feature("surf1").feature("sel1").selection().set(6);
    model.result("pg10").feature("surf1").set("colortable", "Dipole");
    model.result("pg10").feature("surf1").set("colorscalemode", "logarithmic");
    model.result("pg10").feature("surf1").create("tran1", "Transparency");
    model.result("pg10").feature("surf1").feature("tran1").set("transparency", 0.3);
    model.result("pg10").create("surf2", "Surface");
    model.result("pg10").feature("surf2").set("expr", "emw2.normE");
    model.result("pg10").feature("surf2").create("sel1", "Selection");
    model.result("pg10").feature("surf2").feature("sel1").selection().set(1, 2, 3, 4, 5, 7, 8, 9, 10, 11);
    model.result("pg10").feature("surf2").set("colortable", "Dipole");
    model.result("pg10").feature("surf2").set("colorscalemode", "logarithmic");
    model.result("pg10").feature("surf2").create("tran1", "Transparency");
    model.result("pg10").feature("surf2").feature("tran1").set("transparency", 0.7);
    model.result("pg10").set("view", "view2");
    model.result().create("pg11", "PlotGroup1D");
    model.result("pg11").label("Polarization Plot (emw2)");
    model.result("pg11").set("data", "dset3");
    model.result("pg11").set("titletype", "manual");
    model.result("pg11").set("title", "Polarization states, Color: Phase (Radians)");
    model.result("pg11").setIndex("looplevelinput", "manual", 0);
    model.result("pg11").setIndex("looplevel", "1", 0);
    model.result("pg11").create("plz1", "Polarization");
    model.result("pg11").feature("plz1").set("normalization", "allorders");
    model.result("pg11").feature("plz1").set("linestyle", "dotted");
    model.result("pg11").feature("plz1").set("linewidth", 2);
    model.result("pg11").feature("plz1").set("display", "5");
    model.result("pg11").feature("plz1").create("col1", "Color");
    model.result("pg11").feature("plz1").feature("col1").set("colortable", "Cyclic");
    model.result("pg11").feature("plz1").feature("col1").set("colorlegend", true);
    model.result("pg11").feature("plz1").set("legend", true);
    model.result("pg11").feature("plz1").set("legendmethod", "manual");
    model.result("pg11").feature("plz1").setIndex("legends", "Input field", 0);
    model.result("pg11").create("plz2", "Polarization");
    model.result("pg11").feature("plz2").set("normalization", "allorders");
    model.result("pg11").feature("plz2").set("linestyle", "solid");
    model.result("pg11").feature("plz2").set("linewidth", 2);
    model.result("pg11").feature("plz2").set("display", "4");
    model.result("pg11").feature("plz2").create("col1", "Color");
    model.result("pg11").feature("plz2").feature("col1").set("colortable", "Cyclic");
    model.result("pg11").feature("plz2").feature("col1").set("colorlegend", false);
    model.result("pg11").feature("plz2").set("legend", true);
    model.result("pg11").feature("plz2").set("legendmethod", "manual");
    model.result("pg11").feature("plz2").setIndex("legends", "Reflection", 0);
    model.result("pg11").create("plz3", "Polarization");
    model.result("pg11").feature("plz3").set("normalization", "allorders");
    model.result("pg11").feature("plz3").set("linestyle", "dashed");
    model.result("pg11").feature("plz3").set("linewidth", 2);
    model.result("pg11").feature("plz3").set("display", "3");
    model.result("pg11").feature("plz3").create("col1", "Color");
    model.result("pg11").feature("plz3").feature("col1").set("colortable", "Cyclic");
    model.result("pg11").feature("plz3").feature("col1").set("colorlegend", false);
    model.result("pg11").feature("plz3").set("legend", true);
    model.result("pg11").feature("plz3").set("legendmethod", "manual");
    model.result("pg11").feature("plz3").setIndex("legends", "Transmission", 0);
    model.result("pg11").create("plz4", "Polarization");
    model.result("pg11").feature("plz4").label("Propagation Limit, Reflection Side");
    model.result("pg11").feature("plz4").set("planewave", "manual");
    model.result("pg11").feature("plz4")
         .set("xexpr", "emw2.aAxisR*cos(emw2.thetaAxisR)-j*emw2.bAxisR*sin(emw2.thetaAxisR)");
    model.result("pg11").feature("plz4")
         .set("yexpr", "emw2.aAxisR*sin(emw2.thetaAxisR)+j*emw2.bAxisR*cos(emw2.thetaAxisR)");
    model.result("pg11").feature("plz4").set("normalization", "manual");
    model.result("pg11").feature("plz4").set("plotscale", "1");
    model.result("pg11").feature("plz4").set("centerpos", "user");
    model.result("pg11").feature("plz4").set("xcenter", "emw2.mOriginR");
    model.result("pg11").feature("plz4").set("ycenter", "emw2.nOriginR");
    model.result("pg11").feature("plz4").set("showrotdir", false);
    model.result("pg11").feature("plz4").set("showorder", false);
    model.result("pg11").feature("plz4").set("legend", true);
    model.result("pg11").feature("plz4").set("legendmethod", "manual");
    model.result("pg11").feature("plz4").setIndex("legends", "Propagation limit, reflection side", 0);
    model.result("pg11").feature("plz4").active(false);
    model.result("pg11").create("plz5", "Polarization");
    model.result("pg11").feature("plz5").label("Propagation Limit, Transmission Side");
    model.result("pg11").feature("plz5").set("planewave", "manual");
    model.result("pg11").feature("plz5")
         .set("xexpr", "emw2.aAxisT*cos(emw2.thetaAxisT)-j*emw2.bAxisT*sin(emw2.thetaAxisT)");
    model.result("pg11").feature("plz5")
         .set("yexpr", "emw2.aAxisT*sin(emw2.thetaAxisT)+j*emw2.bAxisT*cos(emw2.thetaAxisT)");
    model.result("pg11").feature("plz5").set("normalization", "manual");
    model.result("pg11").feature("plz5").set("plotscale", "1");
    model.result("pg11").feature("plz5").set("centerpos", "user");
    model.result("pg11").feature("plz5").set("xcenter", "emw2.mOriginT");
    model.result("pg11").feature("plz5").set("ycenter", "emw2.nOriginT");
    model.result("pg11").feature("plz5").set("showrotdir", false);
    model.result("pg11").feature("plz5").set("showorder", false);
    model.result("pg11").feature("plz5").set("legend", true);
    model.result("pg11").feature("plz5").set("legendmethod", "manual");
    model.result("pg11").feature("plz5").setIndex("legends", "Propagation limit, transmission side", 0);
    model.result("pg11").feature("plz5").active(false);
    model.result("pg7").run();

//    In the Settings window for 3D Plot Group, type Magnetic Field (emw2, TM) in the Label text field.

    model.result("pg7").label("Magnetic Field (emw2, TM)");
    model.result("pg7").run();

//    In the Model Builder window, expand the Magnetic Field (emw2, TM) node, then click Multislice 1.
//    In the Settings window for Multislice, locate the Expression section.
//    In the Expression text field, type emw2.Hy.

    model.result("pg7").feature("mslc1").set("expr", "emw2.Hy");

//    Locate the Multiplane Data section.
//    Find the X-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg7").feature("mslc1").set("xnumber", "0");

//    Find the Z-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg7").feature("mslc1").set("znumber", "0");

//    Locate the Coloring and Style section.
//    From the Color table list, select WaveLight.

    model.result("pg7").feature("mslc1").set("colortable", "WaveLight");
    model.result("pg7").run();

//    In the Model Builder window, right-click Magnetic Field (emw2, TM) and choose Arrow Volume.

    model.result("pg7").create("arwv1", "ArrowVolume");
    model.result("pg7").feature("arwv1").set("evaluationsettings", "parent");

//    In the Settings window for Arrow Volume, locate the Expression section.
//    In the X-component text field, type emw2.Poavx.

    model.result("pg7").feature("arwv1").setIndex("expr", "emw2.Poavx", 0);

//    In the Y-component text field, type emw2.Poavy.

    model.result("pg7").feature("arwv1").setIndex("expr", "emw2.Poavy", 1);

//    In the Z-component text field, type emw2.Poavz.

    model.result("pg7").feature("arwv1").setIndex("expr", "emw2.Poavz", 2);

//    Locate the Arrow Positioning section.
//    Find the Y grid points subsection.
//    In the Points text field, type 1.

    model.result("pg7").feature("arwv1").set("ynumber", 1);

//    Locate the Coloring and Style section.
//    From the Color list, select Green.

    model.result("pg7").feature("arwv1").set("color", "green");

//    In the Magnetic Field (emw2, TM) toolbar, click Plot.

    model.result("pg7").run();
    model.result("pg8").run();

//    In the Model Builder window, under Results, click S-Parameter (emw2).
//    In the Settings window for 1D Plot Group, type S-Parameter (emw2, TM) in the Label text field.

    model.result("pg8").label("S-Parameter (emw2, TM)");

//    Locate the Title section.
//    From the Title type list, select None.

    model.result("pg8").set("titletype", "none");

//    Locate the Plot Settings section.
//    Select the x-axis label checkbox.

    model.result("pg8").set("xlabelactive", true);

//    In the y-axis label text field, type S-parameter.

    model.result("pg8").set("ylabel", "S-parameter");

//    Locate the Legend section.
//    From the Position list, select Middle left.

    model.result("pg8").set("legendpos", "middleleft");
    model.result("pg8").run();

//    In the Model Builder window, expand the S-Parameter (emw2, TM) node, then click Global 1.
//    In the Settings window for Global, locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg8").feature("glob1").setIndex("expr", "abs(emw2.S11)^2", 0);
    model.result("pg8").feature("glob1").setIndex("unit", 1, 0);
    model.result("pg8").feature("glob1").setIndex("descr", "Reflectance", 0);
    model.result("pg8").feature("glob1").setIndex("expr", "abs(emw2.S21)^2", 1);
    model.result("pg8").feature("glob1").setIndex("unit", 1, 1);
    model.result("pg8").feature("glob1").setIndex("descr", "Transmittance", 1);

//    Locate the Coloring and Style section.
//    Find the Line style subsection.
//    From the Line list, select None.

    model.result("pg8").feature("glob1").set("linestyle", "none");

//    Find the Line markers subsection.
//    From the Marker list, select Cycle.

    model.result("pg8").feature("glob1").set("linemarker", "cycle");

//    From the Positioning list, select Interpolated.

    model.result("pg8").feature("glob1").set("markerpos", "interp");
    model.result("pg8").run();

//    In the Model Builder window, right-click S-Parameter (emw2, TM) and choose Global.

    model.result("pg8").create("glob2", "Global");
    model.result("pg8").feature("glob2").set("markerpos", "datapoints");
    model.result("pg8").feature("glob2").set("linewidth", "preference");

//    In the Settings window for Global, locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg8").feature("glob2").setIndex("expr", "abs(r_p)^2", 0);
    model.result("pg8").feature("glob2").setIndex("descr", "Reflectance, analytic", 0);
    model.result("pg8").feature("glob2").setIndex("expr", "n_slab*cos(beta)/(n_air*cos(alpha))*abs(t_p)^2", 1);
    model.result("pg8").feature("glob2").setIndex("descr", "Transmittance, analytic", 1);

//    Click to expand the Legends section.
//    From the Legends list, select Manual.

    model.result("pg8").feature("glob2").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg8").feature("glob2").setIndex("legends", "Reflectance, analytic", 0);
    model.result("pg8").feature("glob2").setIndex("legends", "Transmittance, analytic", 1);

//    Locate the x-Axis Data section.
//    From the Unit list, select °.

    model.result("pg8").feature("glob2").set("xdataparamunit", "\u00b0");

//    In the S-Parameter (emw2, TM) toolbar, click Plot.

    model.result("pg8").run();
    model.result("pg9").run();

//    In the Model Builder window, under Results, click Smith Plot (emw2).
//    In the Settings window for Smith Plot Group, type Smith Plot (emw2, TM) in the Label text field.

    model.result("pg9").label("Smith Plot (emw2, TM)");

//    In the Model Builder window, expand the Smith Plot (emw2, TM) node.

    model.result("pg9").run();

//    In the Model Builder window, expand the Results > Smith Plot (emw2, TM) > Reflection Graph 1 node, then click Color Expression 1.
//    In the Settings window for Color Expression, locate the Expression section.
//    In the Expression text field, type alpha.

    model.result("pg9").feature("rgr1").feature("col1").set("expr", "alpha");

//    From the Unit list, select °.

    model.result("pg9").feature("rgr1").feature("col1").set("unit", "\u00b0");
    model.result("pg9").run();

//    In the Model Builder window, under Results, click Smith Plot (emw2, TM).
//    In the Settings window for Smith Plot Group, locate the Title section.
//    From the Title type list, select Manual.

    model.result("pg9").set("titletype", "manual");

//    In the Title text area, type Reflection Graph: S-parameter, Color: Angle of incidence (deg).

    model.result("pg9").set("title", "Reflection Graph: S-parameter, Color: Angle of incidence (deg)");

//    In the Smith Plot (emw2, TM) toolbar, click Plot.

    model.result("pg9").run();
    model.result("pg11").run();

//    In the Model Builder window, under Results, click Polarization Plot (emw2).
//    In the Settings window for 1D Plot Group, type Polarization Plot (emw2, TM) in the Label text field.

    model.result("pg11").label("Polarization Plot (emw2, TM)");

//    In the Polarization Plot (emw2, TM) toolbar, click Plot.

    model.result("pg11").run();

//    Also in this case, the polarization plot shows that the field is linearly polarized, in this case with a pure in-plane polarization.

    model.result("pg1").set("window", "window1");
    model.result("pg1").run();

    model.title("Fresnel Equations");

    model
         .description("A plane electromagnetic wave propagating through free space is incident at an angle upon an infinite dielectric medium. This example computes the reflection and transmission coefficients and compares the results to those given by the Fresnel equations.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    run2(model);
  }

}
