Record solution at various column / radial sections instead of outlet only - MATLAB

Hi all,

Sorry for revivifying extinct species, but I’ve been using the MATLAB front-end :slight_smile: .

I’m not sure how to record / obtain time-series solutions for c-bulk, c-solid at specific axial elements in the column, and c-pore, c-solid at specific radial elements in a given particle.

I see we specify solution times, but is there a way to specify solution elements of a particular column, etc.? I saw the equivalent python code online, in the tutorials, but it didn’t seem transferable.

Any help is appreciated! Thanks!

Extract of my MATLAB code:

% Step 3: Assemble system of unit operations
	% ===================================================
    mOut = OutletModel();
	mOut.nComponents = 3;
	% Construct ModelSystem and assign unit operations (order determines IDs)
	mSys = ModelSystem();
	mSys.models = [mIn, mGrm1, mCSTR, mGrm, mOut];

	% Define valve configurations / unit operation connections
	% Valve configuration active on entering section 0
	mSys.connectionStartSection = [0 ];% no meaning yet
	% Connect unit 0 with unit 1 (-1 = all components)
	%% first 0 first unit inlet.. 1 .. 2 inlet GRM .. then all component 
    mSys.connections = {[0, 1, -1, -1,  FlowSections/(60*1e6);    ...
 	                     1, 2, -1, -1,  FlowSections/(60*1e6);    ...
                         2, 3, -1, -1,  FlowSections/(60*1e6);
                         3, 4, -1, -1,  FlowSections/(60*1e6)]};

                     

	% Step 4: Create simulator and configure it
	% ===================================================

	% Construct and configure simulator
	sim = Simulator.create();
    sim.nThreads = 12;

    sim.solutionTimes = pH_time; % [s], time points at which solution is computed
    sim.sectionTimes = inletProfile.breaks;
	sim.sectionContinuity = inletProfile.continuity;
            
    sim.model = mSys;

    
	% Step 5: Run the model and plot the results
	% ===================================================

    sim.absTol=1.0000e-08; % 1.0000e-08;
    sim.relTol=1.0000e-06; % 1.0000e-06;
    sim.algTol= 1.0000e-08; % 1.0000e-08;
    sim.relTolSens=1.000e-6; % 1.0000e-06;
    sim.maxSteps=1000; % 1000
    sim.initStepSize = 1e-12; % 1.0000e-06;
    
    result = sim.run();

	% Extract solution into a matrix with time being the first column
    solution = [result.solution.time, result.solution.outlet{5}];

Hi Soumi,

assuming that your column model is stored in mCol, I believe you can set

mCol.returnSolutionBulk = true;

and then later inspect the solution for every axial cell in result.solution.bulk.

Edit: PSA: I haven’t checked this, this is just an educated guess…


Note, that the CADET-Matlab interface is being deprecated. It will not be included in further releases of CADET since none of us at the institute uses MATLAB.

But do not despair, it’s an ideal time to learn CADET-Process at the first CADET-Workshop in the United States, hosted by our friends at RPI in Troy, NY, May 22-24, 2024. Spread the word and I would love to see you and some other guys from UD over there! :nerd_face:

Best regards

Jo

3 Likes

Thanks Jo!
For completeness, here’s what I did.

mGrm.returnSolutionBulk = true;
mGrm.returnSolutionSolid = true;
mGrm.returnSolutionParticle=true;

For a 3 component system:

K>> result.solution.bulk

ans =

  5×1 cell array

    {   0×0    double}
    {   0×0    double}
    {   0×0    double}
    {9153×60×3 double}
    {   0×0    double}

K>> result.solution.outlet

ans =

  5×1 cell array

    {9153×3 double}
    {9153×3 double}
    {9153×3 double}
    {9153×3 double}
    {9153×3 double}

K>> result.solution.particle

ans =

  5×1 cell array
    {   0×0       double}
    {   0×0       double}
    {   0×0       double}
    {9153×60×45×3 double}
    {   0×0       double}
1 Like

Oh, and also - I forgot to mention: Yes! My colleague from lab will be there.

1 Like