Macro API Changes 5.04

In Simcenter STAR-CCM+ 5.04, the macro API changed for the materials database, NASA polynomials, surface repair, DFBI, and clearing solutions.

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.04.006 if any of the items in the Previous Release columns below have been accessed.

Materials Database

The function setPath() on MaterialDataBase is no longer valid. The purpose of this command was to allow Simcenter STAR-CCM+ to automatically import dbs files from the paths in the list. These files must now be converted in to the new .mdb format, as explained in the user guide.

NASA Polynomials

In previous versions of Simcenter STAR-CCM+, users setting thermodynamic polynomial data through a macro had to first multiply the coefficients by Ru/Mr(X), where Ru is the universal gas constant [J/(kmol K)] and Mr(X) is the molecular weight [kg/kmol] of the substance X. From Simcenter STAR-CCM+ 5.04.006, this scaling is not required: coefficients should be entered as they are found in the literature.

Any existing macros should be revised to account for this change.

Automatic Surface Repair Option

The following methods have been removed from class AutomaticSurfaceRepair:


getDoFixPiercedFaces

setDoFixPiercedFaces

setDoFixCloseProximityFaces

setDoFixPoorQualityFaces

Also, the behavior of the following methods has changed as these now return values based on their settings in the Surface Remesher panel:


getDoFixCloseProximityFaces

getDoFixPoorQualityFaces

DFBI Linear Spring Force

The main functionality of linear springs has been transferred from the Linear Spring Force (located in the External Force and Moment Manger of a 6-DOF body) to the new Linear Spring Coupling (in the new Body Coupling Manager located beneath the DFBI parent top-level node). This means that Java code related to linear springs has changed. Macros as implemented in the previous release are given below, along with their latest counterparts.

Previous Release Simcenter STAR-CCM+ 5.04.006

// Create Linear Spring Force

Body body_0 =

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

LinearSpringForce linearSpringForce_0 =

body_0 .getExternalForceAndMomentManager() .createExternalForceAndMoment(LinearSpringForce.class);

// Set position of first end point

linearSpringForce_0 .getPosition1() .setComponents(1.0, 0.0, 0.0);

// Set position of second end point

linearSpringForce_0 .getPosition2() .setComponents(2.0, 0.0, 0.0);

// Set remaining properties

linearSpringForce_0 .getSpringConstant() .setValue(20.0);

linearSpringForce_0 .getRelaxationLength() .setValue(5.0);

// Create Linear Spring Coupling

LinearSpringCoupling linearSpringCoupling_0 =

simulation_0 .get(SixDofBodyCouplingManager.class) .createSixDofBodyCoupling(LinearSpringCoupling.class);

// Set position of first end point

Coordinate coordinate_0 =

.linearSpringCoupling_0.getPosition1();

Units units_0 =

((Units) simulation_0 .getUnitsManager() .getObject("m"));

coordinate_0.setCoordinate( units_0, units_0, units_0, new DoubleVector(new double[] {1.0, 0.0, 0.0}));

// Set position of second end point

Coordinate coordinate_1 =

linearSpringCoupling_0.getPosition2();

coordinate_1.setCoordinate( units_0, units_0, units_0, new DoubleVector(new double[] {2.0, 0.0, 0.0}));

linearSpringForce_0.setEnabled(false);

linearSpringForce_0.setNoRepellingForce(true);

// Set coordinate system of second end point

LabCoordinateSystem labCoordinateSystem_0 =

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

CartesianCoordinateSystem cartesianCoordinateSystem_0 =

((CartesianCoordinateSystem) labCoordinateSystem_0 .getLocalCoordinateSystemManager() .getObject("Cartesian 1"));

linearSpringForce_0 .setCoordinateSystem(cartesianCoordinateSystem_0);

// Set remaining properties

linearSpringCoupling_0 .getSpringConstant() .setValue(20.0);

linearSpringCoupling_0 .getRelaxationLength() .setValue(5.0);

linearSpringCoupling_0.setEnabled(false);

linearSpringCoupling_0.setNoRepellingForce(true);

// Set coordinate system of second end point

LabCoordinateSystem labCoordinateSystem_0 =

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

CartesianCoordinateSystem cartesianCoordinateSystem_0 =

((CartesianCoordinateSystem) labCoordinateSystem_0 .getLocalCoordinateSystemManager() .getObject("Cartesian 1"));

coordinate_1 .setCoordinateSystem(cartesianCoordinateSystem_0);

Note that the former Linear Spring Forces still exist, but they are managed entirely by their corresponding Linear Spring Couplings. The creation, copying, deleting and renaming of Linear Spring Forces via macros is no longer possible. Creation and deletion is done automatically by selecting or deselecting a specific body in the corresponding Linear Spring Coupling. Copying is done by copying the corresponding Linear Spring Coupling. There is no substitute for renaming because the presentation name of the Linear Spring Force is constructed automatically by the Linear Spring Coupling.

DFBI Spring Elongation Reports

Following on from the previous section, spring elongation reports have also changed.

Previous Release Simcenter STAR-CCM+ 5.04.006

Body body_0 =

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

LinearSpringForce linearSpringForce_0 =

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

springElongationReport_0 .setLinearSpringForce(linearSpringForce_0);

LinearSpringCoupling linearSpringCoupling_0 =

((LinearSpringCoupling) simulation_0 .get(SixDofBodyCouplingManager.class) .getObject("Linear Spring 1"));

springElongationReport_0 .setLinearSpringCoupling(linearSpringCoupling_0);

New Framework for Clearing Solutions

The revised syntax for clearing solutions is shown below.

Previous Release Simcenter STAR-CCM+ 5.04.006

Solution solution_0 =

simulation_0.getSolution();

solution_0.clearSolution();

solution_0.resetForRestart();

Solution solution_0 =

simulation_0.getSolution();

//

// clear history, clear fields and reset mesh

solution_0.clearSolution();

solution_0 .clearSolution(Solution.Clear.History, Solution.Clear.Fields);

// replaces reset for restart

solution_0.clearSolution(Solution.Clear.History);

// clear history + reset the mesh

solution_0.clearSolution(Solution.Clear.History, Solution.Clear.Mesh);