宏 API 更改 4.02
在 Simcenter STAR-CCM+ 4.02 中,针对燃烧、材料数据库、被动标量和 LES 湍流进行了宏 API 的更改。
- 燃烧
DarsCfdReactionModel 现在称为 DarsCfdReactionBaseModel。
- 材料数据库
名称和符号与 props.dbs 中其他材料的约定不一致。 修复此问题意味着使用名称作为符号的宏将失败。
例如,Carbon Steel 符号现在已改为 UNSG101000,材料的名称现在为 Carbon Steel。
之前:
Solid solid_1 = (Solid) solidModel_0.replaceMaterial(solid_0, ((DataBaseSolid) materialDataBase_0.getSolids().getObject("Carbon Steel")));
之后:
Solid solid_1 = (Solid) solidModel_0.replaceMaterial(solid_0, ((DataBaseSolid) materialDataBase_0.getSolids().getObject("UNSG101000")));
- 被动标量
以前版本的被动标量需要在气体或液体材料属性面板中输入分子扩散率和湍流施密特数,现在在被动标量中可执行此操作。 这还允许被动标量现在适用于多组分流体。
之前:
// STAR-CCM+ macro: oldprop.java package macro; import java.util.*; import star.turbulence.*; import star.material.*; import star.common.*; import star.base.neo.*; import star.flow.*; public class oldprop extends StarMacro { public void execute() { Simulation simulation_0 = getActiveSimulation(); PhysicsContinuum physicsContinuum_0 = ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1")); SingleComponentGasModel singleComponentGasModel_0 = physicsContinuum_0.getModelManager().getModel(SingleComponentGasModel.class); Gas gas_0 = ((Gas) singleComponentGasModel_0.getMaterial()); SchmidtNumberDiffusivityMethod schmidtNumberDiffusivityMethod_0 = ((SchmidtNumberDiffusivityMethod) gas_0.getMaterialProperties().getMaterialProperty(MolecularDiffusivityProperty.class).getMethod()); schmidtNumberDiffusivityMethod_0.setSchmidtNumber(0.111); ConstantMaterialPropertyMethod constantMaterialPropertyMethod_0 = ((ConstantMaterialPropertyMethod) gas_0.getMaterialProperties().getMaterialProperty(TurbulentSchmidtNumberProperty.class).getMethod()); constantMaterialPropertyMethod_0.getQuantity().setValue(0.222); } }
之后:
// STAR-CCM+ macro: newprop.java package macro; import java.util.*; import star.material.*; import star.common.*; import star.base.neo.*; import star.flow.*; import star.passivescalar.*; public class newprop extends StarMacro { public void execute() { Simulation simulation_0 = getActiveSimulation(); PhysicsContinuum physicsContinuum_0 = ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1")); PassiveScalarModel passiveScalarModel_0 = physicsContinuum_0.getModelManager().getModel(PassiveScalarModel.class); PassiveScalarMaterial passiveScalarMaterial_0 = passiveScalarModel_0.getPassiveScalarMaterial(); SchmidtNumberDiffusivityMethod schmidtNumberDiffusivityMethod_0 = ((SchmidtNumberDiffusivityMethod) passiveScalarMaterial_0.getMaterialProperties().getMaterialProperty(PassiveScalarDiffusivityProperty.class).getMethod()); schmidtNumberDiffusivityMethod_0.setSchmidtNumber(0.111); ConstantMaterialPropertyMethod constantMaterialPropertyMethod_0 = ((ConstantMaterialPropertyMethod) passiveScalarMaterial_0.getMaterialProperties().getMaterialProperty(PassiveScalarTurbulentSchmidtNumberProperty.class).getMethod()); constantMaterialPropertyMethod_0.getQuantity().setValue(0.222); } }
- LES
场函数的顺序已更改
之前:
public void setInitialCondition() { Simulation simulation_0 = getActiveSimulation(); PhysicsContinuum physicsContinuum_0 = ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1")); TurbulenceIntensityProfile turbulenceIntensityProfile_0 = ! ((TurbulenceIntensityProfile) physicsContinuum_0.getInitialConditions().get(TurbulenceIntensityProfile.class)); turbulenceIntensityProfile_0.setMethod(FunctionScalarProfileMethod.class); UserFieldFunction userFieldFunction_0 = ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("UserFieldFunction_1")); ! ((FunctionScalarProfileMethod) turbulenceIntensityProfile_0.getMethod()).setFieldFunction(userFieldFunction_0); TurbulentLengthScaleProfile turbulentLengthScaleProfile_0 = ! ((TurbulentLengthScaleProfile) physicsContinuum_0.getInitialConditions().get(TurbulentLengthScaleProfile.class)); turbulentLengthScaleProfile_0.setMethod(FunctionScalarProfileMethod.class); - UserFieldFunction userFieldFunction_1 = - ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("UserFieldFunction_3")); - ! ((FunctionScalarProfileMethod) turbulentLengthScaleProfile_0.getMethod()).setFieldFunction(userFieldFunction_1); VelocityProfile velocityProfile_0 = ((VelocityProfile) physicsContinuum_0.getInitialConditions().get(VelocityProfile.class)); velocityProfile_0.setMethod(CompositeVectorProfileMethod.class); ScalarProfile scalarProfile_0 = ((CompositeVectorProfileMethod) velocityProfile_0.getMethod()).getProfile(0); scalarProfile_0.setMethod(FunctionScalarProfileMethod.class); UserFieldFunction userFieldFunction_2 = ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("UserFieldFunction_2")); ((FunctionScalarProfileMethod) scalarProfile_0.getMethod()).setFieldFunction(userFieldFunction_2); }
之后:
public void setInitialCondition() { Simulation simulation_0 = getActiveSimulation(); PhysicsContinuum physicsContinuum_0 = ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1")); + physicsContinuum_0.getInitialConditions().get(PseudoTurbulenceSpecOption.class).setSelected(PseudoTurbulenceSpecOption.INTENSITY_LENGTH_SCALE); + TurbulenceIntensityProfile turbulenceIntensityProfile_0 = ! physicsContinuum_0.getInitialConditions().get(TurbulenceIntensityProfile.class); turbulenceIntensityProfile_0.setMethod(FunctionScalarProfileMethod.class); UserFieldFunction userFieldFunction_0 = + ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("UserFieldFunction_3")); + + ((FunctionScalarProfileMethod) turbulenceIntensityProfile_0.getMethod()).setFieldFunction(userFieldFunction_0); + + UserFieldFunction userFieldFunction_1 = ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("UserFieldFunction_1")); ! ((FunctionScalarProfileMethod) turbulenceIntensityProfile_0.getMethod()).setFieldFunction(userFieldFunction_1); TurbulentLengthScaleProfile turbulentLengthScaleProfile_0 = ! physicsContinuum_0.getInitialConditions().get(TurbulentLengthScaleProfile.class); turbulentLengthScaleProfile_0.setMethod(FunctionScalarProfileMethod.class); ! ((FunctionScalarProfileMethod) turbulentLengthScaleProfile_0.getMethod()).setFieldFunction(userFieldFunction_0); VelocityProfile velocityProfile_0 = ((VelocityProfile) physicsContinuum_0.getInitialConditions().get(VelocityProfile.class)); velocityProfile_0.setMethod(CompositeVectorProfileMethod.class); ScalarProfile scalarProfile_0 = ((CompositeVectorProfileMethod) velocityProfile_0.getMethod()).getProfile(0); scalarProfile_0.setMethod(FunctionScalarProfileMethod.class); UserFieldFunction userFieldFunction_2 = ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("UserFieldFunction_2")); ((FunctionScalarProfileMethod) scalarProfile_0.getMethod()).setFieldFunction(userFieldFunction_2); }