BiSMA model error

Dear Cadet-Devs,

I’m trying to establish an exemplatory process model of the BiSMA-Binding. Unfortunately the simulation does not end. If I try to debug Cadet Core in VS using the h5 file I run into the error below. I attached the h5 file below, could you let me know if this is an issue of the parameter set or the BiSMA implementation in Cadet Core?

Debug Error in Visual Studio using the current Cadet Core master-branch without changes:

Assertion failed: scalingFactors[i] != 0.0, file D:\data\source\repos\CADET\src\libcadet\linalg\DenseMatrix.cpp, line 303

BiSMA_DebugFile.h5 (80.0 KB)

I can reproduce the error. @j.breuer can you maybe also have a look?

Hello Mr. Ortler,

I could also reproduce the error, the factorization in the consistent initialization failed. You only specified the initial values for the salt liquid phase as non-zero, all the other (liquid and solid) phases were specified as zero. These initial values are inconsistent with the equations and we thus need consistent initialization, which CADET generally supports.

We found that the ordering of the binding parameters was not correct: it should be in state-major, i.e. first come the values for the first bound state of all components, then for the second bound states.

The specification of some binding parameters as zero (which was meant for the salt but was applied for a non-salt component) created a singular (sub)matrix in the Jacobian, i.e. a zero row, which is why the factorization within the consistent initialization failed.

Furthermore, in order to debug your simulations, we recommend setting CONNECTIONS_INCLUDE_DYNAMIC_FLOW = false, otherwise the preprocessing takes rather long in debug mode.


1 Like

We also found, that setting the consistent_init_mode = 5 is required if the different bound states have different parameters. E.g.
This will always work,

unit1.adsorption.bisma_ka = np.array([0, 20, 40, 0, 20, 40])

This will require consistent_init_mode = 5:

unit1.adsorption.bisma_ka = np.array([0, 20, 40, 0, 2, 3])

So if you find, that your BiSMA simulations aren’t terminating, especially if they get stuck at a section switch time, try setting consistent_init_mode = 5. This will perform a full “consistent initialization” at the start of the simulation and “lean” initializations at subsequent section switches


Thank you both for looking into this issue!
With your suggestions I succeded in running this simulation. :100:



In CADET-Process, dynamic flow rates set to True by default. To override this, you can set _force_constant_flow_rate = True in the Cadet adapter.

simulator = Cadet()
simulator._force_constant_flow_rate = True

Note that this will only use the constant term of the flow rates. Since this is mostly for debugging, no further checks are performed. So if you implemented gradients using flow rates, this will not work.