宏 API 更改 2406
在 Simcenter STAR-CCM+ 2406 中,针对网格化、材料属性、传热、反应流体、液膜、固体应力和后处理进行了宏 API 的更改。
网格化:计划终止初始化网格功能
因为 2302 版本中已移除了基于区域的网格化,宏代码中的“初始化网格”命令自 Simcenter STAR-CCM+ 2406 起已弃用,并计划从以后的某个版本中移除。要更新宏,移除以下代码的实例:
meshPipelineController_0.initializeMeshPipeline();
材料属性:弃用各向异性材料属性指定方法
材料属性指定方法各向异性和各向异性(原有)从 2210 版本开始已弃用,并计划从以后的版本中移除。有关这些方法和计划替换的详细信息,请参见 2406 发行说明“重要说明”章节中的“材料属性”。
如果任何现有宏使用已弃用的材料属性法(导热率、导电率、渗透率、介电常数的 9 个各向异性分量,或是导热率的各向异性(原有)),则搜索以下字符串的实例并更新它们,如下表中所示。
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
AnisotropicElectricalConductivityMethodWithValues |
FullTensorElectricalConductivityMethodWithValues |
AnisotropicPermeabilityMethodWithValues |
FullTensorPermeabilityMethodWithValues |
AnisotropicPermittivityMethodWithValues |
FullTensorPermittivityMethodWithValues |
AnisotropicThermalConductivityMethodWithValues |
FullTensorThermalConductivityMethodWithValues |
AnisotropicThermalConductivityMethod |
FullTensorLegacyThermalConductivityMethod |
热传递
对块生成指定的更改
对于辐射热传递,重构了块生成参数的指定以支持参数输入。
要更新宏,将 patchPerBFaceProportionLeaf_0.setValue(50.0); 的实例改为 patchPerBFaceProportionLeaf_0.getPatchPerBFaceProportion().setValue(50.0);
对指定边界处辐射属性的更改
在 Simcenter STAR-CCM+ 2406 中,不再使用分布(例如 EmissivityProfile、ReflectionSpecularityProfile、ReflectionSpecularityOption、ReflectivityProfile 或 TransmissivityProfile)指定边界处的辐射属性。
以下是一个修改边界上 EmissivityProfile 的宏代码示例:
EmissivityProfile emissivityProfile_0
= boundary_0.getValues().get(EmissivityProfile.class);
emissivityProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(1.0);
或者,使用 SurfaceMaterials 来指定边界处的辐射属性。
SurfaceMaterials 可在 MaterialDataBase 中创建和存储:
Simulation simulation_0
= getActiveSimulation();
star.material.MaterialDataBase materialMaterialDataBase_0 =
simulation_0.get(MaterialDataBaseManager.class).getMatlDataBase("Standard");
star.material.DataBaseMaterialManager materialDataBaseMaterialManager_1 =
materialMaterialDataBase_0.getFolder("SurfaceMaterials");
star.material.DataBaseSurfaceMaterial materialDataBaseSurfaceMaterial_0 =
materialDataBaseMaterialManager_1.addSurfaceMaterial();
materialDataBaseSurfaceMaterial_0.setTitle("Interface 2");
materialDataBaseSurfaceMaterial_0.setSymbol("bottom-solid1");
materialDataBaseSurfaceMaterial_0.addMaterialPropertyMethods(new StringVector(new String[] {"Emissivity.Constant", "Transmissivity.Constant"}));
star.material.DataBaseMaterialProperty materialDataBaseMaterialProperty_0 =
((star.material.DataBaseMaterialProperty) materialDataBaseSurfaceMaterial_0.getMaterialProperty("Emissivity"));
ConstantMaterialPropertyMethod constantMaterialPropertyMethod_0 =
((ConstantMaterialPropertyMethod) materialDataBaseMaterialProperty_0.getMethod("ConstantMaterialPropertyMethod"));
Units units_0 =
((Units) simulation_0.getUnitsManager().getObject(""));
constantMaterialPropertyMethod_0.getQuantity().setValueAndUnits(0.775, units_0);
如果激活了一个辐射模型,将为该连续体创建 SurfaceMaterialsModel。SurfaceMaterialsModel 是存储 SurfaceMaterials 的位置。SurfaceMaterials 只能从 MaterialDataBase 创建:
SurfaceMaterialsModel surfaceMaterialsModel_0 =
physicsContinuum_0.getModelManager().getModel(SurfaceMaterialsModel.class);
surfaceMaterialsModel_0.getSurfaceMaterialManager().addMaterials(new ArrayList<>(Arrays.<DataBaseMaterial>asList(materialDataBaseSurfaceMaterial_0)));
还可以在连续体级别修改 SurfaceMaterials 的属性:
SurfaceMaterial surfaceMaterial_1 = ((SurfaceMaterial) surfaceMaterialsModel_0.getSurfaceMaterialManager()
.getSurfaceMaterial(surfaceMaterialName));
ConstantMaterialPropertyMethod constantEmissivityMaterialPropertyMethod_Material1 = ((ConstantMaterialPropertyMethod) surfaceMaterial_1
.getMaterialProperties().getMaterialProperty(EmissivitySurfaceProperty.class).getMethod());
constantEmissivityMaterialPropertyMethod_Material1.getQuantity().setValueAndUnits(emissivityValue, units_0);
ConstantMaterialPropertyMethod constantReflectionSpecularityMaterialPropertyMethod_Material1 = ((ConstantMaterialPropertyMethod) surfaceMaterial_1
.getMaterialProperties().getMaterialProperty(ReflectionSpecularitySurfaceProperty.class).getMethod());
constantReflectionSpecularityMaterialPropertyMethod_Material1.getQuantity().setValueAndUnits(reflectionSpecularityValue,
units_0);
ConstantMaterialPropertyMethod constantTransmissivityMaterialPropertyMethod_Material1 = ((ConstantMaterialPropertyMethod) surfaceMaterial_1
.getMaterialProperties().getMaterialProperty(TransmissivitySurfaceProperty.class).getMethod());
constantTransmissivityMaterialPropertyMethod_Material1.getQuantity().setValueAndUnits(transmissivityValue, units_0);
SurfaceMaterials 可用于多波段模型:
SurfaceMaterial surfaceMaterial_1 = ((SurfaceMaterial) surfaceMaterialsModel_0.getSurfaceMaterialManager()
.getSurfaceMaterial(surfaceMaterialName));
ConstantArrayMaterialPropertyMethod constantEmissivityMaterialPropertyMethod_Material1 = ((ConstantArrayMaterialPropertyMethod) surfaceMaterial_1
.getMaterialProperties().getMaterialProperty(EmissivitySurfaceProperty.class).getMethod());
constantEmissivityMaterialPropertyMethod_Material1.getQuantity().setArray(new DoubleVector(emissivityValue));
ConstantArrayMaterialPropertyMethod constantRefSpecMaterialPropertyMethod_Material1 = ((ConstantArrayMaterialPropertyMethod) surfaceMaterial_1
.getMaterialProperties().getMaterialProperty(ReflectionSpecularitySurfaceProperty.class).getMethod());
constantRefSpecMaterialPropertyMethod_Material1.getQuantity().setArray(new DoubleVector(reflectionSpecularityValue));
ConstantArrayMaterialPropertyMethod constantTransmissivityMaterialPropertyMethod_Material1 = ((ConstantArrayMaterialPropertyMethod) surfaceMaterial_1
.getMaterialProperties().getMaterialProperty(TransmissivitySurfaceProperty.class).getMethod());
constantTransmissivityMaterialPropertyMethod_Material1.getQuantity()
.setArray(new DoubleVector(transmissivityValue));
要更改在边界处选择的 SurfaceMaterial:
Boundary boundary_0 =
(Boundary) region_0.getBoundaryManager().getBoundary("boundary-0"));
SurfaceMaterialSpecification surfaceMaterialSpecification_0 =
boundary_0.getValues().get(SurfaceMaterialSpecification.class);
SurfaceMaterialSpecificationLeaf surfaceMaterialSpecificationLeaf_0 =
surfaceMaterialSpecification_0.getModelPartValue();
PhysicsContinuum physicsContinuum_0 =
((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Air"));
SurfaceMaterialsModel surfaceMaterialsModel_0 =
physicsContinuum_0.getModelManager().getModel(SurfaceMaterialsModel.class);
SurfaceMaterial surfaceMaterial_0 =
((SurfaceMaterial) surfaceMaterialsModel_0.getSurfaceMaterialManager().getSurfaceMaterial("bottom-solid1"));
surfaceMaterialSpecificationLeaf_0.setActiveMaterial(surfaceMaterial_0);
反应流体:结束使用已弃用的导入操作
在 Simcenter STAR-CCM+ 12.06 中更改了一项反应导入技术,但该技术的宏代码在 Simcenter STAR-CCM+ 2406 之前仍然有效。
该技术的宏代码不再有效,应将其删除或替换。作为提醒,废弃的代码如下:
ReactingModel reactingModel_0 =
phase_0.getModelManager().getModel(ReactingModel.class);
MaterialDataBase materialDataBase_0 =
simulation_0.get(MaterialDataBaseManager.class).getMaterialDataBase("props");
ReactionManager mgR = (ReactionManager) reactingModel_0.getReactions();
mgR.importReactions(resolvePath("ebuLiquid.chm"), materialDataBase_0);
- 导入相应的 Chemkin 文件。以下示例代码可用作此类宏的更新,前提是拥有正确的 Chemkin 文件名。有关这些导入的更多信息,请参见《Simcenter STAR-CCM+ 用户指南》“反应流”一节中的“导入组分和反应”。
EbuGasCombustionModel ebuGasCombustionModel_0 = phase_0.getModelManager().getModel(EbuGasCombustionModel.class); String filePaths = "ebu.chm"; String thermDats = filePaths; String molDats = ""; String surfFile = ""; ebuGasCombustionModel_0.importCaseFromChemkin(resolvePath(filePaths), resolvePath(thermDats), molDats, surfFile, surfFile); - 或者,按照文件中的格式手动定义反应或用其录制一个宏。
液膜:对液膜沸腾模型的更改
为了适应新的沸腾模型,液膜中使用的沸腾模型已从沸腾重命名为 Rohsenow 沸腾。
此重构改变了宏代码和某些场函数的可用性。有关场函数更改的详细信息,请参见“液膜:薄膜沸腾模型的更改”(《2406 发行说明》的“重要说明”章节)。
要更新宏代码,将 phaseInteraction.enable(FilmBoilingModel.class); 的实例替换为 phaseInteraction.enable(RohsenowFilmBoilingModel.class);。
固体应力:对材料定律模型的更改
从 Simcenter STAR-CCM+ 2406 开始,要获得线性弹性体或超弹性模型的完整定义,必须指定应变测量。
在宏代码中,如果使用 LinearElasticMaterialModel.class,则包含一个附加模型:
materialLaw_0.enable(LinearElasticMaterialModel.class);
materialLaw_0.enable(LinearStrainMeasure.class); // <---- new model has to be selected
在连续体中激活非线性几何模型时,以类似于上述代码示例的方式包含 GreenLagrangeStrainMeasureSmall.class。
对于 HyperElasticMaterialModel.class,添加 GreenLagrangeStrainMeasureLarge.class。
后处理
删除求解历史的新影响
在 Simcenter STAR-CCM+ 2406 中,如果删除求解历史,求解视图将自动随之删除。
如果在之前版本中录制了宏并手动删除了求解视图及求解历史时,则应更新该宏代码,如以下示例所示。如果尝试不更新就在 Simcenter STAR-CCM+ 2406 中运行此类宏,Simcenter STAR-CCM+ 将生成错误。
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
|
|
从 Java Framework 中移除 ChartStyle 类
ChartStyle 类已从 Simcenter STAR-CCM+ 2406 中的绘图框架中移除。
以下类结构不再受支持,在用于导入文件以填充数据集的较旧 Java 宏中可能存在这些结构:
star.common.graph.ChartStylestar.common.graph.ChartStyleManager
该类的一个较早用例在 exampleXYPlot 上显示了一个数据集,其 ChartStyle 将更新:
DataSet dataSet = exampleXYPlot.getYAxes().getAxisType("Y Type 1").getDataSets().getDataSet("Temperature");
dataSet.getChartStyle().setSymbolShape(JCSymbolStyle.NONE);
dataSet.getChartStyle().setLinePattern(JCLineStyle.SOLID);
dataSet.getChartStyle().setLineColor(Color.red);
dataSet.getChartStyle().setLineWidth(4);
近年来,Style 已在其自己的子对象中进行管理,ChartStyle 已变得不必要。
对于 Simcenter STAR-CCM+ 2406,必须执行以下两项更改:
- 如果适用,直接更新
Style,而不是通过ChartStyle路由请求。 - 如果无法直接更改,则完全移除调用。
特定 Style-to-Type 替换:
- 将
JCSymbolStyle替换为SymbolShapeOption.Type。 - 将
JCLineStyle替换为LinePatternOption.Type。 - 将
JCFillStyle替换为FillPatternOption.Type。
更新代码的详细说明,含示例
应根据需要更新以下与线样式相关的调用:
ChartStyle.setLinePatternChartStyle.setLineColorChartStyle.setLineWidth
对线样式 API 调用的更新的示例:
// At the top of the macro
import star.common.LinePatternOption;
import star.common.LineStyle;
DataSet dataSet = exampleXYPlot.getYAxes().getAxisType("Y Type 1").getDataSets().getDataSet("Temperature");
// Step 1: Replace getChartStyle() calls with their direct 'set' calls.
// dataSet.getChartStyle().setLinePattern(JCLineStyle.SOLID);
dataSet.getLineStyle().setLinePatternOptionInput(LinePatternOption.Type.SOLID); // (Step 2) replacement for JCLineStyle.SOLID
// dataSet.getChartStyle().setLineColor(Color.red);
dataSet.getLineStyle().setColor(Color.red);
// dataSet.getChartStyle().setLineWidth(4);
dataSet.getLineStyle().setLineWidth(4);
应根据需要更新以下与标记样式相关的调用:
ChartStyle.setSymbolShapeChartStyle.setSymbolSizeChartStyle.setSymbolStrokeWidthChartStyle.setSymbolColor
对标记样式 API 调用的更新的示例:
// At the top of the macro
import star.common.SymbolShapeOption;
import star.common.SymbolStyle;
DataSet dataSet = exampleXYPlot.getYAxes().getAxisType("Y Type 1").getDataSets().getDataSet("Temperature");
// Step 1: Replace getChartStyle() calls with their direct 'set' calls. Calls
// dataSet.getChartStyle().setSymbolShape(JCSymbolStyle.NONE);
dataSet.getSymbolStyle().setSymbolShapeOptionInput(SymbolShapeOption.Type.NONE); // (Step 2) replacement for JCSymbolStyle.NONE
// dataSet.getChartStyle().setSymbolSize(10);
dataSet.getSymbolStyle().setSize(10);
// dataSet.getChartStyle().setSymbolStrokeWidth(0.2);
dataSet.getSymbolStyle().setStrokeWidth(0.2);
// dataSet.getChartStyle().setSymbolColor(Color.red);
dataSet.getSymbolStyle().setColor(Color.red);
应根据需要更新以下与填充风格相关的调用:
ChartStyle.setFillPatternChartStyle.setFillColorChartStyle.setFillBackground
对填充风格 API 调用的更新的示例:
// At the top of the macro
import star.common.FillPatternOption;
import star.common.FillStyle;
DataSet dataSet = exampleXYPlot.getYAxes().getAxisType("Y Type 1").getDataSets().getDataSet("Temperature");
// Step 1: Replace getChartStyle() calls with their direct 'set' calls.
// dataSet.getChartStyle().setFillPattern(JCFillStyle.SOLID);
dataSet.getFillStyle().setLinePatternOptionInput(FillPatternOption.Type.SOLID); // (Step 2) replacement for JCFillStyle.SOLID
// dataSet.getChartStyle().setFillColor(Color.red);
dataSet.getFillStyle().setColor(Color.red);
// dataSet.getChartStyle().setFillBackground(Color.blue);
dataSet.getFillStyle().setBackgroundColor(Color.blue);
应完全移除以下 API 调用。他们的处理已中止/内部化。
ChartStyle.setLineCapChartStyle.setLineJoin
对线样式 API 调用的移除的示例:
DataSet dataSet = exampleXYPlot.getYAxes().getAxisType("Y Type 1").getDataSets().getDataSet("Temperature");
dataSet.getChartStyle().setLineCap(0);
dataSet.getChartStyle().setLineJoin(0);
旧标记、线样式和填充风格已替换为当前支持的类型
标记样式:导入 star.common.SymbolShapeOption;
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
线样式:导入 star.common.LinePatternOption;
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
填充风格:导入 star.common.FillPatternOption;
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
样式 API 移除和替换
线样式
移除以下内容:
LineStyle.setVisible(boolean)LineStyle.getJoin()LineStyle.setJoin(int)LineStyle.getCap()LineStyle.setCap(int)
如下替换代码:
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
|
|
|
|
符号样式
Remove SymbolStyle.setVisible(boolean)。
如下替换代码:
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
|
|
|
|
填充样式
Remove FillStyle.setVisible(boolean)。
| 以前版本 | Simcenter STAR-CCM+ 2406 |
|---|---|
|
|
|
|