Modify inlets using add_concentration_profile from .h5 file (CADET-Process)

Dear modellers,

I want to load an .h5 file and modify the inlet using CADET-Process’ add_concentration_profile function.
How do I do that as smoothly as possible, without recreating the whole model line by line from the h5 to the CADET-Process format? Below is a MWE and the .h5 file is attached for a simple batch case. Im trying to load the solution in the .h5 file to use as inlet.
model1.h5 (85.6 KB)

from CADETProcess.processModel import Process
from CADETProcess.simulator import Cadet
simulator = Cadet()
modelbatch = Cadet.load_from_h5(simulator, r'model1.h5')
inlet_c = modelbatch.root.output.solution.unit_001.solution_outlet
times = modelbatch.root.output.solution.solution_times
Process.add_concentration_profile(modelbatch,modelbatch.root.input.model.unit_000,times,inlet_c,components = -1)

At least when I try this, it says

AttributeError: 'Cadet' object has no attribute 'flow_sheet'. 

Many thanks in advance!

Best,
Jesper

Hey Jesper,

Process is a class. You need to instantiate it with a FlowSheet before being able to add events (or concentration profiles)

Hi Johannes,

Thank you very much for the answer!
Then I have to create an instance to make the add_concentration_profile function work.

I have two follow up questions.
How do I set initial conditions as a full state vector in CADET-Process? In CADET-Core, I would specify:

  model.root.input.model.init_state_y

Furthermore, I was also not able to find how I set user_solution_times in CADET-Process. In CADET-Core, I would specify:

model.root.input.solver.user_solution_times

Many thanks in advance!

Best,
Jesper

You can set it in

process.system_state = ...

Note, this does currently not perform any kind of checks.

That’s currently not directly possible. You would have to create the CADET-Python config first and then manually overwrite.