Recording the Macro

Record the planned actions.

Any command issued to Simcenter STAR-CCM+ has an associated Java statement. The macroRecording tab of the Output window displays the statements. Do not record unnecessary commands to avoid the Java file being cluttered. Pause the recording to carry out actions without the associated statements being added to the macro.

  1. In the Macro toolbar, click (Start Recording...).
  2. Save the file as macroRecording.java.
Set the initial velocity:
  1. Select the Continua > Physics 1 > Initial Conditions > Velocity node and set Value to [-10, 10, 0] m/s.
Set the inflow velocity:
  1. Select the Regions > trainAndTrack > Boundaries > Inflow > Physics Values > Velocity node and set Value to [-5, 5, 0] m/s.
Clear the previous solution and run the simulation:
  1. From the menu, select Solution > Clear Solution.
  2. Run the simulation.
  3. Click (Stop Iterating) to stop the simulation running.
Run the Drag Coefficient report. When you create the final macro, obtain a single value for the drag coefficient rather than running the entire report. To obtain some of the statements required later on, however, run the report.
  1. Right-click the Reports > Drag Coefficient node and select Run Report.
Save hardcopies of the scene:
  1. Select the Velocity Magnitude tab in the Graphics window.
  2. Right-click in the white area of the scene and select Hardcopy....
  3. In the Save To File dialog, set the following properties:
    Property Setting
    File Name velMag
    X Resolution 1024
    Y Resolution 768
  4. Click Save.
  5. Repeat these steps to save a hardcopy of the Residuals plot; name the file res.
  6. Right-click the Scenes > Streamlines node and select Export to Viewer File.
  7. Name the file Streamlines and click Save.
  8. Click the Save As button in the File menu and save the file under the name trainMacro.
  9. Click Save.
  10. Click the (Stop Recording) button in the Macro toolbar to stop recording.