Recording the Actions for Step 2

Record the actions for Step 2.

The second step involves modifying the material properties of air. Use the same technique as Step 1:
  1. Return to Simcenter STAR-CCM+ and record a macro named ModifyMaterialProperties.java.
  2. Navigate to Continua > Physics > Models > Gas > Air > Material Properties and set the following properties:
    Node Property Setting
    Density Value 1.0 kg/m^3
    Dynamic Viscosity Value 1.716E-5 Pa-s
  3. Stop recording the macro.
    The macro code for these actions is displayed below:
    // begin macro: ModifyMaterialProperties
    Simulation simulation_0 =
        getSimulation();
    PhysicsContinuum physicsContinuum_0 =
        ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics"));
    SingleComponentGasModel singleComponentGasModel_0 =
        physicsContinuum_0.getModelManager().getModel(SingleComponentGasModel.class);
    Gas gas_0 =
        ((Gas) singleComponentGasModel_0.getMaterial());
    ConstantMaterialPropertyMethod constantMaterialPropertyMethod_0 =
        ((ConstantMaterialPropertyMethod) gas_0.getMaterialProperties()
    .getMaterialProperty(ConstantDensityProperty.class).getMethod());
    constantMaterialPropertyMethod_0.getQuantity().setValue(1.0);
    ConstantMaterialPropertyMethod constantMaterialPropertyMethod_1 =
        ((ConstantMaterialPropertyMethod) gas_0.getMaterialProperties()
    .getMaterialProperty(DynamicViscosityProperty.class).getMethod());
    constantMaterialPropertyMethod_1.getQuantity().setValue(1.716E-5);
    // end macro: ModifyMaterialProperties
  4. Copy and paste the code into the materialProperties() function.
  5. Reformat the code in NetBeans.
  6. Select Source > Fix Imports.