Macro API Changes 4.02
In Simcenter STAR-CCM+ 4.02, the macro API changed for combustion, the materials database, passive scalar, and LES turbulence.
- Combustion
DarsCfdReactionModel is now called DarsCfdReactionBaseModel.
- Material Database
Names and symbols were not consistent with the convention for other materials in props.dbs. Fixing this issue means that macros that were using the names as symbols will fail.
For example, the symbol Carbon Steel has now been changed to UNSG101000, and the name for the material is now Carbon Steel.
Before:
Solid solid_1 = (Solid) solidModel_0.replaceMaterial(solid_0, ((DataBaseSolid) materialDataBase_0.getSolids().getObject("Carbon Steel")));
After:
Solid solid_1 = (Solid) solidModel_0.replaceMaterial(solid_0, ((DataBaseSolid) materialDataBase_0.getSolids().getObject("UNSG101000")));
- Passive Scalar
Previous versions of passive scalar required inputting the molecular diffusivity and turbulent Schmidt number in the gas or liquid material properties panel, now it is done within passive scalar. This also allows passive scalar to now work for multi-component flows.
Before:
// 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); } }
After:
// 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
Order of the field functions has changed
Before:
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); }
After:
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); }