/*
 * birdbath_resonator_gyroscope.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 14 2026, 08:35 by COMSOL 6.4.0.420. */
public class birdbath_resonator_gyroscope {

  public static Model run() {
    Model model = ModelUtil.create("Model");

//    From the File menu, choose New.
//    In the New window, click Model Wizard.
//    Start by creating a new 3D model with an <l>Electromechanics, Shell</l> multiphysics interface.
//    In the Model Wizard window, click 3D.
//    In the Select Physics tree, select AC/DC > Electromagnetics and Mechanics > Electromechanics > Electromechanics, Shell.
//    Click Add.
//    Click Study.
//    In the Select Study tree, select Preset Studies for Selected Physics Interfaces > Shell > Eigenfrequency, Prestressed.
//    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("es", "Electrostatics", "geom1");
    model.component("comp1").physics("es").prop("ShapeProperty").set("order_electricpotential", "2m");
    model.component("comp1").physics().create("shell", "Shell", "geom1");

    model.component("comp1").multiphysics().create("emfb1", "ElectromechanicsBoundary", 2);
    model.component("comp1").multiphysics("emfb1").set("Structure_physics", "shell");
    model.component("comp1").multiphysics("emfb1").set("Electrostatics_physics", "es");
    model.component("comp1").multiphysics("emfb1").selection().all();

    model.component("comp1").common().create("free1", "DeformingDomain");
    model.component("comp1").common("free1").set("smoothingType", "hyperelastic");
    model.component("comp1").common("free1").selection().set();
    model.component("comp1").common().create("sym1", "Symmetry");
    model.component("comp1").common("sym1").selection().set();

    model.study().create("std1");
    model.study("std1").create("stat", "Stationary");
    model.study("std1").feature("stat").set("outputmap", new String[]{});
    model.study("std1").feature("stat").set("ngenAUX", "1");
    model.study("std1").feature("stat").set("goalngenAUX", "1");
    model.study("std1").feature("stat").set("ngenAUX", "1");
    model.study("std1").feature("stat").set("goalngenAUX", "1");
    model.study("std1").create("eig", "Eigenfrequency");
    model.study("std1").feature("eig").set("storefact", false);
    model.study("std1").feature("eig").set("outputmap", new String[]{});
    model.study("std1").feature("eig").set("ngenAUX", "1");
    model.study("std1").feature("eig").set("goalngenAUX", "1");
    model.study("std1").feature("eig").set("ngenAUX", "1");
    model.study("std1").feature("eig").set("goalngenAUX", "1");

    model.component("comp1").common().create("mpf1", "ParticipationFactors");

//    The Model Wizard starts the COMSOL Desktop at the <l>Geometry</l> node. Take the opportunity to set the length unit to millimeter for convenience.
//    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");

//    Define and specify the parameters of the model.
//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, locate the Parameters section.
//    In the table, enter the following settings:

    model.param().set("r", "1[mm]");
    model.param().descr("r", "Radius");
    model.param().set("rc", "0.4[mm]");
    model.param().descr("rc", "Center radius");
    model.param().set("ha", "0.4[mm]");
    model.param().descr("ha", "Anchor height");
    model.param().set("he", "0.3[mm]");
    model.param().descr("he", "Electrode height");
    model.param().set("d", "0.02[mm]");
    model.param().descr("d", "Air gap");
    model.param().set("ts", "0.03[mm]");
    model.param().descr("ts", "Shell thickness");
    model.param().set("Vdc", "25[V]");
    model.param().descr("Vdc", "DC bias");
    model.param().set("Vdrive", "1[V]");
    model.param().descr("Vdrive", "Drive voltage");
    model.param().set("Omega", "0[deg/s]");
    model.param().descr("Omega", "Angular velocity");
    model.param().set("Q", "5E5");
    model.param().descr("Q", "Quality factor");

//    In the Geometry toolbar, click Work Plane.

    model.component("comp1").geom("geom1").create("wp1", "WorkPlane");
    model.component("comp1").geom("geom1").feature("wp1").set("unite", true);

//    In the Settings window for Work Plane, locate the Plane Definition section.
//    From the Plane list, select xz-plane.

    model.component("comp1").geom("geom1").feature("wp1").set("quickplane", "xz");

//    In the Model Builder window, click Plane Geometry.
//    In the Work Plane toolbar, click More Primitives and choose Circular Arc.

    model.component("comp1").geom("geom1").feature("wp1").geom().create("ca1", "CircularArc");

//    In the Settings window for Circular Arc, locate the Center section.
//    In the xw text field, type r+rc.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("ca1")
         .set("center", new String[]{"r+rc", "0"});

//    In the yw text field, type ha.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("ca1")
         .set("center", new String[]{"r+rc", "ha"});

//    Locate the Radius section.
//    In the Radius text field, type r.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("ca1").set("r", "r");

//    Locate the Angles section.
//    In the End angle text field, type 180.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("ca1").set("angle2", 180);

//    In the Work Plane toolbar, click More Primitives and choose Line Segment.

    model.component("comp1").geom("geom1").feature("wp1").geom().run("ca1");
    model.component("comp1").geom("geom1").feature("wp1").geom().create("ls1", "LineSegment");

//    On the object ca1, select Point 2.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("ls1").selection("vertex1").set("ca1", 2);

//    In the Settings window for Line Segment, locate the Endpoint section.
//    From the Specify list, select Coordinates.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("ls1").set("specify2", "coord");

//    In the xw text field, type rc.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("ls1")
         .set("coord2", new String[]{"rc", "0"});

//    In the Work Plane toolbar, click Rectangle.

    model.component("comp1").geom("geom1").feature("wp1").geom().run("ls1");
    model.component("comp1").geom("geom1").feature("wp1").geom().create("r1", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type d.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("r1").set("size", new String[]{"d", "1"});

//    In the Height text field, type he.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("r1").set("size", new String[]{"d", "he"});

//    Locate the Position section.
//    In the xw text field, type rc+2*r.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("r1")
         .set("pos", new String[]{"rc+2*r", "0"});

//    In the yw text field, type ha-he.

    model.component("comp1").geom("geom1").feature("wp1").geom().feature("r1")
         .set("pos", new String[]{"rc+2*r", "ha-he"});

//    Click Build Selected.

    model.component("comp1").geom("geom1").feature("wp1").geom().run("r1");

//    In the Model Builder window, right-click Component 1 (comp1) > Geometry 1 > Work Plane 1 (wp1) and choose Revolve.

    model.component("comp1").geom("geom1").run("wp1");
    model.component("comp1").geom("geom1").feature().create("rev1", "Revolve");
    model.component("comp1").geom("geom1").feature("rev1").set("workplane", "wp1");
    model.component("comp1").geom("geom1").feature("rev1").selection("input").set("wp1");
    model.component("comp1").geom("geom1").feature("rev1").set("angtype", "full");

//    In the Settings window for Revolve, locate the Revolution Angles section.
//    Click the Angles button.

    model.component("comp1").geom("geom1").feature("rev1").set("angtype", "specang");

//    In the Start angle text field, type 78.75.

    model.component("comp1").geom("geom1").feature("rev1").set("angle1", 78.75);

//    In the End angle text field, type 90.

    model.component("comp1").geom("geom1").feature("rev1").set("angle2", 90);

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("rev1");

//    In the Geometry toolbar, click Transforms and choose Rotate.

    model.component("comp1").geom("geom1").create("rot1", "Rotate");

//    Select the object rev1.

    model.component("comp1").geom("geom1").feature("rot1").selection("input").set("rev1");

//    In the Settings window for Rotate, locate the Input section.
//    Select the Keep input objects checkbox.

    model.component("comp1").geom("geom1").feature("rot1").set("keep", true);

//    Locate the Rotation section.
//    Click Range.
//    In the Range dialog, type 11.25 in the Start text field.
//    In the Step text field, type 11.25.
//    In the Stop text field, type 348.75.
//    Click Replace.

    model.component("comp1").geom("geom1").feature("rot1").set("rot", "range(11.25,11.25,348.75)");

//    In the Settings window for Rotate, click Build Selected.

    model.component("comp1").geom("geom1").run("rot1");

//    Click Build Selected.

    model.component("comp1").geom("geom1").run("rot1");

//    Define selections for the electrodes and other boundaries and domains to make specifying material models and physics interface features easier.
//    In the Definitions toolbar, click Box.

    model.component("comp1").selection().create("box1", "Box");

    model.component("comp1").geom("geom1").run();

//    In the Settings window for Box, type Gap in the Label text field.

    model.component("comp1").selection("box1").label("Gap");

//    In the Definitions toolbar, click Cylinder.

    model.component("comp1").selection().create("cyl1", "Cylinder");

//    In the Settings window for Cylinder, type Shell in the Label text field.

    model.component("comp1").selection("cyl1").label("Shell");

//    Locate the Geometric Entity Level section.
//    From the Level list, select Boundary.

    model.component("comp1").selection("cyl1").set("entitydim", 2);

//    Locate the Size and Shape section.
//    In the Outer radius text field, type rc+2*r+0.01.

    model.component("comp1").selection("cyl1").set("r", "rc+2*r+0.01");

//    Locate the Output Entities section.
//    From the Include entity if list, select Entity inside cylinder.

    model.component("comp1").selection("cyl1").set("condition", "inside");

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel1", "Explicit");

//    In the Settings window for Explicit, type Drive in the Label text field.

    model.component("comp1").selection("sel1").label("Drive");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel1").geom(2);

//    Click Paste Selection.
//    In the Paste Selection dialog, type 2 3 222 223 in the Selection text field.
//    Click OK.

    model.component("comp1").selection("sel1").set(2, 3, 222, 223);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel2", "Explicit");

//    In the Settings window for Explicit, type Sense in the Label text field.

    model.component("comp1").selection("sel2").label("Sense");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel2").geom(2);

//    Click Paste Selection.
//    In the Paste Selection dialog, type 182 192 in the Selection text field.
//    Click OK.

    model.component("comp1").selection("sel2").set(182, 192);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel3", "Explicit");

//    In the Settings window for Explicit, type Ground in the Label text field.

    model.component("comp1").selection("sel3").label("Ground");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel3").geom(2);

//    Click Paste Selection.
//    In the Paste Selection dialog, type 37, 41, 49, 53, 85, 89, 113, 125, 183, 193 in the Selection text field.
//    Click OK.

    model.component("comp1").selection("sel3").set(37, 41, 49, 53, 85, 89, 113, 125, 183, 193);

//    In the Definitions toolbar, click Box.

    model.component("comp1").selection().create("box2", "Box");

//    In the Settings window for Box, type Fixed Boundary in the Label text field.

    model.component("comp1").selection("box2").label("Fixed Boundary");

//    Locate the Geometric Entity Level section.
//    From the Level list, select Edge.

    model.component("comp1").selection("box2").set("entitydim", 1);

//    Locate the Box Limits section.
//    In the z maximum text field, type 0.01.

    model.component("comp1").selection("box2").set("zmax", 0.01);

//    Locate the Output Entities section.
//    From the Include entity if list, select Entity inside box.

    model.component("comp1").selection("box2").set("condition", "inside");

//    Right-click Fixed Boundary and choose Duplicate.

    model.component("comp1").selection().duplicate("box3", "box2");

//    In the Settings window for Box, type Roller Bottom in the Label text field.

    model.component("comp1").selection("box3").label("Roller Bottom");

//    Locate the Geometric Entity Level section.
//    From the Level list, select Boundary.

    model.component("comp1").selection("box3").set("entitydim", 2);

//    Locate the Box Limits section.
//    In the z maximum text field, type ha-he+0.001.

    model.component("comp1").selection("box3").set("zmax", "ha-he+0.001");

//    Right-click Roller Bottom and choose Duplicate.

    model.component("comp1").selection().duplicate("box4", "box3");

//    In the Settings window for Box, type Roller Top in the Label text field.

    model.component("comp1").selection("box4").label("Roller Top");

//    Locate the Box Limits section.
//    In the z minimum text field, type ha-0.001.

    model.component("comp1").selection("box4").set("zmin", "ha-0.001");

//    In the z maximum text field, type ha+0.001.

    model.component("comp1").selection("box4").set("zmax", "ha+0.001");

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel4", "Explicit");

//    In the Settings window for Explicit, type Roller Side in the Label text field.

    model.component("comp1").selection("sel4").label("Roller Side");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel4").geom(2);

//    Click Paste Selection.
//    In the Paste Selection dialog, type 12, 16, 36, 40, 60, 64, 84, 88, 154, 158, 174, 178, 194, 198, 214, 218 in the Selection text field.
//    Click OK.

    model.component("comp1").selection("sel4")
         .set(12, 16, 36, 40, 60, 64, 84, 88, 154, 158, 174, 178, 194, 198, 214, 218);

//    Add SiO2 material to the model and specify the regions it belongs to.
//    In the Materials toolbar, click Add Material to open the Add Material window.
//    In the tree, select MEMS > Insulators > SiO2 - Silicon oxide.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").propertyGroup()
         .create("Enu", "Enu", "Young's modulus and Poisson's ratio");
    model.component("comp1").material("mat1").label("SiO2 - Silicon oxide");
    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("thermalexpansioncoefficient", new String[]{"0.5e-6[1/K]", "0", "0", "0", "0.5e-6[1/K]", "0", "0", "0", "0.5e-6[1/K]"});
    model.component("comp1").material("mat1").propertyGroup("def").set("heatcapacity", "730[J/(kg*K)]");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermittivity", new String[]{"4.2", "0", "0", "0", "4.2", "0", "0", "0", "4.2"});
    model.component("comp1").material("mat1").propertyGroup("def").set("density", "2200[kg/m^3]");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalconductivity", new String[]{"1.4[W/(m*K)]", "0", "0", "0", "1.4[W/(m*K)]", "0", "0", "0", "1.4[W/(m*K)]"});
    model.component("comp1").material("mat1").propertyGroup("Enu").set("E", "70e9[Pa]");
    model.component("comp1").material("mat1").propertyGroup("Enu").set("nu", "0.17");

//    In the Materials toolbar, click Add Material to close the Add Material window.
//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").material("mat1").selection().geom("geom1", 2);

//    From the Selection list, select Shell.

    model.component("comp1").material("mat1").selection().named("cyl1");

//    In the Model Builder window, under Component 1 (comp1) > Moving Mesh, click Deforming Domain 1.
//    In the Settings window for Deforming Domain, locate the Domain Selection section.
//    From the Selection list, select Gap.

    model.component("comp1").common("free1").selection().named("box1");

//    In the Model Builder window, click Symmetry/Roller 1.
//    In the Settings window for Symmetry/Roller, locate the Boundary Selection section.
//    From the Selection list, select Roller Top.

    model.component("comp1").common("sym1").selection().named("box4");

//    Right-click Component 1 (comp1) > Moving Mesh > Symmetry/Roller 1 and choose Duplicate.

    model.component("comp1").common().duplicate("sym2", "sym1");

//    In the Settings window for Symmetry/Roller, locate the Boundary Selection section.
//    From the Selection list, select Roller Bottom.

    model.component("comp1").common("sym2").selection().named("box3");

//    Right-click Symmetry/Roller 2 and choose Duplicate.

    model.component("comp1").common().duplicate("sym3", "sym2");

//    From the Selection list, select Roller Side.

    model.component("comp1").common("sym2").selection().named("sel4");

//    Specify the settings for the <l>Electrostatics</l> interface.
//    In the Physics toolbar, click Boundaries and choose Boundary Terminal.

    model.component("comp1").physics("es").create("term1", "Terminal", 2);

//    In the Settings window for Boundary Terminal, type Shell in the Label text field.

    model.component("comp1").physics("es").feature("term1").label("Shell");

//    Locate the Boundary Selection section.
//    From the Selection list, select Shell.

    model.component("comp1").physics("es").feature("term1").selection().named("cyl1");

//    Locate the Terminal section.
//    From the Terminal type list, select Voltage.

    model.component("comp1").physics("es").feature("term1").set("TerminalType", "Voltage");

//    In the \[V_\textrm{0}\] text field, type Vdc.

    model.component("comp1").physics("es").feature("term1").set("V0", "Vdc");

//    Right-click Shell and choose Duplicate.

    model.component("comp1").physics("es").feature().duplicate("term2", "term1");

//    In the Settings window for Boundary Terminal, type Drive electrodes in the Label text field.

    model.component("comp1").physics("es").feature("term2").label("Drive electrodes");

//    Locate the Boundary Selection section.
//    From the Selection list, select Drive.

    model.component("comp1").physics("es").feature("term2").selection().named("sel1");

//    Locate the Terminal section.
//    In the \[V_\textrm{0}\] text field, type 0.

    model.component("comp1").physics("es").feature("term2").set("V0", 0);

//    In the Physics toolbar, click Attributes and choose Harmonic Perturbation.

    model.component("comp1").physics("es").feature("term2").create("hp1", "HarmonicPerturbation", 2);

//    In the Settings window for Harmonic Perturbation, locate the Terminal section.
//    In the \[V_\textrm{0}\] text field, type Vdrive.

    model.component("comp1").physics("es").feature("term2").feature("hp1").set("V0", "Vdrive");

//    In the Physics toolbar, click Boundaries and choose Ground.

    model.component("comp1").physics("es").create("gnd1", "Ground", 2);

//    In the Settings window for Ground, locate the Boundary Selection section.
//    From the Selection list, select Ground.

    model.component("comp1").physics("es").feature("gnd1").selection().named("sel3");

//    In the Physics toolbar, click Boundaries and choose Floating Potential.

    model.component("comp1").physics("es").create("fp1", "FloatingPotential", 2);

//    In the Settings window for Floating Potential, type Sense electrode in the Label text field.

    model.component("comp1").physics("es").feature("fp1").label("Sense electrode");

//    Locate the Boundary Selection section.
//    From the Selection list, select Sense.

    model.component("comp1").physics("es").feature("fp1").selection().named("sel2");

//    Define some integration operators for results processing.
//    In the Definitions toolbar, click Nonlocal Couplings and choose Integration.

    model.component("comp1").cpl().create("intop1", "Integration");
    model.component("comp1").cpl("intop1").set("axisym", true);

//    In the Settings window for Integration, locate the Source Selection section.
//    From the Geometric entity level list, select Point.

    model.component("comp1").cpl("intop1").selection().geom("geom1", 0);

//    Select Point 3.

    model.component("comp1").cpl("intop1").selection().set(3);

//    In the Definitions toolbar, click Nonlocal Couplings and choose Integration.

    model.component("comp1").cpl().create("intop2", "Integration");
    model.component("comp1").cpl("intop2").set("axisym", true);

//    In the Settings window for Integration, locate the Source Selection section.
//    From the Geometric entity level list, select Point.

    model.component("comp1").cpl("intop2").selection().geom("geom1", 0);

//    Select Point 93.

    model.component("comp1").cpl("intop2").selection().set(93);

//    In the Definitions toolbar, click Nonlocal Couplings and choose Integration.

    model.component("comp1").cpl().create("intop3", "Integration");
    model.component("comp1").cpl("intop3").set("axisym", true);

//    In the Settings window for Integration, locate the Source Selection section.
//    From the Geometric entity level list, select Point.

    model.component("comp1").cpl("intop3").selection().geom("geom1", 0);

//    Select Point 157.

    model.component("comp1").cpl("intop3").selection().set(157);

//    In the Definitions toolbar, click Nonlocal Couplings and choose Integration.

    model.component("comp1").cpl().create("intop4", "Integration");
    model.component("comp1").cpl("intop4").set("axisym", true);

//    In the Settings window for Integration, locate the Source Selection section.
//    From the Geometric entity level list, select Point.

    model.component("comp1").cpl("intop4").selection().geom("geom1", 0);

//    Select Point 161.

    model.component("comp1").cpl("intop4").selection().set(161);

//    Specify the settings for the <l>Shell</l> interface.
//    In the Model Builder window, under Component 1 (comp1), click Shell (shell).
//    In the Settings window for Shell, locate the Boundary Selection section.
//    From the Selection list, select Shell.

    model.component("comp1").physics("shell").selection().named("cyl1");

//    In the Model Builder window, under Component 1 (comp1) > Shell (shell), click Linear Elastic Material 1.
//    In the Physics toolbar, click Attributes and choose Damping.

    model.component("comp1").physics("shell").feature("emm1").create("dmp1", "Damping", 2);

//    In the Settings window for Damping, locate the Damping Settings section.
//    From the Damping type list, select Isotropic loss factor.

    model.component("comp1").physics("shell").feature("emm1").feature("dmp1")
         .set("DampingType", "IsotropicLossFactor");

//    From the \[\eta_{\textrm{s}}\] list, select User defined.

    model.component("comp1").physics("shell").feature("emm1").feature("dmp1").set("eta_s_mat", "userdef");

//    In the associated text field, type 1/Q.

    model.component("comp1").physics("shell").feature("emm1").feature("dmp1").set("eta_s", "1/Q");

//    In the Model Builder window, under Component 1 (comp1) > Shell (shell), click Thickness and Offset 1.
//    In the Settings window for Thickness and Offset, locate the Thickness and Offset section.
//    In the \[d_0\] text field, type ts.

    model.component("comp1").physics("shell").feature("to1").set("d", "ts");

//    From the Position list, select Top surface on boundary.

    model.component("comp1").physics("shell").feature("to1").set("OffsetDefinition", "top");

//    In the Physics toolbar, click Boundaries and choose Rotating Frame.

    model.component("comp1").physics("shell").create("rotf1", "RotatingFrame", 2);

//    In the Settings window for Rotating Frame, locate the Rotating Frame section.
//    In the \[\omega_\textrm{r}\] text field, type Omega.

    model.component("comp1").physics("shell").feature("rotf1").set("Ovm", "Omega");

//    Locate the Frame Acceleration Effect section.
//    Select the Coriolis force checkbox.

    model.component("comp1").physics("shell").feature("rotf1").set("CoriolisForce", true);

//    In the Physics toolbar, click Edges and choose Fixed Constraint.

    model.component("comp1").physics("shell").create("fix1", "Fixed", 1);

//    In the Settings window for Fixed Constraint, locate the Edge Selection section.
//    From the Selection list, select Fixed Boundary.

    model.component("comp1").physics("shell").feature("fix1").selection().named("box2");

//    Create the mesh for the model.
//    Click the Wireframe Rendering button in the Graphics toolbar.

    model.component("comp1").view("view1").set("renderwireframe", true);

//    In the Mesh toolbar, click More Generators and choose Edge.

    model.component("comp1").mesh("mesh1").create("edg1", "Edge");

//    In the Settings window for Edge, locate the Edge Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 203 205 207 274 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("edg1").selection().set(203, 205, 207, 274);

//    Right-click Edge 1 and choose Distribution.

    model.component("comp1").mesh("mesh1").feature("edg1").create("dis1", "Distribution");

//    In the Settings window for Distribution, locate the Edge Selection section.
//    In the list, select 203.
//    select 203 in the list.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis1").selection().set(205, 207, 274);

//    Select Edges 205, 207, 274.
//    In the list, select 274.
//    select 274 in the list.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis1").selection().set(205, 207);

//    Select Edges 205, 207.
//    Locate the Distribution section.
//    In the Number of elements text field, type 8.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis1").set("numelem", 8);

//    In the Model Builder window, right-click Edge 1 and choose Distribution.

    model.component("comp1").mesh("mesh1").feature("edg1").create("dis2", "Distribution");

//    In the Settings window for Distribution, locate the Edge Selection section.
//    In the list, select 205.
//    select 205 in the list.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis2").selection().set(203, 207, 274);

//    Select Edges 203, 207, 274.
//    In the list, select 207.
//    select 207 in the list.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis2").selection().set(203, 274);

//    Select Edges 203, 274.
//    Locate the Distribution section.
//    In the Number of elements text field, type 6.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("dis2").set("numelem", 6);

//    In the Mesh toolbar, click More Generators and choose Mapped.

    model.component("comp1").mesh("mesh1").create("map1", "Map");

//    In the Settings window for Mapped, locate the Boundary Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 122 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("map1").selection().set(122);

//    In the Mesh toolbar, click More Generators and choose Edge.

    model.component("comp1").mesh("mesh1").create("edg2", "Edge");

//    In the Settings window for Edge, locate the Edge Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 199-202, 215, 218 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("edg2").selection().set(199, 200, 201, 202, 215, 218);

//    Right-click Edge 2 and choose Distribution.

    model.component("comp1").mesh("mesh1").feature("edg2").create("dis1", "Distribution");

//    In the Settings window for Distribution, locate the Edge Selection section.
//    In the list, select 199, 200.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg2").feature("dis1").selection().set(201, 202, 215, 218);

//    Select Edges 201, 202, 215, 218.
//    In the list, select 202, 215.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg2").feature("dis1").selection().set(201, 218);

//    Select Edges 201, 218.
//    Locate the Distribution section.
//    In the Number of elements text field, type 60.

    model.component("comp1").mesh("mesh1").feature("edg2").feature("dis1").set("numelem", 60);

//    In the Model Builder window, right-click Edge 2 and choose Distribution.

    model.component("comp1").mesh("mesh1").feature("edg2").create("dis2", "Distribution");

//    In the Settings window for Distribution, locate the Edge Selection section.
//    In the list, select 201.
//    select 201 in the list.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg2").feature("dis2").selection().set(199, 200, 202, 215, 218);

//    Select Edges 199, 200, 202, 215, 218.
//    In the list, select 218.
//    select 218 in the list.
//    Click Remove from Selection.

    model.component("comp1").mesh("mesh1").feature("edg2").feature("dis2").selection().set(199, 200, 202, 215);

//    Select Edges 199, 200, 202, 215.
//    Locate the Distribution section.
//    In the Number of elements text field, type 8.

    model.component("comp1").mesh("mesh1").feature("edg2").feature("dis2").set("numelem", 8);

//    In the Mesh toolbar, click More Generators and choose Mapped.

    model.component("comp1").mesh("mesh1").create("map2", "Map");

//    Select Boundaries 119, 120.

    model.component("comp1").mesh("mesh1").feature("map2").selection().set(119, 120);

//    In the Mesh toolbar, click Swept.

    model.component("comp1").mesh("mesh1").create("swe1", "Sweep");

    return model;
  }

  public static Model run2(Model model) {

//    In the Settings window for Swept, locate the Domain Selection section.
//    From the Geometric entity level list, select Domain.

    model.component("comp1").mesh("mesh1").feature("swe1").selection().geom("geom1", 3);

//    Select Domain 18.

    model.component("comp1").mesh("mesh1").feature("swe1").selection().set(18);

//    Click to expand the Source Faces section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 122 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("swe1").selection("sourceface").set(122);

//    In the Settings window for Swept, click to expand the Destination Faces section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 125 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("swe1").selection("targetface").set(125);

//    Right-click Swept 1 and choose Distribution.

    model.component("comp1").mesh("mesh1").feature("swe1").create("dis1", "Distribution");

//    In the Settings window for Distribution, locate the Distribution section.
//    In the Number of elements text field, type 4.

    model.component("comp1").mesh("mesh1").feature("swe1").feature("dis1").set("numelem", 4);

//    Click Build Selected.

    model.component("comp1").mesh("mesh1").run("swe1");

//    In the Mesh toolbar, click Copy and choose Copy Face.

    model.component("comp1").mesh("mesh1").create("cpf1", "CopyFace");

//    In the Settings window for Copy Face, locate the Source Boundaries section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 120 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("cpf1").selection("source").set(120);

//    In the Settings window for Copy Face, locate the Destination Boundaries section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 10, 11, 21, 23, 33, 35, 45, 47, 57, 59, 69, 71, 81, 83, 93, 95, 117, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("cpf1").selection("destination")
         .set(10, 11, 21, 23, 33, 35, 45, 47, 57, 59, 69, 71, 81, 83, 93, 95, 117, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153);

//    In the Mesh toolbar, click Copy and choose Copy Face.

    model.component("comp1").mesh("mesh1").create("cpf2", "CopyFace");
    model.component("comp1").mesh("mesh1").feature("cpf2").selection("source").geom(2);
    model.component("comp1").mesh("mesh1").feature("cpf2").selection("destination").geom(2);

//    In the Settings window for Copy Face, locate the Source Boundaries section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 119 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("cpf2").selection("source").set(119);

//    In the Settings window for Copy Face, locate the Destination Boundaries section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 96-111, 118, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("cpf2").selection("destination")
         .set(96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 118, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152);

//    In the Settings window for Copy Face, click Build Selected.

    model.component("comp1").mesh("mesh1").run("cpf2");

//    In the Mesh toolbar, click Copy and choose Copy.

    model.component("comp1").mesh("mesh1").create("copy1", "Copy");
    model.component("comp1").mesh("mesh1").feature("copy1").selection("source").geom(2);
    model.component("comp1").mesh("mesh1").feature("copy1").selection("destination").geom(2);

//    In the Settings window for Copy, locate the Dimension section.
//    From the Geometric entity level list, select Domain.

    model.component("comp1").mesh("mesh1").feature("copy1").set("dimension", 3);

//    Locate the Source Entities section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 18 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("copy1").selection("source").set(18);

//    In the Settings window for Copy, locate the Destination Entities section.
//    Select the Activate Selection toggle button.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 1-17, 19-32 in the Selection text field.
//    Click OK.

    model.component("comp1").mesh("mesh1").feature("copy1").selection("destination")
         .set(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32);

//    In the Settings window for Copy, click Build Selected.

    model.component("comp1").mesh("mesh1").run("copy1");

//    Set up and compute the <l>Prestressed Eigenfrequency</l> study.
//    In the Model Builder window, click Study 1.
//    In the Settings window for Study, type Study 1 - Prestressed Eigenfrequency in the Label text field.

    model.study("std1").label("Study 1 - Prestressed Eigenfrequency");

//    Locate the Study Settings section.
//    Clear the Generate default plots checkbox.

    model.study("std1").setGenPlots(false);

//    In the Model Builder window, under Study 1 - Prestressed Eigenfrequency, click Step 2: Eigenfrequency.
//    In the Settings window for Eigenfrequency, locate the Study Settings section.
//    From the Unit list, select kHz.

    model.study("std1").feature("eig").set("eigunit", "kHz");

//    In the Search for eigenfrequencies around shift text field, type 1.

    model.study("std1").feature("eig").set("shift", "1");

//    For the study to solve, disable the <l>Floating Potential</l> boundary.
//    Locate the Physics and Variables Selection section.
//    Select the Modify model configuration for study step checkbox.

    model.study("std1").feature("eig").set("useadvanceddisable", true);

//    In the tree, select Component 1 (comp1) > Electrostatics (es) > Sense electrode.
//    Right-click and choose Disable.

    model.study("std1").feature("eig").set("disabledphysics", new String[]{"es/fp1"});

//    In the Study toolbar, click Compute.

    model.study("std1").createAutoSequences("all");

    model.sol("sol1").runAll();

//    Set up a <l>Frequency Domain Perturbation</l> study using the sense mode frequency from the previous study.
//    In the Study toolbar, click Add Study to open the Add Study window.
//    Find the Studies subsection.
//    In the Select Study tree, select Preset Studies for Selected Physics Interfaces > Shell > Frequency Domain, Prestressed.
//    Click Add Study in the window toolbar.

    model.study().create("std2");
    model.study("std2").create("stat", "Stationary");
    model.study("std2").feature("stat").set("outputmap", new String[]{});
    model.study("std2").feature("stat").set("ngenAUX", "1");
    model.study("std2").feature("stat").set("goalngenAUX", "1");
    model.study("std2").feature("stat").set("ngenAUX", "1");
    model.study("std2").feature("stat").set("goalngenAUX", "1");
    model.study("std2").create("frlin", "Frequencylinearized");
    model.study("std2").feature("frlin").set("outputmap", new String[]{});
    model.study("std2").feature("frlin").set("ngenAUX", "1");
    model.study("std2").feature("frlin").set("goalngenAUX", "1");
    model.study("std2").feature("frlin").set("ngenAUX", "1");
    model.study("std2").feature("frlin").set("goalngenAUX", "1");

//    In the Study toolbar, click Add Study to close the Add Study window.
//    In the Settings window for Study, type Study 2 - Frequency Domain Perturbation in the Label text field.

    model.study("std2").label("Study 2 - Frequency Domain Perturbation");

//    Locate the Study Settings section.
//    Clear the Generate default plots checkbox.

    model.study("std2").setGenPlots(false);

//    In the Model Builder window, under Study 2 - Frequency Domain Perturbation, click Step 2: Frequency-Domain Perturbation.
//    In the Settings window for Frequency-Domain Perturbation, locate the Study Settings section.
//    From the Frequency unit list, select kHz.

    model.study("std2").feature("frlin").set("punit", "kHz");

//    In the Frequencies text field, type 9.172.

    model.study("std2").feature("frlin").set("plist", 9.172);

//    Click to expand the Study Extensions section.
//    Select the Auxiliary sweep checkbox.

    model.study("std2").feature("frlin").set("useparam", true);

//    Click Add.

    model.study("std2").feature("frlin").setIndex("pname_aux", "r", 0);
    model.study("std2").feature("frlin").setIndex("plistarr_aux", "", 0);
    model.study("std2").feature("frlin").setIndex("punit_aux", "m", 0);
    model.study("std2").feature("frlin").setIndex("pname_aux", "r", 0);
    model.study("std2").feature("frlin").setIndex("plistarr_aux", "", 0);
    model.study("std2").feature("frlin").setIndex("punit_aux", "m", 0);

//    In the table, enter the following settings:

    model.study("std2").feature("frlin").setIndex("pname_aux", "Omega", 0);
    model.study("std2").feature("frlin").setIndex("plistarr_aux", "range(0, 10, 50)[deg/s]", 0);

//    In the Study toolbar, click Compute.

    model.study("std2").createAutoSequences("all");

    model.sol("sol3").runAll();

//    Create plot to show the shapes of the eigenmodes.
//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg1", "PlotGroup3D");
    model.result("pg1").run();

//    In the Settings window for 3D Plot Group, type Mode Shape in the Label text field.

    model.result("pg1").label("Mode Shape");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg1").set("edges", false);

//    Right-click Mode Shape and choose Surface.

    model.result("pg1").create("surf1", "Surface");
    model.result("pg1").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Shell > Displacement > shell.disp - Displacement magnitude - m.

    model.result("pg1").feature("surf1").set("expr", "shell.disp");
    model.result("pg1").feature("surf1").set("descr", "Displacement magnitude");

//    Locate the Expression section.
//    Select the Description checkbox.

    model.result("pg1").feature("surf1").set("descractive", true);

//    Right-click Surface 1 and choose Deformation.

    model.result("pg1").feature("surf1").create("def1", "Deform");
    model.result("pg1").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    Click the Go to XY View button in the Graphics toolbar.

    model.result("pg1").run();

//    In the Model Builder window, click Surface 1.
//    In the Settings window for Surface, click Plot Next.

    model.result("pg1").feature("surf1").stepNext(0);
    model.result("pg1").run();

//    Create plot to show the displacement from the frequency domain study.
//    In the Results toolbar, click 3D Plot Group.

    model.result().create("pg2", "PlotGroup3D");
    model.result("pg2").run();

//    In the Settings window for 3D Plot Group, type Displacement in the Label text field.

    model.result("pg2").label("Displacement");

//    Locate the Data section.
//    From the Dataset list, select Study 2 - Frequency Domain Perturbation/Solution 3 (sol3).

    model.result("pg2").set("data", "dset3");

//    Locate the Plot Settings section.
//    Clear the Plot dataset edges checkbox.

    model.result("pg2").set("edges", false);

//    Right-click Displacement and choose Surface.

    model.result("pg2").create("surf1", "Surface");
    model.result("pg2").feature("surf1").set("evaluationsettings", "parent");

//    In the Settings window for Surface, click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Shell > Displacement > shell.disp - Displacement magnitude - m.

    model.result("pg2").feature("surf1").set("expr", "shell.disp");
    model.result("pg2").feature("surf1").set("descr", "Displacement magnitude");

//    Locate the Expression section.
//    Select the Description checkbox.

    model.result("pg2").feature("surf1").set("descractive", true);

//    Right-click Surface 1 and choose Deformation.

    model.result("pg2").feature("surf1").create("def1", "Deform");
    model.result("pg2").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    Click the Go to XY View button in the Graphics toolbar.
//    Create a 1D plot of potential at the sense terminal as a function of phase.
//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg3", "PlotGroup1D");
    model.result("pg3").run();

//    In the Settings window for 1D Plot Group, locate the Data section.
//    From the Dataset list, select Study 2 - Frequency Domain Perturbation/Solution 3 (sol3).

    model.result("pg3").set("data", "dset3");

//    In the Label text field, type Sense Electrode Potential.

    model.result("pg3").label("Sense Electrode Potential");

//    Right-click Sense Electrode Potential and choose Global.

    model.result("pg3").create("glob1", "Global");
    model.result("pg3").feature("glob1").set("markerpos", "datapoints");
    model.result("pg3").feature("glob1").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("glob1").setIndex("expr", "intop4(V)", 0);

//    Locate the x-Axis Data section.
//    From the Parameter list, select Phase.

    model.result("pg3").feature("glob1").set("xdata", "phase");

//    Click to expand the Legends section.
//    From the Legends list, select Automatic.
//    Find the Include subsection.
//    Clear the Description checkbox.

    model.result("pg3").feature("glob1").set("autodescr", false);

//    In the Sense Electrode Potential toolbar, click Plot.

    model.result("pg3").run();

//    From the Legends list, select Manual.

    model.result("pg3").feature("glob1").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg3").feature("glob1").setIndex("legends", "0 deg/s", 0);
    model.result("pg3").feature("glob1").setIndex("legends", "10 deg/s", 1);
    model.result("pg3").feature("glob1").setIndex("legends", "20 deg/s", 2);
    model.result("pg3").feature("glob1").setIndex("legends", "30 deg/s", 3);
    model.result("pg3").feature("glob1").setIndex("legends", "40 deg/s", 4);
    model.result("pg3").feature("glob1").setIndex("legends", "50 deg/s", 5);
    model.result("pg3").run();

//    In the Model Builder window, click Sense Electrode Potential.
//    In the Settings window for 1D Plot Group, locate the Legend section.
//    From the Position list, select Lower right.

    model.result("pg3").set("legendpos", "lowerright");

//    In the Sense Electrode Potential toolbar, click Plot.

    model.result("pg3").run();
    model.result().create("pg4", "PlotGroup3D");
    model.result("pg4").run();
    model.result("pg4").label("Cross Section");
    model.result("pg4").selection().geom("geom1", 2);
    model.result("pg4").selection().geom("geom1", 2);
    model.result("pg4").selection()
         .set(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 22, 23, 28, 29, 30, 31, 34, 35, 40, 41, 42, 43, 46, 47, 52, 53, 54, 55, 58, 59, 64, 65, 66, 67, 70, 71, 76, 77, 78, 79, 82, 83, 88, 89, 90, 91, 94, 95, 96, 97, 99, 101, 103, 105, 107, 109, 111, 119, 120, 121, 122, 123, 124, 125, 128, 129, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 158, 159, 160, 161, 163, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224);
    model.result("pg4").set("edges", false);
    model.result("pg4").run();
    model.result("pg4").create("surf1", "Surface");
    model.result("pg4").feature("surf1").set("evaluationsettings", "parent");
    model.result("pg4").feature("surf1").set("expr", "1");
    model.result("pg4").feature("surf1").create("mtrl1", "MaterialAppearance");
    model.result("pg4").feature("surf1").feature("mtrl1").set("appearance", "custom");
    model.result("pg4").feature("surf1").feature("mtrl1").set("family", "gold");
    model.result("pg4").run();
    model.result("pg4").run();
    model.result("pg4").run();

    model.component("comp1").view().create("view3", "geom1");

    model.result("pg4").run();

    model.component("comp1").view("view3").set("showaxisorientation", false);

    model.result().remove("pg4");

    model.title("Birdbath Resonator Gyroscope");

    model
         .description("This tutorial demonstrates how to model a birdbath resonator gyroscope, a type of Coriolis vibratory gyroscope invented at the University of Michigan as a millimeter-scale navigation-grade gyroscope. This tutorial shows how the gyroscope's axisymmetric design allows the coupling between drive and sense modes and the detection of Coriolis force.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    run2(model);
  }

}
