In
Simcenter STAR-CCM+ 13.06, the macro API changed for stopping criteria, reacting flows, Eulerian multiphase, electromagnetics, electrochemistry, Design Manager, and co-simulation.
Stopping Criteria: New Choice Between Stopping Inner or Outer Iteration
In previous releases, a monitor stopping criterion could be used to stop both inner and outer iterations of an unsteady simulation. Beginning with
Simcenter STAR-CCM+ 13.06, a monitor stopping criterion can only stop either the inner or outer iteration, but not both. Simulation files saved in previous versions of
Simcenter STAR-CCM+, with a monitor stopping criterion set to stop both inner and outer iterations, automatically clone the existing monitor stopping criterion when opened. One stopping criterion stops the inner iteration and the other stops the outer iteration.
In any macros, however, you must manually clone the monitor stopping criterion.
Previous Release
|
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);
|
Reacting Flows
Changes to Particle Reactions
Improvements have been made to particle reaction modeling, including reactions with liquid phases, resulting in changes to the macro code.
Previous Release
|
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);
|
Changes to Reacting Channels
Due to restructuring, macro codes for reacting channels have changed.
Previous Release
|
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)
|
Eulerian Multiphase
Changes Due to Liquid Film Impingement Modeling
The newly added Caraghiaur impingement model is better suited to droplets that deposit onto the wall due to their inertia, hence the Java class name
InertialFilmImpingementModel
was changed to
IncidentMassFluxImpingementModel
. Modify your existing macros accordingly.
Changes to Flow Stop
Flow stop in melting-solidification modeling has been restructured in the user interface, resulting in changes to the macro code.
Previous Release
|
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)
|
Changes to Default Interaction Length Scale
The default interaction length scale for the secondary regime has been changed, resulting in changes to the macro code. To ensure behavior that is consistent with previous versions of
Simcenter STAR-CCM+, update your macros as shown in the following example.
Previous Release
|
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
|
Electromagnetics: New Symmetric Tensor Field Function
A new Symmetric Tensor field function has been provided for electric conductivity. In simulation files saved in previous versions of
Simcenter STAR-CCM+, the Tensor Component field function still works in
Simcenter STAR-CCM+ 13.06 if the Electrodynamic Potential model is in the physics continuum. However, the Tensor Component field function is not available for selection in new simulation files that are created in
Simcenter STAR-CCM+ 13.06. An example of the changes to the macro code follows:
Previous Release
|
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));
|
Electrochemistry: Changes to Electrochemical Reactions in Porous Media
Due to improvements that facilitate effective modeling of electric current in thin porous layers, two changes have resulted to the macro code:
- The internal derivation of the ionically conductive domain has been replaced. In your macro code, remove all lines that contain the
IonicallyConductiveDomainOption
.
-
The ionically conductive domain of a setup is now determined by the source of electrons added to reactions. This change affects electron addition to reactions in macros recorded before
Simcenter STAR-CCM+ 13.06:
((ReactionComponentSubstance) reaction_1.getReactants().getReactant("e-"));
In
Simcenter STAR-CCM+ 13.06, specify the continuum which provides the electrons. For the above code example, if the electron was taken out of a physics continuum named
Fuel, the statement must appear as follows in the current version:
((ReactionComponentSubstance) reaction_1.getReactants().getReactant("e- (Fuel)"));
Design Manager: Improvement of Table Imports
In
Simcenter STAR-CCM+ 13.06, Design Manager lets you import
.csv
files directly without having to specify every value. This improvement has resulted in changes to the macro code.
Previous Release
|
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());
}
}
|
Co-Simulation
Changes to Field Exchange Values
Field Exchange Control options have been moved in the user interface for consistency, resulting in changes to the macro code.
Previous Release
|
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);
|
Changes to Initialization Methods
Due to improvements in the physics initialization process, certain initialization methods have been removed from co-simulation, resulting in changes to the macro code:
-
Exported fields no longer use the initialization method "Initialize from Physics". In your macro code, remove lines similar to the following example:
scalarAuxiliaryExportSpecification_0.getCoSimFieldInitializationMethod().setSelected(CoSimFieldInitializationMethod.Type.INITIALIZE_FROM_PHYSICS);
-
Imported fields no longer use the initialization method "Use Imported Values". In your macro code, remove lines similar to the following example:
scalarAuxiliaryImportSpecification_0.getCoSimFieldInitializationMethod().setSelected(CoSimFieldInitializationMethod.Type.USE_IMPORTED_VALUES);
Changes to Mesh Interpolation Stencils
Changes have been made to the techniques with which stencils handle mapping of fields from the source mesh to the target mesh. The target location option is no longer set in the simulation performing the export, but in the simulation performing the import of a field, resulting in changes to the macro code.
The following example assumes that
sim1
is performing the export of an auxiliary field, and
sim2
is performing the import of the same field:
-
In the
previous release, the following macro would be recorded in
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);
}
}
-
In
Simcenter STAR-CCM+ 13.06, the following macro would be recorded in
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);
}
}