宏 API 更改 2019.2

Simcenter STAR-CCM+ 2019.2 中,宏 API 在表面准备、时间、运动、伴随、壁面距离、气动声学、多相、电磁、报告、协同仿真和 STAR-ICE 方面有所更改。

表面准备

薄体网格生成器最大厚度操作更改

薄体网格生成器最大厚度操作的用户界面已更改,导致宏代码更改。

以前发行版本 Simcenter STAR-CCM+ 2019.2
RelativeSize relativeSize_0 = ((RelativeSize) thinThicknessThreshold_0.getRelativeSizeValue());double value = relativeSize_0.getRelativeSize().getValue();
double value = thinThicknessThreshold_0.getRelativeSizeValue();
RelativeSize relativeSize_0 = ((RelativeSize) thinThicknessThreshold_0.getRelativeSizeValue());relativeSize_0.getRelativeSize().setValue(200.0);
thinThicknessThreshold_0.setRelativeSizeValue(200.0);
AbsoluteSize absoluteSize_0 = ((AbsoluteSize) thinThicknessThreshold_0.getAbsoluteSizeValue());double value = absoluteSize_0.getValue().getValue();
((ScalarPhysicalQuantity) thinThicknessThreshold_0.getAbsoluteSizeValue()).getValue();
AbsoluteSize absoluteSize_0 = ((AbsoluteSize) thinThicknessThreshold_0.getAbsoluteSizeValue());absoluteSize_0.getValue().setValue(1.0);
((ScalarPhysicalQuantity) thinThicknessThreshold_0.getAbsoluteSizeValue()).setValue(1.0);

抽取体积操作更改

由于重构,用于抽取体积操作的宏代码已更改。虽然以下示例显示对代码直接进行修复,但我们建议您使用随后显示的非弃用 API 方法。

以前发行版本 Simcenter STAR-CCM+ 2019.2
ExtractVolumeOperation extractVolumeOperation_0 = ((ExtractVolumeOperation) simulation_0.get(MeshOperationManager.class).getObject("Extract Volume"));
Coordinate coordinate_0 = extractVolumeOperation_0.getVolumePoint();
Units units = getActiveSimulation().getUnitsManager().getPreferredUnits(new IntVector(new int[] {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}));
coordinate_0.setCoordinate(units, units, units, new DoubleVector(new double[] {0.0, 0.0, 0.1}));
ExtractVolumeOperation extractVolumeOperation_0 = ((ExtractVolumeOperation) simulation_0.get(MeshOperationManager.class).getObject("Extract Volume"));
VectorPhysicalQuantity vectorPhysicalQuantity_0 = extractVolumeOperation_0.getVolumePoint();
vectorPhysicalQuantity_0.setVector(new DoubleVector(new double[] {0.0, 0.0, 0.1}));

非弃用 API 方法会访问手工体积对象,有利于实现长期可靠性,以下示例显示了该方法:

ExtractVolumeOperation extractVolumeOperation_0 = ((ExtractVolumeOperation) simulation_0.get(MeshOperationManager.class).getObject("Extract Volume"));
EVManualVolume eVManualVolume_0 = ((EVManualVolume) extractVolumeOperation_0.getManualVolumes().getObject("Extract Volume"));
EVSeedPoint eVSeedPoint_0 = ((EVSeedPoint) eVManualVolume_0.getVolumePoints().getObject("Seed Point 1"));
eVSeedPoint_0.getCoordinates().setComponents(0.0, 0.0, 0.1);

时间:时间步架构更改

自适应时间步架构组合了两个之前不同的架构(时间步控制和分离时间步),导致宏代码更改:

  • 激活自适应时间步提供程序对流 CFL 条件热扩散率条件
    以前发行版本 Simcenter STAR-CCM+ 2019.2
    PhysicsContinuum physicsContinuum_0 = 
      ((PhysicsContinuum) getActiveSimulation().getContinuumManager().getContinuum("Physics 1"));
    physicsContinuum_0.enable(ConvectiveCflTimeStepControlModel.class);
    physicsContinuum_0.enable(EnergyBasedTimeStepControlModel.class)
    PhysicsContinuum physicsContinuum_0 = 
      ((PhysicsContinuum) getActiveSimulation().getContinuumManager().getContinuum("Physics 1"));
    physicsContinuum_0.enable(AdaptiveTimeStepModel.class);
    
    AdaptiveTimeStepModel adaptiveTimeStepModel_0 =
      physicsContinuum_0.getModelManager().getModel(AdaptiveTimeStepModel.class);
    
    adaptiveTimeStepModel_0.getTimeStepProviderManager().createObject(ConvectiveCflTimeStepProvider.class);
    adaptiveTimeStepModel_0.getTimeStepProviderManager().createObject(ThermalDiffusivityTimeStepProvider.class);
  • 激活自适应时间步提供程序自由表面 CFL 条件融化-凝固条件
    以前发行版本 Simcenter STAR-CCM+ 2019.2
    PhysicsContinuum physicsContinuum_0 = 
      ((PhysicsContinuum) getActiveSimulation().getContinuumManager().getContinuum("Physics 1"));
    
    physicsContinuum_0.enable(SegregatedFluidTimeStepModel.class); 
    
    // above enables "VOF" and "Melting-Solidification" time-step methods
    // given that corresponding models exist
    PhysicsContinuum physicsContinuum_0 = 
      ((PhysicsContinuum) getActiveSimulation().getContinuumManager().getContinuum("Physics 1"));
    physicsContinuum_0.enable(AdaptiveTimeStepModel.class);
    
    AdaptiveTimeStepModel adaptiveTimeStepModel_0 =
      physicsContinuum_0.getModelManager().getModel(AdaptiveTimeStepModel.class);
    
    adaptiveTimeStepModel_0.getTimeStepProviderManager().createObject(FreeSurfaceCflTimeStepProvider.class);
    adaptiveTimeStepModel_0.getTimeStepProviderManager().createObject(VofEnthalpyMeltingTimeStepProvider.class);

    之前的分离时间步方法能量已被弃用。虽然我们不鼓励使用它们,但可以使用宏激活它们以向后兼容。可以使用 SegregatedFlowTimeStepMethod.classSegregatedEnergyTimeStepMethod.class 创建它们,与上述代码等效。

  • 修改对流 CFL 时间步控制基于能量的时间步控制的属性变为修改热扩散率条件的属性:
    以前发行版本 Simcenter STAR-CCM+ 2019.2
    TimeStepControlSolver timeStepControlSolver_0 = 
      ((TimeStepControlSolver) getActiveSimulation().getSolverManager().getSolver(TimeStepControlSolver.class));
    
    TimeStepControlSubSolverManager timeStepControlSubSolverManager_0 =
      ((TimeStepControlSubSolverManager) timeStepControlSolver_0.getTimeStepControlSubSolverManager());
    
    ConvectiveCflTimeStepControlSolver convectiveCflTimeStepControlSolver_0 = 
      ((ConvectiveCflTimeStepControlSolver) timeStepControlSubSolverManager_0.getSolver("Convective CFL Time-Step Control"));
    convectiveCflTimeStepControlSolver_0.getTargetMeanCfl().setValue(2.4);
    convectiveCflTimeStepControlSolver_0.getTargetMaxCfl().setValue(40.0);
    
    EnergyBasedTimeStepControlSolver energyTimeStepControlSolver_0 = 
      ((EnergyBasedTimeStepControlSolver) timeStepControlSubSolverManager_0.getSolver("Energy-Based Time-Step Control"));
    energyTimeStepControlSolver_0.getTargetMeanVonNeumannNumber().setValue(0.002);
    energyTimeStepControlSolver_0.getTargetMaxVonNeumannNumber().setValue(0.005);
    ConvectiveCflTimeStepProvider convectiveCflTimeStepProvider_0 = 
      ((ConvectiveCflTimeStepProvider) adaptiveTimeStepModel_0.getTimeStepProviderManager().getObject("Convective CFL Condition"));
    convectiveCflTimeStepProvider_0.getTargetMaxCfl().setValue(2.4);
    convectiveCflTimeStepProvider_0.getTargetMeanCfl().setValue(40.0);
    
    ThermalDiffusivityTimeStepProvider thermalDiffusivityTimeStepProvider_0 =
      ((ThermalDiffusivityTimeStepProvider) adaptiveTimeStepModel_0.getTimeStepProviderManager().getObject("Thermal Diffusivity Condition"));
    thermalDiffusivityTimeStepProvider_0.getTargetMeanVonNeumannNumber().setValue(0.002);
    thermalDiffusivityTimeStepProvider_0.getTargetMaxVonNeumannNumber().setValue(0.005);
  • 修改 VOF融化-凝固时间步方法的属性变为修改自由表面 CFL 条件融化-凝固条件的属性:
    以前发行版本 Simcenter STAR-CCM+ 2019.2
    SegregatedFluidTimeStepModel segregatedFluidTimeStepModel_0 = 
      physicsContinuum_0.getModelManager().getModel(SegregatedFluidTimeStepModel.class);
    
    SegregatedVofTimeStepMethod segregatedVofTimeStepMethod_0 = 
      segregatedFluidTimeStepModel_0.getMethod(SegregatedVofTimeStepMethod.class);
    ((ScalarPhysicalQuantity) segregatedVofTimeStepMethod_0.getMaxConditionLimit()).setValue(0.2);
    ((ScalarPhysicalQuantity) segregatedVofTimeStepMethod_0.getSmoothingSteps()).setValue(3.0);
    
    EnthalpyMeltingTimeStepMethod enthalpyMeltingTimeStepMethod_0 = 
      segregatedFluidTimeStepModel_0.getMethod(EnthalpyMeltingTimeStepMethod.class);
    ((ScalarPhysicalQuantity) enthalpyMeltingTimeStepMethod_0.getMaxConditionLimit()).setValue(1.0);
    ((ScalarPhysicalQuantity) enthalpyMeltingTimeStepMethod_0.getSmoothingSteps()).setValue(0.0);
    FreeSurfaceCflTimeStepProvider freeSurfaceCflTimeStepProvider_0 = 
      ((FreeSurfaceCflTimeStepProvider) adaptiveTimeStepModel_0.getTimeStepProviderManager().getObject("Free Surface CFL Condition"));
    freeSurfaceCflTimeStepProvider_0.getMaxConditionLimit().setValue(0.2);
    freeSurfaceCflTimeStepProvider_0.getSmoothingSteps().setValue(3.0);
    
    VofEnthalpyMeltingTimeStepProvider vofEnthalpyMeltingTimeStepProvider_0 = 
      ((VofEnthalpyMeltingTimeStepProvider) adaptiveTimeStepModel_0.getTimeStepProviderManager().getObject("Melting-Solidification Condition"));
    vofEnthalpyMeltingTimeStepProvider_0.getMaxConditionLimit().setValue(1.0);
    vofEnthalpyMeltingTimeStepProvider_0.getSmoothingSteps().setValue(0.0);

    之前的分离时间步方法能量已被弃用。虽然我们不鼓励使用它们,但可以使用宏激活它们以向后兼容。它们的显示名称分别为流(分离时间步)能量(分离时间步)。修改上述属性即可修改它们的属性。

  • 修改时间步控制求解器的属性变为修改自适应时间步求解器的属性:
    以前发行版本 Simcenter STAR-CCM+ 2019.2
    TimeStepControlSolver timeStepControlSolver_0 = 
      ((TimeStepControlSolver) getActiveSimulation().getSolverManager().getSolver(TimeStepControlSolver.class));
    
    ((ScalarPhysicalQuantity) timeStepControlSolver_0.getMinTimeStep()).setValue(1.0E-5);
    timeStepControlSolver_0.setMaxTimeStepChangeFactor(1.8);
    timeStepControlSolver_0.setVerbose(true);
    AdaptiveTimeStepSolver adaptiveTimeStepSolver_0 = 
      ((AdaptiveTimeStepSolver) getActiveSimulation().getSolverManager().getSolver(AdaptiveTimeStepSolver.class));
    
    adaptiveTimeStepSolver_0.setInitialTimeStepOption(AdaptiveTimeStepInitializationOption.MINIMUM);
    adaptiveTimeStepSolver_0.getMinimumTimeStep().setValue(1.0E-5);
    adaptiveTimeStepSolver_0.setVerbose(true);
    adaptiveTimeStepSolver_0.setChangeFactorBoundsOption(true);
    
    AdaptiveTimeStepChangeFactorBounds adaptiveTimeStepChangeFactorBounds_0 = 
      ((AdaptiveTimeStepChangeFactorBounds) adaptiveTimeStepSolver_0.getChangeFactorBounds());
    adaptiveTimeStepChangeFactorBounds_0.setMaximumChangeFactor(1.8);

    最小时间步用作初始时间步长。需要为自适应时间步求解器明确指定此值。此外,默认情况下,时间步变化因子边界选项在新求解器中处于不活动状态。

  • 修改分离时间步模型的属性变为修改自适应时间步求解器的属性:
    以前发行版本 Simcenter STAR-CCM+ 2019.2
    SegregatedFluidTimeStepModel segregatedFluidTimeStepModel_0 = 
      physicsContinuum_0.getModelManager().getModel(SegregatedFluidTimeStepModel.class);
    
    ((ScalarPhysicalQuantity) segregatedFluidTimeStepModel_0.getStartTimeStep()).setValue(1.0E-4);
    ((ScalarPhysicalQuantity) segregatedFluidTimeStepModel_0.getMinTimeStep()).setValue(1.0E-5);
    segregatedFluidTimeStepModel_0.setMaxTimeStepChangeFactors(new DoubleVector(new double[] {1.8, 2.5}));
    segregatedFluidTimeStepModel_0.setVerboseFlag(true);
    AdaptiveTimeStepSolver adaptiveTimeStepSolver_0 = 
      ((AdaptiveTimeStepSolver) getActiveSimulation().getSolverManager().getSolver(AdaptiveTimeStepSolver.class));
    
    adaptiveTimeStepSolver_0.setInitialTimeStepOption(AdaptiveTimeStepInitializationOption.SPECIFIED);
    adaptiveTimeStepSolver_0.getSpecifiedInitialTimeStep().setValue(1.0E-4);
    adaptiveTimeStepSolver_0.getMinimumTimeStep().setValue(1.0E-5);
    adaptiveTimeStepSolver_0.setVerbose(true);
    adaptiveTimeStepSolver_0.setChangeFactorBoundsOption(true);
    
    AdaptiveTimeStepChangeFactorBounds adaptiveTimeStepChangeFactorBounds_0 = 
      ((AdaptiveTimeStepChangeFactorBounds) adaptiveTimeStepSolver_0.getChangeFactorBounds());
    adaptiveTimeStepChangeFactorBounds_0.setMaximumChangeFactor(1.8);
    adaptiveTimeStepChangeFactorBounds_0.setMinimumChangeFactor(1./2.5);

    默认情况下,时间步变化因子边界选项在新求解器中处于禁用状态。此外,之前的 (向上, 向下) 最大时间步变化因子矢量的第二个值(即现在的最小变化因子)被视为倒数值。

  • 以下示例显示如何修改分离时间步模型开始时间结束时间的属性。

    结束时间(晚于开始时间)的作用不仅是在达到该时间之后停用模型,还可确保精确达到该时间。在新架构中(如右侧所示),该双重作用要求在两个位置指定值,以使每个时间步提供程序和自适应时间步求解器在该时间之后停用。

    以前发行版本 Simcenter STAR-CCM+ 2019.2
    SegregatedFluidTimeStepModel segregatedFluidTimeStepModel_1 = 
      physicsContinuum_0.getModelManager().getModel(SegregatedFluidTimeStepModel.class);
    ((ScalarPhysicalQuantity) segregatedFluidTimeStepModel_1.getStartTime()).setValue(0.3);
    ((ScalarPhysicalQuantity) segregatedFluidTimeStepModel_1.getEndTime()).setValue(2.6);
    AdaptiveTimeStepModel adaptiveTimeStepModel_0 = 
      physicsContinuum_0.getModelManager().getModel(AdaptiveTimeStepModel.class);
    
    ConvectiveCflTimeStepProvider convectiveCflTimeStepProvider_0 = 
      ((ConvectiveCflTimeStepProvider) adaptiveTimeStepModel_0.getTimeStepProviderManager().getObject("Convective CFL Condition"));
    convectiveCflTimeStepProvider_0.setEnabledOption(AdaptiveTimeStepProviderOption.TIME_RANGE);
    
    EnabledTimeRange enabledTimeRange_0 = 
      ((EnabledTimeRange) convectiveCflTimeStepProvider_0.getEnabledTimeRange());
    enabledTimeRange_0.getStartTime().setValue(0.3);
    enabledTimeRange_0.setEnableStop(true);
    enabledTimeRange_0.getStopTime().setValue(2.6);
    
    AdaptiveTimeStepSolver adaptiveTimeStepSolver_0 = 
      ((AdaptiveTimeStepSolver) getActiveSimulation().getSolverManager().getSolver(AdaptiveTimeStepSolver.class));
    adaptiveTimeStepSolver_0.setCheckpointTimes(new DoubleVector(new double[] {2.6}));

运动:变形条件处理更改

由于 Simcenter STAR-CCM+ 使用边界条件的方式有所改进,RigidBody 边界条件和 MorpherSpecification 已被弃用。为了确保行为与以前版本的 Simcenter STAR-CCM+ 保持一致,请按如下示例所示更新您的宏。

以前发行版本 Simcenter STAR-CCM+ 2019.2
Boundary boundary_14 = boundaryManager.getBoundary("car-bdy");
boundary_14.getConditions().get(MorpherSpecification.class).setSelected(MorpherSpecification.Type.RIGIDBODY);
AngularDisplacementProfile angularDisplacementProfile_0 = boundary_14.getValues().get(AngularDisplacementProfile.class); 
Units units_0 = ((Units) sim.getUnitsManager().getObject("deg"));
((ConstantScalarProfileMethod) angularDisplacementProfile_0.getMethod()).getQuantity().setUnits(units_0);
((ConstantScalarProfileMethod) angularDisplacementProfile_0.getMethod()).getQuantity().setValue(1.0);
RigidBodyBCValues rigidBodyBCValues_0 = boundary_14.getValues().get(RigidBodyBCValues.class);
rigidBodyBCValues_0.setAXIS(new DoubleVector(new double[] {0.0, 1.0, 0.0}));
rigidBodyBCValues_0.setORIGIN(new DoubleVector(new double[] {0.5, 0.0, 0.3}));
// 1. create a new rigid motion with all the relevant parameters

RotatingAndTranslatingMotion rigidMotion = 
  sim.get(MotionManager.class).createMotion(RotatingAndTranslatingMotion.class,
                                            "Rotation and Translation");

rigidMotion.getAxisOrigin().setComponents(0.5, 0.0, 0.3);
rigidMotion.getAxisDirection().setComponents(0.0, 1.0, 0.0);
rigidMotion.getRotationRate().setDefinition("0.174533"); // old_angular_step / time_step

// 2. Assign rigid motion to boundary's conditions
boundary_14.getConditions().get(MorpherSpecification.class).setSelected(MorpherSpecification.Type.DISPLACEMENT);
MotionHandle motionHandle_0 = boundary_14.getValues().get(MotionHandle.class);
motionHandle_0.setMotion(rigidMotion);

Simcenter STAR-CCM+ 2019.2 中,仅可通过宏访问的以下变形边界条件已被移除且不再受支持。

  • MorpherSpecification.Type.GRID_VELOCITY
  • MorpherSpecification.Type.PROSTAR
  • MorpherSpecification.Type.FIXEDPLANE
  • MorpherSpecification.Type.BEAM
  • MorpherSpecification.Type.SOLIDSTRESS
  • MorpherSpecification.Type.RIGIDBODY
  • MorpherSpecification.Type.SLIDING
  • MorpherSpecification.Type.RIGIDSLIDING
  • MorpherSpecification.Type.ABAQUSCOSIMULATION
  • MorpherSpecification.Type.RIGIDMOTION
  • MorpherSpecification.Type.STARCOSIMULATION
  • MorpherSpecification.Type.INTERNAL
  • MorpherSpecification.Type.SLIDE_ON_SURFACE

伴随

Simcenter STAR-CCM+ 2019.2 中,引入了高级别 AdjointModel 作为其他伴随模型的“守卫”。因此,该新增伴随模型是激活任何其他模型的前提条件。

在以下宏代码更改实例中,要使现有宏继续按预期正常工作,必须激活 AdjointModel。但是,为了获得长期可靠性,建议使用此处列出的伴随宏代码的所有其他更改更新宏。

模型选择更改

要激活 AdjointFlowModelAdjointSolidEnergyModel,需激活 AdjointModel

以前发行版本 Simcenter STAR-CCM+ 2019.2
continuum.enable(AdjointFlowModel.class);
continuum.enable(AdjointModel.class);
continuum.enable(AdjointFlowModel.class);
continuum.enable(AdjointSolidEnergyModel.class);
continuum.enable(AdjointModel.class);
continuum.enable(AdjointSolidEnergyModel.class);

伴随求解器步进和运行更改

Simcenter STAR-CCM+ 2019.2 中,AdjointRunnableSolver 已从 AdjointFlowSolver 移至 AdjointSolver。这意味着,要步进或运行伴随求解器,应修改宏,以使用新求解器来访问 AdjointRunnableSolver

以前发行版本 Simcenter STAR-CCM+ 2019.2
AdjointFlowSolver adjointFlowSolver_0 = simulation.getSolverManager().getSolver(AdjointFlowSolver.class);
AdjointRunnableSolver adjointRunnableSolver_0 = adjointFlowSolver_0.getAdjointRunnableSolver();
simulation_0.getSimulationIterator().step(adjointRunnableSolver_0, 1);
AdjointSolver adjointSolver_0 = simulation.getSolverManager().getSolver(AdjointSolver.class);
AdjointRunnableSolver adjointRunnableSolver_0 = adjointSolver_0.getAdjointRunnableSolver();
simulation_0.getSimulationIterator().step(adjointRunnableSolver_0, 1);

AdjointFlowSolver 用于访问 AdjointRunnableSolver 的方法已被弃用,因此现有宏应继续正常工作,前提是 AdjointSolver 已正确注册。为此,必须激活 AdjointModel

求解器访问更改

Simcenter STAR-CCM+ 2019.2 中,AdjointFlowSolverAdjointMeshSolverSurfaceSensitivitySolver 已从 SolverManager 移至高级别 AdjointSolver 下的 AdjointSolverManager。必须更改访问这些求解器的宏,使其先通过此高级别求解器。

以前发行版本 Simcenter STAR-CCM+ 2019.2
simulation.getSolverManager().getSolver(AdjointFlowSolver.class);
simulation.getSolverManager().getSolver(AdjointSolver.class).getAdjointSolverManager().getSolver(AdjointFlowSolver.class);
simulation.getSolverManager().getSolver(AdjointMeshSolver.class);
simulation.getSolverManager().getSolver(AdjointSolver.class).getAdjointSolverManager().getSolver(AdjointMeshSolver.class);
simulation.getSolverManager().getSolver(SurfaceSensitivitySolver.class);
simulation.getSolverManager().getSolver(AdjointSolver.class).getAdjointSolverManager().getSolver(SurfaceSensitivitySolver.class);

如果 AdjointSolver 已正确注册,则现有宏应继续正常工作。为此,必须激活 AdjointModel

加速选项和 GMRES 设置更改

Simcenter STAR-CCM+ 2019.2 中,AdjointAccelerationOption 已从 AdjointFlowSolver 移至 AdjointSolver。要设置加速选项,需要更改宏才能访问新求解器。

以前发行版本 Simcenter STAR-CCM+ 2019.2
AdjointFlowSolver adjointFlowSolver_0 = simulation.getSolverManager().getSolver(AdjointFlowSolver.class);
AdjointAccelerationOption option = adjointFlowSolver_0.getAccelerationOption();
AdjointSolver adjointSolver_0 = simulation.getSolverManager().getSolver(AdjointSolver.class);
AdjointAccelerationOption option = adjointSolver_0.getAccelerationOption();

GMRES 设置也已更改位置:从 GMRESDriver(和 FlexGMRESDriver)移至 GmresSettings(和 FlexibleGmresSettings)。要设置任何 GMRES 属性(例如克雷洛夫空间维度),更新宏以访问 AdjointSolver 中的设置。

以前发行版本 Simcenter STAR-CCM+ 2019.2
AdjointFlowSolver adjointFlowSolver_0 = simulation.getSolverManager().getSolver(AdjointFlowSolver.class);
GMRESDriver driver = adjointFlowSolver_0.getGMRESDriver();
driver.setKrylovSpaceDimension(50);
AdjointSolver adjointSolver_0 = simulation.getSolverManager().getSolver(AdjointSolver.class);
GmresSettings settings = adjointSolver_0.getGmresSettings();
settings.setKrylovSpaceDimension(50);

对于加速选项和 GMRES 设置,现有宏应继续正常工作。

壁面距离

壁面距离求解器(和 VOF 波区距离求解器)更改

壁面距离求解器选项属性已从求解器移至壁面距离模型属性,显示为壁面距离方法属性。此项传输导致宏代码更改。VOF 波区距离求解器还继承壁面距离求解器的属性,因此需要类似的宏代码更改。要选择特定的壁面距离选项,按如下示例所示更新宏。

以前发行版本 Simcenter STAR-CCM+ 2019.2
Simulation simulation_0 =
    getActiveSimulation();

WallDistanceSolver wallDistanceSolver_0 =
((WallDistanceSolver)
simulation_0.getSolverManager().getSolver(WallDistanceSolver.class));

wallDistanceSolver_0.getWallDistanceOption().
setSelected(WallDistanceOption.Type.IMPLICIT_TREE);
Simulation simulation_0 =
    getActiveSimulation();

PhysicsContinuum physicsContinuum_0
    = ((PhysicsContinuum)
simulation_0.getContinuumManager().getContinuum("Fluid"));

WallDistanceModel wallDistanceModel_0 =
physicsContinuum_0.getModelManager().getModel(WallDistanceModel.class);

wallDistanceModel_0.getBoundaryDistanceOption().setSelected(BoundaryDistanceOption.Type.IMPLICIT_TREE);

如果宏代码要启用已弃用的空间填充曲线 (SFC/SIMD) 方法进行距离计算,则按如下示例所示更新宏。

在以前的版本中,已弃用 SFC/SIMD 方法,并且在选择此选项时会自动选择隐式树方法。

以前发行版本 Simcenter STAR-CCM+ 2019.2
Simulation simulation_0 =
    getActiveSimulation();

WallDistanceSolver wallDistanceSolver_0 =
((WallDistanceSolver)
simulation_0.getSolverManager().getSolver(Wal
lDistanceSolver.class));

wallDistanceSolver_0.setUseSfcSimd(true);
Simulation simulation_0 =
    getActiveSimulation();

PhysicsContinuum physicsContinuum_0
    = ((PhysicsContinuum)
simulation_0.getContinuumManager().getContinuum("Fluid"));

WallDistanceModel wallDistanceModel_0 =
physicsContinuum_0.getModelManager().getModel(WallDistanceModel.class);

wallDistanceModel_0.getBoundaryDistanceOption().setSelected(BoundaryDistanceOption.Type.IMPLICIT_TREE);

传递 PDE 壁面距离模型

已移除 PDE 壁面距离模型节点,并且在壁面距离模型节点的壁面距离方法属性下方,已添加相应选项以使用 PDE 方法计算壁面距离。此删除导致宏代码更改。要设置 PDE 壁面距离方法,按如下示例所示更新宏。

以前发行版本 Simcenter STAR-CCM+ 2019.2
Simulation simulation_0 =
    getActiveSimulation();

PhysicsContinuum physicsContinuum_0
    = ((PhysicsContinuum)
simulation_0.getContinuumManager().getContinuum("Fluid"));

physicsContinuum_0.enable(PdeWallDistanceModel.class);
Simulation simulation_0 =
    getActiveSimulation();

PhysicsContinuum physicsContinuum_0
    = ((PhysicsContinuum)
simulation_0.getContinuumManager().getContinuum("Fluid"));

WallDistanceModel wallDistanceModel_0 =
physicsContinuum_0.getModelManager().getModel(WallDistanceModel.class);

wallDistanceModel_0.getBoundaryDistanceOption().setSelected(BoundaryDistanceOption.Type.PDE);

气动声学:后 Ffowcs Williams-Hawkings (FW-H) 模型更改

对于(后 FW-H 模型的)后点接收器,属性选项声学数据源已移至后 FW-H 接收器节点管理器。

因此,如果任何旧宏使用的后 FW-H 模型针对不同的后点接收器使用不同的声学数据源设置,则这些旧宏将自动使用默认选项

以前发行版本 Simcenter STAR-CCM+ 2019.2
pointFwhPostProcessingReceiver_0.getAcousticDataSourceOption().setSelected(AcousticDataSourceOption.Type.APE);
simulation_0.get(FwhPostProcessingReceiverManager.class).getAcousticDataSourceOption().setSelected(AcousticDataSourceOption.Type.APE);

多相:合并波状剥离和边缘剥离

为了简化工作流,波状剥离和边缘剥离已重构,导致宏代码更改。

已移除以下类:

  • FilmEdgeStrippingDmpModel.class
  • FilmEdgeStrippingEMPModel.class
  • FilmEdgeStrippingLagrangianModel.class
  • FilmWaveStrippingDmpModel.class
  • FilmWaveStrippingEMPModel.class
  • FilmWaveStrippingLagrangianModel.class

要设置液膜剥离模型,应使用以下类:

  • FilmStrippingDmpModel.class
  • FilmStrippingEMPModel.class
  • FilmStrippingLagrangianModel.class

应使用正确的 FilmStrippingOption 来调用方法 setStrippingOption。可使用三个选项:

  • ONLY_EDGE_STRIPPING
  • ONLY_WAVE_STRIPPING
  • EDGE_AND_WAVE_STRIPPING(默认)

要更改剥离模型的属性,使用以下方法访问边缘和波状子模型:

  • getFilmEdgeStrippingSubModel()
  • getFilmWaveStrippingSubModel()

以下示例适用于离散多相模型剥离 (DMP):

边缘剥离

以前发行版本 Simcenter STAR-CCM+ 2019.2
phaseInteraction_1.enable(FilmEdgeStrippingDmpModel.class);
phaseInteraction_1.enable(FilmStrippingDmpModel.class);
FilmStrippingDmpModel filmStrippingDmpModel_0 =
  phaseInteraction_1.getModelManager().getModel(FilmStrippingDmpModel.class);
filmStrippingDmpModel_0.setStrippingOption(FilmStrippingOption.ONLY_EDGE_STRIPPING);

波状剥离

以前发行版本 Simcenter STAR-CCM+ 2019.2
phaseInteraction.enable(FilmWaveStrippingDmpModel.class);
phaseInteraction_1.enable(FilmStrippingDmpModel.class);
FilmStrippingDmpModel filmStrippingDmpModel_0 =
  phaseInteraction_1.getModelManager().getModel(FilmStrippingDmpModel.class);
filmStrippingDmpModel_0.setStrippingOption(FilmStrippingOption.ONLY_WAVE_STRIPPING);

边缘和波状剥离

以前发行版本 Simcenter STAR-CCM+ 2019.2
phaseInteraction_1.enable(FilmEdgeStrippingDmpModel.class);
phaseInteraction_1.enable(FilmWaveStrippingDmpModel.class);
phaseInteraction_1.enable(FilmStrippingDmpModel.class);

更改属性

以前发行版本 Simcenter STAR-CCM+ 2019.2
phaseInteraction_1.getModelManager().getModel(FilmWaveStrippingDmpModel.class).setCShear2Free(15.0);
phaseInteraction_1.getModelManager().getModel(FilmStrippingDmpModel.class).getFilmWaveStrippingSubModel().setCShear2Free(15.0);

电磁:新导入涡流抑制模型

由于重构,涡流抑制模型现已从磁势库中导入,而不是从电阻加热导入。要更新宏,使用 import star.electromagnetism.magneticpotential.EddyCurrentSuppressionModel; 替换所有 import star.electromagnetism.ohmicheating.EddyCurrentSuppressionModel; 实例。

报告:统计数据报告的样本开始事件属性更改

由于重构了协同时间值的监视,宏代码已发生更改。现有宏将继续按预期正常工作,但为获得最大可靠性,建议按如下示例所示更新宏代码。

以前发行版本 Simcenter STAR-CCM+ 2019.2
LastNSamplesFilter lastNSamplesFilter_0 = ((LastNSamplesFilter) statisticsReport_0.getSampleFilterManager().getObject("Last N Samples"));
SampleSetStartEventWatcher sampleSetStartEventWatcher_0 = lastNSamplesFilter_0.getSampleSetStartEventWatcher();
DeltaMonitorUpdateEvent deltaMonitorUpdateEvent_0 = ((DeltaMonitorUpdateEvent) simulation_0.getUpdateEventManager().getUpdateEvent("Monitor Delta"));
sampleSetStartEventWatcher_0.setUpdateEvent(deltaMonitorUpdateEvent_0);
LastNSamplesFilter lastNSamplesFilter_0 = ((LastNSamplesFilter) statisticsReport_0.getSampleFilterManager().getObject("Last N Samples"));
DeltaMonitorUpdateEvent deltaMonitorUpdateEvent_0 = ((DeltaMonitorUpdateEvent) simulation_0.getUpdateEventManager().getUpdateEvent("Monitor Delta"));
lastNSamplesFilter_0.setUpdateEvent(deltaMonitorUpdateEvent_0);

如果已编辑自动生成的宏,则可能会遇到附带问题,因为 SampleSetStartEventWatcher 不再是 ClientServerObject。考虑以下示例:调用 LastNSamples::getSampleStartEventWatcher() 的返回值被分配给声明为 ClientServerObject 的变量,随后转换为 SampleSetStartEventWatcher,以便可以调用 setUpdateEvent() 方法:

LastNSamplesFilter lastNSamplesFilter_0 = ((LastNSamplesFilter) statisticsReport_0.getSampleFilterManager().getObject("Last N Samples"));
ClientServerObject cso = lastNSamplesFilter_0.getSampleSetStartEventWatcher();
DeltaMonitorUpdateEvent deltaMonitorUpdateEvent_0 = ((DeltaMonitorUpdateEvent)
simulation_0.getUpdateEventManager().getUpdateEvent("Monitor Delta"));
((SampleSetStartEventWatcher) sampleSetStartEventWatcher_0).setUpdateEvent(deltaMonitorUpdateEvent_0);

此类更改过的代码在 2019.1 中可正确执行,但在 2019.2 中无法正确执行,您需要根据上面的建议修改代码。

协同仿真

耦合术语更改

为了更清晰地说明,术语耦合时间步已替换为耦合间隔,导致宏代码更改。

star.cosimulation.abaqus.ConstantCouplingTimeStep 已替换为 star.cosimulation.common.CoSimCouplingInterval

以前发行版本 Simcenter STAR-CCM+ 2019.2
// class import
import star.cosimulation.abaqus.ConstantCouplingTimeStep;

// class usage
ConstantCouplingTimeStep constantCouplingTimeStep_0 = coSimulation_0.getCoSimulationValues().get(ConstantCouplingTimeStep.class);
constantCouplingTimeStep_0.getValue().setValue(0.42);
// class import
import star.cosimulation.common.CoSimCouplingInterval;

// class usage
CoSimCouplingInterval coSimCouplingInterval_0 = coSimulation_0.getCoSimulationValues().get(CoSimCouplingInterval.class);
coSimCouplingInterval_0.getCouplingInterval().setValue(0.42);

star.cosimulation.common.CoSimCouplingTimeStep 已替换为 star.cosimulation.common.CoSimCouplingInterval

以前发行版本 Simcenter STAR-CCM+ 2019.2
// class import
import star.cosimulation.common.CoSimCouplingTimeStep;

// class had the method getCouplingTimeStep
CoSimCouplingTimeStep coSimCouplingTimeStep_0 = coSimulation_0.getCoSimulationValues().get(CoSimCouplingTimeStep.class);
coSimCouplingTimeStep_0.getCouplingTimeStep().setValue(0.42);
// class import
import star.cosimulation.common.CoSimCouplingInterval;

// class now has the method getCouplingInterval instead
CoSimCouplingInterval coSimCouplingInterval_0 = coSimulation_0.getCoSimulationValues().get(CoSimCouplingInterval.class);
coSimCouplingInterval_0.getCouplingInterval().setValue(0.42);

star.cosimulation.common.CoSimAssignedCouplingTimeStep 已替换为 star.cosimulation.common.CoSimAssignedCouplingInterval

以前发行版本 Simcenter STAR-CCM+ 2019.2
// class import
import star.cosimulation.common.CoSimAssignedCouplingTimeStep;

// class the method getCouplingTimeStep
CoSimAssignedCouplingTimeStep coSimCouplingTimeStep_0 = coSimulation_0.getCoSimulationValues().get(CoSimAssignedCouplingTimeStep.class);
coSimAssignedCouplingTimeStep_0.getCouplingTimeStep().setValue(0.42);
// class import
import star.cosimulation.common.CoSimAssignedCouplingInterval;

// class now has the method getCouplingInterval instead
CoSimAssignedCouplingInterval coSimCouplingInterval_0 = coSimulation_0.getCoSimulationValues().get(CoSimAssignedCouplingInterval.class);
CoSimAssignedCouplingInterval_0.getCouplingInterval().setValue(0.42);

名称处理更改

由于在场储存和其他名称处理方面有所改进,因此宏代码发生了更改:

  • 同一区域下具有相同名称的导出场和导入场不再视为有效设置。在这种情况下,已重命名导入场。

    以前发行版本 Simcenter STAR-CCM+ 2019.2
    ScalarAuxiliaryImportSpecification scalarAuxiliaryImportSpecification_0 = 
      ((ScalarAuxiliaryImportSpecification) coSimulationZone_0.getCoSimulationZoneConditions().get(ImportFieldSpecificationManager.class).getObject("Scalar Auxiliary Field 1"));
    ScalarAuxiliaryImportSpecification scalarAuxiliaryImportSpecification_0 = 
      ((ScalarAuxiliaryImportSpecification) coSimulationZone_0.getCoSimulationZoneConditions().get(ImportFieldSpecificationManager.class).getObject("Scalar Auxiliary Field 1 2"));
  • 协同仿真场函数的函数名称已更改,便于在多个区域中导入相同的场。

    以前发行版本 Simcenter STAR-CCM+ 2019.2
    PrimitiveFieldFunction primitiveFieldFunction_0 = 
      ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("CosimImportScalarAuxiliaryField1"));
    PrimitiveFieldFunction primitiveFieldFunction_0 = 
      ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("Cosim.Scalar Auxiliary Field 1"));
  • 由于同一区域下的导出场和导入场不能再同名,因此导入/导出限制已从初始化值、Simcenter Amesim 端口关联和 WAVE 引脚关联的名称中移除。

    以前发行版本 Simcenter STAR-CCM+ 2019.2
    CoSimScalarInitializationValue coSimScalarInitializationValue_0 = 
      ((CoSimScalarInitializationValue) coSimulationZone_0.getCoSimulationZoneValues().get(CoSimInitializationValueManager.class).getObject("Import: Scalar Auxiliary Field 1"));
    CoSimScalarInitializationValue coSimScalarInitializationValue_0 = 
      ((CoSimScalarInitializationValue) coSimulationZone_0.getCoSimulationZoneValues().get(CoSimInitializationValueManager.class).getObject("Scalar Auxiliary Field 1"));
    IdToSpecAssociation idToSpecAssociation_0 = 
      ((IdToSpecAssociation) coSimulation_0.getCoSimulationConditions().get(AmesimPortAssociationManager.class).getObject("Import: Scalar Auxiliary Field 1"));
    IdToSpecAssociation idToSpecAssociation_0 = 
      ((IdToSpecAssociation) coSimulation_0.getCoSimulationConditions().get(AmesimPortAssociationManager.class).getObject("Scalar Auxiliary Field 1"));
    IdToSpecAssociation idToSpecAssociation_0 = 
      ((IdToSpecAssociation) coSimulation_0.getCoSimulationConditions().get(WaveControlPinAssociationManager.class).getObject("Import: Scalar Auxiliary Field 1"));
    IdToSpecAssociation idToSpecAssociation_0 = 
      ((IdToSpecAssociation) coSimulation_0.getCoSimulationConditions().get(WaveControlPinAssociationManager.class).getObject("Scalar Auxiliary Field 1"));

STAR-ICE:布尔谓词不再可用于自动化

由于在 STAR-ICE 中进行了重构,AutomationBoolPredicate 不再可用于自动化。建议将 AutomationBoolPredicate 的实例替换为默认谓词,如以下示例所示。

以前发行版本 Simcenter STAR-CCM+ 2019.2
Simulation simulation_0 = 
  getActiveSimulation();
SimDriverWorkflow simDriverWorkflow_0 = 
  ((SimDriverWorkflow) simulation_0.get(SimDriverWorkflowManager.class).getObject("MorphMap"));
LoopAutomationBlock loopAutomationBlock_0 = 
  ((LoopAutomationBlock) simDriverWorkflow_0.getBlocks().getObject("Loop"));
AutomationBoolPredicate AutomationBoolPredicate_0 = 
  ((AutomationBoolPredicate) loopAutomationBlock_0.getAutomationPredicateManager().getObject("Boolean Predicate"));
loopAutomationBlock_0.setSelectedPredicate(AutomationBoolPredicate);
Simulation simulation_0 = 
  getActiveSimulation();
SimDriverWorkflow simDriverWorkflow_0 = 
  ((SimDriverWorkflow) simulation_0.get(SimDriverWorkflowManager.class).getObject("MorphMap"));
LoopAutomationBlock loopAutomationBlock_0 = 
  ((LoopAutomationBlock) simDriverWorkflow_0.getBlocks().getObject("Loop"));
AutomationSolverStoppingCriterionPredicate automationSolverStoppingCriterionPredicate_0 = 
  ((AutomationSolverStoppingCriterionPredicate) loopAutomationBlock_0.getAutomationPredicateManager().getObject("Stopping Criterion Predicate"));
loopAutomationBlock_0.setSelectedPredicate(automationSolverStoppingCriterionPredicate_0);