Hi all,
I’m trying to model an adsorption column with a system of PDEs, which have been discretized in space using a WENO finite volume scheme. I’m new to julia and this is my first time simulating a complex system like this. I am currently unsure what the best framework is in which to write out the equations and use solvers from DifferentialEquations.jl. I’ve attempted to write the model both as an ODEProblem()
and as a DAEProblem()
, but the solvers I’ve tried either crash by reducing the time step to an extremely small value, or run very slowly.
Specifically the PDEs that I’m solving are (after removing most constants):
- Component Mass balance:
and (hopefully self-enforced) y_1 + y_2 + y_3 = 1.
- Total Mass balance:
- Solid phase balance:
- Column energy balance:
- Pressure drop
These equations and boundary/initial conditions are taken directly from the paper Multiobjective Optimization of a Four-Step Adsorption Process for Postcombustion CO2 Capture Via Finite Volume Simulation.
The only purely algebraic equation is the pressure drop relation, which in theory could be solved separately at each time step. However, because the system is so tightly coupled, I’m not sure whether I should be formulating this as an ODEProblem
or a DAEProblem
. I also tried writing the system in mass matrix form, but it seems that isn’t supported when the coefficients in front of the time derivatives depend on the state variables.
The other issue I’m having is that the simulations without the solid phase balance equation (dx_i/dt = 0) are using up an enormous amount of memory, e.g. 45.900171 seconds (3.93 G allocations: 62.034 GiB, 12.26% gc time, 6.25% compilation time)
. Even though I’m using preallocated buffers for intermediate arrays, this seems excessive. I’m not sure what’s causing such high memory usage.
My project can be found at GitHub - shivang57721/adsorption_process: Numerical simulation of adsorption. I apologize that it’s not a ‘minimal example’, but I’m not really sure how to best isolate the problem. I would greatly appreciate any advice on debugging memory/stability issues, or maybe more general suggestions for organizing coupled PDEs in julia. For example, I see that the package ModelingToolkit.jl
might be useful, but I’m not really sure.