Using custom cadet core in Cadet-Process

Expected behavior.

Hello! Flynn shared with me his version of cadet core that was allowing him to run a two component simulation with the ACT isotherm. Since Im using cadet-process and hes using a more advanced version (6.x.x) that is nor supported by cadet-process, there are incompatibilities that dont allow the code to run and there are a lot of errors that I dont know how to fix. Im not super familiar with all the proper terminology, so Im sorry if this sounds confusing. But I would really appreciate if someone could help me and let me know what more information I need to share in order to get help. Here is the initial thread An example to use ACT isotherm for protein A affinity chromatography - #56 by Flynn
Thanks a lot in advance :slight_smile:
I share below the code I would like to run and the new environment I created with the changes Flynn shared with me.

Actual behavior

Error message: CADETProcessError: CADET Error: Simulation failed with IO ERROR: Group ‘/input/model/unit_001/particle_type_000’ doesn’t exist in file

How to produce bug (including a minimal reproducible example)

import numpy as np

from CADETProcess.processModel import (
    ComponentSystem, Inlet, GeneralRateModel, Outlet, FlowSheet, Process,
    AffinityComplexTitration
)
from CADETProcess.simulator import Cadet

cs = ComponentSystem()
cs.add_component("pH")         
cs.add_component("Main Peak")  
cs.add_component("Far BV")

act = AffinityComplexTitration(cs, name="ACT")
act.is_kinetic   = 0
act.bound_states = [0, 1, 1]   
protein_MW = 100 #kDa

act.adsorption_rate = [1.0,   (80 * protein_MW) * (1-0.945), (80 * protein_MW) * (1-0.945)]   # ka [m^3/mol/s]  (fit later)
act.desorption_rate = [1.0,   1, 1 ]  # kd [1/s]        (fit later; pH=1.0 to avoid zero issues)
act.capacity        = [1e-10, (50 / protein_MW) / (1-0.945), (50 / protein_MW) / (1-0.945)]   # qmax [mol/m^3 solid] (kept fixed in fitting if desired)

act.eta_a = [0.0, 1.16, 1]
act.pka_a = [0.0, 5.25, 4.5]
act.eta_g = [0.0, 0.88, 0.9]
act.pka_g = [0.0, 4.14, 3.5]


print("ACT param check:", act.check_required_parameters())

inlet = Inlet(cs, name="inlet")
inlet.flow_rate = 2.3e-8  # m^3/s

col = GeneralRateModel(cs, name="column")
col.binding_model = act

col.length = 0.204 # m
col.diameter = 0.0066 # m
col.bed_porosity = 0.44 
col.particle_radius = 5e-5
col.particle_porosity = 0.902
col.axial_dispersion = 1.4e-08  #m2/s

col.film_diffusion    = [1, 1.4e-05, 1.4e-05] # m/s
col.pore_diffusion    = [1, 2e-11, 2e-11 ]  #m2/s

col.surface_diffusion = [0, 0]          

# initial concentrations
col.c  = [7.0, 0.0, 0.0]   
col.cp = [7.0, 0.0, 0.0]   

outlet = Outlet(cs, name="outlet")

# ===================== Flow sheet ============================================
fs = FlowSheet(cs)
fs.add_unit(inlet); fs.add_unit(col); fs.add_unit(outlet, product_outlet=True)
fs.add_connection(inlet, col)
fs.add_connection(col, outlet)

# ===================== Process & Events (load → wash → pH gradient) ===========
process = Process(fs, 'mp_act_sim')

process.cycle_time   = 260.0 * 60.0  # total [s]
load_duration        = 42  * 60      # [s]
t_gradient_start     = 100 * 60      # [s]
gradient_duration    = process.cycle_time - t_gradient_start
t_strip = 120 *60

MP_load = (3.6 * 0.35 / 100615.0) * 1e3  
fBV_load = (3.6 * 0.30 / 100615.0) * 1e3  

c_load  = np.array([7.00, MP_load, fBV_load])   
c_wash  = np.array([5.6, 0.0, 0.0])       
c_elute = np.array([3.34, 0.0, 0.0])       

gradient_slope   = (c_elute - c_wash) / gradient_duration
c_gradient_poly  = np.array(list(zip(c_wash, gradient_slope)))  # shape (2,2)

process.add_event('load',       'flow_sheet.inlet.c', c_load)
process.add_event('wash',       'flow_sheet.inlet.c', c_wash,       load_duration)
process.add_event('grad_start', 'flow_sheet.inlet.c', c_gradient_poly, t_gradient_start)

from CADETProcess.simulator import Cadet

# === Run ACT simulation (using the process you built above) ===
if __name__ == '__main__':
    from CADETProcess.simulator import Cadet

    process_simulator = Cadet()
    process_simulator.install_path = r"C:\Users\InesSilva\anaconda3\envs\cadet_"

    simulation_results = process_simulator.simulate(process)


    from CADETProcess.plotting import SecondaryAxis
    sec = SecondaryAxis()
    sec.components = ['pH']
    sec.y_label = '$c_{pH}$'

    simulation_results.solution.column.outlet.plot(secondary_axis=sec)

File produced by conda env export > environment.yml

cadet_.yml (7.34 KB)

Hi, CADET-Core is currently undergoing a large overhaul of some internal structures which does affect the interface. Once this is finished, CADET-Process will start implementing those new features. Until then, we will have to ask you for some patience. Do not expect this to be done by the end of the year.
Best
Johannes

1 Like

Hi Sasha,

adding to Johannes comment, you can use the v6 pre-releases or master source builds of CADET-Core via CADET-Python, including the ACT isotherm. I know that this is what Flynn does. An example for an ACT configuration with CADET-Python can be found in CADET-Verification, specifically here, and you can adapt this to your specific setting.
Best regards,
Jan

3 Likes

Also adding to what Jan said, we’re happy to help. Consider joining our Office Hours.

2 Likes

So what youre saying basically is that right now it would just be easier if I moved to CADET-Python and try the CADET-core custom version Flynn sent me through that?

1 Like

Yes.
Further, there will be a new pre-release (v6.0.0a3) in the next couple of days which includes the improved ACT. Pre-releases can be installed via conda and PyPi as described here

2 Likes