Assigning constants in Bi-Langmuir model

Hi there,

I am trying to run a Bi-Langmuir adsorption model with a single column but having problems to correctly assign adsorption constants for the second adsorption site of each component. I’ve tried this but without success:

Hey Sebastian,

I suppose that nbound is the culprit here. Please try the following:

set_discretization(bilangmuir_model, n_col=150, n_bound=n_comp*[2])

This will set nbound properly in the discretization branch, assuming you’re using some column model (the configuration for a CSTR would be slightly different; see also here and here).

It is important to note that nbound is a vector/list of length NCOMP (or NCOMP * NPARTYPE if you have more than one particle type) and describes the number of bound states for each component. For the classical Bi-Langmuir, that would be [2,2]. Note, that you can model an arbitrary number of binding sites. It should probably not be called Bi-Langmuir any more but rather something like Multistate-Multicomponent-Langmuir.

By the way, if you could post the source code in plain text, it would be a bit more convenient for us to assist you in finding issues. To format blocks of code, use three backticks `. E.g.
print(‘hello world’)
will be rendered as

print('hello world')

Thanks Johannes.

I’ve tried this way but then it fails saying:

INIT_Q does not contain enough values for all bound states.

Then I’ve changed from

bilangmuir_model.root.input.model.unit_001.init_q = n_comp*[0.0]


bilangmuir_model.root.input.model.unit_001.init_q = n_comp*[0.0, 0.0]

but here I get a convergence error:

returncode=3, stdout=b"[Error: idasErrorHandler::200] In function ‘IDASolve’ of module ‘IDAS’, error code ‘IDA_CONV_FAIL’:\r\nAt t = 0 and h = 9.53674e-13, the corrector convergence failed repeatedly or with |h| = hmin.\r\n[Error: integrate::1364] IDASolve returned IDA_CONV_FAIL at t = 0\r\n", stderr=b’SOLVER ERROR: Error in IDASolve: IDA_CONV_FAIL at t = 0.000000\r\n’)

any Idea?

Hey Sebastian,

This looks good to me, so maybe something else is still missing (or there is a bug somewhere). Would you mind sending us the hdf5 file so we can inspect it a bit more in detail?

In case you’re using tutorial utils, you can call run_simulation() and pass an additional file name as argument. E.g.


will create a new hdf5 file with the complete CADET model configuration in your working directory.