Macro API Changes 5.02

In Simcenter STAR-CCM+ 5.02, the macro API changed for motion and reports (Body Force and Body Moment).

Changes to various items within the macro API are detailed below. Macros created using previous releases of the software will not necessarily run in Simcenter STAR-CCM+ 5.02.009 if any of the items in the Previous Release columns below have been accessed.

Motion Changes

Significant changes have been implemented in motion models, reference frames and coordinate systems. These changes are reflected both in the GUI and in the Java macro API. Macros written for previous versions of Simcenter STAR-CCM+ will no longer work in the current release. It will be necessary for users to re-write their macros according to the following guide.

There are two steps in general:

  • Create the new motion or reference frame and set its properties
  • Apply the motion or reference frame object on the new region value, Motion Specification.
Create Rigid Body Motions

// Rotation

RotatingMotion rotatingMotion_0 =

simulation_0.get(MotionManager.class) .createMotion(RotatingMotion.class, "Rotation");

// Rotation and Translation

RotatingAndTranslatingMotion rotatingAndTranslatingMotion_0 =

simulation_0.get(MotionManager.class) .createMotion( RotatingAndTranslatingMotion.class, "Rotation and Translation");

Create Morphing Motion

MorphingMotion morphingMotion_0 =

simulation_0.get(MotionManager.class) .createMotion(MorphingMotion.class, "Morphing");

DFBI (6-DOF) Motions

// DFBI Rotation and Translation

SixDofMotion sixDofMotion_0 =

simulation_0.get(MotionManager.class) .createMotion( SixDofMotion.class, "DFBI Rotation and Translation");

// DFBI Embedded Rotation

SixDofEmbeddedMotion sixDofEmbeddedMotion_0 =

simulation_0.get(MotionManager.class) .createMotion( SixDofEmbeddedMotion.class, "DFBI Embedded Rotation");

// DFBI Morphing

SixDofMorphingMotion sixDofMorphingMotion_0 =

simulation_0.get(MotionManager.class) .createMotion( SixDofMorphingMotion.class, "DFBI Morphing");

// DFBI Superposed Rotation

SixDofPlusRotatingMotion sixDofPlusRotatingMotion_0 =

simulation_0.get(MotionManager.class) .createMotion( SixDofPlusRotatingMotion.class, "DFBI Superposed Rotation");

Create Harmonic Balance Flutter Motion

HarmonicBalanceFlutterMotion harmonicBalanceFlutterMotion_0 =

simulation_0.get(MotionManager.class) .createMotion( HarmonicBalanceFlutterMotion.class, "Harmonic Balance Flutter");

Create Solid Displacement Motion

LargeDisplacementMotion largeDisplacementMotion_0 =

simulation_0.get(MotionManager.class) .createMotion( LargeDisplacementMotion.class, "Solid Displacement");

Assign Motion to a Region

// Use rotatingMotion_0 as example

MotionSpecification motionSpecification_0 =

region_0.getValues().get(MotionSpecification.class);

motionSpecification_0.setMotion(rotatingMotion_0);

A similar process is followed for reference frames.

Create and Assign a Reference Frame

UserRotatingReferenceFrame userRotatingReferenceFrame_0 =

simulation_0.get(ReferenceFrameManager.class) .createReferenceFrame( UserRotatingReferenceFrame.class, "Rotating");

userRotatingReferenceFrame_0 .getRotationRate() .setValue(3000.0);

MotionSpecification motionSpecification_0 =

region_0.getValues().get(MotionSpecification.class);

motionSpecification_0.setMotion(rotatingMotion_0);

motionSpecification_0 .setReferenceFrame(userRotatingReferenceFrame_0);

Coordinate systems make use of the new local coordinate system manager.

Create a Local Coordinate System

LabCoordinateSystem labCoordinateSystem_0 =

((LabCoordinateSystem) simulation_0. getCoordinateSystemManager() .getObject("Laboratory"));

CartesianCoordinateSystem cartesianCoordinateSystem_0 =

labCoordinateSystem_0 .getLocalCoordinateSystemManager() .createLocalCoordinateSystem( CartesianCoordinateSystem.class, "Cartesian");

CylindricalCoordinateSystem cylindricalCoordinateSystem_0 =

labCoordinateSystem_0 .getLocalCoordinateSystemManager() .createLocalCoordinateSystem( CylindricalCoordinateSystem.class, "Cylindrical");

// Create a nested spherical system

SphericalCoordinateSystem sphericalCoordinateSystem_0 =

cartesianCoordinateSystem_0 .getLocalCoordinateSystemManager() .createLocalCoordinateSystem( SphericalCoordinateSystem.class,

"Spherical");

Body Force and Body Moment Reports

Previous Release

// Body Force Report

BodyForceReport bodyForceReport_0 =

((BodyForceReport) simulation_0.getReportManager() .getReport("Active Force X"));

Body body_0 =

((Body) simulation_0.get(BodyManager.class) .getObject("Body 1"));

bodyForceReport_0.setBody(body_0);

bodyForceReport_0 .getBodyForceReportOption() .setSelected(BodyForceReportOption.ACTIVE_FORCE);

// Alternative 1

bodyForceReport_0 .getBodyForceReportOption() .setSelected(BodyForceReportOption.RAWCFD_FORCE);

// Alternative 2

bodyForceReport_0 .getBodyForceReportOption() .setSelected(BodyForceReportOption.RAW_FORCE);

// Body Moment Report

BodyMomentReport bodyMomentReport_0 =

((BodyMomentReport) simulation_0.getReportManager() .getReport("Active Moment X"));

bodyMomentReport_0.setBody(body_0);

bodyMomentReport_0 .getBodyMomentReportOption() .setSelected(BodyMomentReportOption.ACTIVE_MOMENT);

// Alternative

bodyMomentReport_0 .getBodyMomentReportOption() .setSelected(BodyMomentReportOption.RAW_MOMENT);

For reasons of compatibility, the above methods are still available, but marked as deprecated. The new way of setting the group of forces or moments, and the use of raw forces, is shown below.

Simcenter STAR-CCM+ 5.02.009

// Setting the group of forces in the Body Force Report

BodyForceReport bodyForceReport_0 =

((BodyForceReport) simulation_0 .getReportManager() .getReport("Active Force X"));

Body body_0 =

((Body) simulation_0.get(BodyManager.class).getObject("Body 1"));

ExternalFluidForceAndMoment externalFluidForceAndMoment_0 =

((ExternalFluidForceAndMoment) body_0 .getExternalForceAndMomentManager() .getObject("Fluid Force and Moment 1"));

ExternalGravityForce externalGravityForce_0 =

((ExternalGravityForce) body_0 .getExternalForceAndMomentManager() .getObject("Gravity Force 1"));

LinearSpringForce linearSpringForce_0 =

((LinearSpringForce) body_0 .getExternalForceAndMomentManager() .getObject("Linear Spring Force 1"));

bodyForceReport_0.setBody(body_0);

bodyForceReport_0 .getForces() .setObjects( externalFluidForceAndMoment_0,

externalGravityForce_0,

linearSpringForce_0);

bodyForceReport_0.setUseRawForces(true);

// Setting the group of moments in the Body Moment Report

BodyMomentReport bodyMomentReport_0 =

((BodyMomentReport) simulation_0 .getReportManager() .getReport("Active Moment X"));

bodyMomentReport_0.setBody(body_0);

bodyMomentReport_0 .getMoments() .setObjects( externalFluidForceAndMoment_0, linearSpringForce_0);

bodyMomentReport_0.setUseRawMoments(false);