Macro API Changes 3.04
In Simcenter STAR-CCM+ 3.04, the macro API changed for reflectivity, volume shapes, and meshing.
-
Specified Reflectivity Now Has Auto-Calculate as Default
Specified reflectivity has changed for macros. Old macros that explicitly set reflectivity need to be revised. With the auto-calculate method as the default, a constant reflectivity cannot be set in a macro unless the method type is first changed to constant. The easiest thing to do is to remove the setting of reflectivity from any macros; the reflectivity will then be calculated automatically.
- Volume Shapes Now Recognize Local Coordinate Systems
Volume shapes have been enhanced to allow the use of the local coordinate system and user-specified units.
To accommodate these changes, a new Coordinate class has been designed which has a reference to the local coordinate system and knows the units of its components. This class replaces the pre-existing VectorPhysicalQuantity class. This change affects the following data of each volume shape:
- BrickVolumeShape - Corner1 and Corner2
- CylinderConeVolumeShape - Start Coordinate and End Coordinate
- SphereVolumeShape - Origin
So when you access these data elements of the volume shape in the macro, changes might be required in the macro depending on the way the data is accessed:
The macro need not be changed if it accesses the data as follows: brickVolumeShape_0.getCorner1().setVector(new DoubleVector(new double[] {0.1, 0.0108, 0.0}));
If the macro accesses the data and type casts it to VectorPhysicalQuantity, and calls its methods setVector or getVector, then it is necessary to replace the type cast of VectorPhysicalQuantity with the Coordinate class:
// old - ((VectorPhysicalQuantity) brickVolumeShape_0.getCorner2()).setVector(new DoubleVector(new double[] {0.2, 0.0, 0.0}));
// new - ((Coordinate) brickVolumeShape_0.getCorner2()).setVector(new DoubleVector(new double[] {0.2, 0.0, 0.0}));
-
Volumetric Controls Can Be Enabled Per Meshing Model
Volumetric Controls (previously known as Volume Sources) have an additional step of specifying which meshing models the control applies to and the size is a generic property of the control.
A 3.02 macro would look like:
// create VolumeSource VolumeSource volumeSource_0 = meshContinuum_0.getVolumeSources().createVolumeSource(); // stick shape in the source SphereVolumeShape sphereVolumeShape_0 = ((SphereVolumeShape) simulation_0.get(VolumeShapeManager.class).getObject("Sphere 1")); volumeSource_0.getVolumeShapeGroup().setObjects(sphereVolumeShape_0); // set the size of the volume source (applies to all meshers) VolumeSourceSize volumeSourceSize_0 = volumeSource_0.getSize(); GenericRelativeSize genericRelativeSize_0 = ((GenericRelativeSize) volumeSourceSize_0.getRelativeSize()); genericRelativeSize_0.setPercentage(20.0);
On the other hand the exact same macro in 3.04 would require:
// create volume source VolumeSource volumeSource_1 = meshContinuum_0.getVolumeSources().createVolumeSource(); // enable volume source for poly mesher (new step) VolumeSourceDualMesherSizeOption volumeSourceDualMesherSizeOption_0 = volumeSource_1.get(MeshConditionManager.class).get(VolumeSourceDualMesherSizeOption.class); volumeSourceDualMesherSizeOption_0.setVolumeSourceDualMesherSizeOption(true); // enable volume source for surface remesher (new step) VolumeSourceResurfacerSizeOption volumeSourceResurfacerSizeOption_0 = volumeSource_1.get(MeshConditionManager.class).get(VolumeSourceResurfacerSizeOption.class); volumeSourceResurfacerSizeOption_0.setVolumeSourceResurfacerSizeOption(true); // enable volume source for wrapper (new step) VolumeSourceSurfaceWrapperSizeOption volumeSourceSurfaceWrapperSizeOption_0 = volumeSource_1.get(MeshConditionManager.class).get(VolumeSourceSurfaceWrapperSizeOption.class); volumeSourceSurfaceWrapperSizeOption_0.setVolumeSourceSurfaceWrapperSizeOption(true); // set the size for the source (now done through // MeshValueManager not directly from the source) VolumeSourceSize volumeSourceSize_0 = volumeSource_1.get(MeshValueManager.class).get(VolumeSourceSize.class); GenericRelativeSize genericRelativeSize_0 = ((GenericRelativeSize) volumeSourceSize_0.getRelativeSize()); genericRelativeSize_0.setPercentage(20.0);
If a user tries to run the 3.02 macro through 3.04 it will work but not do what the user expects – the source will be created and associated with the sphere shape but it will not be activated for any mesh models. The reason that the 3.02 macro will work in 3.04 is because we kept method VolumeSource::getSize() around for backward compatibility.