Modeling DAE system with discontinous solution (jump condition domain)
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am trying build steady-state 1D electrodialysis model in matlab, cromprizing three sub domains, namely the analyte channel, the catholyte channel and an ion exchange membrane inbetween. I have provided the key eqations, while there are still some other minor algebraic equations.
DAE system:
(dc/dt=0)

Boundary condition: Neuman boundary conditions (also shown in the sketch)
Internal boundary condition (jump condition)
(membran solution interface continuity condition)The masstransport is modeled using the nerst plank equation for each species and the electricfield is calculated through ohms law. Additionally I use the electron neutrality condition to close the mass balance. The individuall sub domains are connetced through an internal flux continuity boundary condition.
So far i have a rough understanding of the various ode solvers but from what i understand, the ode solvers only work when the whole problem is fully defined. In my case however, I have these sub domains connected via flux continuity boundary conditions, which is why i can not solve the sub domains individually. I have to solve them all at once. Additionally the boundary continuity boundary condition at the membrane interface introduces a jump (discontinuity) to the conentration and the potential profile. (qualitatively sketched below)

I am now looking for an appropirate way to model this system. The tricky part is the continuity condition at the membrane interface.
I hope to solve this problem with bvp5c where one can define multiple boundary condition inside the domain as described in this documentation:
But I am not entirlly sure how to implement the countinuity condition.
I have figured that it is possible to have jumps in the solution but since the continuity boundary condition which i am aiming to use is more complex that what has been done in the documentation, I am not quite sure on how to implent it. I would need the derivertives at the interface, instad of simply relating the absolute values at the interface to each other. (as it is done here)

function res = bc(YL,YR) % boundary conditions
res = [YL(1,1) % v(0) = 0
YR(1,1) - YL(1,2) - 1 % Here, I introduced a jump with a constant value at x=1
YR(2,1) - YL(2,2) % Continuity of C(x) at x=1
YR(2,end) - 1]; % C(lambda) = 1
end
Does anyone have an Idea, how i can use this solver for my problem. Any alternative approaches and clues are also very welcome.
Thank you^^
Bonus:
Ideally I want to build a hirachical model where all these three domains are modeled as individual systems (ode systems) and conntect them through a continiuty condtion for the concentraiton and the donnanpotential for the electric field. Also for the purpose of reusing the individuall models for later simulations. I know that this is common practice in gPROMS but i couldnt find similar approaches to modeling using matlab. Is there a similar modeling framework in matlab? I have only seen people using the various ode solvers for modeling in matlab for fully defined ODE systems.
5 comentarios
Torsten
el 26 de Feb. de 2023
I don't understand the background of your equations which I think would be necessary to help.
What variables are known, what are unknown ?
How are ϕ and φ related ?
Is c related to the C_i ?
Respuestas (1)
Berat Cagan Türkmen
el 26 de Feb. de 2023
Editada: Berat Cagan Türkmen
el 26 de Feb. de 2023
20 comentarios
Torsten
el 5 de Mzo. de 2023
Editada: Torsten
el 6 de Mzo. de 2023
d^2c_2/dx^2 = -z1/z2 * d^2c_1/dx^2
by the relation
z1*c_1 + z2*c_2 = 0
And then you solve the equation for d^2c_1/dx^2, substitute y(1) = c_1, y(2) = dc_1/dx as usual. What's the problem ?
this works for 2 species, you are right. but i have more then 2 species i cant do that.
Write down the system for N species. If you arrange the equations with regard to d^2c_i/dx^2 (i=1,...,N-1) and substitute d^2c_N/dx^2 as you substituted d^2c_2/dx^2 above, you get a linear system of equations of the form
a11*d^2c_1/dx^2 + a12*d^2c_2/dx^2 + ... + a1,N-1*d^2c_(N-1)/dx^2 = b_1
a21*d^2c_1/dx^2 + a22*d^2c_2/dx^2 + ... + a2,N-1*d^2c_(N-1)/dx^2 = b_2
...
aN-1,1*d^2c_1/dx^2 + aN-1,2*d^2c_2/dx^2 + ... + aN-1,N-1*d^2c_(N-1)/dx^2 = b_N-1
Here, a_ij and bi depend on c_i and dc_i/dx.
This system can be solved for the d^2c_i/dx^2 using backslash, as I already told you in a previous response.
The problem i see however, is that the bvp5c model forces me to form first order odes. but if i could code a finite difference method based solver, shouldnt i be able to manually discritize me second order and the dphi/dx equation?
Where do you see a problem in writing second-order derivatives as two first-order derivatives ?
In my experience, self-written numerical code (e.g. to solve a multipoint boundary value problem) should only come into play if the available solvers are not applicable. I don't see that this is the case here.
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!























