/*
 * one_family_house.java
 */

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

/** Model exported on May 12 2026, 12:24 by COMSOL 6.4.0.418. */
public class one_family_house {

  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 Acoustics > Geometrical Acoustics > Acoustic Diffusion Equation (ade).
//    Click Add.
//    Click Study.
//    In the Select Study tree, select General Studies > Stationary.
//    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("ade", "AcousticDiffusionEquation", "geom1");

    model.study().create("std1");
    model.study("std1").create("stat", "Stationary");

//    The geometry is set up by importing a geometry sequence. The sequence imports the one-family house geometry, including parameters for source location and power, and sets up several selections. The predefined selections simplify the rest of the model setup.
//    In the Geometry toolbar, click Insert Sequence and choose Insert Sequence.

    model.component("comp1").geom("geom1").insertFile("one_family_house_geom_sequence.mph", "geom1");

//    Browse to the model's Application Library folder and double-click the file one_family_house_geom_sequence.mph.
//    In the Model Builder window, under Component 1 (comp1) > Geometry 1, click Import 1 (imp1).
//    In the Settings window for Import, click Build Selected.

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

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Geometry toolbar, click Build All.

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

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

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

//    Import the model parameters from text files. The parameters include the source location and power, as well as boundary conditions for the surfaces and partitions.
//    The parameters for the source location were defined in the geometry-sequence file. Add a parameter for the source power.
//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, type Parameters 1 - Source in the Label text field.

    model.param().label("Parameters 1 - Source");

//    Locate the Parameters section.
//    In the table, enter the following settings:

    model.param().set("P_s", "0.1[W]");
    model.param().descr("P_s", "Source power");

//    In the Home toolbar, click Parameters and choose Add > Parameters.

    model.param().create("par2");

//    In the Settings window for Parameters, type Parameters 2 - Indoor Boundaries in the Label text field.

    model.param("par2").label("Parameters 2 - Indoor Boundaries");

//    Locate the Parameters section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file one_family_house_parameters_indoor.txt.
//    To import content from file, use:
//    model.param("par2").loadFile("FILENAME");
    model.param("par2").set("a_wall", "0.1", "Wall absorption coefficient");
    model.param("par2").set("a_ceiling", "0.15", "Ceiling absorption coefficient");
    model.param("par2").set("a_window", "0.05", "Window absorption coefficient");
    model.param("par2").set("a_stairs", "0.05", "Stairs absorption coefficient");
    model.param("par2").set("a_floor", "0.2", "Wooden floor absorption coefficient");
    model.param("par2").set("TL_heavy", "10[dB]", "Transmission loss for heavy partitions");
    model.param("par2").set("TL_light", "5[dB]", "Transmission loss for light partitions");

//    In the Materials toolbar, click Add Material to open the Add Material window.
//    In the tree, select Built-in > Air.
//    Click the right end of the Add to Component split button in the window toolbar.
//    From the menu, choose Add to Component.

    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.
//    Proceed to set up the physics of the model. Broadband frequency is considered in this case, which is also equivalent to single frequency. Each room is defined with absorption coefficients on its boundaries and a mean free path. The rooms are then coupled with each other by applying transmission loss or sound field continuity on the partitions they have in common.
//    Select Domains 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12.

    model.component("comp1").physics("ade").selection().set(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);

//    In the Model Builder window, expand the Acoustic Diffusion Equation (ade) node, then click Room 1.
//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room1").selection().set();

//    Select Domain 5.

    model.component("comp1").physics("ade").feature("room1").selection().set(5);

//    In the Model Builder window, expand the Room 1 node, then click Wall 1.
//    In the Settings window for Wall, locate the Boundary Selection section.
//    From the Selection list, select All boundaries.

    model.component("comp1").physics("ade").feature("room1").feature("wall1").selection().all();

//    Locate the Wall Absorption Properties section.
//    In the \[\alpha\] text field, type a_wall.

    model.component("comp1").physics("ade").feature("room1").feature("wall1").set("alpha", "a_wall");

//    In the Model Builder window, click Room 1.
//    In the Physics toolbar, click Attributes and choose Wall.

    model.component("comp1").physics("ade").feature("room1").create("wall2", "Wall", 2);

//    In the Settings window for Wall, locate the Boundary Selection section.
//    From the Selection list, select Windows.

    model.component("comp1").physics("ade").feature("room1").feature("wall2").selection().named("geom1_sel1");

//    Locate the Wall Absorption Properties section.
//    In the \[\alpha\] text field, type a_window.

    model.component("comp1").physics("ade").feature("room1").feature("wall2").set("alpha", "a_window");

//    In the Model Builder window, click Room 1.
//    In the Physics toolbar, click Attributes and choose Wall.

    model.component("comp1").physics("ade").feature("room1").create("wall3", "Wall", 2);

//    In the Settings window for Wall, locate the Boundary Selection section.
//    From the Selection list, select Wooden Floors.

    model.component("comp1").physics("ade").feature("room1").feature("wall3").selection().named("geom1_sel2");

//    Locate the Wall Absorption Properties section.
//    In the \[\alpha\] text field, type a_floor.

    model.component("comp1").physics("ade").feature("room1").feature("wall3").set("alpha", "a_floor");

//    In the Model Builder window, click Room 1.
//    In the Physics toolbar, click Attributes and choose Wall.

    model.component("comp1").physics("ade").feature("room1").create("wall4", "Wall", 2);

//    In the Settings window for Wall, locate the Boundary Selection section.
//    From the Selection list, select Ceilings.

    model.component("comp1").physics("ade").feature("room1").feature("wall4").selection().named("geom1_sel4");

//    Locate the Wall Absorption Properties section.
//    In the \[\alpha\] text field, type a_ceiling.

    model.component("comp1").physics("ade").feature("room1").feature("wall4").set("alpha", "a_ceiling");

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room2", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room2").selection().set();

//    Select Domain 8.

    model.component("comp1").physics("ade").feature("room2").selection().set(8);

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room3", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room3").selection().set();

//    Select Domain 7.

    model.component("comp1").physics("ade").feature("room3").selection().set(7);

//    In the Model Builder window, expand the Room 3 node, then click Wall 3.
//    In the Settings window for Wall, locate the Boundary Selection section.
//    From the Selection list, select Stairs.

    model.component("comp1").physics("ade").feature("room3").feature("wall3").selection().named("geom1_sel3");

//    Locate the Wall Absorption Properties section.
//    In the \[\alpha\] text field, type a_stairs.

    model.component("comp1").physics("ade").feature("room3").feature("wall3").set("alpha", "a_stairs");

//    In the Model Builder window, right-click Component 1 (comp1) > Acoustic Diffusion Equation (ade) > Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room4", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room4").selection().set();

//    Select Domain 9.

    model.component("comp1").physics("ade").feature("room4").selection().set(9);

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room5", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room5").selection().set();

//    Select Domain 4.

    model.component("comp1").physics("ade").feature("room5").selection().set(4);

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room6", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room6").selection().set();

//    Select Domains 3, 10.

    model.component("comp1").physics("ade").feature("room6").selection().set(3, 10);

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room7", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room7").selection().set();

//    Select Domain 2.

    model.component("comp1").physics("ade").feature("room7").selection().set(2);

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room8", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room8").selection().set();

//    Select Domain 6.

    model.component("comp1").physics("ade").feature("room8").selection().set(6);

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room9", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room9").selection().set();

//    Select Domain 12.

    model.component("comp1").physics("ade").feature("room9").selection().set(12);

//    Right-click Room 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("room10", "room1");

//    In the Settings window for Room, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("ade").feature("room10").selection().set();

//    Select Domain 11.

    model.component("comp1").physics("ade").feature("room10").selection().set(11);

//    In the Physics toolbar, click Boundaries and choose Mapped Room Coupling.

    model.component("comp1").physics("ade").create("mrctl1", "MappedRoomCoupling", 2);

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 1.

    model.component("comp1").physics("ade").feature("mrctl1").selection().named("geom1_sel5");

//    Locate the Transmission Loss section.
//    In the \[\textrm{TL}\] text field, type TL_heavy.

    model.component("comp1").physics("ade").feature("mrctl1").set("TL", "TL_heavy");

//    Right-click Mapped Room Coupling 1 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl2", "mrctl1");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 2.

    model.component("comp1").physics("ade").feature("mrctl2").selection().named("geom1_sel6");

//    Right-click Mapped Room Coupling 2 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl3", "mrctl2");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 3.

    model.component("comp1").physics("ade").feature("mrctl3").selection().named("geom1_sel7");

//    Right-click Mapped Room Coupling 3 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl4", "mrctl3");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 4.

    model.component("comp1").physics("ade").feature("mrctl4").selection().named("geom1_sel8");

//    Right-click Mapped Room Coupling 4 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl5", "mrctl4");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 5.

    model.component("comp1").physics("ade").feature("mrctl5").selection().named("geom1_sel9");

//    Right-click Mapped Room Coupling 5 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl6", "mrctl5");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 6.

    model.component("comp1").physics("ade").feature("mrctl6").selection().named("geom1_sel10");

//    Right-click Mapped Room Coupling 6 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl7", "mrctl6");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 7.

    model.component("comp1").physics("ade").feature("mrctl7").selection().named("geom1_sel11");

//    Right-click Mapped Room Coupling 7 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl8", "mrctl7");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 8.

    model.component("comp1").physics("ade").feature("mrctl8").selection().named("geom1_sel12");

//    Locate the Transmission Loss section.
//    In the \[\textrm{TL}\] text field, type TL_light.

    model.component("comp1").physics("ade").feature("mrctl8").set("TL", "TL_light");

//    Right-click Mapped Room Coupling 8 and choose Duplicate.

    model.component("comp1").physics("ade").feature().duplicate("mrctl9", "mrctl8");

//    In the Settings window for Mapped Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Wall Partition.

    model.component("comp1").physics("ade").feature("mrctl9").selection().named("geom1_sel14");

//    In the Physics toolbar, click Boundaries and choose Room Coupling.

    model.component("comp1").physics("ade").create("rctl1", "RoomCoupling", 2);

//    In the Settings window for Room Coupling, locate the Boundary Selection section.
//    From the Selection list, select Door 9.

    model.component("comp1").physics("ade").feature("rctl1").selection().named("geom1_sel13");

//    Locate the Transmission Loss section.
//    In the \[\textrm{TL}\] text field, type TL_light.

    model.component("comp1").physics("ade").feature("rctl1").set("TL", "TL_light");

//    Click to expand the Continuity section.
//    Select the Force continuity checkbox.

    model.component("comp1").physics("ade").feature("rctl1").set("bol_force_cont", true);

//    In the Physics toolbar, click Points and choose Point Source.

    model.component("comp1").physics("ade").create("ps1", "PointSource", 0);

//    Select Point 49.

    model.component("comp1").physics("ade").feature("ps1").selection().set(49);

//    In the Settings window for Point Source, locate the Point Source section.
//    In the \[q_\textrm{p}\] text field, type P_s.

    model.component("comp1").physics("ade").feature("ps1").set("qp", "P_s");

//    Now create a mesh for the model. Geometrical acoustics methods do not require a fine mesh to perform accurately; however, in order to study the sound-pressure level on the different surfaces the element sizes should remain reasonably small.
//    In the Model Builder window, right-click Component 1 (comp1) > Mesh 1 and choose Build All.

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

//    Proceed to compute the stationary study. Solving the model takes a few seconds.
//    In the Model Builder window, click Study 1.
//    In the Settings window for Study, type Study 1 - Stationary in the Label text field.

    model.study("std1").label("Study 1 - Stationary");

//    In the Study toolbar, click Compute.

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

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

    model.result().create("pg1", "PlotGroup3D");
    model.result("pg1").label("Sound Pressure Level (ade)");
    model.result("pg1").set("showlegendsunit", true);
    model.result("pg1").feature().create("mslc1", "Multislice");
    model.result("pg1").feature("mslc1").label("Multislice");
    model.result("pg1").feature("mslc1").set("expr", "ade.Lp");
    model.result("pg1").feature("mslc1").set("smooth", "internal");
    model.result("pg1").feature("mslc1").set("data", "parent");
    model.result().create("pg2", "PlotGroup3D");
    model.result("pg2").label("Sound Energy Density (ade)");
    model.result("pg2").set("showlegendsunit", true);
    model.result("pg2").feature().create("mslc1", "Multislice");
    model.result("pg2").feature("mslc1").label("Multislice");
    model.result("pg2").feature("mslc1").set("smooth", "internal");
    model.result("pg2").feature("mslc1").set("data", "parent");
    model.result().create("pg3", "PlotGroup3D");
    model.result("pg3").label("Local Energy Flux (ade)");
    model.result("pg3").set("showlegendsunit", true);
    model.result("pg3").feature().create("arwv1", "ArrowVolume");
    model.result("pg3").feature("arwv1").label("Arrow Volume");
    model.result("pg3").feature("arwv1").set("arrowlength", "logarithmic");
    model.result("pg3").feature("arwv1").set("color", "black");
    model.result("pg3").feature("arwv1").set("data", "parent");
    model.result("pg1").run();

//    In the Settings window for 3D Plot Group, type Sound Pressure Level (ade) - Slices in the Label text field.

    model.result("pg1").label("Sound Pressure Level (ade) - Slices");
    model.result("pg1").run();

//    In the Model Builder window, expand the Sound Pressure Level (ade) - Slices node, then click Multislice.
//    In the Settings window for Multislice, locate the Multiplane Data section.
//    Find the X-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg1").feature("mslc1").set("xnumber", "0");

//    Find the Y-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg1").feature("mslc1").set("ynumber", "0");

//    Find the Z-planes subsection.
//    In the Planes text field, type 4.

    model.result("pg1").feature("mslc1").set("znumber", "4");

//    In the Sound Pressure Level (ade) - Slices toolbar, click Plot.

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

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

    model.result().create("pg4", "PlotGroup3D");
    model.result("pg4").run();

//    In the Settings window for 3D Plot Group, type Sound Pressure Level (ade) - Boundaries in the Label text field.

    model.result("pg4").label("Sound Pressure Level (ade) - Boundaries");

//    Locate the Color Legend section.
//    Select the Show units checkbox.

    model.result("pg4").set("showlegendsunit", true);

//    Right-click Sound Pressure Level (ade) - Boundaries and choose Surface.

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

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type ade.Lp.

    model.result("pg4").feature("surf1").set("expr", "ade.Lp");

//    In the Sound Pressure Level (ade) - Boundaries toolbar, click Plot.

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

//    In the Model Builder window, expand the Sound Energy Density (ade) node, then click Multislice.
//    In the Settings window for Multislice, locate the Multiplane Data section.
//    Find the X-planes subsection.
//    In the Planes text field, type 0.

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

//    Find the Y-planes subsection.
//    In the Planes text field, type 2.

    model.result("pg2").feature("mslc1").set("ynumber", "2");

//    Find the Z-planes subsection.
//    In the Planes text field, type 3.

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

//    In the Sound Energy Density (ade) toolbar, click Plot.

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

//    In the Model Builder window, expand the Local Energy Flux (ade) node.
//    Right-click Arrow Volume and choose Disable.

    model.result("pg3").feature("arwv1").active(false);
    model.result("pg3").run();

    return model;
  }

  public static Model run2(Model model) {

//    In the Model Builder window, right-click Local Energy Flux (ade) and choose Streamline.

    model.result("pg3").create("str1", "Streamline");
    model.result("pg3").feature("str1").set("evaluationsettings", "parent");

//    In the Settings window for Streamline, locate the Streamline Positioning section.
//    In the Number text field, type 100.

    model.result("pg3").feature("str1").set("selnumber", 100);

//    Select Boundaries 66, 68, 133, 139.

    model.result("pg3").feature("str1").selection().set(66, 68, 133, 139);

//    Locate the Coloring and Style section.
//    Find the Line style subsection.
//    From the Type list, select Tube.

    model.result("pg3").feature("str1").set("linetype", "tube");

//    Right-click Streamline 1 and choose Color Expression.

    model.result("pg3").feature("str1").create("col1", "Color");
    model.result("pg3").run();

//    In the Settings window for Color Expression, locate the Expression section.
//    In the Expression text field, type sqrt(ade.Jx^2+ade.Jy^2+ade.Jz^2).

    model.result("pg3").feature("str1").feature("col1").set("expr", "sqrt(ade.Jx^2+ade.Jy^2+ade.Jz^2)");

//    Locate the Coloring and Style section.
//    From the Scale list, select Logarithmic.

    model.result("pg3").feature("str1").feature("col1").set("colorscalemode", "logarithmic");

//    In the Local Energy Flux (ade) toolbar, click Plot.

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

//    In the Home toolbar, click Add Plot Group and choose 3D Plot Group.

    model.result().create("pg5", "PlotGroup3D");
    model.result("pg5").run();

//    In the Settings window for 3D Plot Group, type Reverberation Time in the Label text field.

    model.result("pg5").label("Reverberation Time");

//    Right-click Reverberation Time and choose Volume.

    model.result("pg5").create("vol1", "Volume");
    model.result("pg5").feature("vol1").set("evaluationsettings", "parent");

//    In the Settings window for Volume, locate the Expression section.
//    In the Expression text field, type ade.T60_EN.

    model.result("pg5").feature("vol1").set("expr", "ade.T60_EN");

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

    model.result("pg5").feature("vol1").set("colortable", "AuroraBorealis");

//    In the Reverberation Time toolbar, click Plot.

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

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

    model.result().create("pg6", "PlotGroup3D");
    model.result("pg6").run();

//    In the Settings window for 3D Plot Group, type Model Thumbnail in the Label text field.

    model.result("pg6").label("Model Thumbnail");
    model.result("pg3").run();

//    In the Model Builder window, right-click Results > Local Energy Flux (ade) > Streamline 1 and choose Copy.

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

//    In the Model Builder window, right-click Model Thumbnail and choose Paste Streamline.

    model.result("pg6").feature().copy("str1", "pg3/str1");
    model.result("pg6").run();

//    In the Settings window for Streamline, locate the Streamline Positioning section.
//    In the Number text field, type 50.

    model.result("pg6").feature("str1").set("selnumber", 50);
    model.result("pg6").run();

//    In the Model Builder window, expand the Streamline 1 node, then click Color Expression 1.
//    In the Settings window for Color Expression, locate the Coloring and Style section.
//    Clear the Color legend checkbox.

    model.result("pg6").feature("str1").feature("col1").set("colorlegend", false);
    model.result("pg6").run();

//    In the Model Builder window, right-click Model Thumbnail and choose Slice.

    model.result("pg6").create("slc1", "Slice");
    model.result("pg6").feature("slc1").set("evaluationsettings", "parent");

//    In the Settings window for Slice, locate the Expression section.
//    In the Expression text field, type ade.Lp.

    model.result("pg6").feature("slc1").set("expr", "ade.Lp");

//    Locate the Plane Data section.
//    From the Plane list, select XY-planes.

    model.result("pg6").feature("slc1").set("quickplane", "xy");

//    From the Entry method list, select Coordinates.

    model.result("pg6").feature("slc1").set("quickzmethod", "coord");

//    In the Z-coordinates text field, type 0.3.

    model.result("pg6").feature("slc1").set("quickz", 0.3);

//    Locate the Coloring and Style section.
//    Clear the Color legend checkbox.

    model.result("pg6").feature("slc1").set("colorlegend", false);
    model.result("pg6").run();

//    Right-click Model Thumbnail and choose Surface.

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

//    In the Model Builder window, right-click Surface 1 and choose Selection.

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

//    In the Settings window for Selection, locate the Selection section.
//    From the Selection list, select Stairs.

    model.result("pg6").feature("surf1").feature("sel1").selection().named("geom1_sel3");
    model.result("pg6").run();

//    In the Model Builder window, click Surface 1.
//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type 1.

    model.result("pg6").feature("surf1").set("expr", "1");

//    Locate the Coloring and Style section.
//    Clear the Color legend checkbox.

    model.result("pg6").feature("surf1").set("colorlegend", false);

//    From the Coloring list, select Uniform.

    model.result("pg6").feature("surf1").set("coloring", "uniform");

//    From the Color list, select Gray.

    model.result("pg6").feature("surf1").set("color", "gray");

//    Right-click Results > Model Thumbnail > Surface 1 and choose Duplicate.

    model.result("pg6").feature().duplicate("surf2", "surf1");
    model.result("pg6").run();
    model.result("pg6").run();

//    In the Model Builder window, expand the Surface 2 node, then click Selection 1.
//    In the Settings window for Selection, locate the Selection section.
//    Click Clear Selection.

    model.result("pg6").feature("surf2").feature("sel1").selection().set();

//    Click Paste Selection.
//    In the Paste Selection dialog, type 16, 17, 20, 21, 23, 25, 29, 32, 45, 61, 123, 201 in the Selection text field.
//    Click OK.

    model.result("pg6").feature("surf2").feature("sel1").selection()
         .set(16, 17, 20, 21, 23, 25, 29, 32, 45, 61, 123, 201);

//    In the Model Thumbnail toolbar, click Plot.

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

//    Add and compute an eigenvalue study to investigate the modes in the house and derive associated reverberation times.
//    In the Home toolbar, click Add Study to open the Add Study window.
//    Find the Studies subsection.
//    In the Select Study tree, select General Studies > Eigenvalue.
//    Click Add Study in the window toolbar.

    model.study().create("std2");
    model.study("std2").create("eigv", "Eigenvalue");

//    In the Home toolbar, click Add Study to close the Add Study window.
//    In the Settings window for Eigenvalue, locate the Study Settings section.
//    Select the Desired number of eigenvalues checkbox.

    model.study("std2").feature("eigv").set("neigsactive", true);

//    In the associated text field, type 10.

    model.study("std2").feature("eigv").set("neigs", 10);

//    Select the Search for eigenvalues around shift checkbox.

    model.study("std2").feature("eigv").set("shiftactive", true);

//    From the Search method around shift list, select Larger real part.

    model.study("std2").feature("eigv").set("eigwhich", "lr");

//    In the Model Builder window, click Study 2.
//    In the Settings window for Study, type Study 2 - Eigenvalue in the Label text field.

    model.study("std2").label("Study 2 - Eigenvalue");

//    In the Study toolbar, click Compute.

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

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

    model.result().create("pg7", "PlotGroup3D");
    model.result("pg7").label("Sound Energy Density Modes (ade)");
    model.result("pg7").set("data", "dset2");
    model.result("pg7").setIndex("looplevel", 1, 0);
    model.result("pg7").set("showlegendsunit", true);
    model.result("pg7").feature().create("mslc1", "Multislice");
    model.result("pg7").feature("mslc1").label("Multislice");
    model.result("pg7").feature("mslc1").set("smooth", "internal");
    model.result("pg7").feature("mslc1").set("data", "parent");
    model.result().evaluationGroup().create("eg1", "EvaluationGroup");
    model.result().evaluationGroup("eg1").set("data", "dset2");
    model.result().evaluationGroup("eg1").feature().create("gev1", "EvalGlobal");
    model.result().evaluationGroup("eg1").feature("gev1").label("Reverberation Time");
    model.result().evaluationGroup("eg1").feature("gev1").set("expr", new String[]{"ade.T60"});
    model.result().evaluationGroup("eg1").feature("gev1").set("data", "parent");
    model.result("pg7").run();

//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Eigenvalue (rad/s) list, select 23.452.

    model.result("pg7").set("looplevel", new int[]{3});
    model.result("pg7").run();

//    In the Model Builder window, expand the Sound Energy Density Modes (ade) node, then click Multislice.
//    In the Settings window for Multislice, locate the Multiplane Data section.
//    Find the X-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg7").feature("mslc1").set("xnumber", "0");

//    Find the Y-planes subsection.
//    In the Planes text field, type 0.

    model.result("pg7").feature("mslc1").set("ynumber", "0");

//    Find the Z-planes subsection.
//    In the Planes text field, type 2.

    model.result("pg7").feature("mslc1").set("znumber", "2");

//    In the Sound Energy Density Modes (ade) toolbar, click Plot.

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

//    In the Model Builder window, under Results, click Evaluation Group 1.
//    In the Settings window for Evaluation Group, type Reverberation Time in the Label text field.

    model.result().evaluationGroup("eg1").label("Reverberation Time");

//    In the Reverberation Time toolbar, click Evaluate.

    model.result().evaluationGroup("eg1").run();

//    Add a transient study to calculate the energy decay in the different rooms. The solution from Study 1 serves as input to represent a stationary source being turned off at the initial time of the transient study.
//    In the Home toolbar, click Add Study to open the Add Study window.
//    Find the Studies subsection.
//    In the Select Study tree, select General Studies > Time Dependent.
//    Click Add Study in the window toolbar.

    model.study().create("std3");
    model.study("std3").create("time", "Transient");

//    In the Home toolbar, click Add Study to close the Add Study window.
//    In the Settings window for Time Dependent, locate the Study Settings section.
//    In the Output times text field, type range(0,0.01,1).

    model.study("std3").feature("time").set("tlist", "range(0,0.01,1)");

//    Locate the Physics and Variables Selection section.
//    Select the Modify model configuration for study step checkbox.

    model.study("std3").feature("time").set("useadvanceddisable", true);

//    In the tree, select Component 1 (comp1) > Acoustic Diffusion Equation (ade) > Point Source 1.
//    Right-click and choose Disable.

    model.study("std3").feature("time").set("disabledphysics", new String[]{"ade/ps1"});

//    Click to expand the Values of Dependent Variables section.
//    Find the Initial values of variables solved for subsection.
//    From the Settings list, select User controlled.

    model.study("std3").feature("time").set("useinitsol", true);

//    From the Method list, select Solution.

    model.study("std3").feature("time").set("initmethod", "sol");

//    From the Study list, select Study 1 - Stationary, Stationary.

    model.study("std3").feature("time").set("initstudy", "std1");

//    In the Model Builder window, click Study 3.
//    In the Settings window for Study, type Study 3 - Transient in the Label text field.

    model.study("std3").label("Study 3 - Transient");

//    Locate the Study Settings section.
//    Clear the Generate default plots checkbox.

    model.study("std3").setGenPlots(false);

//    In the Study toolbar, click Compute.

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

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

//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg8", "PlotGroup1D");
    model.result("pg8").run();

//    In the Settings window for 1D Plot Group, type Energy Decay Curves (normalized) in the Label text field.

    model.result("pg8").label("Energy Decay Curves (normalized)");

//    Locate the Data section.
//    From the Dataset list, select Study 3 - Transient/Solution 3 (sol3).

    model.result("pg8").set("data", "dset3");

//    Click to expand the Title section.
//    From the Title type list, select Manual.

    model.result("pg8").set("titletype", "manual");

//    In the Title text area, type Energy Decay Curves.

    model.result("pg8").set("title", "Energy Decay Curves");

//    Locate the Plot Settings section.
//    Select the y-axis label checkbox.

    model.result("pg8").set("ylabelactive", true);

//    In the associated text field, type Level (dB).

    model.result("pg8").set("ylabel", "Level (dB)");

//    Right-click Energy Decay Curves (normalized) and choose Point Graph.

    model.result("pg8").create("ptgr1", "PointGraph");
    model.result("pg8").feature("ptgr1").set("markerpos", "datapoints");
    model.result("pg8").feature("ptgr1").set("linewidth", "preference");

//    Select Points 100, 377, 415.

    model.result("pg8").feature("ptgr1").selection().set(100, 377, 415);

//    In the Settings window for Point Graph, locate the y-Axis Data section.
//    In the Expression text field, type ade.Lp-with('first',ade.Lp).

    model.result("pg8").feature("ptgr1").set("expr", "ade.Lp-with('first',ade.Lp)");

//    Click to expand the Coloring and Style section.
//    From the Width list, select 2.

    model.result("pg8").feature("ptgr1").set("linewidth", 2);

//    Click to expand the Legends section.
//    Select the Show legends checkbox.

    model.result("pg8").feature("ptgr1").set("legend", true);

//    Find the Prefix and suffix subsection.
//    In the Prefix text field, type Point .

    model.result("pg8").feature("ptgr1").set("legendprefix", "Point ");

//    In the Energy Decay Curves (normalized) toolbar, click Plot.

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

//    The sound field radiated outside the house can be investigated with the <em>Ray Acoustics</em> interface. Start by importing parameters to represent absorption and scattering coefficients in the outdoor domain.
//    In the Home toolbar, click Parameters and choose Add > Parameters.

    model.param().create("par3");

//    In the Settings window for Parameters, type Parameters 3 - Outdoor Boundaries in the Label text field.

    model.param("par3").label("Parameters 3 - Outdoor Boundaries");

//    Locate the Parameters section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file one_family_house_parameters_outdoor.txt.
//    To import content from file, use:
//    model.param("par3").loadFile("FILENAME");
    model.param("par3").set("a_ground", "0.2", "Ground absorption coefficient");
    model.param("par3").set("s_ground", "0.15", "Ground scattering coefficient");
    model.param("par3").set("a_extwall", "0.1", "Exterior wall absorption coefficient");
    model.param("par3").set("s_extwall", "0.1", "Exterior wall scattering coefficient");
    model.param("par3").set("s_window", "0.1", "Window scattering coefficient");

//    Define the surfaces radiating outward and import the variables to set up the manual coupling between the <em>Acoustics Diffusion Equation</em> and <em>Ray Acoustics</em> interfaces.
//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel1", "Explicit");

//    In the Settings window for Explicit, type Radiating Window 1 in the Label text field.

    model.component("comp1").selection("sel1").label("Radiating Window 1");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel1").geom(2);

//    Select Boundary 43.

    model.component("comp1").selection("sel1").set(43);

//    Right-click Radiating Window 1 and choose Duplicate.

    model.component("comp1").selection().duplicate("sel2", "sel1");

//    In the Settings window for Explicit, type Radiating Window 2 in the Label text field.

    model.component("comp1").selection("sel2").label("Radiating Window 2");

//    Locate the Input Entities section.
//    Click Clear Selection.

    model.component("comp1").selection("sel2").set();

//    Select Boundaries 110, 146.

    model.component("comp1").selection("sel2").set(110, 146);

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

    model.component("comp1").cpl("intop1").selection().geom("geom1", 2);

//    From the Selection list, select Radiating Window 1.

    model.component("comp1").cpl("intop1").selection().named("sel1");

//    Right-click Integration 1 (intop1) and choose Duplicate.

    model.component("comp1").cpl().duplicate("intop2", "intop1");

//    In the Settings window for Integration, locate the Source Selection section.
//    From the Selection list, select Radiating Window 2.

    model.component("comp1").cpl("intop2").selection().named("sel2");

//    In the Model Builder window, right-click Definitions and choose Variables.

    model.component("comp1").variable().create("var1");

//    In the Settings window for Variables, type Variables 1 - Outdoor Radiation in the Label text field.

    model.component("comp1").variable("var1").label("Variables 1 - Outdoor Radiation");

//    Locate the Variables section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file one_family_house_variables_radiation.txt.
//    To import content from file, use:
//    model.component("comp1").variable("var1").loadFile("FILENAME");
    model.component("comp1").variable("var1")
         .set("Pwin1", "intop1(ade.psq/ade.rho/ade.c)", "Power on the inside of window 1");
    model.component("comp1").variable("var1")
         .set("Pwin2", "intop2(ade.psq/ade.rho/ade.c)", "Power on the inside of window 2");
    model.component("comp1").variable("var1").set("TLwin", "20[dB]", "Transmission loss of the windows");
    model.component("comp1").variable("var1").set("tau", "10^(-TLwin/10)", "Power transmission coefficient");
    model.component("comp1").variable("var1").set("Prad1", "Pwin1*tau", "Power radiated from window 1");
    model.component("comp1").variable("var1").set("Prad2", "Pwin2*tau", "Power radiated from window 2");

//    Proceed to set up the physics model. To compute the sound pressure level on surfaces, it is necessary to model the power along the rays.
//    In the Home toolbar, click Add Physics to open the Add Physics window.
//    In the tree, select Acoustics > Geometrical Acoustics > Ray Acoustics (rac).
//    Find the Physics interfaces in study subsection.
//    In the table, enter the following settings:
//    Click Add to Component 1 in the window toolbar.

    model.component("comp1").physics().create("rac", "RayAcoustics", "geom1");

    model.study("std1").feature("stat").setSolveFor("/physics/rac", false);
    model.study("std2").feature("eigv").setSolveFor("/physics/rac", false);
    model.study("std3").feature("time").setSolveFor("/physics/rac", false);

//    In the Home toolbar, click Add Physics to close the Add Physics window.
//    In the Settings window for Ray Acoustics, locate the Domain Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("rac").selection().set();

//    Select Domain 1.

    model.component("comp1").physics("rac").selection().set(1);

//    In the Model Builder window, under Component 1 (comp1) > Ray Acoustics (rac), click Medium Properties 1.
//    In the Settings window for Medium Properties, locate the Pressure Acoustics Model section.
//    From the Fluid model list, select Atmosphere attenuation.

    model.component("comp1").physics("rac").feature("mp1").set("FluidModel", "Atmosphere");

//    Locate the Model Input section.
//    In the \[\phi_\textrm{w}\] text field, type 0.45.

    model.component("comp1").physics("rac").feature("mp1").set("minput_relativehumidity", 0.45);

//    Set up the sources as radiating surfaces based on the sound power calculated in Study 1.
//    In the Physics toolbar, click Boundaries and choose Release from Boundary.

    model.component("comp1").physics("rac").create("relb1", "ReleaseFromBoundary", 2);

//    Start by selecting the desired surface and defining its discretization. Rays will be released from every point on the surface.
//    In the Settings window for Release from Boundary, locate the Boundary Selection section.
//    From the Selection list, select Radiating Window 1.

    model.component("comp1").physics("rac").feature("relb1").selection().named("sel1");

//    Locate the Initial Position section.
//    In the \[N\] text field, type 200.

    model.component("comp1").physics("rac").feature("relb1").setIndex("Nr", 200, 0);

//    Continue with the radiation direction and the number of rays released by each point.
//    Locate the Ray Direction Vector section.
//    From the Ray direction vector list, select Hemispherical.

    model.component("comp1").physics("rac").feature("relb1").set("RayDirectionVector", "Hemispherical");

//    Select the Specify tangential and normal vector components checkbox.

    model.component("comp1").physics("rac").feature("relb1").set("SpecifyInletTangentialNormal", true);

//    In the \[N_\textrm{w}\] text field, type 500.

    model.component("comp1").physics("rac").feature("relb1").setIndex("Nw", 500, 0);

//    Specify the \[\mathbf{r}\] vector as

    model.component("comp1").physics("rac").feature("relb1").set("rax", new int[]{0, 0, 1});

//    Finally, enter the source power previously defined in variables.
//    Locate the Total Source Power section.
//    In the \[P_{\textrm{src}}\] text field, type Prad1.

    model.component("comp1").physics("rac").feature("relb1").set("Psrc", "Prad1");

//    Right-click Release from Boundary 1 and choose Duplicate.

    model.component("comp1").physics("rac").feature().duplicate("relb2", "relb1");

//    In the Settings window for Release from Boundary, locate the Boundary Selection section.
//    From the Selection list, select Radiating Window 2.

    model.component("comp1").physics("rac").feature("relb2").selection().named("sel2");

//    Locate the Total Source Power section.
//    In the \[P_{\textrm{src}}\] text field, type Prad2.

    model.component("comp1").physics("rac").feature("relb2").set("Psrc", "Prad2");

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

    model.component("comp1").physics("rac").create("wall2", "RayAcousticsWall", 2);

//    In the Settings window for Wall, type Wall 2 - Ground in the Label text field.

    model.component("comp1").physics("rac").feature("wall2").label("Wall 2 - Ground");

//    Select Boundary 3.

    model.component("comp1").physics("rac").feature("wall2").selection().set(3);

//    Locate the Wall Condition section.
//    In the \[s\] text field, type 1-s_ground.

    model.component("comp1").physics("rac").feature("wall2").set("s", "1-s_ground");

//    In the \[\alpha\] text field, type a_ground.

    model.component("comp1").physics("rac").feature("wall2").set("alpha", "a_ground");

//    In the Physics toolbar, click Attributes and choose Sound Pressure Level Calculation.

    model.component("comp1").physics("rac").feature("wall2").create("spl1", "SoundPressureLevelBoundary", 2);

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

    model.component("comp1").physics("rac").create("wall3", "RayAcousticsWall", 2);

//    In the Settings window for Wall, type Wall 3 - Exterior Wall in the Label text field.

    model.component("comp1").physics("rac").feature("wall3").label("Wall 3 - Exterior Wall");

//    Select Boundaries 33, 34, 35, 40, 41, 42, 51, 52, 53, 73, 74, 103, 104, 105, 106, 107, 108, 109, 143, 144, 145, 175, 226.

    model.component("comp1").physics("rac").feature("wall3").selection()
         .set(33, 34, 35, 40, 41, 42, 51, 52, 53, 73, 74, 103, 104, 105, 106, 107, 108, 109, 143, 144, 145, 175, 226);

//    Locate the Wall Condition section.
//    In the \[s\] text field, type s_extwall.

    model.component("comp1").physics("rac").feature("wall3").set("s", "s_extwall");

//    In the \[\alpha\] text field, type a_extwall.

    model.component("comp1").physics("rac").feature("wall3").set("alpha", "a_extwall");

//    Right-click Wall 3 - Exterior Wall and choose Duplicate.

    model.component("comp1").physics("rac").feature().duplicate("wall4", "wall3");

//    In the Settings window for Wall, type Wall 4 - Windows in the Label text field.

    model.component("comp1").physics("rac").feature("wall4").label("Wall 4 - Windows");

//    Locate the Boundary Selection section.
//    Click Clear Selection.

    model.component("comp1").physics("rac").feature("wall4").selection().set();

//    Select Boundaries 43, 54, 110, 111, 146.

    model.component("comp1").physics("rac").feature("wall4").selection().set(43, 54, 110, 111, 146);

//    Locate the Wall Condition section.
//    In the \[s\] text field, type s_window.

    model.component("comp1").physics("rac").feature("wall4").set("s", "s_window");

//    In the \[\alpha\] text field, type a_window.

    model.component("comp1").physics("rac").feature("wall4").set("alpha", "a_window");

//    In the Physics toolbar, click Boundaries and choose General Wall.

    model.component("comp1").physics("rac").create("gwall1", "GeneralWall", 2);

//    In the Settings window for General Wall, type General Wall 1 - Air in the Label text field.

    model.component("comp1").physics("rac").feature("gwall1").label("General Wall 1 - Air");

//    Select Boundaries 1, 2, 4, 5, 259.

    model.component("comp1").physics("rac").feature("gwall1").selection().set(1, 2, 4, 5, 259);

//    Locate the Wall Condition section.
//    From the Wall condition list, select Disappear.

    model.component("comp1").physics("rac").feature("gwall1").set("WallCondition", "Disappear");

//    Proceed with the ray tracing study, setting the results from Study 1 as input.
//    In the Home 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 > Ray Acoustics > Ray Tracing.
//    Find the Physics interfaces in study subsection.
//    In the table, enter the following settings:
//    Click Add Study in the window toolbar.

    model.study().create("std4");
    model.study("std4").create("rtrac", "RayTracing");
    model.study("std4").feature("rtrac").setSolveFor("/physics/ade", false);

//    In the Home toolbar, click Add Study to close the Add Study window.
//    In the Settings window for Ray Tracing, locate the Study Settings section.
//    From the Time unit list, select s.

    model.study("std4").feature("rtrac").set("tunit", "s");

//    In the Output times text field, type 0 0.2.

    model.study("std4").feature("rtrac").set("tlist", "0 0.2");

//    Click to expand the Values of Dependent Variables section.
//    Find the Values of variables not solved for subsection.
//    From the Settings list, select User controlled.

    model.study("std4").feature("rtrac").set("usesol", true);

//    From the Method list, select Solution.

    model.study("std4").feature("rtrac").set("notsolmethod", "sol");

//    From the Study list, select Study 1 - Stationary, Stationary.

    model.study("std4").feature("rtrac").set("notstudy", "std1");

//    In the Model Builder window, click Study 4.
//    In the Settings window for Study, type Study 4 - Ray Acoustics in the Label text field.

    model.study("std4").label("Study 4 - Ray Acoustics");

//    In the Study toolbar, click Compute.

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

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

    model.result().dataset().create("ray1", "Ray");
    model.result().dataset("ray1").set("solution", "sol4");
    model.result().dataset("ray1").set("posdof", new String[]{"comp1.qx", "comp1.qy", "comp1.qz"});
    model.result().dataset("ray1").set("geom", "geom1");
    model.result().dataset("ray1").set("rgeom", "pgeom_rac");
    model.result().dataset("ray1").set("rgeomspec", "fromphysics");
    model.result().dataset("ray1").set("physicsinterface", "rac");
    model.result().create("pg9", "PlotGroup3D");
    model.result("pg9").set("data", "ray1");
    model.result("pg9").label("Ray Trajectories (rac)");
    model.result("pg9").set("showlegendsunit", true);
    model.result("pg9").create("rtrj1", "RayTrajectories");
    model.result("pg9").feature("rtrj1").set("linetype", "line");
    model.result("pg9").feature("rtrj1").set("extrasteps", "none");
    model.result("pg9").feature("rtrj1").create("col1", "Color");
    model.result("pg9").feature("rtrj1").feature("col1").set("expr", "t");
    model.result("pg9").feature("rtrj1").create("filt1", "RayTrajectoriesFilter");
    model.result("pg9").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Settings window for 3D Plot Group, locate the Data section.
//    From the Time (s) list, select Interpolation.

    model.result("pg9").setIndex("looplevel", "interp", 0);

//    In the Time text field, type 0.003.

    model.result("pg9").set("interp", new double[]{0.003});
    model.result("pg9").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Model Builder window, expand the Ray Trajectories (rac) node, then click Ray Trajectories 1.
//    In the Settings window for Ray Trajectories, locate the Coloring and Style section.
//    Find the Line style subsection.
//    From the Type list, select None.

    model.result("pg9").feature("rtrj1").set("linetype", "none");

//    Find the Point style subsection.
//    From the Type list, select Point.

    model.result("pg9").feature("rtrj1").set("pointtype", "point");
    model.result("pg9").run();

//    In the Model Builder window, expand the Ray Trajectories 1 node, then click Color Expression 1.
//    In the Settings window for Color Expression, locate the Expression section.
//    In the Expression text field, type rac.Q.

    model.result("pg9").feature("rtrj1").feature("col1").set("expr", "rac.Q");

//    In the Ray Trajectories (rac) toolbar, click Plot.

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

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

    model.result().create("pg10", "PlotGroup3D");
    model.result("pg10").run();

//    In the Settings window for 3D Plot Group, type Outdoor SPL in the Label text field.

    model.result("pg10").label("Outdoor SPL");

//    Locate the Data section.
//    From the Dataset list, select Study 4 - Ray Acoustics/Solution 4 (sol4).

    model.result("pg10").set("data", "dset4");

//    Locate the Color Legend section.
//    Select the Show units checkbox.

    model.result("pg10").set("showlegendsunit", true);

//    Right-click Outdoor SPL and choose Surface.

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

//    In the Settings window for Surface, locate the Expression section.
//    In the Expression text field, type rac.wall2.spl1.Lp.

    model.result("pg10").feature("surf1").set("expr", "rac.wall2.spl1.Lp");

    return model;
  }

  public static Model run3(Model model) {

//    Click to expand the Range section.
//    Select the Manual color range checkbox.

    model.result("pg10").feature("surf1").set("rangecoloractive", true);

//    In the Minimum text field, type 65.

    model.result("pg10").feature("surf1").set("rangecolormin", 65);

//    In the Maximum text field, type 115.

    model.result("pg10").feature("surf1").set("rangecolormax", 115);

//    Right-click Surface 1 and choose Duplicate.

    model.result("pg10").feature().duplicate("surf2", "surf1");
    model.result("pg10").run();

//    In the Settings window for Surface, locate the Data section.
//    From the Dataset list, select Study 1 - Stationary/Solution 1 (sol1).

    model.result("pg10").feature("surf2").set("data", "dset1");

//    Locate the Expression section.
//    In the Expression text field, type ade.Lp.

    model.result("pg10").feature("surf2").set("expr", "ade.Lp");

//    Click to expand the Title section.
//    From the Title type list, select None.

    model.result("pg10").feature("surf2").set("titletype", "none");

//    Locate the Coloring and Style section.
//    Clear the Color legend checkbox.

    model.result("pg10").feature("surf2").set("colorlegend", false);

//    In the Outdoor SPL toolbar, click Plot.

    model.result("pg10").run();
    model.result("pg6").run();

    model.title("Acoustics in a Single-Family Home");

    model
         .description("This model shows an application of the Acoustic Diffusion Equation physics interface. The acoustics in a two-story single-family home consisting of 10\u00a0rooms is analyzed.\n\nThe steady-state sound pressure level and energy density distributions are analyzed for a monopole source located in the living room. The reverberation time T60 of the different coupled rooms is then studied using the eigenvalue solver. The transient energy decay is also found using a time-dependent study.\n\nFurthermore, the sound pressure level radiated outside the house is determined with a manual coupling to the Ray Acoustics interface.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    model = run2(model);
    run3(model);
  }

}
