I somehow redefined a standard unit. When I used Units.compatible() and Units.equivalent() to check such units, the python terminates without an error or a warning. The following Python code can reproduce the issue:
from libcellml import Component, Model, Units, Variable
model_name = 'unit_compatibletest'
model = Model(model_name)
component=Component(model_name)
component_param=Component(model_name+'_param')
model.addComponent(component)
model.addComponent(component_param)
const_name = 'T'
var_const=Variable(const_name)
unit_name = 'kelvin'
u=Units(unit_name)
u.addUnit(Units.StandardUnit.KELVIN)
model.addUnits(u)
var_const.setUnits(u)
param_const = var_const.clone()
param_const.setInitialValue(293)
model.component(component.name()).addVariable(var_const)
model.component(component_param.name()).addVariable(param_const)
print(f'1 {var_const.name()} units: {param_const.units().name()}')
Units.compatible(var_const.units(), param_const.units()) # where the python terminates without an error or a warning
Units.equivalent(var_const.units(), param_const.units()) # where the python terminates without an error or a warning
print(f'2 {var_const.name()} units: {param_const.units().name()}')
libcellml version 0.4.0
I somehow redefined a standard unit. When I used Units.compatible() and Units.equivalent() to check such units, the python terminates without an error or a warning. The following Python code can reproduce the issue: