/*
 * circulator.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 15 2026, 11:27 by COMSOL 6.4.0.421. */
public class circulator {

  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 2D.
//    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", 2);

    model.component("comp1").mesh().create("mesh1");

    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");

//    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("eps_r", "1");
    model.param().descr("eps_r", "Relative permittivity");

//    In the Geometry toolbar, click Import.

    model.component("comp1").geom("geom1").create("imp1", "Import");

//    In the Settings window for Import, locate the Source section.
//    Click Browse.
//    Browse to the model's Application Library folder and double-click the file circulator.mphbin.

    model.component("comp1").geom("geom1").feature("imp1").set("filename", "circulator.mphbin");

//    Click Import.

    model.component("comp1").geom("geom1").feature("imp1").importData();

//    Click the Zoom Extents button in the Graphics toolbar.

    model.component("comp1").geom("geom1").run();

//    In the Materials toolbar, click Add Material to open the Add Material window.
//    In the tree, select Built-in > Air.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("eta", "Piecewise");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("Cp", "Piecewise");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("rho", "Analytic");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("k", "Piecewise");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("cs", "Analytic");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("an1", "Analytic");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("an2", "Analytic");
    model.component("comp1").material("mat1").propertyGroup()
         .create("RefractiveIndex", "RefractiveIndex", "Refractive index");
    model.component("comp1").material("mat1").propertyGroup()
         .create("NonlinearModel", "NonlinearModel", "Nonlinear model");
    model.component("comp1").material("mat1").propertyGroup().create("idealGas", "idealGas", "Ideal gas");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func().create("Cp", "Piecewise");
    model.component("comp1").material("mat1").label("Air");
    model.component("comp1").material("mat1").set("family", "air");
    model.component("comp1").material("mat1").propertyGroup("def").func("eta").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("def").func("eta")
         .set("pieces", new String[][]{{"200.0", "1600.0", "-8.38278E-7+8.35717342E-8*T^1-7.69429583E-11*T^2+4.6437266E-14*T^3-1.06585607E-17*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("eta").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("def").func("eta").set("fununit", "Pa*s");
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp")
         .set("pieces", new String[][]{{"200.0", "1600.0", "1047.63657-0.372589265*T^1+9.45304214E-4*T^2-6.02409443E-7*T^3+1.2858961E-10*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("def").func("Cp").set("fununit", "J/(kg*K)");
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("expr", "pA*0.02897/R_const[K*mol/J]/T");
    model.component("comp1").material("mat1").propertyGroup("def").func("rho").set("args", new String[]{"pA", "T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho").set("fununit", "kg/m^3");
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("argunit", new String[]{"Pa", "K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("plotaxis", new String[]{"off", "on"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("plotfixedvalue", new String[]{"101325", "273.15"});
    model.component("comp1").material("mat1").propertyGroup("def").func("rho")
         .set("plotargs", new String[][]{{"pA", "101325", "101325"}, {"T", "273.15", "293.15"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("k").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("def").func("k")
         .set("pieces", new String[][]{{"200.0", "1600.0", "-0.00227583562+1.15480022E-4*T^1-7.90252856E-8*T^2+4.11702505E-11*T^3-7.43864331E-15*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("k").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("def").func("k").set("fununit", "W/(m*K)");
    model.component("comp1").material("mat1").propertyGroup("def").func("cs")
         .set("expr", "sqrt(1.4*R_const[K*mol/J]/0.02897*T)");
    model.component("comp1").material("mat1").propertyGroup("def").func("cs").set("args", new String[]{"T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("cs").set("fununit", "m/s");
    model.component("comp1").material("mat1").propertyGroup("def").func("cs").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("cs")
         .set("plotfixedvalue", new String[]{"273.15"});
    model.component("comp1").material("mat1").propertyGroup("def").func("cs")
         .set("plotargs", new String[][]{{"T", "273.15", "373.15"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("funcname", "alpha_p");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("expr", "-1/rho(pA,T)*d(rho(pA,T),T)");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("args", new String[]{"pA", "T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("fununit", "1/K");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("argunit", new String[]{"Pa", "K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotaxis", new String[]{"off", "on"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotfixedvalue", new String[]{"101325", "273.15"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotargs", new String[][]{{"pA", "101325", "101325"}, {"T", "273.15", "373.15"}});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("funcname", "muB");
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("expr", "0.6*eta(T)");
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("args", new String[]{"T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("fununit", "Pa*s");
    model.component("comp1").material("mat1").propertyGroup("def").func("an2").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2")
         .set("plotfixedvalue", new String[]{"200"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an2")
         .set("plotargs", new String[][]{{"T", "200", "1600"}});
    model.component("comp1").material("mat1").propertyGroup("def").set("thermalexpansioncoefficient", "");
    model.component("comp1").material("mat1").propertyGroup("def").set("molarmass", "");
    model.component("comp1").material("mat1").propertyGroup("def").set("bulkviscosity", "");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalexpansioncoefficient", new String[]{"alpha_p(pA,T)", "0", "0", "0", "alpha_p(pA,T)", "0", "0", "0", "alpha_p(pA,T)"});
    model.component("comp1").material("mat1").propertyGroup("def").set("molarmass", "0.02897[kg/mol]");
    model.component("comp1").material("mat1").propertyGroup("def").set("bulkviscosity", "muB(T)");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermeability", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermittivity", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("def").set("dynamicviscosity", "eta(T)");
    model.component("comp1").material("mat1").propertyGroup("def").set("ratioofspecificheat", "1.4");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("electricconductivity", new String[]{"0[S/m]", "0", "0", "0", "0[S/m]", "0", "0", "0", "0[S/m]"});
    model.component("comp1").material("mat1").propertyGroup("def").set("heatcapacity", "Cp(T)");
    model.component("comp1").material("mat1").propertyGroup("def").set("density", "rho(pA,T)");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalconductivity", new String[]{"k(T)", "0", "0", "0", "k(T)", "0", "0", "0", "k(T)"});
    model.component("comp1").material("mat1").propertyGroup("def").set("soundspeed", "cs(T)");
    model.component("comp1").material("mat1").propertyGroup("def").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("def").addInput("pressure");
    model.component("comp1").material("mat1").propertyGroup("RefractiveIndex")
         .set("n", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("NonlinearModel").set("BA", "def.gamma-1");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").label("Piecewise 2");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").set("arg", "T");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp")
         .set("pieces", new String[][]{{"200.0", "1600.0", "1047.63657-0.372589265*T^1+9.45304214E-4*T^2-6.02409443E-7*T^3+1.2858961E-10*T^4"}});
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").set("argunit", "K");
    model.component("comp1").material("mat1").propertyGroup("idealGas").func("Cp").set("fununit", "J/(kg*K)");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("Rs", "R_const/Mn");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("heatcapacity", "Cp(T)");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("ratioofspecificheat", "1.4");
    model.component("comp1").material("mat1").propertyGroup("idealGas").set("molarmass", "0.02897[kg/mol]");
    model.component("comp1").material("mat1").propertyGroup("idealGas").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("idealGas").addInput("pressure");
    model.component("comp1").material("mat1").materialType("nonSolid");

//    In the Materials toolbar, click Add Material to close the Add Material window.
//    Select Domains 1, 3, 6, 7.

    model.component("comp1").material("mat1").selection().set(1, 3, 6, 7);

//    Define the dielectric matching elements with a permittivity eps_r. You will later set up the solver to sweep this parameter.
//    In the Model Builder window, right-click Materials and choose Blank Material.

    model.component("comp1").material().create("mat2", "Common");

//    In the Settings window for Material, type Dielectric in the Label text field.

    model.component("comp1").material("mat2").label("Dielectric");

//    Select Domains 2, 4, 5.

    model.component("comp1").material("mat2").selection().set(2, 4, 5);

//    Locate the Material Contents section.
//    In the table, enter the following settings:

    model.component("comp1").material("mat2").propertyGroup("def").set("relpermittivity", new String[]{"eps_r"});
    model.component("comp1").material("mat2").propertyGroup("def").set("relpermeability", new String[]{"1"});
    model.component("comp1").material("mat2").propertyGroup("def").set("electricconductivity", new String[]{"0"});

//    Right-click Materials and choose Blank Material.

    model.component("comp1").material().create("mat3", "Common");

//    In the Settings window for Material, type Ferrite in the Label text field.

    model.component("comp1").material("mat3").label("Ferrite");

//    Select Domain 8.

    model.component("comp1").material("mat3").selection().set(8);

//    Locate the Material Contents section.
//    In the table, enter the following settings:

    model.component("comp1").material("mat3").propertyGroup("def").set("relpermittivity", new String[]{"12.9"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("relpermeability", new String[]{"mur", "-i*kr", "0", "i*kr", "mur", "0", "0", "0", "1"});
    model.component("comp1").material("mat3").propertyGroup("def").set("electricconductivity", new String[]{"0"});

//    In the Model Builder window, expand the Component 1 (comp1) > Materials > Ferrite (mat3) node, then click Basic (def).
//    In the Settings window for Basic, locate the Model Inputs section.
//    Click Select Quantity.
//    In the Physical Quantity dialog, type frequency in the text field.
//    In the tree, select General > Frequency (Hz).
//    Click OK.

    model.component("comp1").material("mat3").propertyGroup("def").addInput("frequency");

//    To define mur and kr in terms of the frequency, you need to enter a number of local parameters.
//    In the Settings window for Basic, locate the Local Properties section.
//    In the Local properties table, enter the following settings:

    model.component("comp1").material("mat3").propertyGroup("def").set("gamma", new String[]{"1.759e11[C/kg]"});
    model.component("comp1").material("mat3").propertyGroup("def").set("omega", new String[]{"2*pi*freq"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("H0", new String[]{"omega/(gamma*mu0_const+1e4[m/C])"});
    model.component("comp1").material("mat3").propertyGroup("def").set("w0", new String[]{"mu0_const*gamma*H0"});
    model.component("comp1").material("mat3").propertyGroup("def").set("Ms", new String[]{"0.3[Wb/m^2]/mu0_const"});
    model.component("comp1").material("mat3").propertyGroup("def").set("wm", new String[]{"mu0_const*gamma*Ms"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("mur", new String[]{"1+w0*wm/(w0^2-omega^2)"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("kr", new String[]{"omega*wm/(w0^2-omega^2)"});

//    With the Electromagnetic Waves interface selected and the materials defined, the physics you need to specify is only the ports.
//    In the Model Builder window, under Component 1 (comp1), click Electromagnetic Waves, Frequency Domain (emw).
//    In the Settings window for Electromagnetic Waves, Frequency Domain, locate the Components section.
//    From the Electric field components solved for list, select Out-of-plane vector.

    model.component("comp1").physics("emw").prop("components").set("components", "outofplane");

//    Only the <eqv>z</eqv>-component of electric field (transverse electric mode) is effective in the simulation domain. By choosing the <l>Out-of-plane vector</l>, the computation can be more efficient.
//    In the Physics toolbar, click Boundaries and choose Port.

    model.component("comp1").physics("emw").create("port1", "Port", 1);

//    Select Boundary 1.

    model.component("comp1").physics("emw").feature("port1").selection().set(1);

//    In the Settings window for Port, locate the Port Properties section.
//    From the Type of port list, select Rectangular.

    model.component("comp1").physics("emw").feature("port1").set("PortType", "Rectangular");

//    For the first port, wave excitation is <l>on</l> by default.
//    In the Physics toolbar, click Boundaries and choose Port.

    model.component("comp1").physics("emw").create("port2", "Port", 1);

//    Select Boundary 20.

    model.component("comp1").physics("emw").feature("port2").selection().set(20);

//    In the Settings window for Port, locate the Port Properties section.
//    From the Type of port list, select Rectangular.

    model.component("comp1").physics("emw").feature("port2").set("PortType", "Rectangular");

//    In the Physics toolbar, click Boundaries and choose Port.

    model.component("comp1").physics("emw").create("port3", "Port", 1);

//    Select Boundary 21.

    model.component("comp1").physics("emw").feature("port3").selection().set(21);

//    In the Settings window for Port, locate the Port Properties section.
//    From the Type of port list, select Rectangular.

    model.component("comp1").physics("emw").feature("port3").set("PortType", "Rectangular");

//    In the Model Builder window, under Component 1 (comp1), click Mesh 1.
//    In the Settings window for Mesh, locate the Physics-Controlled Mesh section.
//    In the table, enter the following settings:

    model.component("comp1").mesh("mesh1").contribute("physics/emw", false);

//    From the Element size list, select Finer.

    model.component("comp1").mesh("mesh1").autoMeshSize(3);

//    Click 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", "eps_r", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "", 0);
    model.study("std1").feature("param").setIndex("pname", "eps_r", 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("plistarr", "range(1,0.01,1.5)", 0);

//    In the Model Builder window, click Step 1: Frequency Domain.
//    In the Settings window for Frequency Domain, locate the Study Settings section.
//    In the Frequencies text field, type 10[GHz].

    model.study("std1").feature("freq").set("plist", "10[GHz]");

//    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", "PlotGroup2D");
    model.result("pg2").set("data", "dset1");
    model.result("pg2").setIndex("looplevel", 51, 0);
    model.result("pg2").create("surf1", "Surface");
    model.result("pg2").feature("surf1").set("expr", "emw.normE");
    model.result("pg2").feature("surf1").set("descr", "Electric field norm");
    model.result("pg2").set("showlegendsmaxmin", true);
    model.result("pg2").feature("surf1").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", "emw.S31dB"});
    model.result("pg3").feature("glob1").set("descr", new String[]{"S11", "S21", "S31"});
    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", "eps_r");
    model.result("pg3").feature("glob1").set("xdataunit", "");
    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("pg2").run();

//    The default plot shows the norm of the electric field for eps_r = 1.5. The plot is dominated by the strong field in the ferrite post. Adjust the range to get a better overview of the fields throughout the circulator, and add arrows representing the power flow.

    model.result("pg2").run();

//    In the Model Builder window, expand the Electric Field (emw) node, then click Surface 1.
//    In the Settings window for Surface, click to expand the Range section.
//    Select the Manual color range checkbox.

    model.result("pg2").feature("surf1").set("rangecoloractive", true);

//    In the Maximum text field, type 350.

    model.result("pg2").feature("surf1").set("rangecolormax", 350);

//    In the Electric Field (emw) toolbar, click Plot.

    model.result("pg2").run();
    model.result("pg2").run();

//    In the Model Builder window, right-click Electric Field (emw) and choose Arrow Surface.

    model.result("pg2").create("arws1", "ArrowSurface");
    model.result("pg2").feature("arws1").set("evaluationsettings", "parent");

//    In the Settings window for Arrow Surface, 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.Poavy - Power flow, time average.

    model.result("pg2").feature("arws1").set("expr", new String[]{"emw.Poavx", "emw.Poavy"});
    model.result("pg2").feature("arws1").set("descr", "Power flow, time average");

//    Locate the Arrow Positioning section.
//    Find the Y grid points subsection.
//    In the Points text field, type 25.

    model.result("pg2").feature("arws1").set("ynumber", 25);

//    Locate the Coloring and Style section.
//    From the Color list, select Black.

    model.result("pg2").feature("arws1").set("color", "black");

//    In the Electric Field (emw) toolbar, click Plot.

    model.result("pg2").run();

//    The presence of standing waves in the input arm is clearly visible for this value (1.5) of the relative permittivity in the matching elements. To study how the reflections depend on the value of this parameter, plot the reflection coefficient S<sub>11</sub> as a function of eps_r.

    model.result("pg3").run();

//    In the Model Builder window, expand the Results > 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 > S-parameter, dB - dB > emw.S11dB - S11.

    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();

//    The plot shows that eps_r = 1.29 gives the minimum reflection. You can study the field distribution for this solution by selecting it as follows:

    model.result("pg2").run();

//    In the Model Builder window, under Results, click Electric Field (emw).
//    In the Settings window for 2D Plot Group, locate the Data section.
//    From the Parameter value (eps_r) list, select 1.29.

    model.result("pg2").setIndex("looplevel", 30, 0);

//    In the Electric Field (emw) toolbar, click Plot.

    model.result("pg2").run();

    model.title("Three-Port Ferrite Circulator");

    model
         .description("The transmission of a 10\u00a0GHz TE10 wave through a lossless three-port ferrite circulator is modeled. Identical tuning elements are placed in each arm for impedance matching.");

    return model;
  }

  public static void main(String[] args) {
    run();
  }

}
