2020.3 宏 API 更改

Simcenter STAR-CCM+ 2020.3 中,已针对 3D-CAD、运动、伴随、欧拉多相流、DFBI、电磁和协同仿真更改了宏 API。

3D-CAD:对“去特征”面板进行了更改

在当前版本中,去特征面板的删除内部面选项已扩展,从而导致宏代码发生更改。

FeatureManager 类中,两个成员函数已替换为如下函数:

  • public Defeature createDefeature(List<Face> faces); has been replaced by public Defeature createDefeature_2(List<Face> faces);
  • public Defeature createDefeature(); has been replaced by public Defeature createDefeature_2();

运动:对基于轨迹运动的叠加运动进行了更改

由于基于轨迹运动的叠加运动(具体来说是正切旋转、受约束旋转和优势点旋转)的改进,相关的宏代码(例如用于与这些运动一起使用的宏代码)已更改。

以前版本 Simcenter STAR-CCM+ 2020.3
// create Trajectory Motion 
TrajectoryMotion trajectoryMotion_0 = simulation_0.get(MotionManager.class).createMotion(TrajectoryMotion.class, "Trajectory");
// create Superposing Tangential Rotation
TangentialRotation tangentialRotation_0 = 
    trajectoryMotion_0.getSuperposingMotionManager().createSuperposingMotion(TangentialRotation.class, "Tangential Rotation");
// set Region's MotionSpec as TangentialRotation
Region region_0 = simulation_0.getRegionManager().getRegion("Block");
MotionSpecification motionSpecification_0 = region_0.getValues().get(MotionSpecification.class);
motionSpecification_0.setMotion(tangentialRotation_0);
// Generation of Coordinate system is manual
LabCoordinateSystem labCoordinateSystem_0 = simulation_0.getCoordinateSystemManager().getLabCoordinateSystem();
// first create a Cartesian CSys
CartesianCoordinateSystem cartesianCoordinateSystem_0 = 
  labCoordinateSystem_0.getLocalCoordinateSystemManager().createLocalCoordinateSystem(CartesianCoordinateSystem.class, "Cartesian");
// set up its attributes and name it as per Your requirements. For example "managedCSys"
cartesianCoordinateSystem_0.getOrigin().setValue(new DoubleVector(new double[] {2.0, 0.0, 0.0}));
cartesianCoordinateSystem_0.setBasis0(new DoubleVector(new double[] {1.0, 0.0, 0.0}));
cartesianCoordinateSystem_0.setBasis1(new DoubleVector(new double[] {0.0, 1.0, 0.0}));
cartesianCoordinateSystem_0.setPresentationName("managedCSys");
// It is then set as Managed by the TrajectoryMotion, which is the parent motion of the Tangential Rotation
trajectoryMotion_0.getManagedCoordinateSystems().setQuery(null);
trajectoryMotion_0.getManagedCoordinateSystems().setObjects(cartesianCoordinateSystem_0);
// If You want have a CSys which it to be managed by the TangentialRotation then
// create another CSys under the "managedCSys"
CartesianCoordinateSystem cartesianCoordinateSystem_1 =  
    cartesianCoordinateSystem_0.getLocalCoordinateSystemManager().createLocalCoordinateSystem(CartesianCoordinateSystem.class, "Cartesian");
// set up its attributes and name it as required. For example "rotatingCSys"
cartesianCoordinateSystem_1.getOrigin().setValue(new DoubleVector(new double[] {0.0, 0.0, 0.0}));
cartesianCoordinateSystem_1.setBasis0(new DoubleVector(new double[] {1.0, 0.0, 0.0}));
cartesianCoordinateSystem_1.setBasis1(new DoubleVector(new double[] {0.0, 1.0, 0.0}));
cartesianCoordinateSystem_1.setPresentationName("rotatingCSys");
// Then set it as managed by the Tangential Rotation
tangentialRotation_0.getManagedCoordinateSystems().setQuery(null);
tangentialRotation_0.getManagedCoordinateSystems().setObjects(cartesianCoordinateSystem_1);
// create Trajectory Motion 
TrajectoryMotion trajectoryMotion_0 = simulation_0.get(MotionManager.class).createMotion(TrajectoryMotion.class, "Trajectory");
// create Superposing Tangential Rotation
TangentialRotation tangentialRotation_0 = trajectoryMotion_0.getSuperposingMotionManager().createSuperposingMotion(TangentialRotation.class, "Tangential Rotation");
// set Region's MotionSpec as TangentialRotation
Region region_0 = simulation_0.getRegionManager().getRegion("Block");
MotionSpecification motionSpecification_0 = region_0.getValues().get(MotionSpecification.class);
motionSpecification_0.setMotion(tangentialRotation_0);
// generation of coordinate system is automatic as per the created Motions
LabCoordinateSystem labCoordinateSystem_0 = simulation_0.getCoordinateSystemManager().getLabCoordinateSystem();
// When a Superposing Motion is created, following actions are done w.r.t CSystems :
// - A Coordinate system is created with motion's name as Suffix
// - This CSystem is assigned as Managed Coordinate System of the Parent Motion (in this case - Trajectory Motion)
// - This CSystem is set the Coordinate System of the created Superposing Motion (in this case - Tangential Rotation)
// get hold of the already created Coordinate System, which is named according to the created Superposing Motion
CartesianCoordinateSystem cartesianCoordinateSystem_0 = 
    ((CartesianCoordinateSystem) labCoordinateSystem_0.getLocalCoordinateSystemManager().getObject("Tangential Rotation-CSys"));
Units units_0 = ((Units) simulation_0.getUnitsManager().getObject("m"));
// it is then configured as per the users requirement
cartesianCoordinateSystem_0.getOrigin().setCoordinate(units_0, units_0, units_0, new DoubleVector(new double[] {2.0, 0.0, 0.0}));
// Create another cartesian CSys under the "Tangential Rotation-CSys" - This step is/was optional if the user needed/required
// a CSys to be managed by the Leaf Motion i.e. Tangetial Rotation  
CartesianCoordinateSystem cartesianCoordinateSystem_1 = 
     cartesianCoordinateSystem_0.getLocalCoordinateSystemManager().createLocalCoordinateSystem(CartesianCoordinateSystem.class, "Cartesian");
// set up its attributes and name it as required. For example "ManagedByTangentialRotation"
cartesianCoordinateSystem_1.getOrigin().setValue(new DoubleVector(new double[] {0.0, 0.0, 0.0}));
cartesianCoordinateSystem_1.setBasis0(new DoubleVector(new double[] {1.0, 0.0, 0.0}));
cartesianCoordinateSystem_1.setBasis1(new DoubleVector(new double[] {0.0, 1.0, 0.0}));
cartesianCoordinateSystem_1.setPresentationName("ManagedByTangentialRotation");
// Then set it as managed by the Tangential Rotation
tangentialRotation_0.getManagedCoordinateSystems().setQuery(null);
tangentialRotation_0.getManagedCoordinateSystems().setObjects(cartesianCoordinateSystem_1);

伴随:伴随网格和表面灵敏度与耦合流体分离

为使伴随建模可用而不必使用耦合流体,伴随网格表面灵敏度模型已重构。在当前版本中,这两个模型在物理模型选择对话框中显示为可选模型,并且以前的模型及其求解器具有新名称伴随网格变形,以反映与网格变形的主要关联。

现在,必须激活伴随网格变形模型,以计算相对于网格节点位移的成本函数的伴随。

这些改进已导致宏代码发生更改。

以前位于 star.coupledflow.* 软件包中的表面灵敏度模型和求解器现在位于 star.morpher.* 软件包中。

以前版本 Simcenter STAR-CCM+ 2020.3
import star.coupledflow.SurfaceSensitivityModel;
import star.morpher.SurfaceSensitivityModel;

以前位于 star.coupledflow.* 软件包中的伴随网格模型和求解器现在位于 star.morpher.* 软件包中,并且已从 AdjointMesh* 重命名为 AdjointMeshDeformation*

以前版本 Simcenter STAR-CCM+ 2020.3
import star.coupledflow.AdjointMeshSolver;
import star.morpher.AdjointMeshDeformationSolver;

欧拉多相流 (EMP)

对颗粒流进行了更改

为清楚起见并提高一致性,颗粒流的多个类名称已更改。下表显示了包含部分已重命名类的宏代码的示例:

以前版本 Simcenter STAR-CCM+ 2020.3
GranularTemperatureTransportModelProvider granularTemperatureTransportModelProvider_1 = physicsContinuum_0.getModelManager().getModel(GranularTemperatureTransportModelProvider.class);
GranularTemperatureTransportPhysicsModel GranularTemperatureTransportPhysicsModel_1 = physicsContinuum_0.getModelManager().getModel(GranularTemperatureTransportPhysicsModel.class);
GranularTemperatureModelProviderGroup granularTemperatureModelProviderGroup_0 = 
physicsContinuum_0.getModelManager().getModel(GranularTemperatureModelProviderGroup.class);
GranularTemperatureModelGroup granularTemperatureModelGroup_0 = 
physicsContinuum_0.getModelManager().getModel(GranularTemperatureModelGroup.class);

其他类已按如下所示重命名:

以前版本 Simcenter STAR-CCM+ 2020.3
physicsContinuum_0.enable(GranularTemperatureTransportModelProvider.class);
physicsContinuum_0.enable(GranularTemperatureTransportPhysicsModel.class);
physicsContinuum_0.enable(GranularTemperatureModelProviderGroup.class);
physicsContinuum_0.enable(GranularTemperatureModelGroup.class);
physicsContinuum_0.enable(AlgebraicGranularTemperatureModelProvider.class);
physicsContinuum_0.enable(AlgebraicGranularTemperaturePhysicsModel.class);

对质量传递模型进行了更改

为提高效率,能量源项的计算已重定位,从而导致宏代码发生更改。

LsiInterphaseMassTransferGroup 已更改为 MfrInterphaseMassTransferModel

以前版本 Simcenter STAR-CCM+ 2020.3
phaseInteraction_0.enable(LsiInterphaseMassTransferGroup.class);
phaseInteraction_0.enable(MfrInterphaseMassTransferModel.class);

LsiBulkBoilingModel 已更改为 MfrBoilingMassTransferRateModel

以前版本 Simcenter STAR-CCM+ 2020.3
phaseInteraction_0.enable(LsiBulkBoilingModel.class);
phaseInteraction_0.enable(MfrBoilingMassTransferRateModel.class);
LsiBulkBoilingModel lsiBulkBoilingModel_0 = 
phaseInteraction_0.getModelManager().getModel(LsiBulkBoilingModel.class);
MfrBoilingMassTransferRateModel mfrBoilingMassTransferRateModel_0 = 
phaseInteraction_0.getModelManager().getModel(MfrBoilingMassTransferRateModel.class);

InterphaseMassFluxModel 已更改为 UserDefinedInterphaseMassTransferRateModel

以前版本 Simcenter STAR-CCM+ 2020.3
phaseInteraction_0.enable(InterphaseMassFluxModel.class);
phaseInteraction_0.enable(UserDefinedInterphaseMassTransferRateModel.class);
InterphaseMassFluxModel interphaseMassFluxModel_3 = 
phaseInteraction_0.getModelManager().getModel(InterphaseMassFluxModel.class);
UserDefinedInterphaseMassTransferRateModel userDefinedInterphaseMassTransferRateModel_3 = 
phaseInteraction_0.getModelManager().getModel(UserDefinedInterphaseMassTransferRateModel.class);

DFBI:对弹簧耦合进行了更改

为反映添加了阻尼力这一事实,线性弹簧节点(在 DFBI > 体耦合中)已重命名并重构:

  • 线性弹簧节点和菜单项已重命名为弹簧-阻尼
  • 该节点的弹簧常数属性已更改为名为弹性系数的子节点。除了常数之外,该子节点还允许使用多项式和表格值。
  • 6 自由度体的外力与力矩子节点下的对应力节点反映了新的默认名称。

这些改进已导致宏代码发生更改。

以前版本 Simcenter STAR-CCM+ 2020.3
LinearSpringCoupling linearSpringCoupling_1 = 
simulation_0.get(SixDofBodyCouplingManager.class).createSixDofBodyCoupling(LinearSpringCoupling.class);
// To set a numeric value
linearSpringCoupling_1.getSpringConstant().setValue(1.0);
// To set an expression
linearSpringCoupling_1.getSpringConstant().setDefinition("$stiffness");
Units units_0 = 
  ((Units) simulation_0.getUnitsManager().getObject("N/m"));
linearSpringCoupling_1.getSpringConstant().setUnits(units_0);
BodyForceReport bodyForceReport_0 = 
  ((BodyForceReport) simulation_0.getReportManager().getReport("Force X"));
bodyForceReport_0.getForces().setQuery(null);
ContinuumBody continuumBody_0 = 
  ((ContinuumBody) simulation_0.get(star.sixdof.BodyManager.class).getObject("ship"));
LinearSpringForce linearSpringForce_1 = 
  ((LinearSpringForce) continuumBody_0.getExternalForceAndMomentManager().getObject("Linear Spring Force [Linear Spring 1]"));
bodyForceReport_0.getForces().setObjects(linearSpringForce_1);
BodyMomentReport bodyMomentReport_0 = 
  ((BodyMomentReport) simulation_0.getReportManager().getReport("Moment X"));
bodyMomentReport_0.getMoments().setQuery(null);
bodyMomentReport_0.getMoments().setObjects(linearSpringForce_1);

SpringElongationReport springElongationReport_0 =
  ((SpringElongationReport) simulation_0.getReportManager().getReport("6-DOF Body Spring Elongation 1"));
springElongationReport_0.setLinearSpringCoupling(linearSpringCoupling_1);
SpringDamperCoupling springDamperCoupling_0 = 
simulation_0.get(SixDofBodyCouplingManager.class).createSixDofBodyCoupling(SpringDamperCoupling.class);
ElasticCoefficientConstantMethod elasticCoefficientConstantMethod_0 = 
  ((ElasticCoefficientConstantMethod) springDamperCoupling_0.getElasticCoefficientMethodManager().getActiveMethod());
// To set a numeric value
elasticCoefficientConstantMethod_0.getCoefficient().setValue(1.0);
// To set an expression
elasticCoefficientConstantMethod_0.getCoefficient().setDefinition("$stiffness");
Units units_0 = 
  ((Units) simulation_0.getUnitsManager().getObject("N/m"));
elasticCoefficientConstantMethod_0.getCoefficient().setUnits(units_0);
BodyForceReport bodyForceReport_0 = 
  ((BodyForceReport) simulation_0.getReportManager().getReport("Force X"));
bodyForceReport_0.getForces().setQuery(null);
ContinuumBody continuumBody_0 = 
  ((ContinuumBody) simulation_0.get(star.sixdof.BodyManager.class).getObject("ship"));
SpringDamperForce springDamperForce_0 = 
  ((SpringDamperForce) continuumBody_0.getExternalForceAndMomentManager().getObject("Spring-Damper Force [Spring-Damper 1]"));
bodyForceReport_0.getForces().setObjects(springDamperForce_0);
BodyMomentReport bodyMomentReport_0 = 
  ((BodyMomentReport) simulation_0.getReportManager().getReport("Moment X"));
bodyMomentReport_0.getMoments().setQuery(null);
bodyMomentReport_0.getMoments().setObjects(springDamperForce_0);

SpringElongationReport springElongationReport_0 =
  ((SpringElongationReport) simulation_0.getReportManager().getReport("6-DOF Body Spring Elongation 1"));
springElongationReport_0.setSpringDamperCoupling(springDamperCoupling_0);

电磁:对励磁线圈电路元件进行了更改

励磁线圈电路元件已与有限元励磁线圈电路元件组合在一起,从而导致宏代码发生更改。

以前版本 Simcenter STAR-CCM+ 2020.3
import star.electromagnetism.magneticpotential.fem.FiniteElementExcitationCoilCircuitElement;

FiniteElementExcitationCoilCircuitElement feExcitationCoilCircuitElement = 
circuit.getElements().createCircuitElement(FiniteElementExcitationCoilCircuitElement.class);
import star.electromagnetism.magneticpotential.ExcitationCoilCircuitElement;

ExcitationCoilCircuitElement feExcitationCoilCircuitElement = 
circuit.getElements().createCircuitElement(ExcitationCoilCircuitElement.class);

协同仿真

对区域零部件进行了更改

为使扩展的导出功能便于使用,区域零部件功能已重构,从而导致宏代码发生更改。

以前版本 Simcenter STAR-CCM+ 2020.3
import star.cosimulation.link.parts.ZoneCoupledParts;
coSimulationZone_0.getCoSimulationZoneConditions().get(ZoneCoupledParts.class);
// FOR SURFACE ZONE TYPE

import star.cosimulation.link.parts.InternalSurfaceParts;
coSimulationZone_0.getCoSimulationZoneConditions().get(InternalSurfaceParts.class);
// FOR VOLUME ZONE TYPE

import star.cosimulation.link.parts.InternalVolumeParts;
coSimulationZone_0.getCoSimulationZoneConditions().get(InternalVolumeParts.class);

对 CGNS 外部文件访问进行了更改

由于 CGNS 导入/导出方法的改进,类 star.cosimulation.link.oneway.ImportExportFile 已替换为 star.cosimulation.link.oneway.CgnsExternalFile,如以下示例中所示:

以前版本 Simcenter STAR-CCM+ 2020.3
// import
import star.cosimulation.link.oneway.ImportExportFile;
// import
import star.cosimulation.link.oneway.CgnsExternalFile;
// usage
ImportExportFile importExportFile_0 = coSimulation_0.getCoSimulationValues().get(ImportExportFile.class);
// usage
CgnsExternalFile cgnsExternalFile_0 = coSimulation_0.getCoSimulationValues().get(CgnsExternalFile.class);