宏 API 更改 13.06

Simcenter STAR-CCM+ 13.06 中,针对停止条件、反应流体、欧拉多相流、电磁、电化学、设计管理器和协同仿真更改了宏 API。

停止条件:停止内迭代或外迭代之间的新选择

在以前发行版本中,可以使用监控器停止标准来同时停止非稳态模拟的内部和外部迭代。从 Simcenter STAR-CCM+ 13.06 开始,监视器停止条件只能停止内部迭代或外部迭代,但不能同时停止两者。以前发行版本的 Simcenter STAR-CCM+ 中保存的模拟文件,以及设置为同时停止内部和外部迭代的监控器停止标准,打开时会自动克隆现有的监控器停止标准。一个停止标准停止内部迭代,而另一个停止标准停止外部迭代。

但是,在任意宏中,您必须手动克隆监控器停止标准。

以前发行版本 Simcenter STAR-CCM+ 13.06
ResidualMonitor residualMonitor_0 = 
  ((ResidualMonitor) simulation_0.getMonitorManager().getMonitor("Energy"));
MonitorIterationStoppingCriterion monitorIterationStoppingCriterion_4 = 
  residualMonitor_0.createIterationStoppingCriterion();
monitorIterationStoppingCriterion_4.setOuterIterationCriterion(true);
ResidualMonitor residualMonitor_0 = 
  ((ResidualMonitor) simulation_0.getMonitorManager().getMonitor("Energy"));
MonitorIterationStoppingCriterion monitorIterationStoppingCriterion_5 = 
  residualMonitor_0.createIterationStoppingCriterion();
monitorIterationStoppingCriterion_5.setPresentationName("Energy Criterion Inner");
MonitorIterationStoppingCriterion monitorIterationStoppingCriterion_6 = 
  simulation_0.getSolverStoppingCriterionManager().createSolverStoppingCriterion(MonitorIterationStoppingCriterion.class, "Energy Criterion Inner");
monitorIterationStoppingCriterion_6.copyProperties(monitorIterationStoppingCriterion_5);
monitorIterationStoppingCriterion_6.setPresentationName("Energy Criterion Outer");
monitorIterationStoppingCriterion_6.setInnerIterationCriterion(false);

反应流体

对颗粒反应的更改

已对颗粒反应模型进行了改进,包括与液相的反应,从而导致宏代码的更改。

以前发行版本 Simcenter STAR-CCM+ 13.06
particleReaction_0.getParticleReactants().addGasReactant(gasComponent_0);
particleReaction_0.getParticleProducts().addGasProduct(gasComponent_0);
particleReaction_0.getParticleReactants().addFluidReactant(gasComponent_0);
particleReaction_0.getParticleProducts().addFluidProduct(gasComponent_0);

对反应通道的更改

由于重构,反应通道的宏代码已更改。

以前发行版本 Simcenter STAR-CCM+ 13.06
ReactingChannelWall*Discretization* reactingChannelWallDiscretization_0 =
 coSimulationZone_0.getCoSimulationZoneValues().get(ReactingChannelWallDiscretization.class);
reactingChannelWallDiscretization_0.setReactingChannelHSOrientation(new DoubleVector(new double[] 
{0.0, 1.0, 0.0}));
ReactingChannelWall*Orientation* reactingChannelWallOrientation_0 =
 coSimulationZone_0.getCoSimulationZoneValues().get(ReactingChannelWallOrientation.class);
reactingChannelWallOrientation_0.setReactingChannelHSOrientation(new DoubleVector(new double[] {0.0, 1.0, 0.0} 
));
ReactingChannel*WallDiscretization* reactingChannelWallDiscretization_0 =
 coSimulationZone_0.getCoSimulationZoneValues().get(ReactingChannelWallDiscretization.class);
reactingChannelWallDiscretization_0.setReactingChannelHsAxl(100);
ReactingChannel*WallSampling* reactingChannelWallSampling_0 =
 coSimulationZone_0.getCoSimulationZoneValues().get(ReactingChannelWallSampling.class);
reactingChannelWallSampling_0.getValue().setValue(D);
  // where D = pipeLength/the_original_number (so if the original number is 100 and pipe length in the simfile is 0.3m then the D = 0.003m)

欧拉多相

由于液膜碰撞模型造成的更改

由于其标准不同,新添加的 Caraghiaur 碰撞模型更适合于沉积在壁面上的液滴,因此名称为 InertialFilmImpingementModel 的 Java 类已更改为 IncidentMassFluxImpingementModel。对现有的宏做出相应修改。

对流体停止的更改

“融化-凝固”模型中的流体停止已在用户界面中进行重构,从而导致宏代码的更改。

以前发行版本 Simcenter STAR-CCM+ 13.06
Simulation simulation_0 = 
  getActiveSimulation();
PhysicsContinuum physicsContinuum_0 = 
  ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
EulerianMultiPhaseModel eulerianMultiPhaseModel_0 = 
  physicsContinuum_0.getModelManager().getModel(EulerianMultiPhaseModel.class);
EulerianPhase eulerianPhase_0 = 
  ((EulerianPhase) eulerianMultiPhaseModel_0.getPhaseManager().getPhase("Phase 1"));
eulerianPhase_0.enable(VofEnthalpyMeltingModel.class); // automatically adds VofEnthalpyMeltingFlowStopModel to "Physics 1"
VofEnthalpyMeltingModel vofEnthalpyMeltingModel_0 = 
  eulerianPhase_0.getModelManager().getModel(VofEnthalpyMeltingModel.class);
vofEnthalpyMeltingModel_0.setFlowStopRelativeSolidFraction(0.9);
vofEnthalpyMeltingModel_0.setLinearizeMelting(true);
vofEnthalpyMeltingModel_0.setUrf(0.95);
VofEnthalpyMeltingFlowStopModel vofEnthalpyMeltingFlowStopModel_0 = 
  physicsContinuum_0.getModelManager().getModel(VofEnthalpyMeltingFlowStopModel.class);
vofEnthalpyMeltingFlowStopModel_0.setFlowStopSolidFraction(0.4);
vofEnthalpyMeltingFlowStopModel_0.setFlowStopMassCompensation(true);
Simulation simulation_0 = 
  getActiveSimulation();
PhysicsContinuum physicsContinuum_0 = 
  ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
EulerianMultiPhaseModel eulerianMultiPhaseModel_0 = 
  physicsContinuum_0.getModelManager().getModel(EulerianMultiPhaseModel.class);
EulerianPhase eulerianPhase_0 = 
  ((EulerianPhase) eulerianMultiPhaseModel_0.getPhaseManager().getPhase("Phase 1"));
eulerianPhase_0.enable(VofEnthalpyMeltingModel.class);
physicsContinuum_0.enable(VofEnthalpyMeltingFlowStopModel.class); // no longer added automatically
SinglePhaseLiquidModel singlePhaseLiquidModel_0 = 
  eulerianPhase_0.getModelManager().getModel(SinglePhaseLiquidModel.class);
SinglePhaseLiquid singlePhaseLiquid_0 = 
  ((SinglePhaseLiquid) singlePhaseLiquidModel_0.getMaterial());
ConstantMaterialPropertyMethod constantMaterialPropertyMethod_0 = 
  ((ConstantMaterialPropertyMethod) singlePhaseLiquid_0.getMaterialProperties().getMaterialProperty(FlowabilityThresholdProperty.class).getMethod());
constantMaterialPropertyMethod_0.getQuantity().setValue(0.9); // c.f., setFlowStopRelativeSolidFraction(0.9)
VofEnthalpyMeltingModel vofEnthalpyMeltingModel_0 = 
  eulerianPhase_0.getModelManager().getModel(VofEnthalpyMeltingModel.class);
vofEnthalpyMeltingModel_0.setLinearizeMelting(true); // unchanged
vofEnthalpyMeltingModel_0.setUrf(0.95); // unchanged
Region region_0 = 
  simulation_0.getRegionManager().getRegion("Region 1");
FlowStopSolidFractionProfile flowStopSolidFractionProfile_0 = 
  region_0.getValues().get(FlowStopSolidFractionProfile.class);
flowStopSolidFractionProfile_0.getMethod(ConstantScalarProfileMethod.class).getQuantity().setValue(0.4); // c.f., setFlowStopSolidFraction(0.4)
physicsContinuum_0.enable(VofFlowStopMassCompensationModel.class); // c.f., setFlowStopMassCompensation(true)

更改了默认的相互作用长度尺度

第二区的默认相互作用长度尺度已更改,从而导致宏代码的更改。为了确保行为与以前版本的 Simcenter STAR-CCM+ 保持一致,请按如下示例所示更新您的宏。

以前发行版本 Simcenter STAR-CCM+ 13.06
MultiPhaseInteractionModel multiPhaseInteractionModel_0 = physicsContinuum.getModelManager().getModel(MultiPhaseInteractionModel.class);
PhaseIntraction phaseInteraction_o = multiPhaseInteractionModel_0.createPhaseInteraction(); 
phaseInteraction_0.enable(MmpInteractionLengthScaleModel.class);
MultiPhaseInteractionModel multiPhaseInteractionModel_0 = physicsContinuum.getModelManager().getModel(MultiPhaseInteractionModel.class);
PhaseIntraction phaseInteraction_o = multiPhaseInteractionModel_0.createPhaseInteraction(); 
phaseInteraction_0.enable(MmpInteractionLengthScaleModel.class); 
MmpInteractionLengthScaleModel mmpInteractionLengthScaleModel_0 = phaseInteraction_0.getModelManager().getModel(MmpInteractionLengthScaleModel.class);
ConstantInteractionCoefficientMethod constantInteractionCoefficientMethod_1 = mmpInteractionLengthScaleModel_0.getSecondaryDispersedInteractionLengthScaleMethodManager().getMethod(ConstantInteractionCoefficientMethod.class);
constantInteractionCoefficientMethod_0.getQuantity().setValue(0.001);
   // 0.001 was the default value before 13.06

电磁:新的对称张量场函数

为导电率提供了新的对称张量场函数。在以前版本的 Simcenter STAR-CCM+ 中保存的模拟文件中,如果电动势模型在物理连续体中,张量分量场函数在 Simcenter STAR-CCM+ 13.06 中仍可正常使用。但是,在 Simcenter STAR-CCM+ 13.06 中创建的新模拟文件中,将无法选择该张量分量场函数。以下是宏代码的更改示例:

以前发行版本 Simcenter STAR-CCM+ 13.06
PrimitiveFieldFunction primitiveFieldFunction_0 = 
 ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("ElectricalConductivityTensorComponentII"));
 PrimitiveFieldFunction primitiveFieldFunction_1 = 
 ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("ElectricalConductivityTensorComponentIJ"));
PrimitiveFieldFunction primitiveFieldFunction_0 = 
 ((PrimitiveFieldFunction) simulation_0.getFieldFunctionManager().getFunction("ElectricalConductivitySymmetricTensor"));

SymmetricTensorComponentFieldFunction symmetricTensorComponentFieldFunction_0 = 
 ((SymmetricTensorComponentFieldFunction) primitiveFieldFunction_0.getComponentFunction(0, 0));

SymmetricTensorComponentFieldFunction symmetricTensorComponentFieldFunction_1 = 
 ((SymmetricTensorComponentFieldFunction) primitiveFieldFunction_0.getComponentFunction(1, 0));

电化学:对多孔介质中电化学反应的更改

由于对多孔薄壁中电流有效建模的改进,从而导致宏代码发生了两种更改:

  • 离子导电域的内部衍生已被替换。在您的宏代码中,删除包含 IonicallyConductiveDomainOption 的所有行。
  • 某个设置的离子导电域现在由添加到反应的电子源确定。此更改会影响将电子添加到在 Simcenter STAR-CCM+ 13.06 之前录制的宏中的反应:

    ((ReactionComponentSubstance) reaction_1.getReactants().getReactant("e-"));

    Simcenter STAR-CCM+ 13.06 中,应指定提供电子的连续体。对于以上代码示例,如果电子从名为 Fuel 的物理连续体中获得,则语句在当前版本中必须显示如下:

    ((ReactionComponentSubstance) reaction_1.getReactants().getReactant("e- (Fuel)"));

设计管理器:表导入的改进

Simcenter STAR-CCM+ 13.06 中,通过设计管理器可直接导入 .csv 文件,而不必指定每个值。此项改进导致宏代码更改。

以前发行版本 Simcenter STAR-CCM+ 13.06
// STAR-CCM+ macro: ImportCsvManual1304.java
// Written by STAR-CCM+ 13.04.010
package macro;

import java.util.*;

import star.base.neo.*;
import star.common.*;
import star.mdx.*;

public class ImportCsvManual1304 extends MdxMacro {

  public void execute() {
    execute0();
  }

  private void execute0() {

    MdxProject mdxProject_0 = 
      getActiveMdxProject();

    MdxDesignStudy mdxDesignStudy_0 = 
      mdxProject_0.getDesignStudyManager().getDesignStudy("Design Study 2");

    MdxStudyParameter mdxStudyParameter_0 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("LeadingFlapRotateAngle"));

    mdxStudyParameter_0.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_1 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TrailingFlapRotateAngle"));

    mdxStudyParameter_1.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_2 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateLeadingFlap_X"));

    mdxStudyParameter_2.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_3 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateLeadingFlap_Y"));

    mdxStudyParameter_3.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_4 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateTrailingFlap_X"));

    mdxStudyParameter_4.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_5 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateTrailingFlap_Y"));

    mdxStudyParameter_5.setType(MdxStudyParameter.Type.DISCRETE);

    MdxDesignTable mdxDesignTable_0 = 
      mdxDesignStudy_0.getDesignTable();

    Units units_0 = 
      ((Units) mdxProject_0.get(UnitsManager.class).getObject("deg"));

    Units units_1 = 
      ((Units) mdxProject_0.get(UnitsManager.class).getObject("m"));

    mdxDesignTable_0.addNewRows(new StringVector(new String[] {"D01", "D02", "D03", "D04", "D05", "D06", "D07", "D08", "D09", "D10", "D11", "D12", "D13", "D14", "D15"}), new Vector(Arrays.asList(((MdxStudyParameterColumn) mdxDesignTable_0.getTableColumns().getDesignTableColumn("LeadingFlapRotateAngle")), ((MdxStudyParameterColumn) mdxDesignTable_0.getTableColumns().getDesignTableColumn("TrailingFlapRotateAngle")), ((MdxStudyParameterColumn) mdxDesignTable_0.getTableColumns().getDesignTableColumn("TranslateLeadingFlap_X")), ((MdxStudyParameterColumn) mdxDesignTable_0.getTableColumns().getDesignTableColumn("TranslateLeadingFlap_Y")), ((MdxStudyParameterColumn) mdxDesignTable_0.getTableColumns().getDesignTableColumn("TranslateTrailingFlap_X")), ((MdxStudyParameterColumn) mdxDesignTable_0.getTableColumns().getDesignTableColumn("TranslateTrailingFlap_Y")))), new Vector(Arrays.asList(new DoubleWithUnits(-15.97514708, units_0), 
/** SIMILAR LINES OMITTED **/,
, new DoubleWithUnits(-0.015261275, units_1))));
  }
}
// STAR-CCM+ macro: ImportCsvManual1306.java
// Written by STAR-CCM+ 13.05.086
package macro;
import java.util.*;
import star.base.neo.*;
import java.lang.*;
import star.mdx.*;
public class ImportCsvManual1306 extends MdxMacro {
  public void execute() {
    execute0();
  }
  private void execute0() {

    MdxProject mdxProject_0 = 
      getActiveMdxProject();

    MdxDesignStudy mdxDesignStudy_0 = 
      mdxProject_0.getDesignStudyManager().getDesignStudy("Design Study 2");

    MdxStudyParameter mdxStudyParameter_0 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("LeadingFlapRotateAngle"));

    mdxStudyParameter_0.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_1 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TrailingFlapRotateAngle"));

    mdxStudyParameter_1.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_2 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateLeadingFlap_X"));

    mdxStudyParameter_2.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_3 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateLeadingFlap_Y"));

    mdxStudyParameter_3.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_4 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateTrailingFlap_X"));

    mdxStudyParameter_4.setType(MdxStudyParameter.Type.DISCRETE);

    MdxStudyParameter mdxStudyParameter_5 = 
      ((MdxStudyParameter) mdxDesignStudy_0.getStudyParameters().getObject("TranslateTrailingFlap_Y"));

    mdxStudyParameter_5.setType(MdxStudyParameter.Type.DISCRETE);

    MdxDesignTable mdxDesignTable_0 = 
      mdxDesignStudy_0.getDesignTable();

    mdxDesignTable_0.importCsvFile("ag.csv", false, Arrays.asList());
  }
}

协同仿真

对场交换值的更改

场交换控制选项已被移动到用户界面中以保持一致性,从而导致宏代码的更改。

以前发行版本 Simcenter STAR-CCM+ 13.06
// get cosimulation
StarccmplusCoSimulation starccmplusCoSimulation_0 =
    ((StarccmplusCoSimulation) simulation_0.get(CoSimulationManager.class)
                                           .getObject("Link 1"));

// Set iterations per field data exchange
starccmplusCoSimulation_0.getCoSimulationConditions()
                         .get(StarccmplusFieldExchangeControls.class)
                         .setNumIterationsPerExchange(5);
// get cosimulation
StarccmplusCoSimulation starccmplusCoSimulation_0 =
    ((StarccmplusCoSimulation) simulation_0.get(CoSimulationManager.class)
                                           .getObject("Link 1"));

// Set iterations per field data exchange
starccmplusCoSimulation_0.getCoSimulationValues()
                         .get(StarccmplusFieldExchangeControls.class)
                         .setNumIterationsPerExchange(5);

对初始化方法的更改

由于物理初始化流程的改进,已从协同仿真中删除某些初始化方法,从而导致宏代码的更改:

  • 已导出的场已不再使用初始化方法“从物理值初始化”。在您的宏代码中,删除与以下示例类似的行:

    scalarAuxiliaryExportSpecification_0.getCoSimFieldInitializationMethod().setSelected(CoSimFieldInitializationMethod.Type.INITIALIZE_FROM_PHYSICS);
  • 已导入的场已不再使用初始化方法“使用导入的值”。在您的宏代码中,删除与以下示例类似的行:

    scalarAuxiliaryImportSpecification_0.getCoSimFieldInitializationMethod().setSelected(CoSimFieldInitializationMethod.Type.USE_IMPORTED_VALUES);

对网格插值模板的更改

已对模板处理从源网格到目标网格场映射所使用的技术进行更改。目标位置选项设置不再位于执行场导出的模拟中,而是位于执行场导入的模拟中,从而导致宏代码的更改。

以下示例假设 sim1 正在执行附加场的导出,而 sim2 正在执行同一个场的导入:

  • 以前发行版本中,以下宏将被录制到 sim1 中:

    public class ExportChangeTargetStencil extends StarMacro {
      public void execute() {
        execute0();
      }
      private void execute0() {
        Simulation simulation_0 = 
          getActiveSimulation();
        CoSimulation coSimulation_0 = 
          ((CoSimulation) simulation_0.get(CoSimulationManager.class).getObject("sim2"));
        CoSimulationZone coSimulationZone_0 = 
          coSimulation_0.getCoSimulationZoneManager().getCoSimulationZone("Zone 1");
        ScalarAuxiliaryExportSpecification scalarAuxiliaryExportSpecification_0 = 
          ((ScalarAuxiliaryExportSpecification) coSimulationZone_0.getCoSimulationZoneConditions().get(ExportSpecificationManager.class).getObject("Scalar Auxiliary Field 1"));
        scalarAuxiliaryExportSpecification_0.getCoSimTargetLocationOption().setSelected(CoSimLocationOption.Type.VERTEX);
      }
    }
  • Simcenter STAR-CCM+ 13.06 中,以下宏将在 sim2 中录制:

    public class ImportChangeStencil extends StarMacro {
      public void execute() {
        execute0();
      }
      private void execute0() {
        Simulation simulation_0 = 
          getActiveSimulation();
        CoSimulation coSimulation_0 = 
          ((CoSimulation) simulation_0.get(CoSimulationManager.class).getObject("sim1"));
        CoSimulationZone coSimulationZone_0 = 
          coSimulation_0.getCoSimulationZoneManager().getCoSimulationZone("Zone 1");
        ScalarAuxiliaryImportSpecification scalarAuxiliaryImportSpecification_0 = 
          ((ScalarAuxiliaryImportSpecification) coSimulationZone_0.getCoSimulationZoneConditions().get(ImportSpecificationManager.class).getObject("Scalar Auxiliary Field 1"));
        scalarAuxiliaryImportSpecification_0.getCoSimLocationOption().setSelected(CoSimLocationOption.Type.VERTEX);
      }
    }