Macro API Changes 2022.1

In Simcenter STAR-CCM+ 2022.1, the macro API changed for multiphase, DFBI, visualization, and update events.

Multiphase

Removal of Models

Two multiphase models, Multiphase Equation of State and Eulerian Multiphase Mixture, have been removed from the Simcenter STAR-CCM+ UI. They have no properties and are not required as information to the user.

To update your macro code, remove instances of the use of these models as shown in the following example:

import star.common.EulerianMultiphaseMixtureModel;
...
PhysicsContinuum physicsContinuum = ((PhysicsContinuum) simulation.getContinuumManager().getContinuum("Physics 1"));
physicsContinuum.enable(EulerianMultiphaseMixtureModel.class)

Total Pressure and Total Temperature Now Available per Phase in Mixture Multiphase and VOF

Beginning with Simcenter STAR-CCM+ 2022.1, support for total pressure and total temperature per physics continuum has been discontinued from Mixture Multiphase and VOF simulations. Instead, these values are now available per phase. Simulation files that used total pressure and/or total temperature in post-processing need to be updated, and macros have to be changed. In the following example, total pressure is evaluated and a phase with the name Water is to be used in the updated macro code:

Previous Release Simcenter STAR-CCM+ 2022.1
Simulation simulation_0 = getActiveSimulation()
PrimitiveFieldFunction totalPressure = ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("TotalPressure"));
Simulation simulation_0 = getActiveSimulation()
PrimitiveFieldFunction totalPressure = ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("TotalPressureWater"));

Changes to VOF Waves Model Properties

The following properties of the VOF Waves model can now be set as parameters (scalar quantities, field functions, or global parameters):

  • Damping Constant 1
  • Damping Constant 2
  • Damping Exponent
  • Forcing Constant

As a result, macro code has changed. For backward compatibility, macros recorded in previous releases still work in Simcenter STAR-CCM+ 2022.1.

Previous Release Simcenter STAR-CCM+ 2022.1
VofWaveModel vofWaveModel_0 = physicsContinuum_0.getModelManager().getModel(VofWaveModel.class);
vofWaveModel_0.setDampingConstantOne(11.0);
vofWaveModel_0.setDampingConstantTwo(12.0);
vofWaveModel_0.setDampingExponent(3.0);
vofWaveModel_0.setForcingConstant(11.0);
VofWaveModel vofWaveModel_0 = physicsContinuum_0.getModelManager().getModel(VofWaveModel.class);
Units units_0 = ((Units) simulation_0.getUnitsManager().getObject("/s"));
Units units_1 = ((Units) simulation_0.getUnitsManager().getObject("/m"));
Units units_2 = ((Units) simulation_0.getUnitsManager().getObject(""));
vofWaveModel_0.getDampingConstantOne().setValueAndUnits(11.0, units_0);
vofWaveModel_0.getDampingConstantTwo().setValueAndUnits(12.0, units_1);
vofWaveModel_0.getDampingExponent().setValueAndUnits(3.0, units_2);
vofWaveModel_0.getForcingConstant().setValueAndUnits(11.0, units_0);

It is also possible to use a shorter way of setting values without the units:

VofWaveModel vofWaveModel_0 = physicsContinuum_0.getModelManager().getModel(VofWaveModel.class);
vofWaveModel_0.getDampingConstantOne().setValue(11.0);
vofWaveModel_0.getDampingConstantTwo().setValue(12.0);
vofWaveModel_0.getDampingExponent().setValue(3.0);
vofWaveModel_0.getForcingConstant().setValue(11.0);

DFBI: Automation of Specific Forces and Moments

For creation and removal of the following forces and moments an automatic handling has been introduced:

  • Fluid Force and Moment
  • DEM Force and Moment
  • Electromagnetic Force and Moment

These forces and moments can no longer be created or removed manually.

In previous versions of Simcenter STAR-CCM+, the Fluid Force and Moment was created by default together with a new continuum body. In Simcenter STAR-CCM+ 2022.1, no Fluid Force and Moment is created when you create a continuum body. The Fluid Force and Moment is created automatically as soon as a boundary with relation to a supported flow model is added to the body surface definition.

As a result, the macro code has changed to set up the body surface and the flow model before accessing the Fluid Force and Moment, as shown in the following example:

Previous Release Simcenter STAR-CCM+ 2022.1
ContinuumBody continuumBody_0 = 
  simulation_0.get(star.sixdof.BodyManager.class).createContinuumBody(true);
FluidForceAndMoment fluidForceAndMoment_0 = 
  ((FluidForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("Fluid Force and Moment"));
fluidForceAndMoment_0.setSmoothingEnabled(true);
continuumBody_0.getBodySurface().setQuery(null);
Region region_0 = 
  simulation_0.getRegionManager().getRegion("Zone_1");
Boundary boundary_0 = 
  region_0.getBoundaryManager().getBoundary("hull");
continuumBody_0.getBodySurface().setObjects(boundary_0);
PhysicsContinuum physicsContinuum_0 = 
  ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
physicsContinuum_0.enable(SegregatedFlowModel.class);
continuumBody continuumBody_0 = 
  simulation_0.get(star.sixdof.BodyManager.class).createContinuumBody(true);
continuumBody_0.getBodySurface().setQuery(null);
Region region_0 = 
  simulation_0.getRegionManager().getRegion("Zone_1");
Boundary boundary_0 = 
  region_0.getBoundaryManager().getBoundary("hull");
continuumBody_0.getBodySurface().setObjects(boundary_0);
PhysicsContinuum physicsContinuum_0 = 
  ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
physicsContinuum_0.enable(SegregatedFlowModel.class);
FluidForceAndMoment fluidForceAndMoment_0 = 
  ((FluidForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("Fluid Force and Moment"));
fluidForceAndMoment_0.setSmoothingEnabled(true);

No manual removal of forces and moments

Automatically handled forces and moments cannot be removed manually. They need to be disabled instead. For backward compatibility reasons, the old macro calls to remove these forces and moments are still accepted, but they disable the forces and moments instead of removing them.

Previous Release Simcenter STAR-CCM+ 2022.1
ContinuumBody continuumBody_0 = 
  ((ContinuumBody) simulation_0.get(star.sixdof.BodyManager.class).getObject("Body 1"));
FluidForceAndMoment fluidForceAndMoment_0 = 
  ((FluidForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("Fluid Force and Moment"));
continuumBody_0.getExternalForceAndMomentManager().removeObjects(fluidForceAndMoment_0);
DemForceAndMoment demForceAndMoment_0 = 
  ((DemForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("DEM Force and Moment"));
continuumBody_0.getExternalForceAndMomentManager().removeObjects(demForceAndMoment_0);
ElectromagneticForceAndMoment electromagneticForceAndMoment_0 = 
  ((ElectromagneticForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("Electromagnetic Force and Moment"));
continuumBody_0.getExternalForceAndMomentManager().removeObjects(electromagneticForceAndMoment_0);
ContinuumBody continuumBody_0 = 
  ((ContinuumBody) simulation_0.get(star.sixdof.BodyManager.class).getObject("Body 1"));
FluidForceAndMoment fluidForceAndMoment_0 = 
  ((FluidForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("Fluid Force and Moment"));
fluidForceAndMoment_0.setEnabled(false);
DemForceAndMoment demForceAndMoment_0 = 
  ((DemForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("DEM Force and Moment"));
demForceAndMoment_0.setEnabled(false);
ElectromagneticForceAndMoment electromagneticForceAndMoment_0 = 
  ((ElectromagneticForceAndMoment) continuumBody_0.getExternalForceAndMomentManager().getObject("Electromagnetic Force and Moment"));
electromagneticForceAndMoment_0.setEnabled(false);

No manual creation of forces and moments

Automatically handled forces and moments cannot be created manually. For backward compatibility reasons, the functionality of creating these forces and moments with a macro call is still made available. Creating these forces and moments in existing macros should still work, and the obtained force and moment objects can be further manipulated within the macro. However, the newly created forces and moments are not made visible in the UI and they are not used for computations unless the automatic mechanism detects that they are needed for the simulation.

Previous Release Simcenter STAR-CCM+ 2022.1
ContinuumBody continuumBody_0 = 
  ((ContinuumBody) simulation_0.get(star.sixdof.BodyManager.class).getObject("Body 1"));
FluidForceAndMoment fluidForceAndMoment_1 = 
  continuumBody_0.getExternalForceAndMomentManager().createForceAndMoment(FluidForceAndMoment.class);
DemForceAndMoment demForceAndMoment_1 = 
  continuumBody_0.getExternalForceAndMomentManager().createForceAndMoment(DemForceAndMoment.class);
ElectromagneticForceAndMoment electromagneticForceAndMoment_1 = 
  continuumBody_0.getExternalForceAndMomentManager().createForceAndMoment(ElectromagneticForceAndMoment.class);
--
// Fluid, DEM and EMAG forces and moments should not be created with a macro. However,
// for backward compatibility reasons, existing macro code to create these forces and
// moments should still work

Visualization: Changes to Advanced Rendering Materials

Advanced rendering materials have undergone a variety of changes in Simcenter STAR-CCM+ 2022.1. Yet in macros that involve rendering materials, the Preset Material and Advanced Rendering Material settings of a displayer should continue to function without change. In addition, the creation of new rendering materials works in macros as before, even though the Tools > Rendering Materials node now contains new subfolder nodes for material types.

However, macros that reference one of the renamed or deleted default materials by name, when applied to a simulation file that is created in Simcenter STAR-CCM+ 2022.1, must be updated. Specifically, the only macro function that is directly affected by the object changes is RayTraceMaterialManager.get/hasObject(), which must be called with the new material name when run on a simulation file that does not contain the old materials:

Previous Release Simcenter STAR-CCM+ 2022.1
RayTraceSimpleMaterial rayTraceSimpleMaterial_0 = 
 ((RayTraceSimpleMaterial) simulation_0.get(RayTraceMaterialManager.class).getObject("Light Gray"));
RayTraceSimpleMaterial rayTraceSimpleMaterial_0 = 
 ((RayTraceSimpleMaterial) simulation_0.get(RayTraceMaterialManager.class).getObject("Non-Physical Light Gray"));

Alternatively, you can export old materials from earlier simulation files and import them into new ones.

Update Events

Change to Control of Inner Samples

For the Monitor Asymptote update event, macro codes have been changed for the activation and deactivation of the Inner Samples checkbox property:

  • getOnlyInnerSamples has been replaced by getInnerSamples.
  • setOnlyInnerSamples has been replaced by setInnerSamples.

Your existing macros will continue to work as expected, but for maximum reliability, it is recommended that you update your macro code.

Change to Evaluated Status Information

In update event objects under the Update Events node, the Satisfied checkbox property has been replaced by a new Evaluated Status property. The read-only states, Satisfied, Unsatisfied, and Unevaluated, clarify the evaluation status of the update event.

The old macro call that returns a boolean, updateEvent.getEvaluatedState(), remains unchanged, but the value returned corresponds to the state of the current iteration rather than the state when the update event was evaluated last (as in previous releases).

Another API has been added, updateEvent.getEvaluatedStatus(), that returns the status of the update event at the current iteration (status returned is one of the following : 'Unsatisfied' - 0, 'Satisfied' - 1, 'Unevaluated' - 2).