宏 API 更改 5.02

Simcenter STAR-CCM+ 5.02 中,针对运动和报告(体积力和体积力矩)进行了宏 API 的更改。

下面详细介绍宏 API 中各项的更改。 如果已访问下面“以前发行版本”列中的任何项,使用以前版本的软件创建的宏将不必在 Simcenter STAR-CCM+ 5.02.009 中运行。

运动更改

在运动模型、参考坐标系和坐标系中已实施重大更改。 这些更改反映在 GUI 和 Java 宏 API 中。 为以前的 Simcenter STAR-CCM+ 版本编写的宏在当前版本中不再有效。 用户需要根据以下指南重新编写宏。

一般情况下需要两个步骤:

  • 创建新的运动或参考坐标系,并设置其属性
  • 将运动或参考坐标系对象应用于新的区域值“定义运动”。
创建刚体运动

// 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");

创建变形运动

MorphingMotion morphingMotion_0 =

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

DFBI(6 自由度)运动

// 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");

创建谐波平衡颤振运动

HarmonicBalanceFlutterMotion harmonicBalanceFlutterMotion_0 =

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

创建固体位移运动

LargeDisplacementMotion largeDisplacementMotion_0 =

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

将运动分配到区域

// Use rotatingMotion_0 as example

MotionSpecification motionSpecification_0 =

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

motionSpecification_0.setMotion(rotatingMotion_0);

参考坐标系遵循类似的过程。

创建和分配参考坐标系

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);

坐标系将使用新的局部坐标系管理器。

创建局部坐标系

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 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);

为确保兼容,上述方法仍然可用,但标记为失效。 下面显示了设置力或力矩组及使用原始力的新方式。

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);