/*
 * pyramidal_absorber.java
 */

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

/** Model exported on May 13 2026, 08:17 by COMSOL 6.4.0.419. */
public class pyramidal_absorber {

  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 the study frequency ahead of performing any frequency-dependent operation such as building mesh. The physics-controlled mesh uses the specified frequency value.
//    In the Model Builder window, under Study 1, click Step 1: Frequency Domain.
//    In the Settings window for Frequency Domain, locate the Study Settings section.
//    In the Frequencies text field, type 5[GHz].

    model.study("std1").feature("freq").set("plist", "5[GHz]");

//    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 mm.

    model.component("comp1").geom("geom1").lengthUnit("mm");

//    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("theta", "0[deg]");
    model.param().descr("theta", "Elevation angle");

//    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 50.

    model.component("comp1").geom("geom1").feature("blk1").set("size", new double[]{50, 1, 1});

//    In the Depth text field, type 50.

    model.component("comp1").geom("geom1").feature("blk1").set("size", new double[]{50, 50, 1});

//    In the Height text field, type 280.

    model.component("comp1").geom("geom1").feature("blk1").set("size", new double[]{50, 50, 280});

//    Locate the Position section.
//    In the x text field, type -25.

    model.component("comp1").geom("geom1").feature("blk1").set("pos", new double[]{-25, 0, 0});

//    In the y text field, type -25.

    model.component("comp1").geom("geom1").feature("blk1").set("pos", new double[]{-25, -25, 0});

//    In the z text field, type -90.

    model.component("comp1").geom("geom1").feature("blk1").set("pos", new double[]{-25, -25, -90});

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("blk1");

//    Click the Wireframe Rendering button in the Graphics toolbar.

    model.component("comp1").view("view1").set("renderwireframe", true);

//    In the Geometry toolbar, click Block.

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

//    In the Settings window for Block, locate the Size and Shape section.
//    In the Width text field, type 50.

    model.component("comp1").geom("geom1").feature("blk2").set("size", new double[]{50, 1, 1});

//    In the Depth text field, type 50.

    model.component("comp1").geom("geom1").feature("blk2").set("size", new double[]{50, 50, 1});

//    In the Height text field, type 180.

    model.component("comp1").geom("geom1").feature("blk2").set("size", new double[]{50, 50, 180});

//    Locate the Position section.
//    From the Base list, select Center.

    model.component("comp1").geom("geom1").feature("blk2").set("base", "center");

//    In the Geometry toolbar, click Block.

    model.component("comp1").geom("geom1").run("blk2");
    model.component("comp1").geom("geom1").create("blk3", "Block");

//    In the Settings window for Block, locate the Size and Shape section.
//    In the Width text field, type 50.

    model.component("comp1").geom("geom1").feature("blk3").set("size", new double[]{50, 1, 1});

//    In the Depth text field, type 50.

    model.component("comp1").geom("geom1").feature("blk3").set("size", new double[]{50, 50, 1});

//    In the Height text field, type 25.

    model.component("comp1").geom("geom1").feature("blk3").set("size", new double[]{50, 50, 25});

//    Locate the Position section.
//    From the Base list, select Center.

    model.component("comp1").geom("geom1").feature("blk3").set("base", "center");

//    In the z text field, type -77.5.

    model.component("comp1").geom("geom1").feature("blk3").set("pos", new double[]{0, 0, -77.5});

//    In the Geometry toolbar, click More Primitives and choose Pyramid.

    model.component("comp1").geom("geom1").run("blk3");
    model.component("comp1").geom("geom1").create("pyr1", "Pyramid");

//    In the Settings window for Pyramid, locate the Size and Shape section.
//    In the Base length 1 text field, type 50.

    model.component("comp1").geom("geom1").feature("pyr1").set("a", 50);

//    In the Base length 2 text field, type 50.

    model.component("comp1").geom("geom1").feature("pyr1").set("b", 50);

//    In the Height text field, type 120.

    model.component("comp1").geom("geom1").feature("pyr1").set("h", 120);

//    In the Ratio text field, type 0.

    model.component("comp1").geom("geom1").feature("pyr1").set("rat", 0);

//    Locate the Position section.
//    In the z text field, type -65.

    model.component("comp1").geom("geom1").feature("pyr1").set("pos", new double[]{0, 0, -65});

//    Click Build All Objects.

    model.component("comp1").geom("geom1").runPre("fin");

//    The finished geometry should look like this.
//    Set up the physics based on the direction of propagation and the E-field polarization. Assume a TE-polarized wave which is equivalent to \[s\]-polarization and perpendicular polarization. E<sub>x</sub> and E<sub>z</sub> are zero while E<sub>y</sub> is dominant.

    model.component("comp1").geom("geom1").run();

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("emw").create("pc1", "PeriodicCondition", 2);

//    Select Boundaries 1, 4, 9, 18, 19, 20.

    model.component("comp1").physics("emw").feature("pc1").selection().set(1, 4, 9, 18, 19, 20);

//    In the Settings window for Periodic Condition, locate the Periodicity Settings section.
//    From the Type of periodicity list, select Floquet periodicity.

    model.component("comp1").physics("emw").feature("pc1").set("PeriodicType", "Floquet");

//    From the k-vector for Floquet periodicity list, select From periodic port.

    model.component("comp1").physics("emw").feature("pc1").set("Floquet_source", "FromPeriodicPort");

//    In the Physics toolbar, click Boundaries and choose Periodic Condition.

    model.component("comp1").physics("emw").create("pc2", "PeriodicCondition", 2);

//    Select Boundaries 2, 5, 10, 13, 14, 16.

    model.component("comp1").physics("emw").feature("pc2").selection().set(2, 5, 10, 13, 14, 16);

//    In the Settings window for Periodic Condition, locate the Periodicity Settings section.
//    From the Type of periodicity list, select Floquet periodicity.

    model.component("comp1").physics("emw").feature("pc2").set("PeriodicType", "Floquet");

//    From the k-vector for Floquet periodicity list, select From periodic port.

    model.component("comp1").physics("emw").feature("pc2").set("Floquet_source", "FromPeriodicPort");

//    In the Physics toolbar, click Boundaries and choose Port.

    model.component("comp1").physics("emw").create("port1", "Port", 2);

//    Select Boundary 11.

    model.component("comp1").physics("emw").feature("port1").selection().set(11);

//    In the Settings window for Port, locate the Port Properties section.
//    From the Type of port list, select Periodic.

    model.component("comp1").physics("emw").feature("port1").set("PortType", "Periodic");

//    For the first port, wave excitation is <l>on</l> by default.
//    Select the Activate slit condition on interior port checkbox.

    model.component("comp1").physics("emw").feature("port1").set("PortSlit", true);

//    Click Toggle Power Flow Direction.

    model.component("comp1").physics("emw").feature("port1").set("PortOrientation", "ReversePort");

//    Locate the Port Mode Settings section.
//    Specify the \[\mathbf{E}_\textrm{0}\] vector as

    model.component("comp1").physics("emw").feature("port1").set("Eampl", new int[]{0, 1, 0});

//    In the \[\alpha_{1}\] text field, type theta.

    model.component("comp1").physics("emw").feature("port1").set("alpha1_inc", "theta");

//    The maximum frequency in the setting window will be used only when <l>Compute Diffraction Order</l> button is clicked to generate Diffraction Order features handling higher order mode individually. In this model, PML absorbs all higher order modes, so this setting is ineffective.
//    In the Physics toolbar, click Boundaries and choose Scattering Boundary Condition.

    model.component("comp1").physics("emw").create("sctr1", "Scattering", 2);

//    Select Boundary 12.

    model.component("comp1").physics("emw").feature("sctr1").selection().set(12);

//    In the Definitions toolbar, click Perfectly Matched Layer.

    model.component("comp1").coordSystem().create("pml1", "PML");

//    Select Domain 4.

    model.component("comp1").coordSystem("pml1").selection().set(4);

//    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, locate the Material Contents section.
//    In the table, enter the following settings:

    model.component("comp1").material("mat1").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("def").set("relpermeability", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("def").set("electricconductivity", new String[]{"0"});

//    Right-click Materials and choose Blank Material.

    model.component("comp1").material().create("mat2", "Common");

//    Select Domains 1, 3.

    model.component("comp1").material("mat2").selection().set(1, 3);

//    In the Settings window for Material, locate the Material Contents section.
//    In the table, enter the following settings:

    model.component("comp1").material("mat2").propertyGroup("def").set("relpermittivity", new String[]{"1"});
    model.component("comp1").material("mat2").propertyGroup("def").set("relpermeability", new String[]{"1"});
    model.component("comp1").material("mat2").propertyGroup("def").set("electricconductivity", new String[]{"0.5"});

//    In the Model Builder window, right-click Component 1 (comp1) > Mesh 1 and choose Build All.

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

//    In the Model Builder window, right-click View 1 and choose Hide for Physics.

    model.component("comp1").view("view1").hideEntities().create("hide1");

//    Select Domain 4.

    model.component("comp1").view("view1").hideEntities("hide1").set(4);

//    In the Settings window for Hide for Physics, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").view("view1").hideEntities("hide1").geom("geom1", 2);

//    Select Boundaries 4, 5, 9, 10.

    model.component("comp1").view("view1").hideEntities("hide1").set(4, 5, 9, 10);

//    In the Model Builder window, under Component 1 (comp1), click Mesh 1.
//    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", "theta", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "rad", 0);
    model.study("std1").feature("param").setIndex("pname", "theta", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "rad", 0);

//    In the table, enter the following settings:

    model.study("std1").feature("param").setIndex("plistarr", "range(0[deg],5[deg],85[deg])", 0);

//    In the Study toolbar, click Compute.

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

    model.component("comp1").probe("emw_port1_probe").genResult("none");

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

    model.result().create("pg2", "PlotGroup3D");
    model.result("pg2").set("data", "dset1");
    model.result("pg2").setIndex("looplevel", 18, 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("pg2").selection().geom("geom1", 3);
    model.result("pg2").selection().set(1, 2, 3);
    model.result("pg2").set("applyselectiontodatasetedges", true);
    model.result("pg2").run();
    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"});
    model.result("pg3").feature("glob1").set("descr", new String[]{"S11"});
    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", "theta");
    model.result("pg3").feature("glob1").set("xdataunit", "rad");
    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, 3);
    model.result("pg5").set("applyselectiontodatasetedges", true);

    model.component("comp1").measure().selection().geom(2);
    model.component("comp1").measure().selection().set(3);
    model.component("comp1").measure().selection().geom(2);
    model.component("comp1").measure().selection().set(1, 2, 3, 4, 5, 9, 10, 12, 13, 14, 16, 18, 19, 20);

    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(3);
    model.result("pg5").feature("surf1").set("colortable", "Dipole");
    model.result("pg5").feature("surf1").set("colorscalemode", "logarithmic");
    model.result("pg5").feature("surf1").create("mtrl1", "MaterialAppearance");
    model.result("pg5").feature("surf1").feature("mtrl1").set("appearance", "custom");
    model.result("pg5").feature("surf1").feature("mtrl1").set("family", "aluminumpolished");
    model.result("pg5").feature("surf1").set("expr", "1");
    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, 4, 5, 9, 10, 13, 14, 16, 18, 19, 20);
    model.result("pg5").feature("surf2").set("colortable", "Prism");
    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.result("pg5").create("surf3", "Surface");
    model.result("pg5").feature("surf3").set("expr", "emw.normE");
    model.result("pg5").feature("surf3").create("sel1", "Selection");
    model.result("pg5").feature("surf3").feature("sel1").selection().set(6, 7, 8, 15, 17);
    model.result("pg5").feature("surf3").set("colortable", "Dipole");
    model.result("pg5").feature("surf3").set("colorscalemode", "logarithmic");
    model.result("pg5").feature("surf3").create("tran1", "Transparency");
    model.result("pg5").feature("surf3").feature("tran1").set("transparency", 0.7);

    model.component("comp1").view().create("view2", "geom1");
    model.component("comp1").view("view2").camera().set("position", new double[]{-339.15, -452.2, 360.89});
    model.component("comp1").view("view2").set("environmentmap", "Indoor");
    model.component("comp1").view("view2").camera().set("zoomanglefull", 46.925);

    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", "1");
    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", "0");
    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").label("Propagation Limit, Reflection Side");
    model.result("pg6").feature("plz3").set("planewave", "manual");
    model.result("pg6").feature("plz3")
         .set("xexpr", "emw.aAxisR*cos(emw.thetaAxisR)-j*emw.bAxisR*sin(emw.thetaAxisR)");
    model.result("pg6").feature("plz3")
         .set("yexpr", "emw.aAxisR*sin(emw.thetaAxisR)+j*emw.bAxisR*cos(emw.thetaAxisR)");
    model.result("pg6").feature("plz3").set("normalization", "manual");
    model.result("pg6").feature("plz3").set("plotscale", "1");
    model.result("pg6").feature("plz3").set("centerpos", "user");
    model.result("pg6").feature("plz3").set("xcenter", "emw.mOriginR");
    model.result("pg6").feature("plz3").set("ycenter", "emw.nOriginR");
    model.result("pg6").feature("plz3").set("showrotdir", false);
    model.result("pg6").feature("plz3").set("showorder", false);
    model.result("pg6").feature("plz3").set("legend", true);
    model.result("pg6").feature("plz3").set("legendmethod", "manual");
    model.result("pg6").feature("plz3").setIndex("legends", "Propagation limit, reflection side", 0);
    model.result("pg6").feature("plz3").active(false);
    model.result("pg2").set("applyselectiontodatasetedges", true);
    model.result("pg2").run();

//    In the Model Builder window, expand the Results > Datasets node, then click Study 1/Solution 1 (sol1).
//    In the Results toolbar, click Attributes and choose Selection.
//    In the Settings window for Selection, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Domain.

    model.result().dataset("dset1").selection().geom("geom1", 3);

//    Select Domains 1, 2, 3.

    model.result().dataset("dset1").selection().geom("geom1", 3);
    model.result().dataset("dset1").selection().set(1, 2, 3);
    model.result("pg2").run();

//    In the Model Builder window, expand the Results > Electric Field (emw) node, then click Multislice 1.
//    In the Settings window for Multislice, locate the Multiplane Data section.
//    Find the Z-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg2").feature("mslc1").set("znumber", "0");
    model.result("pg2").run();

//    In the Model Builder window, right-click Electric Field (emw) 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 > 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 X grid points subsection.
//    In the Points text field, type 21.

    model.result("pg2").feature("arwv1").set("xnumber", 21);

//    Find the Y grid points subsection.
//    In the Points text field, type 1.

    model.result("pg2").feature("arwv1").set("ynumber", 1);

//    Find the Z grid points subsection.
//    In the Points text field, type 21.

    model.result("pg2").feature("arwv1").set("znumber", 21);

//    In the Electric Field (emw) toolbar, click Plot.

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

//    In the Model Builder window, click Electric Field (emw).
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Parameter value (theta (rad)) list, select 0.5236.

    model.result("pg2").setIndex("looplevel", 7, 0);

//    In the Electric Field (emw) toolbar, click Plot.

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

//    Click the Zoom Extents button in the Graphics toolbar.

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

//    In the Model Builder window, expand the S-Parameter (emw) node, then click Global 1.
//    In the Settings window for Global, click Replace Expression in the upper-right corner of the y-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Electromagnetic Waves, Frequency Domain > Ports > emw.S11dB - S11 - dB.

    model.result("pg3").feature("glob1").set("expr", new String[]{"emw.S11dB"});
    model.result("pg3").feature("glob1").set("descr", new String[]{"S11"});
    model.result("pg3").feature("glob1").set("unit", new String[]{"dB"});

//    In the S-Parameter (emw) toolbar, click Plot.

    model.result("pg3").run();
    model.result("pg5").run();

//    In the Model Builder window, under Results, click Electric Field, Logarithmic (emw).
//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg7", "PlotGroup3D");
    model.result("pg7").set("applyselectiontodatasetedges", false);
    model.result("pg7").run();

//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Parameter value (theta (rad)) list, select 0.5236.

    model.result("pg7").setIndex("looplevel", 7, 0);

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg7").set("edges", false);

//    Right-click 3D Plot Group 7 and choose Isosurface.

    model.result("pg7").create("iso1", "Isosurface");
    model.result("pg7").feature("iso1").set("evaluationsettings", "parent");

//    In the Settings window for Isosurface, locate the Levels section.
//    In the Total levels text field, type 20.

    model.result("pg7").feature("iso1").set("number", 20);

//    Locate the Coloring and Style section.
//    From the Color table list, select Ranitomeya.

    model.result("pg7").feature("iso1").set("colortable", "Ranitomeya");

//    In the Model Builder window, right-click Isosurface 1 and choose Transparency.

    model.result("pg7").feature("iso1").create("tran1", "Transparency");
    model.result("pg7").run();

//    In the Settings window for Transparency, locate the Transparency section.
//    Find the Transparency subsection.
//    Set the Transparency value to 0.85.

    model.result("pg7").feature("iso1").feature("tran1").set("transparency", 0.85);
    model.result("pg7").run();

//    In the Model Builder window, right-click 3D Plot Group 7 and choose Surface.

    model.result("pg7").create("surf1", "Surface");
    model.result("pg7").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, locate the Coloring and Style section.
//    From the Color table list, select Xylethrus.

    model.result("pg7").feature("surf1").set("colortable", "Xylethrus");

//    Right-click Surface 1 and choose Selection.

    model.result("pg7").feature("surf1").create("sel1", "Selection");

//    Select Boundaries 1, 2, 6, 8, 13, 15, 17, 18.

    model.result("pg7").feature("surf1").feature("sel1").selection().set(1, 2, 6, 8, 13, 15, 17, 18);

//    In the 3D Plot Group 7 toolbar, click Plot.

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

    model.title("Modeling of Pyramidal Absorbers for an Anechoic Chamber");

    model
         .description("In this example, periodic pyramidal lossy structures work as microwave absorbers. Pyramidal absorbers with radiation-absorbent material (RAM) are popularly used in anechoic chambers for electromagnetic wave measurements. This example emulates microwave absorbers with a lossy material mimicking conductive carbon-loaded foam.");

    return model;
  }

  public static void main(String[] args) {
    run();
  }

}
