宏 API 更改 2021.3

Simcenter STAR-CCM+ 2021.3 中,已针对 3D-CAD、网格化、热传递、气动声学、反应流、欧拉多相流、离散多相、VOF、电磁、电池建模、可视化、设计管理器、CAE 集成和协同仿真更改宏 API。

3D-CAD

特征故障处理的更改

Simcenter STAR-CCM+ 2021.3 中,如果组合体体的减运算特征失败,则当选择失败特征的相应节点时,将高亮显示导致失败的体、面、边和节点。此新特征导致宏代码更改。已弃用组分替换如下:

  • UniteBodiesFeature createUniteBodies(List<Body> bodies); 已替换为 UniteBodiesFeature createUniteBodies_2(List<Body> bodies);
  • UniteBodiesFeature createUniteBodies(); 已替换为 UniteBodiesFeature createUniteBodies_2();

压印选项的更改

3D-CAD 的两个压印特征(用于将体压印到体上和将面压印到面)已增强。它们现在可用于指定是否将目标体/面压印到工具体/面,而不是自动进行压印。这些指定仅适用于压印选项设为两个体组之间的体压印特性,以及压印选项设为两个体的面之间的面压印特性。

新的公共成员函数 Imprint::setImprintOntoToolBodiesImprintFaces::setImprintOntoToolFaces 用于控制此压印,如以下示例所示:

Imprint imprintBodies = cadModel.getFeatureManager().createImprint();
imprintBodies.setImprintOntoToolBodies(false);
ImprintFaces imprintFaces = cadModel.getFeatureManager().createImprintFaces();
imprintFaces.setImprintOntoToolFaces(false);

可以使用新的公共成员函数 Imprint::isImprintOntoToolBodiesImprintFaces::isImprintOntoToolFaces.查询这些设置。

网格化:由于新建表面网格编号而进行了更改

分割零部件表面和零部件曲线的过程已更改,因此新零部件的编号保持一致且独立于 CAD 网格等因子。虽然此更改不会影响在先前版本中保存的模拟文件,但它产生的编号与先前版本的编号不同。

因此,如果有依赖于此编号的宏,则更新这些宏,如下表所示。例如,在上一版本中,命名为块表面 4 的零部件表面现命名为块表面,即分割前表面的名称。因此,不再需要 partSurface_1 变量。

以前版本 Simcenter STAR-CCM+ 2021.3
Simulation simulation_0 = 
  getActiveSimulation();
SimpleBlockPart simpleBlockPart_0 = 
  ((SimpleBlockPart) simulation_0.get(SimulationPartManager.class).getPart("Block"));
PartSurface partSurface_0 = 
  ((PartSurface) simpleBlockPart_0.getPartSurfaceManager().getPartSurface("Block Surface"));
simpleBlockPart_0.getPartSurfaceManager().splitPartSurfacesByAngle(new NeoObjectVector(new Object[] {partSurface_0}), 89.0);
AutoMeshOperation autoMeshOperation_0 = 
  ((AutoMeshOperation) simulation_0.get(MeshOperationManager.class).getObject("Automated Mesh"));
SurfaceCustomMeshControl surfaceCustomMeshControl_0 = 
  ((SurfaceCustomMeshControl) autoMeshOperation_0.getCustomMeshControls().getObject("Surface Control"));
surfaceCustomMeshControl_0.getGeometryObjects().setQuery(null);
PartSurface partSurface_1 = 
  ((PartSurface) simpleBlockPart_0.getPartSurfaceManager().getPartSurface("Block Surface 4"));
surfaceCustomMeshControl_0.getGeometryObjects().setObjects(partSurface_1);
Simulation simulation_0 = 
  getActiveSimulation();
SimpleBlockPart simpleBlockPart_0 = 
  ((SimpleBlockPart) simulation_0.get(SimulationPartManager.class).getPart("Block"));
PartSurface partSurface_0 = 
  ((PartSurface) simpleBlockPart_0.getPartSurfaceManager().getPartSurface("Block Surface"));
simpleBlockPart_0.getPartSurfaceManager().splitPartSurfacesByAngle(new NeoObjectVector(new Object[] {partSurface_0}), 89.0);
AutoMeshOperation autoMeshOperation_0 = 
  ((AutoMeshOperation) simulation_0.get(MeshOperationManager.class).getObject("Automated Mesh"));
SurfaceCustomMeshControl surfaceCustomMeshControl_0 = 
  ((SurfaceCustomMeshControl) autoMeshOperation_0.getCustomMeshControls().getObject("Surface Control"));
surfaceCustomMeshControl_0.getGeometryObjects().setQuery(null);
surfaceCustomMeshControl_0.getGeometryObjects().setObjects(partSurface_0);

热传递:辐射工作流的更改

由于简化了外部边界的辐射工作流,宏代码有所更改。

表面方向选项,用于激活来自边界外侧的辐射,在 Simcenter STAR-CCM+ 2021.3 中不再可用。相反,将辐射传输选项区域条件设为外部,如示例所示:

以前版本 Simcenter STAR-CCM+ 2021.3
region_0.getConditions().get(SurfaceOrientationOption.class).setSelected(SurfaceOrientationOption.Type.OUTWARD);
region_0.getConditions().get(RadiationTransferOption.class).setSelected(RadiationTransferOption.Type.EXTERNAL);

环境热指定选项在 Simcenter STAR-CCM+ 2021.3 中不再可用。要获得相同的热行为,选择对流热选项:

以前版本 Simcenter STAR-CCM+ 2021.3
boundary_0.getConditions().get(WallThermalOption.class).setSelected(WallThermalOption.Type.ENVIRONMENT);
boundary_0.getConditions().get(WallThermalOption.class).setSelected(WallThermalOption.Type.CONVECTION );

在先前版本中使用热辐射时,环境热规范还会自动激活来自边界的外部辐射。在 Simcenter STAR-CCM+ 2021.3 中,必须通过以下宏将辐射传输选项设为外部,或内部和外部(如果适当):

region_0.getConditions().get(RadiationTransferOption.class).setSelected(RadiationTransferOption.Type.EXTERNAL);

region_0.getConditions().get(RadiationTransferOption.class).setSelected(RadiationTransferOption.Type.DUAL_SIDED);

气动声学:来自飞行中的 FW-H 接收器和后 FW-H 接收器的数据不再需要 .csv 导出

对于飞行中的 FW-H 求解器和后 FW-H 求解器,计算的声学数据现在仍存储在 FW-H 接收器节点中。现在,包含此数据的表对象存在于每个接收器节点下,并且可以像任何其他内部表一样进行后处理。因此,已移除点接收器的以下右键单击操作:

  • 导出总表面积
  • 导出表面厚度
  • 导出表面负载
  • 导出体积四极

此项重新设计导致宏代码发生了以下更改。对于后 FW-H 接收器,移除表示导出操作的线:

pointFwhPostProcessingReceiver_0.exportTotalTrn(f1.getAbsolutePath());

并添加以下线:

ReceiverTable receiverTable_0 = pointFwhPostProcessingReceiver_0.getReceiverTable();
receiverTable_0.export(f1.getAbsolutePath());

对于实时 FW-H 模型接收器,要更新宏代码以移除各种导出操作,将先前版本中的行替换为 Simcenter STAR-CCM+ 2021.3 中的行,如下表所示:

以前版本 Simcenter STAR-CCM+ 2021.3
pointReceiver_0.export(f.getAbsolutePath());
ReceiverTable receiverTable_0 = pointReceiver_0.getReceiverTable();
receiverTable_0.export(f.getAbsolutePath());
pointReceiver_0.exportLoading(fLoading.getAbsolutePath());
XYPlot xYPlot_1 = simulation_0.getPlotManager().createPlot(XYPlot.class);
xYPlot_1.getDataSetManager().addDataProviders(new NeoObjectVector(new Object[] {receiverTable_0}));
ExternalDataSet externalDataSet_1 =  ((ExternalDataSet) +xYPlot_1.getDataSetManager().getDataSet("PointReceiver1"));
externalDataSet_1.setXValuesName("Acoustic Time");
externalDataSet_1.setYValuesName("Sound Pressure Loading Noise");
xYPlot_1.getDataSetManager().writeCSVDataSet(externalDataSet_1, fLoading, ",");
pointReceiver_0.exportThickness(fThickness.getAbsolutePath());
XYPlot xYPlot_2 = simulation_0.getPlotManager().createPlot(XYPlot.class);
xYPlot_2.getDataSetManager().addDataProviders(new NeoObjectVector(new Object[] {receiverTable_0}));
ExternalDataSet externalDataSet_2 =  ((ExternalDataSet) +xYPlot_2.getDataSetManager().getDataSet("PointReceiver1"));
externalDataSet_2.setXValuesName("Acoustic Time");
externalDataSet_2.setYValuesName("Sound Pressure Thickness Noise");
xYPlot_2.getDataSetManager().writeCSVDataSet(externalDataSet_2, fThickness, ",");
pointReceiver_0.exportQuadrupole(fQuadrupoleSoundPressure.getAbsolutePath());
XYPlot xYPlot_2 = getSimulation().getPlotManager().createPlot(XYPlot.class);
xYPlot_2.getDataSetManager().addDataProviders(new NeoObjectVector(new Object[] {receiverTable_0}));
ExternalDataSet externalDataSet_0 = ((ExternalDataSet) +xYPlot_2.getDataSetManager().getDataSet("PointReceiver1"));
externalDataSet_0.setXValuesName("Quadrupole Acoustic Time");
externalDataSet_0.setYValuesName("Quadrupole Sound Pressure");
xYPlot_2.getDataSetManager().writeCSVDataSet(externalDataSet_0, fQuadrupoleSoundPressure, ",");

反应流体:小火焰模型的更改

小火焰表中的变量插值已优化,性能更快,从而导致宏代码更改。组分已替换如下:

  • physicsContinuum_0.enable(PpdfIdealGasModel.class); 已替换为 physicsContinuum_0.enable(PpdfEquilibriumIdealGasModel.class);
  • continuum.enable(IdealGasWithFlameletModel.class); 已替换为 continuum.enable(PpdfFlameletIdealGasModel.class);
  • gasMixture_0.getMaterialProperties().getMaterialProperty(SpecificHeatProperty.class).setMethod(PpdfFlameletSpecificHeatMethod.class); 已替换为 gasMixture_0.getMaterialProperties().getMaterialProperty(SpecificHeatProperty.class).setMethod(PpdfOneHlrSpecificHeatMethod.class);
  • gasMixture_0.getMaterialProperties().getMaterialProperty(SpecificHeatProperty.class).setMethod(PvmSpecificHeatMethod.class); 已替换为 gasMixture_0.getMaterialProperties().getMaterialProperty(SpecificHeatProperty.class).setMethod(FgmOneHlrSpecificHeatMethod.class);

欧拉多相流 (EMP)

扩展基于 EMP CFL 的时间步控制

平滑对流 CFL 条件现替代和增强 EMP 中的时间步提供程序对流 CFL 条件,从而导致宏代码的更改。

以前版本 Simcenter STAR-CCM+ 2021.3
Simulation simulation_0 = getActiveSimulation();
PhysicsContinuum physicsContinuum_0 = ((PhysicsContinuum) simulation_0.getContinuumManager(). getContinuum("Physics 1"));
AdaptiveTimeStepModel adaptiveTimeStepModel_0 = physicsContinuum_0.getModelManager().getModel(AdaptiveTimeStepModel.class);
ConvectiveCflTimeStepProvider convectiveCflTimeStepProvider_0 = adaptiveTimeStepModel_0.getTimeStepProviderManager(). createObject(ConvectiveCflTimeStepProvider.class);

          convectiveCflTimeStepProvider_0.getTargetMaxCfl().setValue(10.0);
Units units_0 = ((Units) simulation_0.getUnitsManager().getObject(""));
convectiveCflTimeStepProvider_0.getTargetMaxCfl().setUnits(units_0);

//"Target Mean CFL Number" does not exist in future releases
Units units_0 = ((Units) simulation_0.getUnitsManager().getObject(""));
convectiveCflTimeStepProvider_0.getTargetMeanCfl().setUnits(units_0);
Simulation simulation_0 = getActiveSimulation();
PhysicsContinuum physicsContinuum_0 = ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
AdaptiveTimeStepModel adaptiveTimeStepModel_0 = physicsContinuum_0.getModelManager().getModel(AdaptiveTimeStepModel.class);
EmpSmoothedConvectiveCflTimeStepProvider empSmoothedConvectiveCflTimeStepProvider_0 = adaptiveTimeStepModel_0.getTimeStepProviderManager().createObject(EmpSmoothedConvectiveCflTimeStepProvider.class);

empSmoothedConvectiveCflTimeStepProvider_0.getMaxConditionLimit().setValue(10.0);
Units units_0 = ((Units) simulation_0.getUnitsManager().getObject(""));
empSmoothedConvectiveCflTimeStepProvider_0.getMaxConditionLimit().setUnits(units_0);

液膜剥离的更改

液膜剥离改进导致对宏代码的更改。要更新宏,可移除以下示例中所示的代码实例:

filmStrippingEMPModel_0.getStrippingVolumeFractionLimit().setValue(0.8);

离散多相:颗粒尺寸指定的更改

Simcenter STAR-CCM+ 2021.3 开始,DMP 相的颗粒尺寸信息不再指定为材料属性,而是指定为每个相间相互作用中的相互作用长度尺度。更新宏如以下示例所示。

以前版本 Simcenter STAR-CCM+ 2021.3
import star.dmp.ParticleDiameterInteractionLengthScaleModel;
import star.multiphase.ParticleDiameterProperty;
...
PhaseInteraction phaseInteraction_1 = multiPhaseInteractionModel_0.createPhaseInteraction(PhaseInteractionTopology.DMP_PC, eulerianPhase_0, physicsContinuum_0);
phaseInteraction_1.enable(ParticleDiameterInteractionLengthScaleModel.class);
...
PhysicsContinuum physicsContinuum = (PhysicsContinuum) getActiveSimulation().getContinuumManager().getContinuum("Physics 1");
dispersedMultiphaseModel = physicsContinuum.getModelManager().getModel(DispersedMultiphaseModel.class);
EulerianPhase eulerianPhase = dispersedMultiphaseModel.createPhase();
DMPSingleComponentDropletModel dmpSingleComponentDropletModel = eulerianPhase.getModelManager().getModel(DMPSingleComponentDropletModel.class);
Liquid liquid = ((Liquid) dmpSingleComponentDropletModel.getMaterial());
ConstantMaterialPropertyMethod constantMaterialPropertyMethod = 
  ((ConstantMaterialPropertyMethod) liquid.getMaterialProperties().getMaterialProperty(ParticleDiameterProperty.class).getMethod());
constantMaterialPropertyMethod.getQuantity().setValue(1e-5);
import star.dmp.DmpInteractionLengthScaleModel;
import star.multiphase.ConstantInteractionCoefficientMethod;
...
PhaseInteraction phaseInteraction_1 = multiPhaseInteractionModel_0.createPhaseInteraction(PhaseInteractionTopology.DMP_PC, eulerianPhase_0, physicsContinuum_0);
phaseInteraction_1.enable(DmpInteractionLengthScaleModel.class);
...
DmpInteractionLengthScaleModel dmpInteractionLengthScaleModel = phaseInteraction.getModelManager().getModel(DmpInteractionLengthScaleModel.class);
ConstantInteractionCoefficientMethod constantInteractionCoefficientMethod = ((InteractionLengthScaleMethodManager) dmpInteractionLengthScaleModel.getInteractionLengthScaleMethodManager()).getMethod(ConstantInteractionCoefficientMethod.class);
constantInteractionCoefficientMethod.getQuantity().setValue(1e-5);

VOF:解析的 VOF-拉格朗日转换模型的更改

Simcenter STAR-CCM+ 2021.3 中,已解析的 VOF-拉格朗日转换模型现在可以将 VOF Blob 转换为拉格朗日粒子束,不仅具有最大 Blob 直径,而且具有最小 Blob 直径和/或 Blob 形状度量。此项重新设计导致宏代码发生了以下更改。

以前版本 Simcenter STAR-CCM+ 2021.3
Simulation simulation_0 = 
  getActiveSimulation();
PhysicsContinuum physicsContinuum_0 = 
  ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
MultiPhaseInteractionModel multiPhaseInteractionModel_0 = 
  physicsContinuum_0.getModelManager().getModel(MultiPhaseInteractionModel.class);
PhaseInteraction phaseInteraction_0 = 
  ((PhaseInteraction) multiPhaseInteractionModel_0.getPhaseInteractionManager().getPhaseInteraction("Phase Interaction 1"));
phaseInteraction_0.enable(ResolvedVofLagrangianTransitionModel.class);
ResolvedVofLagrangianTransitionModel resolvedVofLagrangianTransitionModel_0 = 
  phaseInteraction_0.getModelManager().getModel(ResolvedVofLagrangianTransitionModel.class);
VofLagrangianTransitionLengthScaleProfile vofLagrangianTransitionLengthScaleProfile_0 = 
  resolvedVofLagrangianTransitionModel_0.getTransitionLengthScaleProfile();
vofLagrangianTransitionLengthScaleProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(1.0E-4);
Units units_0 = 
  ((Units) simulation_0.getUnitsManager().getObject("m"));
vofLagrangianTransitionLengthScaleProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setUnits(units_0);
Simulation simulation_0 = 
  getActiveSimulation();
PhysicsContinuum physicsContinuum_0 = 
  ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
MultiPhaseInteractionModel multiPhaseInteractionModel_0 = 
  physicsContinuum_0.getModelManager().getModel(MultiPhaseInteractionModel.class);
PhaseInteraction phaseInteraction_0 = 
  ((PhaseInteraction) multiPhaseInteractionModel_0.getPhaseInteractionManager().getPhaseInteraction("Phase Interaction 1"));
phaseInteraction_0.enable(ResolvedVofLagrangianTransitionModel.class);
ResolvedVofLagrangianTransitionModel resolvedVofLagrangianTransitionModel_0 = 
  phaseInteraction_0.getModelManager().getModel(ResolvedVofLagrangianTransitionModel.class);
BlobDiameterVofLagrangianTransitionCriterion blobDiameterVofLagrangianTransitionCriterion_0 = 
  ((BlobDiameterVofLagrangianTransitionCriterion) resolvedVofLagrangianTransitionModel_0.getCriterionManager().getObject("Blob Diameter Criterion"));
Units units_0 = 
  ((Units) simulation_0.getUnitsManager().getObject("m"));
blobDiameterVofLagrangianTransitionCriterion_0.getMaxDiameter().setValue(1.0E-4);
blobDiameterVofLagrangianTransitionCriterion_0.getMaxDiameter().setUnits(units_0);
blobDiameterVofLagrangianTransitionCriterion_0.getMinDiameter().setValue(0.0);
blobDiameterVofLagrangianTransitionCriterion_0.getMinDiameter().setUnits(units_0);
BlobShapeVofLagrangianTransitionCriterion blobShapeVofLagrangianTransitionCriterion_0 = 
  ((BlobShapeVofLagrangianTransitionCriterion) resolvedVofLagrangianTransitionModel_0.getCriterionManager().getObject("Blob Shape Criterion"));
resolvedVofLagrangianTransitionModel_0.getCriterionManager().removeObjects(blobShapeVofLagrangianTransitionCriterion_0);

电磁

线圈设置的更改

励磁线圈的设置已重构,导致宏代码更改。

以前版本 Simcenter STAR-CCM+ 2021.3
ExcitationCoilElectricCurrentDensityMagnitudeProfile excitationCoilElectricCurrentDensityMagnitudeProfile_0
                                    = region_4.getValues().get(ExcitationCoilElectricCurrentDensityMagnitudeProfile.class);
                                    excitationCoilElectricCurrentDensityMagnitudeProfile_0.getMethod(ExcitationCoilAmpereTurnMethod.class).setNSections(2);
                                    
                                    ExcitationCoilConductorRelativeOrAbsoluteArea excitationCoilConductorRelativeOrAbsoluteArea_0 = 
                                    excitationCoilElectricCurrentDensityMagnitudeProfile_0.getMethod(ExcitationCoilAmpereTurnMethod.class).getCoilArea();
                                    excitationCoilConductorRelativeOrAbsoluteArea_0.getRelativeOrAbsoluteOption().setSelected(ExcitationCoilConductorRelativeOrAbsoluteAreaOption.Type.ABSOLUTE);
                                    ((ExcitationCoilConductorAbsoluteArea) excitationCoilConductorRelativeOrAbsoluteArea_0.getAbsoluteArea());
import star.electromagnetism.common.ExcitationCoilNSections;
                                    ExcitationCoilNSections excitationCoilNSections = region_4.getValues().get(ExcitationCoilNSections.class);
                                    excitationCoilNSections.getModelPartValue().setValue(2);
                                    
                                    import star.electromagnetism.common.ExcitationCoilConductorArea;
                                    import star.electromagnetism.common.ExcitationCoilConductorAreaLeaf;
                                    ExcitationCoilConductorArea excitationCoilConductorArea_0 = region_5.getValues().get(ExcitationCoilConductorArea.class);
                                    ExcitationCoilConductorAreaLeaf excitationCoilConductorAreaLeaf_0 = excitationCoilConductorArea_0.getModelPartValue();excitationCoilConductorAreaLeaf_0.getRelativeOrAbsoluteOption().setSelected(ExcitationCoilConductorRelativeOrAbsoluteAreaOption.Type.ABSOLUTE);
                                    ((ExcitationCoilConductorAbsoluteArea) excitationCoilConductorAreaLeaf_0.getAbsoluteArea());

永磁建模的更改

只要物理连续体激活永磁模型,建议通过激活线性永磁常规模型,确保它是默认模型,如下例所示:

    PhysicsContinuum pc = sim.getContinuumManager().createContinuum(PhysicsContinuum.class);
// ...
    pc.enable(PermanentMagnetModel.class);
    pc.enable(LinearPermanentMagnetGeneralModel.class);

要启用此默认模型,需要从 magneticpotential 导入它,如下所示:

import star.electromagnetism.magneticpotential.LinearPermanentMagnetGeneralModel;

电池建模:工作流的更改

Simcenter STAR-CCM+ 中已引入电池建模的新工作流,从而导致宏代码的更改。

以下类已替换如下:

  • BatteryCell 已替换为 BatteryCellBase
  • BatteryModule 已替换为 TBMBatteryModule
  • BatteryModuleCell 已替换为 TBMBatteryModuleCell
  • BlockCellModelDescription 已替换为 BlockModelGeometry
  • CylindricalCellModelDescription 已替换为 CylindricalModelGeometry
  • PrismaticCellModelDescription 已替换为 PrismaticModelGeometry

在某些情况下,可能需要强制转换为适当的类。

更新这些参数的宏代码如下:

新建 TBMBatteryModule

以前版本 Simcenter STAR-CCM+ 2021.3
BatteryModule batteryModule_0 = batteryTool_0.getModules().createEmptyBatteryModule();
TBMBatteryModule batteryModule_0 = (TBMBatteryModule) (batteryTool_0.getModules()).createTBMBatteryModule();

使用 <Shape>ModelGeometry

以前版本 Simcenter STAR-CCM+ 2021.3
<Shape>CellModelDescription cellModelDescription_0 = ((<Shape>CellModelDescription) <shape>BatteryCell_0.getCellModelDescription());
<Shape>ModelGeometry modelGeometry_0 = (<Shape>ModelGeometry) <shape>BatteryCell_0.getModelGeometry());

循环电池单元:

以前版本 Simcenter STAR-CCM+ 2021.3
Collection<BatteryCell> bcs = batteryTool_0.getCells().getObjects();
    for (BatteryCell bc : bcs) {
Collection<BatteryCellBase> bcs = batteryTool_0.getCells().getObjects();
   for (BatteryCellBase bcb : bcs) {
     BatteryCell bc = (BatteryCell) bcb;

可视化

硬拷贝导出用户界面的更改

对绘图和布局(类似于场景)引入抗锯齿和透明度控制后,现有宏现使用抗锯齿导出绘图的图形文件(硬拷贝)。

场景文件压缩的更改

由于在 Simcenter STAR-CCM+ 2021.3 中为导出场景 (.sce) 文件引入多级压缩,宏代码有所更改。

以前版本 Simcenter STAR-CCM+ 2021.3
Simulation simulation_0 = getActiveSimulation();
Scene scene_0 = simulation_0.getSceneManager().getScene("Scene");
// export a scene file with lossless compression
scene_0.export3DSceneFileAndWait(resolvePath("Scene.sce"), "Scene", "Description", false, true);
ResidualPlot residualPlot_0 = ((ResidualPlot) simulation_0.getPlotManager().getPlot("Residuals"));
// export a plot with lossless compression
residualPlot_0.exportScene(resolvePath("Residuals.sce"), "Residuals", "", false, true);
Simulation simulation_0 = getActiveSimulation();
Scene scene_0 = simulation_0.getSceneManager().getScene("Scene");
// export a scene file with lossless compression
scene_0.export3DSceneFileAndWait(resolvePath("Scene.sce"), "Scene", "Description", false, SceneFileCompressionLevel.LOSSLESS);
// export a scene file with medium lossy compression
scene_0.export3DSceneFileAndWait(resolvePath("Scene_lossy.sce"), "Scene", "Description", false, SceneFileCompressionLevel.MEDIUM);
ResidualPlot residualPlot_0 = ((ResidualPlot) simulation_0.getPlotManager().getPlot("Residuals"));
// export a plot with lossless compression
residualPlot_0.exportScene(resolvePath("Residuals.sce"), "Residuals", "", false, SceneFileCompressionLevel.LOSSLESS);

在求解运行期间更新场景或使用导出模拟操作时,也可以导出场景文件。因为这些文件现也支持选择压缩等级,getCompress()setCompress() 已被弃用并替换为以下类中的 getCompressionLevel()setCompressionLevel()

  • star.common.SceneFileProperties
  • star.common.SceneExportSceneFileSettings
  • star.common.PlotExportSceneFileSettings

Simcenter STAR-CCM+ 2021.3 中,绘图更新子节点现包括选择场景文件作为导出文件类型的功能。新的 SCE 条目已添加至 star.common.PlotHardcopyFormat,而且 star.common.PlotUpdate 现也具有 getSceneFileProperties() 方法。已弃用组分替换如下:

  • public boolean getCompress() 已替换为 public SceneFileCompressionLevel getCompressionLevel()
  • public void setCompress(boolean value) 已替换为 public void setCompressionLevel(SceneFileCompressionLevel level)
以前版本 Simcenter STAR-CCM+ 2021.3
Simulation simulation_0 = getActiveSimulation();
Scene scene_0 = simulation_0.getSceneManager().getScene("Scene");
ResidualPlot residualPlot_0 = ((ResidualPlot) simulation_0.getPlotManager().getPlot("Residuals"));

SceneUpdate sceneUpdate_0 = scene_0.getSceneUpdate();
sceneUpdate_0.setAnimationFileFormat(ImageFileFormat.SCE);
SceneFileProperties sceneFileProperties_0 = sceneUpdate_0.getSceneFileProperties();
if (!sceneFileProperties_0.getCompress()) {
  sceneFileProperties_0.setCompress(true);
}

SimDriverWorkflow simDriverWorkflow_0 = 
  ((SimDriverWorkflow) simulation_0.get(SimDriverWorkflowManager.class).getObject("Simulation Operations 1"));

ExportAutomationBlock exportAutomationBlock_0 = 
  ((ExportAutomationBlock) simDriverWorkflow_0.getBlocks().getObject("Export"));

SceneExportSettings sceneExportSettings_0 = exportAutomationBlock_0.getSceneSettings();
sceneExportSettings_0.setExportType(SceneExportType.SCENE_FILE);
SceneExportSceneFileSettings sceneExportSceneFileSettings_0 = sceneExportSettings_0.getSceneFileSettings();
if (sceneExportSceneFileSettings_0.getCompress()) {
  sceneExportSceneFileSettings_0.setCompress(false);
}

PlotExportSettings plotExportSettings_0 = exportAutomationBlock_0.getPlotSettings();
plotExportSettings_0.setExportType(PlotExportType.SCENE_FILE);
PlotExportSceneFileSettings plotExportSceneFileSettings_0 = plotExportSettings_0.getSceneFileSettings();
if (plotExportSceneFileSettings_0.getCompress()) {
  plotExportSceneFileSettings_0.setCompress(false);
}
Simulation simulation_0 = getActiveSimulation();
Scene scene_0 = simulation_0.getSceneManager().getScene("Scene");
ResidualPlot residualPlot_0 = ((ResidualPlot) simulation_0.getPlotManager().getPlot("Residuals"));

SceneUpdate sceneUpdate_0 = scene_0.getSceneUpdate();
sceneUpdate_0.setAnimationFileFormat(ImageFileFormat.SCE);
SceneFileProperties sceneFileProperties_0 = sceneUpdate_0.getSceneFileProperties();
if (sceneFileProperties_0.getCompressionLevel() == SceneFileCompressionLevel.OFF) {
  sceneFileProperties_0.setCompressionLevel(SceneFileCompressionLevel.LOSSLESS);
}

PlotUpdate plotUpdate_0 = residualPlot_0.getPlotUpdate();
plotUpdate_0.setAnimationFileFormat(PlotHardcopyFormat.SCE);
SceneFileProperties sceneFileProperties_1 = plotUpdate_0.getSceneFileProperties();
if (sceneFileProperties_1.getCompressionLevel() == SceneFileCompressionLevel.OFF) {
  sceneFileProperties_1.setCompressionLevel(SceneFileCompressionLevel.LOSSLESS);
}

SimDriverWorkflow simDriverWorkflow_0 = 
  ((SimDriverWorkflow) simulation_0.get(SimDriverWorkflowManager.class).getObject("Simulation Operations 1"));

ExportAutomationBlock exportAutomationBlock_0 = 
  ((ExportAutomationBlock) simDriverWorkflow_0.getBlocks().getObject("Export"));

SceneExportSettings sceneExportSettings_0 = exportAutomationBlock_0.getSceneSettings();
sceneExportSettings_0.setExportType(SceneExportType.SCENE_FILE);
SceneExportSceneFileSettings sceneExportSceneFileSettings_0 = sceneExportSettings_0.getSceneFileSettings();
if (sceneExportSceneFileSettings_0.getCompressionLevel() == SceneFileCompressionLevel.LOSSLESS) {
  sceneExportSceneFileSettings_0.setCompressionLevel(SceneFileCompressionLevel.OFF);
}

PlotExportSettings plotExportSettings_0 = exportAutomationBlock_0.getPlotSettings();
plotExportSettings_0.setExportType(PlotExportType.SCENE_FILE);
PlotExportSceneFileSettings plotExportSceneFileSettings_0 = plotExportSettings_0.getSceneFileSettings();
if (plotExportSceneFileSettings_0.getCompressionLevel() == SceneFileCompressionLevel.LOSSLESS) {
  plotExportSceneFileSettings_0.setCompressionLevel(SceneFileCompressionLevel.OFF);
}

处理注释的更改

注释重构导致用于添加和移除注释的宏代码更改。

以前版本 Simcenter STAR-CCM+ 2021.3
Simulation simulation_0 = 
  getActiveSimulation();
ResidualPlot residualPlot_0 = 
  ((ResidualPlot) simulation_0.getPlotManager().getPlot("Residuals"));
LogoAnnotation logoAnnotation_0 = 
  ((LogoAnnotation) simulation_0.getAnnotationManager().getObject("Logo"));
LogoAnnotationProp logoAnnotationProp_0 = 
  (LogoAnnotationProp) residualPlot_0.getAnnotationPropManager().createPropForAnnotation(logoAnnotation_0);
residualPlot_0.getAnnotationPropManager().removePropsForAnnotations(logoAnnotation_0);
Simulation simulation_0 = 
  getActiveSimulation();
ResidualPlot residualPlot_0 = 
  ((ResidualPlot) simulation_0.getPlotManager().getPlot("Residuals"));
residualPlot_0.getAnnotationPropManager().getAnnotationGroup().setQuery(null);
LogoAnnotation logoAnnotation_0 = 
  ((LogoAnnotation) simulation_0.getAnnotationManager().getObject("Logo"));
residualPlot_0.getAnnotationPropManager().getAnnotationGroup().setObjects(logoAnnotation_0);
residualPlot_0.getAnnotationPropManager().getAnnotationGroup().setQuery(null);
residualPlot_0.getAnnotationPropManager().getAnnotationGroup().setObjects();

createPropForAnnotation 已弃用。将其实例替换为 createAnnotationProp,如以下示例所示:

Simulation simulation_0 = 
  getActiveSimulation();
ResidualPlot residualPlot_0 = 
  ((ResidualPlot) simulation_0.getPlotManager().getPlot("Residuals"));
LogoAnnotation logoAnnotation_0 = 
  ((LogoAnnotation) simulation_0.getAnnotationManager().getObject("Logo"));
residualPlot_0.getAnnotationPropManager().createAnnotationProp(logoAnnotation_0);
residualPlot_0.getAnnotationPropManager().removePropsForAnnotations(logoAnnotation_0);

设计管理器:计算资源的更改

Simcenter STAR-CCM+ 2021.3 中,所有计算资源都移动到工具下,从而导致宏代码的更改。

Java 类 MdxDirectSettingsMdxJobManagerSettingsMdxLinuxClusterSettingsMdxWindowsHPCClusterSettings 已移除。不支持具有这些类的宏,宏编译将失败。

MdxComputeResource Java 类中用于获取设置的方法也已移除:

  • getDirectSettings()
  • getLinuxClusterSettings()
  • getWindowsHPCClusterSettings()
  • getJobManagerSettings()

应更新宏以使用新的资源类 MdxDirectResourceMdxJobManagerResourceMdxLinuxClusterResourceMdxWindowsHPCClusterResource,如以下示例所示。

直接

以前版本 Simcenter STAR-CCM+ 2021.3
MdxProject mdxProject_0 = getActiveMdxProject();
MdxDesignStudy study = mdxProject_0.getDesignStudyManager().getDesignStudy("Sweep");
MdxStudySettings study = study.getStudySettings();
MdxComputeResource mdxComputeResource_0 = study.getComputeResource();
mdxComputeResource_0.setType(MdxComputeResource.ResourceType.DIRECT);
MdxDirectSettings mdxDirectSettings_0 = mdxComputeResource_0.getDirectSettings();
mdxDirectSettings_0.setCcmpCmd("powerpre");
MdxProject mdxProject_0 = getActiveMdxProject();
MdxDesignStudy study = mdxProject_0.getDesignStudyManager().getDesignStudy("Sweep");
MdxDirectResource mdxDirectResource_0 =
mdxProject_0.get(MdxResourceManager.class).createResource(MdxDirectResource.class);
MdxLaunchSettings mdxLaunchSettings_0 = mdxStudySettings_0.getLaunchSettings();
mdxLaunchSettigns_0.setResourceMode(MdxLaunchSettings.ResourceMode.SINGLE_RESOURCE);
MdxSingleResourceSettings mdxSingleResourceSettings_0 =
mdxLaunchSettings_0.getSingleResourceSettings();
mdxSingleResourceSettings_0.setResource(mdxDirectResource_0);
mdxDirectResource_0.setCcmpCmd("powerpre");

Linux 群集

以前版本 Simcenter STAR-CCM+ 2021.3
mdxComputeResource_0.setType(MdxComputeResource.ResourceType.LINUX_CLUSTER);
MdxLinuxClusterSettings mdxLinuxClusterSettings_0 =
mdxComputeResource_0.getLinuxClusterSettings();
mdxLinuxClusterSettings_0.setCcmpCmd("power");
mdxLinuxClusterSettings_0.setJobSubmitCmd("qsub -l nodes=1:ppn=8");
mdxLinuxClusterSettings_0.setJobNameIdentifier("-n");
mdxLinuxClusterSettings_0.setJobNamePrefix("dm_design");
mdxLinuxClusterSettings_0.setScriptFile("script.sh");
MdxLinuxClusterResource mdxLinuxClusterResource_0 =
mdxProject_0.get(MdxResourceManager.class).createResource(MdxLinuxClusterResource.class);
mdxSingleResourceSettings_0.setResource(mdxLinuxClusterResource_0);
mdxLinuxClusterResource_0.setCcmpCmd("powerpre");
mdxLinuxClusterResource_0.setJobSubmitCmd("qsub -l nodes=1:ppn=8");
mdxLinuxClusterResource_0.setJobNameIdentifier("-n");
mdxLinuxClusterResource_0.setJobNamePrefix("dm_design");
mdxLinuxClusterResource_0.setScriptFile("script.sh");

Windows 群集

以前版本 Simcenter STAR-CCM+ 2021.3
mdxComputeResource_0.setType(MdxComputeResource.ResourceType.WINDOWS_CLUSTER);
MdxWindowsHPCClusterSettings mdxWindowsHPCClusterSettings_0 =
mdxComputeResource_0.getWindowsHPCClusterSettings();
mdxWindowsHPCClusterSettings_0.setCcmpCmd("power");
mdxWindowsHPCClusterSettings_0.setJobSubmitCmd("job submit /numcores:16");
mdxWindowsHPCClusterSettings_0.setJobNameIdentifier("/jname");
mdxWindowsHPCClusterSettings_0.setJobNamePrefix("dm_design");
mdxWindowsHPCClusterSettings_0.setScriptFile("script.sh");
MdxWindowsHPCClusterResource mdxWindowsHPCClusterResource_0 =
mdxProject_0.get(MdxResourceManager.class).createResource(MdxWindowsHPCClusterResource.class);
mdxSingleResourceSettings_0.setResource(mdxWindowsHPCClusterResource_0);
mdxWindowsHPCClusterResource_0.setCcmpCmd("power");
mdxWindowsHPCClusterResource_0.setJobSubmitCmd("job submit /numcores:16");
mdxWindowsHPCClusterResource_0.setJobNameIdentifier("/jname");
mdxWindowsHPCClusterResource_0.setJobNamePrefix("dm_design");
mdxWindowsHPCClusterResource_0.setScriptFile("script.sh");

作业管理器

以前版本 Simcenter STAR-CCM+ 2021.3
mdxComputeResource_0.setType(MdxComputeResource.ResourceType.JOB_MANAGER);
MdxJobManagerSettings mdxJobManagerSettings_0 =
mdxComputeResource_0.getJobManagerSettings();
mdxJobManagerSettings_0.setCcmpCmd("power");
mdxJobManagerSettings_0.setJobManagerKey("url:8100");
mdxJobManagerSettings_0.setSubmissionTemplate("NIGHTLY");
MdxJobManagerResource mdxJobManagerResource_0 =
mdxProject_0.get(MdxResourceManager.class).createResource(MdxJobManagerResource.class);
mdxSingleResourceSettings_0.setResource(mdxJobManagerResource_0);
mdxJobManagerResource_0.setCcmpCmd("power");
mdxJobManagerResource_0.setJobManagerKey("url:8100");
mdxJobManagerResource_0.setSubmissionTemplate("NIGHTLY");

本地 CAD 更新

以前版本 Simcenter STAR-CCM+ 2021.3
mdxComputeResource_0.setType(MdxComputeResource.ResourceType.LOCAL_CAD_UPDATE);
MdxLocalCadUpateSettings lcUpdateSettings = mdxComputeResource_0.getLocalCadUpdateSettings();
mdxLaunchSettigns_0.setResourceMode(MdxLaunchSettings.ResourceMode.LOCAL_CAD_UPDATE);
MdxLocalCadUpateSettings lcUpdateSettings = mdxLaunchSettings_0.getLocalCadUpdateSettings();

CAE 集成:CGNS 导入的更改

时间插值改进导致 CGNS 导入的宏代码更改。

以前版本 Simcenter STAR-CCM+ 2021.3
import star.cosimulation.oneway.common.*;
...
public void execute() {
    Simulation simulation_0 = 
      getActiveSimulation();
    CoSimulation coSimulation_0 = 
      ((CoSimulation) simulation_0.get(CoSimulationManager.class).getObject("Link 1"));
    TransferStartTime transferStartTime_0 = 
      coSimulation_0.getCoSimulationValues().get(TransferStartTime.class);
    ...
    TransferStopTime transferStopTime_0 = 
      coSimulation_0.getCoSimulationValues().get(TransferStopTime.class);
    ...
    TimeStepsPerTransfer timeStepsPerTransfer_0 = 
      coSimulation_0.getCoSimulationValues().get(TimeStepsPerTransfer.class);
    ...
}
// The directory star.cosimulation.oneway.common is no longer used
// Use star.cosimulation.link.common instead

import star.cosimulation.link.common.*;
...
public void execute() {
    Simulation simulation_0 = 
      getActiveSimulation();
    CoSimulation coSimulation_0 = 
      ((CoSimulation) simulation_0.get(CoSimulationManager.class).getObject("Link 1"));
    // TransferStartTime has moved:
    //    FROM star.cosimulation.oneway.common
    //    TO   star.cosimulation.link.common
    TransferStartTime transferStartTime_0 = 
      coSimulation_0.getCoSimulationValues().get(TransferStartTime.class);
    ...
    // TransferStopTime has moved:
    //    FROM star.cosimulation.oneway.common
    //    TO   star.cosimulation.link.common
    TransferStopTime transferStopTime_0 = 
      coSimulation_0.getCoSimulationValues().get(TransferStopTime.class);
    ...
    // TimeStepsPerTransfer has been renamed to TimeStepFrequency and moved:
    //    FROM star.cosimulation.oneway.common
    //    TO   star.cosimulation.link.common
    TimeStepFrequency timeStepFrequency_0 = 
      coSimulation_0.getCoSimulationValues().get(TimeStepFrequency.class);
    timeStepFrequency_0.setFrequency(5);
    ...
}

协同仿真:Abaqus 映射选项的更改

Abaqus 协同仿真的用户界面进行了改进,导致宏代码更改。

以前版本 Simcenter STAR-CCM+ 2021.3
CoSimulation coSimulation_0 =  ((CoSimulation) simulation_0.get(CoSimulationManager.class).getObject("Link 1"));
CoSimulationZone coSimulationZone_0 = coSimulation_0.getCoSimulationZoneManager().getCoSimulationZone("Zone 1");
MapperSettings mapperSettings_0 = coSimulationZone_0.getCoSimulationZoneValues().get(MapperSettings.class);
mapperSettings_0.getMapperRefConfig().setSelected(MapperRefConfigOptions.Type.CURRENT);
CoSimulation coSimulation_0 = ((CoSimulation) simulation_0.get(CoSimulationManager.class).getObject("Link 1"));
coSimulation_0.getCoSimulationConditions().get(DisplacementReferenceConfigurationOption.class).setSelected(DisplacementReferenceConfigurationOption.Type.CURRENT);