Class-by-Class Breakdown
A class-by-class breakdown is provided for you. The final macro is too complicated to describe how to write it from scratch, so it has been provided for you.
- Navigate to the automation folder of the downloaded tutorial files. Copy the trainFlowAngles.java file to your working directory.
- Open the trainFlowAngles.java file using an appropriate text editor.
A detailed description which includes Java coding follows in the following sections. The processes in each nested class are as follows:
SimData
The data passed to the SimData object includes the velocities of the train and wind. You must calculate the x and y components of the inflow velocity and initial velocity to set the velocities in the simulation. These calculations are made in the SimData class.
- Receive the data from DataReader.
- Calculate the velocity components.
DataReader
- Read a line of data from the input file
- Assign each value to the corresponding variable
- Create a SimData object for the set of variables
- Store the SimData object in a collection of SimData objects
- Repeat for each line in the input file.
DataWriter
- Create an output file and write the necessary table headings.
- Add a line to the file including the cross-wind angle and drag coefficient after each simulation has run.
SimRunner
- Retrieve the properties in Simcenter STAR-CCM+related to the input data.
- Retrieve data from the SimData object and set the values of these properties.
- Clear any previous solution.
- Run the simulation.
- Obtain the value of the drag coefficient and store it in the SimData object.
PostProcessor
- Retrieve the scenes and plots in Simcenter STAR-CCM+ to be exported as hardcopies.
- Save hardcopies of various scenes and plots.
The following sections describe each of these classes in detail, highlighting key features in the Java code.