Understanding the PostProcessor Nested Class

The PostProcessor class is used to export hardcopies of the Velocity Magnitude scene and the Residuals plot. You can also export the Streamlines scene as a STAR-View+ file.

Description Code
  • In a similar fashion to the previous class, you set member variables for each scene or plot that you want to export.
public class PostProcessor {
 
  private Scene m_velMag = null;
  • Furthermore, you find the relevant objects in the simulation by placing the necessary statements in the constructor.
public PostProcessor(Simulation theSim) {
 
  m_sim = theSim;
 
  m_velMag =
    ((Scene) m_sim
    .getSceneManager()
    .getScene(“Velocity Magnitude”)); 
 
}
  • Following are methods which are used to perform the action of saving the relevant scene or plot. As before, the statements for carrying out these operations can be copied from the recorded macro. You pass the path of the output file to the method as an argument, String sceneToSave.
public void saveVelMagScene(String sceneToSave) {
 
  m_velMag.printAndWait(
    sceneToSave, 1, 1024, 768
  );
 
}
  • When a hardcopy is saved, it is automatically opened in the Graphics window in the Simcenter STAR-CCM+ GUI. In the Streamlines scene, make sure that the scene is closed before the next simulation is run, otherwise the simulation run time is dramatically increased. Use the Scene.close() method.
public void saveStreamlinesScene(String sceneToSave) {
 
  m_streamlines.export3DSceneFileAndWait(
    sceneToSave, true
  );
 
  m_streamlines.close(true);
 
}