- You declare the properties that are set in the simulation as
member variables of the
SimRunner class. Include only variables that are set using the input data, such as inlet velocity, and variables that are extracted, such as drag coefficient. The type of each of the member variables can be found by referring to the
macroRecording.java file, and to the section
Understanding the Recorded Macro .
|
private VelocityProfile m_inflowVel = null;
|
- Locating an object in
Simcenter STAR-CCM+ follows the same path as expanding nodes in the object tree. Therefore, to perform an operation such as setting the inlet velocity, locate each of the upper objects first. Here this action is performed in the constructor, as the location of the objects do not change, and you want to find the objects for every
SimRunner object that is created.
- The statements for locating each object can be copied from the recorded macro, taking care the change the variable names as necessary.
|
public SimRunner(Simulation theSim) {
m_sim = theSim;
PhysicsContinuum physics =
((PhysicsContinuum) m_sim
.getContinuumManager()
.getContinuum(“Physics 1”));
m_initVel =
((VelocityProfile) physics
.getInitialConditions()
.get(VelocityProfile.class));
}
|
- In the next method,
runCase() , implement the statements that set the necessary properties in the simulation. First, you extract the values from the
SimData object; then you use this data to set the values of each property. Notice that you use the getter methods that were defined in the
SimData nested class to extract the data.
|
public void runCase(SimData sD, int iterations) {
double initX =
sD.getInitVelX();
double velY =
sD.getVelY();
|