COMSOL 6.0 API Changes
Pair Features
The removal of the fallback features under pair features can break any API code that you have written that accesses these features. The presence of a default pair feature may also create a different configuration compared to what previous API runs did.
Java or MATLAB® programs that accessed fallback features under a pair feature will not work anymore. This is a necessary limitation because any attempt to support such API backward compatibility will be both unintuitive and unsafe. For most physics created from the API, the default feature from the physics will act as the fallback to the pair features. As long as the default fallback feature in 5.6 was of the same type, the behavior in 6.0 will be equivalent. If you used a special fallback feature for a pair feature in 5.6, you now place it either before or after the pair feature and use the same selection as the pair feature. Placing the fallback feature afterward makes it possible to use the pair feature’s selection directly. The example below shows such code for 5.6 and how the equivalent code in 6.0 can be written:
// Creating a pair feature in both 5.6 and 6.0
model.component("comp1").physics("es").create("cont1", "Continuity", 2);
// Assign some pairs to the pair feature
model.component("comp1").physics("es").feature("cont1").
set("pairs", new String[]{"ap1", "ap2"});
 
// Creating a fallback feature under a pair in 5.6 (this will not work in 6.0)
model.component("comp1").physics("es").feature("cont1").
create("sfcd1", "SurfaceChargeDensity", 2);
// Accessing a settings in 5.6 (this will not work in 6.0)
model.component("comp1").physics("es").feature("cont1").
feature("sfcd1").set("rhoqs", "1e-9");
 
// Creating an equivalent feature in 6.0 that act as fallback to the pair feature
model.component("comp1").physics("es").create("sfcd1", "SurfaceChargeDensity", 2);
// Use the same selection as the pair feature
int[] ent = model.component("comp1").physics("es").
feature("cont1").selection().entities();
model.component("comp1").physics("es").feature("sfcd1").
selection().set(ent);
// Accessing a settings in 6.0
model.component("comp1").physics("es").feature("sfcd1").
set("rhoqs", "1e-9");
When a physics interface is created from the API in 6.0, it will also add default pair features that did not exist in 5.6. As long as the final model uses all created pairs, the behavior will be the same in 6.0; otherwise, it may be necessary to disconnect the default pair feature with an extra command. Below is an example for the Electric Currents interface, but the actual set operation is identical for all interfaces.
model.component("comp1").physics("ec").feature("dcont1").set("pairDisconnect", true);
This concludes the release notes for COMSOL Multiphysics version 6.4.