Customizing the Workflow Using Java Macros

You can customize the Design Manager workflow using Java macros.

There are two instances in the Design Manager workflow where you can use *.java macros to perform custom tasks:

  • When setting up and starting design studies in the Design Manager project
  • When running the Simcenter STAR-CCM+ design simulations
Customizing the Design Manager Project

You can script the process of setting up and starting design studies in Design Manager. The File > Macro menu in Design Manager contains the same options for recording and running macros as Simcenter STAR-CCM+. For a full description of the available options, see Scripting the Application.

Scripting the Design Manager application is particularly useful when you want to automate repetitive tasks or when you want to perform certain actions within the project when running in batch (locally or on a cluster).

Example: Running a Design Manager project in batch using the default command option (-batch run) runs all design studies within the project sequentially from first to last. However, if you want to run only one or more specific design studies, you can record a macro in Design Manager that runs only the relevant studies. You then specify this Java macro on the command line when running the project. For more information, see Running from a batch client.

Customizing the Simcenter STAR-CCM+ Design Simulations

When running a particular design of a design study, Design Manager launches Simcenter STAR-CCM+, loads the reference simulation, modifies the relevant parameters, and runs the simulation until certain stopping criteria are met. You can expand this default workflow by adding custom macros to the respective design study. For details of the blocks that Design Manager executes, see Study Runs.

There are four points where Design Manager accepts additional macros:

  • Before Update Model
  • Before Meshing
  • Before Running
  • Before Results

Example: One example of how you can customize the workflow is to change the run settings and then re-run the solver. You can record a macro in Simcenter STAR-CCM+ where you modify the run settings, for example the Mach number, extend the number of iterations in the stopping criteria, and then re-run the solver. Using this technique you can perform two runs with different mach numbers for a single design. You then insert this macro after running the solver. When Design Manager reaches this stage, it performs the custom steps and then proceeds with the remaining default workflow.

To customize the Simcenter STAR-CCM+ design simulations:

  1. In Simcenter STAR-CCM+, record the steps that you want to include in the design simulation workflow.
    For more information, see Recording a Macro.
  2. In Design Manager, set up your design study.
  3. Right-click the Settings > Macro Files node and select New.
  4. In the Open dialog, navigate to and select the appropriate *.java file.
  5. Set Macro Insertion Point to the option that is relevant to your situation:
    • Before Update Model—if you want to perform the actions before executing the geometrical changes of the model.
    • Before Meshing—if you want to perform the actions before executing the meshing pipeline.
    • Before Running—if you want to perform the actions before running the solver operation.
    • Before Results—if you want to perform the actions after the Simcenter STAR-CCM+ solver completes, and before any results are returned to Design Manager.
  6. Click Open.
    The macro is added to the Macro Files node.

    You can add multiple macros to a design study. For the list of available macro file properties, see Macro Files Reference.

When you run the Design Manager study, the custom steps are run at the appropriate stage of the workflow. If a macro throws an error during execution, the corresponding design is marked as a failure. The error message includes the name of the macro file in which the failure occurred.