宏 API 更改 2302

Simcenter STAR-CCM+ 2302 中,已针对网格化、模拟操作、变形、材料属性、电磁、电池建模和 Simcenter STAR-CCM+ In-cylinder 更改了宏 API。

网格化:移除基于区域的网格化

基于区域的网格化已经移除。有关 Simcenter STAR-CCM+ UI 中特定更改的详细信息,请参见“网格化:移除基于区域的网格化”(《2302 发行说明》的“重要说明”章节)。

推荐的做法是使用基于部件的网格化,请参见 Simcenter STAR-CCM+ 用户指南中的“Simcenter STAR-CCM+ > 预处理 > 网格化 > 基于部件的网格化”章节。

与该功能相关的宏代码也已更改。

以前版本 Simcenter STAR-CCM+ 2302
public void newRegionsFromParts(Collection<GeometryPart> parts,
          String regionMode,
          Region region,
          String boundaryMode,
          Boundary boundary,
          String featureCurveMode,
          Object featureCurve,
          CreateInterfaceMode interfaceMode)
// Deprecated; use instead:

public void newRegionsFromParts(Collection<GeometryPart> parts,
          String regionMode,
          Region region,
          String boundaryMode,
          Boundary boundary,
          CreateInterfaceMode interfaceMode)
public void newRegionsFromParts(Collection<GeometryPart> parts,
        String regionMode,
        String boundaryMode,
        String featureCurveMode,
        boolean createInterfaces)
// Deprecated; use instead: 

public void newRegionsFromParts(Collection<GeometryPart> parts,
          String regionMode,
          String boundaryMode,
          boolean createInterfaces)
public void newRegionFromPart(GeometryPart part,
                String boundaryMode,
                String featureCurveMode,
                boolean createInterfaces)
// Removed.
public void newRegionsFromParts(
Collection<GeometryPart> parts,
String regionMode,
Region region,
String boundaryMode,
Boundary boundary,
String featureCurveMode,
FeatureCurve featureCurve,
boolean createInterfaces)
public void newRegionsFromParts(
Collection<GeometryPart> parts,
String regionMode,
Region region,
String boundaryMode,
Boundary boundary,
boolean createInterfaces)
FeatureCurve featureCurve_0 = 
    ((FeatureCurve) region_2.getFeatureCurveManager().getObject("Default"));

     region_2.getFeatureCurveManager().removeObjects(featureCurve_0);
// Deprecated. This code can still be called, but it has no effect.
PartCurve pc;
pc.hasFeatureCurve();
pc.getFeatureCurve();
pc.setFeatureCurve(fc);
// Removed.
Region r;
r.getMeshContinuum();
r.setMeshContinuum(MeshContinuum mc);
// Removed.

已移除与 FeatureCurvesMeshContinuumMeshValueManager 相关的类。以 SolverModel 结尾的许多类也已经移除。以下是在宏中可能已移除或更改的类的列表:

  • AbsoluteWakeRefinementDistance
  • AbsoluteWakeRefinementSize
  • AddEdgesToFeatureCurveAction
  • AssignPartCurveToExistingFeatureCurveAction
  • AssignPartCurveToFeatureCurveAction
  • AssignPartCurveToNewFeatureCurveAction
  • AutomaticSurfaceRepair
  • BatteryMeshContinuum
  • BatteryMesherModel
  • BatteryMesherSolver
  • BatteryResurfacerMeshingModel
  • BodyFittedMesherModel
  • BodyFittedMesherSolver
  • BodyfittedPrismStretchingOption
  • BodyfittedPrismThickness
  • BodyfittedPrismWallThickness
  • BodyfittedVolumeSourceDualMesherSizeOption
  • BodyfittedVolumeSourcePrismsOption
  • BooleanOperateRegionsAction
  • BoundaryOption
  • CombineFeatureCurvesAction
  • ContactPreventionSelectBoundariesAction
  • ContactPreventionSet
  • ContactPreventionSetManager
  • CreateFeatureEdgesAction
  • CustomSimpleSurfaceGrowthRate
  • CustomSurfaceGrowthRateOption
  • CustomTwoLevelTemplateSurfaceGrowthRate
  • DelaunayMesherModel
  • DelaunayMesherSolver
  • DualMesherModel
  • DualMesherSolver
  • EditFeatureCurveAction
  • ExtrudeBoundaryCoordinateValues
  • ExtrudeBoundaryNonNormalValues
  • ExtrudeBoundaryNormalValues
  • ExtrudeBoundaryOption
  • ExtrudeBoundaryValues
  • ExtruderModel
  • ExtruderSolver
  • FeatureCurveEditor
  • FeatureCurvePartCurveGroup
  • FeatureCurvePartCurvesDynamicQueryGroup
  • FeatureCurvesComboBox
  • FeatureCurveSelector
  • FeatureCurveTransferSelector
  • FillHolesInFeatureCurvesAction
  • GenCylConstantExtrusionValues
  • GenCylExtrusionValues
  • GenCylModel
  • GenCylNonConstantExtrusionValues
  • IntersectBoundariesAction
  • IntersectRegionsAction
  • MeshContinuum
  • MeshingModelsSelectAction
  • MeshValueManager
  • NumLayers
  • OneGroupContactPreventionSet
  • PartsMeshContinuum
  • PolyWakeRefinementSelectBoundariesAction
  • PolyWakeRefinementSelectFeatureCurvesAction
  • PolyWakeRefinementSet
  • PolyWakeRefinementSetManager
  • PrismMesherModel
  • PrismMesherSolver
  • PrismTypeValue
  • RegionOption
  • RelativeWakeRefinementSize
  • ResurfacerMeshingModel
  • ShellingExtrusionValues
  • ShellingMesherModel
  • SimpleTemplateGrowthRate
  • SolidMesherModel
  • SolidMesherModelBase
  • SolidMesherRegionOption
  • SolidMesherSolver
  • SolidMesherSubModel
  • SolutionInterpolationOption
  • SplitBoundariesByFeatureCurvesAction
  • SplitBoundaryByFacesAction
  • SplitBoundaryByPatchAction
  • SplitNonContiguousFeatureCurvesAction
  • SplitRegionsBySurfaceTopologyAction
  • StartSurfaceMeshRepairAction
  • SubtractRegionsAction
  • SurfaceCurvatureOption
  • SurfaceImporter
  • SurfaceProximityOption
  • SurfaceRepFeatureCurve
  • SurfaceRepFeatureCurveManager
  • SurfaceSizeRatio
  • SurfaceWrapperMeshingModel
  • SurfaceWrapperSolver
  • ThinSolidLayers
  • ThinSolidThickness
  • TrimmerAnisotropicSizeOption
  • TrimmerMeshingModel
  • TrimmerSizeOption
  • TrimmerSolver
  • TwoGroupContactPreventionSet
  • TwoLevelTemplateGrowthRate
  • UniteRegionsAction
  • VolumeMeshSourceBlending
  • VolumeSourcePrismsOption
  • VolumeSourceResurfacerSizeOption
  • VolumeSourceSurfaceWrapperSizeOption
  • WakeRefinementSelectBoundariesAction
  • WakeRefinementSelectFeatureCurvesAction
  • WakeRefinementSet
  • WakeRefinementSetManager
  • ZipEdgesInFeatureCurvesAction

模拟操作:对求解正则模态操作的更改

由于重构,求解正则模态模拟操作的宏代码已更改。

以前版本 Simcenter STAR-CCM+ 2302
import star.modalharmonic.SolveNormalModesAutomationBlock;

public class NormalModesSimOpSetup extends NormalModesSetup {

    public void ModalAnalysisSolve() {

        Simulation simulation_0 = getActiveSimulation();
        
        SimDriverWorkflow simDriverWorkflow_0 = 
                ((SimDriverWorkflow) simulation_0.get(SimDriverWorkflowManager.class).createSimDriverWorkflow("Simulation Operations 1"));
 simDriverWorkflow_0.getBlocks().createBlock("star.modalharmonic.SolveNormalModesAutomationBlock", "Solve Normal Modes");
  
        simulation_0.get(SimDriverWorkflowManager.class).setSelectedWorkflow(simDriverWorkflow_0);
  
        simDriverWorkflow_0.execute();
    }
}
import star.solidstress.SolveNormalModesAutomationBlock;

public class NormalModesSimOpSetup extends NormalModesSetup {

    public void ModalAnalysisSolve() {

        Simulation simulation_0 = getActiveSimulation();
        
        SimDriverWorkflow simDriverWorkflow_0 = 
                ((SimDriverWorkflow) simulation_0.get(SimDriverWorkflowManager.class).createSimDriverWorkflow("Simulation Operations 1"));
        
        simDriverWorkflow_0.getBlocks().createBlock("star.solidstress.SolveNormalModesAutomationBlock", "Solve Normal Modes");
  
        simulation_0.get(SimDriverWorkflowManager.class).setSelectedWorkflow(simDriverWorkflow_0);
  
        simDriverWorkflow_0.execute();
    }
}

变形:对默认变形方法的更改

对于变形,变形方法属性的默认设置已从 RBF 更改为 BSpline

这会根据首选的默认设置影响宏代码。

  • 如果要保留 RBF 作为默认方法,如下所示更新宏。
    以前版本 Simcenter STAR-CCM+ 2302
    MorphingMotion morphingMotion_0 = _sim.get(MotionManager.class).createMotion(MorphingMotion.class, "Morphing");
    RbfMorpherParameters rbfMorpherParameters_0 = morphingMotion_0.getRbfMorpherParameters();
     rbfMorpherParameters_0.setAutomaticThinout(false);
    MorphingMotion morphingMotion_0 = _sim.get(MotionManager.class).createMotion(MorphingMotion.class, "Morphing");
    morphingMotion_0.getMorpherMethodOption().setSelected(MorpherMethodOption.Type.RBF);
    RbfMorpherParameters rbfMorpherParameters_0 = morphingMotion_0.getRbfMorpherParameters();
    rbfMorpherParameters_0.setAutomaticThinout(false);
    rbfMorpherParameters_0.setLinearFit(true);
  • 或者,要使用新的默认 B-样条变形,如下使用相关设置对象(而不是 RbfMorpherParameters)更新宏。
    以前版本 Simcenter STAR-CCM+ 2302
    MorphingMotion morphingMotion_0 = _sim.get(MotionManager.class).createMotion(MorphingMotion.class, "Morphing");
    RbfMorpherParameters rbfMorpherParameters_0 = morphingMotion_0.getRbfMorpherParameters();
     rbfMorpherParameters_0.setAutomaticThinout(false);
    MorphingMotion morphingMotion_0 = _sim.get(MotionManager.class).createMotion(MorphingMotion.class, "Morphing");
    // B-Spline is used by default here. But we need to grab the relevant settings object.
    BsplineMorpherParameters bsplineMorpherParameters_0 =  morphingMotion_0.getBsplineMorpherParameters();
    bsplineMorpherParameters_0.setLinearFit(true);

材料属性:弃用各向异性材料属性指定方法

材料属性指定方法各向异性各向异性(原有)在 2210 版本中已弃用,并计划从以后的版本中移除。有关这些方法和计划替换的详细信息,请参见 2302 发行说明“重要说明”章节中的“材料属性”。

如果任何现有宏使用已弃用的材料属性方法(导热率、导电率、渗透率、介电常数的 9 个各向异性分量,或是导热率的各向异性(原有)),则搜索以下字符串的实例并更新它们,如下表中所示:

以前版本 Simcenter STAR-CCM+ 2302
AnisotropicElectricalConductivityMethodWithValues FullTensorElectricalConductivityMethodWithValues
AnisotropicPermeabilityMethodWithValues FullTensorPermeabilityMethodWithValues
AnisotropicPermittivityMethodWithValues FullTensorPermittivityMethodWithValues
AnisotropicThermalConductivityMethodWithValues FullTensorThermalConductivityMethodWithValues
AnisotropicThermalConductivityMethod FullTensorLegacyThermalConductivityMethod

电磁:部件曲线选择功能扩展导致的更改

由于添加了支持多个部件曲线的功能,相关宏代码已更改。

以前版本 Simcenter STAR-CCM+ 2302
import star.electromagnetism.common.LocalDirectionFieldFeatureCurveFlipOption;
import star.electromagnetism.common.LocalDirectionFieldFeatureCurveMethod;

LocalDirectionFieldFeatureCurveMethod method =
regionCoilB.getValues().get(LocalDirectionFieldProfile.class).getMethod(LocalDirectionFieldFeatureCurveMethod.class);
method.getFlipOption().setSelected(LocalDirectionFieldFeatureCurveFlipOption.FORWARD);

localDirectionFieldDirection_0.getDirectionOption().setSelected(LocalDirectionFieldFeatureCurveFlipOption.Type.RETURN);
import star.electromagnetism.common.LocalDirectionFieldFlipOption;
import star.electromagnetism.common.LocalDirectionFieldPartCurveMethod;_

LocalDirectionFieldPartCurveMethod method =
regionCoilB.getValues().get(LocalDirectionFieldProfile.class).getMethod(LocalDirectionFieldPartCurveMethod.class);
method.getFlipOption().setSelected(LocalDirectionFieldFlipOption.FORWARD);

localDirectionFieldDirection_0.getDirectionOption().setSelected(LocalDirectionFieldFlipOption.Type.RETURN);

电池建模:工作流的更改

电池热失控的引入更改了 Simcenter STAR-CCM+ 中的电池建模工作流程,宏代码因此进行了更改。

  • star.battery.EquivalentCircuitBatteryCell 已重命名为 star.battery.UserDefinedBatteryCell
    以前版本 Simcenter STAR-CCM+ 2302
    EquivalentCircuitBatteryCell equivalentCircuitBatteryCell_0 = ((EquivalentCircuitBatteryCell) batteryTool_0.getCells().getBatteryCellBase("Equivalent Circuit Battery Cell"));
    UserDefinedBatteryCell equivalentCircuitBatteryCell_0 =  ((UserDefinedBatteryCell) batteryTool_0.getCells().getBatteryCellBase("User Defined Battery Cell"));
  • 以前版本中的 EquivalentCircuitBatteryCell 默认包含 RCR 模型。在 Simcenter STAR-CCM+ 2302 中,UserDefinedBatteryCell 默认不包含任何模型。需要激活 RCR 模型。
以前版本 Simcenter STAR-CCM+ 2302
batteryTool_0.getCells().createUserDefinedBatteryCell();
UserDefinedBatteryCell equivalentCircuitBatteryCell_0 = (UserDefinedBatteryCell) batteryTool_0.getCells().createUserDefinedBatteryCell();
    equivalentCircuitBatteryCell_0.enableModel(ModelType.RCR);

Simcenter STAR-CCM+ In-cylinder:重新组织对象

Simcenter STAR-CCM+ In-cylinder 中使用的对象进行了各种更改。其中许多更改涉及从对象名称中移除 "1",以防与其他对象产生功能冲突。有关 Simcenter STAR-CCM+ In-cylinder UI 中特定更改的详细信息,请参见“Simcenter STAR-CCM+ In-Cylinder:重新组织对象”(《2302 发行说明》的“重要说明”章节)。

相关宏代码也因本次重新组织而更改:

  • 快速部件定义的名称已更改,使其与初始快速部件名称匹配。在宏中相应地更新名称。例如,getQuickPartDefinition("CustomCylinderDef 1") 现在必须为 getQuickPartDefinition("Cylinder")
  • 必须手动更新不遵循对象 : 数量格式的任何名称。
  • 只要显示网格单元最低质量网格单元最低质量 1 名称,调换它们。
  • 以下 Java 类已移除,如果宏中导入了它们,也必须移除:
    • CellCountMonitorPlot.java
    • CylinderMassMonitorPlot.java
    • CylinderPressureMonitorPlot.java
    • CylinderTemperatureMonitorPlot.java
    • CylinderTurbulenceKineticEnergyPlot.java
    • CylinderVolumeMonitorPlot.java
    • MinimumTimeStepMonitorPlot.java
    • PressureVolumeDiagramPlot.java
    • SwirlMonitorPlot.java
    • TumbleXMonitorPlot.java
    • TumbleYMonitorPlot.java