Macro API Changes 2021.2

In Simcenter STAR-CCM+ 2021.2, the macro API changed for adjoint, reacting flow, multiphase, Eulerian multiphase, electrochemistry, and Design Manager.

Adjoint: Changes to GMRES Solver Settings

Due to the introduction of new GMRES options for Adjoint solvers, macro code has changed.

GMRES settings

The classes GmresSettings and FlexibleGmresSettings have been replaced, respectively, by GmresAlgorithm and FlexibleGmresAlgorithm. Also, the property KrylovSpaceDimension has been renamed to MaxKrylovBaseSize, as in the example below.

Previous Release Simcenter STAR-CCM+ 2021.2
AdjointSolver adjointSolver_0 = ((AdjointSolver) simulation_0.getSolverManager().getSolver(AdjointSolver.class));
GmresSettings gmresSettings_0 = adjointSolver_0.getGmresSettings();
gmresSettings_0.getPreconditionerOption().setSelected(PreconditionerOption.Type.RIGHT_PRECONDITIONING);
gmresSettings_0.setKrylovSpaceDimension(50);
gmresSettings_0.setCorrectionSweeps(3);
AdjointSolver adjointSolver_0 = ((AdjointSolver) simulation_0.getSolverManager().getSolver(AdjointSolver.class));
AdjointGmresAlgorithm adjointGmresAlgorithm_0 = adjointSolver_0.getGmresAlgorithm();
adjointGmresAlgorithm_0.getPreconditionerOption().setSelected(PreconditionerOption.Type.RIGHT_PRECONDITIONING);
adjointGmresAlgorithm_0.setMaxKrylovBaseSize(50);
adjointGmresAlgorithm_0.setCorrectionSweeps(3);

GMRES iterations

The definition of GMRES and Flexible GMRES (FGMRES) iteration has changed. In the previous version an "iteration" corresponded to a full GMRES/FGMRES cycle. In the new version, an "iteration" is a single inner GMRES/FGMRES iteration (that is, a single Arnoldi iteration). For instance, if the Krylov base size is 50, then an iteration of the old version corresponds to 50 iterations of the new.

Previous Release Simcenter STAR-CCM+ 2021.2
AdjointSolver adjointSolver_0 = ((AdjointSolver) simulation_0.getSolverManager().getSolver(AdjointSolver.class));
GmresSettings gmresSettings_0 = adjointSolver_0.getGmresSettings();
gmresSettings_0.setKrylovSpaceDimension(50);
adjointSolver_0.stepAdjoint(2);
AdjointSolver adjointSolver_0 = ((AdjointSolver) simulation_0.getSolverManager().getSolver(AdjointSolver.class));
AdjointGmresAlgorithm adjointGmresAlgorithm_0 = adjointSolver_0.getGmresAlgorithm();
adjointGmresAlgorithm_0.setMaxKrylovBaseSize(50);
adjointSolver_0.stepAdjoint(100); // 100 = Krylov Base Size multiplied by Number of Steps in "old" version

Reacting Flow: Changes to Soot Sections with Flamelet and Extended Coherent Flame Model (ECFM)

Due to restructuring, changes have been made to macro code for the Soot model and Sections models. Specifically, SootMomentOption has been renamed to SootOption and SootMomentNucleationOption has been renamed to SootNucleationOption.

For example, instances of

RNSootOption rNSootOption = reactorNetworkEmissions.getSootMomentOption();

should be changed to

RNSootOption rNSootOption = reactorNetworkEmissions.getSootOption();

Instances of

sootMomentEcfmModelProperties.getSootMomentNucleationOption().setSelected(SootMomentNucleationOption.Type.C2H2);

should be changed to

sootMomentEcfmModelProperties.getSootNucleationOption().setSelected(SootNucleationOption.Type.C2H2);

Multiphase: Changes to Phase Modeling

The possibility to select different profiles for drag (Schiller-Naumann vs. Symmetric) for drag-based phase slip in both MMP and VOF has been removed. Instead, the phase interaction holding the phase slip model can be restricted to the dispersed secondary phase regime (equivalent to Schiller-Naumann drag) or be left unrestricted (equivalent to Symmetric drag). Macros should be changed accordingly:

Previous Release Simcenter STAR-CCM+ 2021.2
Simulation simulation_0 = getActiveSimulation();
Region region_0 = simulation.getRegionManager().getRegion("Region");
PhaseConditions phaseConditions_0 = ((PhaseConditions) region_0.get(PhaseConditionsManager.class).getPhaseConditions("Phase Interaction 1"));
MmpDragCoefficientProfile mmpDragCoefficientProfile_0 = phaseConditions_0.getPhaseValueManager().get(MmpDragCoefficientProfile.class);
mmpDragCoefficientProfile_0.setMethod(MmpSchillerNaumannDragCoefficient.class);
Simulation simulation_0 = getActiveSimulation();
PhysicsContinuum physicsContinuum_0 = ((PhysicsContinuum) simulation_0.getContinuumManager().getContinuum("Physics 1"));
MultiPhaseInteractionModel multiPhaseInteractionModel_0 = physicsContinuum_0.getModelManager().getModel(MultiPhaseInteractionModel.class);
PhaseInteraction phaseInteraction_0 = ((PhaseInteraction) multiPhaseInteractionModel_0.getPhaseInteractionManager().getPhaseInteraction("Phase Interaction 1"));
MmpMmpPhaseInteractionModel mmpMmpPhaseInteractionModel_0 = phaseInteraction_0.getModelManager().getModel(MmpMmpPhaseInteractionModel.class);
mmpMmpPhaseInteractionModel_0.getRegimeRestrictionOption().setSelected(RegimeRestrictionOption.Type.DISPERSED_SECONDARY);

Eulerian Multiphase (EMP): Changes to AMUSIG Model

Due to improvements in the Adaptive Multiple Size-Group (AMUSIG) model, related macro code has changed.

Specifically, the method getInterGroupRedistributionRate() is no longer required. Macros recorded in previous versions of Simcenter STAR-CCM+ may use such a method, for example:

amusigModel_0.getInterGroupRedistributionRate().setValue(0.1);

For maximum reliability, it is recommended that you remove instances of this method from your macros.

Electrochemistry: Changes to Charged Species

Due to restructuring, changes have been made to macro code for Charged Species. Specifically, instances of

import star.electrochemicalspecies.ChargedSpeciesModel;

should be changed to

import star.electrochemicalspecies.chargedspecies.ChargedSpeciesModel;

Instances of

import star.electrochemicalspecies.ChargedSpeciesSolver;

should be changed to

import star.electrochemicalspecies.chargedspecies.ChargedSpeciesSolver;

For setups using the ChargedSpeciesModel only (not for setups using ElectrochemicalSpeciesModel), instances of

import star.electrochemicalspecies.ElectrochemicalSpeciesIonicConductivityMethod;

should be changed to

import star.electrochemicalspecies.chargedspecies.SpeciesIonicConductivityMethod;

Design Manager: Changes to Mesh Reuse

Mesh reuse functionality in Design Manager has been modified, resulting in changes for MdxMacroFile:

  • The MacroInsertType enumerated type in MdxMacroFile.java is deprecated in Simcenter STAR-CCM+ 2021.2. This is replaced with the new enumerated type MacroInsertionPoint.
  • The methods getMacroInsertType() and setMacroInsertType() are deprecated. For maximum reliability, replace them in your macro code with the new methods getMacroInsertionPoint() and setMacroInsertionPoint().
  • MacroInsertType.AFTER_MESHING is replaced with MacroInsertionPoint.BEFORE_RUNNING.
  • MacroInsertType.AFTER_RUNNING is replaced with MacroInsertionPoint.BEFORE_RESULTS.
Previous Release Simcenter STAR-CCM+ 2021.2
MdxMacroFile mdxMacroFile_0 = mdxStudySettings_0.getMacroFiles().createMacroFile(0, "macro.java");
mdxMacroFile_0.setMacroInsertType (MdxMacroFile.MacroInsertType.AFTER_MESHING);
mdxMacroFile_0.setMacroInsertType (MdxMacroFile.MacroInsertType.AFTER_RUNNING);
MdxMacroFile mdxMacroFile_0 = mdxStudySettings_0.getMacroFiles().createMacroFile( MacroInsertionPoint.BEFORE_MESHING, "macro.java")
mdxMacroFile_0.setMacroInsertionPoint (MdxMacroFile.MacroInsertionPoint.BEFORE_RUNNING);
mdxMacroFile_0.setMacroInsertionPoint (MdxMacroFile.MacroInsertionPoint.BEFORE_RESULTS);