Weird behaviour with CADET-Process

Sorry I am relatively new to chromatography and CADET/CADET-Process.
I try to track the concentration going into the column via the attached code, however, the initial concentration is 325 for no reason (I would expect it to be 150 corresponding to load_on). If I comment out the lines about the elution event, then it becomes 150.
Could someone help me understand what is the issue?

Another general question I had was, do we need to maintain total flow rate constant in the column? In all examples such as this (CADET-Process/examples/load_wash_elute/lwe_flow_rate.py at master · fau-advanced-separations/CADET-Process · GitHub) it is kept constant despite there being a gradient.
CP bug elution.ipynb (59.5 KB)

Hi, could you please provide the code in executable form, not as jupyter notebook. Thanks!

For some reason, I was having trouble attaching that, here is the code though:

from CADETProcess.processModel import ComponentSystem
from CADETProcess.processModel import StericMassAction
from CADETProcess.processModel import Inlet, GeneralRateModel, Outlet
from CADETProcess.processModel import FlowSheet
from CADETProcess.processModel import Process
from CADETProcess.simulator import Cadet

# Component System
component_system = ComponentSystem()
component_system.add_component('Salt')
component_system.add_component('A')
component_system.add_component('B')
component_system.add_component('C')

# Binding Model
binding_model = StericMassAction(component_system, name='SMA')
binding_model.is_kinetic = True
binding_model.adsorption_rate = [0.0, 35.5, 1.59, 7.7]
binding_model.desorption_rate = [0.0, 1000, 1000, 1000]
binding_model.characteristic_charge = [0.0, 4.7, 5.29, 3.7]
binding_model.steric_factor = [0.0, 11.83, 10.6, 10]
binding_model.capacity = 1200.0

# Unit Operations
load = Inlet(component_system, name='load')
load.c = [150, 1.0, 1.0, 1.0]

wash = Inlet(component_system, name='wash')
wash.c = [50.0, 0.0, 0.0, 0.0]

elute = Inlet(component_system, name='elute')
elute.c = [500.0, 0.0, 0.0, 0.0]

column = GeneralRateModel(component_system, name='column')
column.binding_model = binding_model

column.length = 0.014
column.diameter = 0.02
column.bed_porosity = 0.37
column.particle_radius = 4.5e-5
column.particle_porosity = 0.75
column.axial_dispersion = 5.75e-8
column.film_diffusion = column.n_comp*[6.9e-6]
column.pore_diffusion = [7e-10, 6.07e-11, 6.07e-11, 6.07e-11]
column.surface_diffusion = column.n_bound_states*[0.0]

column.c = [50, 0, 0, 0]
column.cp = [50, 0, 0, 0]
column.q = [binding_model.capacity, 0, 0, 0]

outlet = Outlet(component_system, name='outlet')

# Flow Sheet
flow_sheet = FlowSheet(component_system)

flow_sheet.add_unit(load)#, feed_inlet=True)
flow_sheet.add_unit(wash)#, feed_inlet=True)
flow_sheet.add_unit(elute)#, eluent_inlet=True)
flow_sheet.add_unit(column)
flow_sheet.add_unit(outlet, product_outlet=True)

flow_sheet.add_connection(load, column)
flow_sheet.add_connection(wash, column)
flow_sheet.add_connection(elute, column)
flow_sheet.add_connection(column, outlet)

# Process
process = Process(flow_sheet, 'lwe')
process.cycle_time = 2000.0

load_duration = 10.0
t_gradient_start = 90.0
gradient_duration = process.cycle_time - t_gradient_start

wash_duration = t_gradient_start - load_duration

Q = 6.683738370512285e-8
gradient_slope = Q/(process.cycle_time - t_gradient_start)

process.add_event('load_on', 'flow_sheet.load.flow_rate', Q)
process.add_event('load_off', 'flow_sheet.load.flow_rate', 0)
process.add_duration('load_duration', time = load_duration)

process.add_event_dependency('load_off', ['load_on', 'load_duration'], [1, 1])

# # process.add_event('wash_on', 'flow_sheet.wash.flow_rate', Q)
# # process.add_event_dependency('wash_on', ['load_off'])
process.add_event('wash_on', 'flow_sheet.wash.flow_rate', Q, time=load_duration)
# process.add_event_dependency('wash_on', ['load_off'])


process.add_event('wash_off', 'flow_sheet.wash.flow_rate', 0)
process.add_duration('wash_duration', time=wash_duration)


process.add_event_dependency('wash_off', ['wash_on', 'wash_duration'])

process.add_event('elute_on', 'flow_sheet.elute.flow_rate', Q, time=t_gradient_start)
process.add_event_dependency('elute_on', ['wash_off'])




process_simulator = Cadet()

simulation_results = process_simulator.simulate(process)

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

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

print(simulation_results.solution.column.inlet.total_concentration_components)

Hi Ronan,

this issue stems from CADET Process assuming cyclic processes. So the status that the process ends in (flow rates, inlet concentrations etc.) carry over to the start of the simulation. And because you started the eluent and never turned it off again, it’s “still” running at the start of the simulation. To fix the behavior you can add an eluent off event at t=process.cycle_time and things will work as expected.

Cheers,
Ron

1 Like