f

#### solving a system of COUPLED partial differential equations

```"Hello,

I'm trying to solve a system of 3 partial differential equations (3 diffusion equations, 2nd law of Fick) using ode15s! First of all, I transformed my system in an ODE system using the finite difference method to discretize each equation. After, I attached the boundary conditions , that after the discretization are become algebraic equations , and so in the end I' m obliged to solve a DAE system. From my readings I understood that I have to use ode15s to solve M*y'=f(t,y)! I defined the matrix M, by putting 0 where ever I have an algebraic equation, and I 've created a separate function file for f(t,y), in which I defined the coefficients of the variables. The function f(t,y) has the form B(n,n)*C(n), where B is the matrix with the variable's coefficients and C is the variable vector!
After the first run of the code I obtained negative results so I thought that it's best to adimensionalize the variables, and I did so, and now I'm confronting with a warning message :'Warning: Failure at t=3.124127e+00. Unable to meet integration tolerances without reducing the step
size below the smallest value allowed (7.105427e-15) at time t. '' . I know that the coefficient 's matrix is ill conditionned but what I don't know is how to handle this problem!""

I forgot to mention that the equations are coupled and that I'm trying to simulate the transfer of a specie through three different phases ( that's why I have 3 basic diffusion equations).
```
 0
Alina
6/1/2010 1:54:04 PM
comp.soft-sys.matlab 211266 articles. 19 followers. lunamoonmoon (257) is leader.

2 Replies
1638 Views

Similar Articles

[PageSpeed] 59

```> "Hello,
>
> I'm trying to solve a system of 3 partial
> differential equations (3 diffusion equations, 2nd
> law of Fick) using ode15s! First of all, I
> transformed my system in an ODE system using the
> finite difference method to discretize each equation.
> After, I attached the boundary conditions , that
> after the discretization are become algebraic
> equations , and so in the end I' m obliged to solve a
> DAE system. From my readings I understood that I have
> to use ode15s to solve M*y'=f(t,y)! I defined the
> matrix M, by putting 0 where ever I have an algebraic
> equation, and I 've created a separate function file
> for f(t,y), in which I defined the coefficients of
> the variables. The function f(t,y) has the form
> B(n,n)*C(n), where B is the matrix with the
> variable's coefficients and C is the variable vector!
> After the first run of the code I obtained negative
> results so I thought that it's best to
> adimensionalize the variables, and I did so, and now
> I'm confronting with a warning message :'Warning:
> Failure at t=3.124127e+00. Unable to meet integration
> tolerances without reducing the step
> size below the smallest value allowed (7.105427e-15)
> at time t. '' . I know that the coefficient 's matrix
> is ill conditionned but what I don't know is how to
> handle this problem!""
>
>
> I forgot to mention that the equations are coupled
> and that I'm trying to simulate the transfer of a
> specie through three different phases ( that's why I
> have 3 basic diffusion equations).

Did you try MATLAB's pdepe ?

Best wishes
Torsten.
```
 0
Torsten
6/1/2010 11:16:08 AM
```Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote in message <735098493.260351.1275405399232.JavaMail.root@gallium.mathforum.org>...
> > "Hello,
> >
> > I'm trying to solve a system of 3 partial
> > differential equations (3 diffusion equations, 2nd
> > law of Fick) using ode15s! First of all, I
> > transformed my system in an ODE system using the
> > finite difference method to discretize each equation.
> > After, I attached the boundary conditions , that
> > after the discretization are become algebraic
> > equations , and so in the end I' m obliged to solve a
> > DAE system. From my readings I understood that I have
> > to use ode15s to solve M*y'=f(t,y)! I defined the
> > matrix M, by putting 0 where ever I have an algebraic
> > equation, and I 've created a separate function file
> > for f(t,y), in which I defined the coefficients of
> > the variables. The function f(t,y) has the form
> > B(n,n)*C(n), where B is the matrix with the
> > variable's coefficients and C is the variable vector!
> > After the first run of the code I obtained negative
> > results so I thought that it's best to
> > adimensionalize the variables, and I did so, and now
> > I'm confronting with a warning message :'Warning:
> > Failure at t=3.124127e+00. Unable to meet integration
> > tolerances without reducing the step
> > size below the smallest value allowed (7.105427e-15)
> > at time t. '' . I know that the coefficient 's matrix
> > is ill conditionned but what I don't know is how to
> > handle this problem!""
> >
> >
> > I forgot to mention that the equations are coupled
> > and that I'm trying to simulate the transfer of a
> > specie through three different phases ( that's why I
> > have 3 basic diffusion equations).
>
>
> Did you try MATLAB's pdepe ?
>
> Best wishes
> Torsten.

Hello,
So I did what you told me and the answer form matlab is :
''aliq =

1.0000e+00   1.0000e+00   1.0000e+00   1.0000e+00   1.0000e+00
1.0000e+00   1.0000e+00   1.0000e+00   9.9999e-01   9.9357e-01
1.0000e+00   1.0000e+00   1.0000e+00   9.9996e-01   9.8743e-01
1.0000e+00   1.0000e+00   1.0000e+00   9.9990e-01   9.8149e-01
1.0000e+00   1.0000e+00   1.0000e+00   9.9983e-01   9.7574e-01
1.0000e+00   1.0000e+00   1.0000e+00   9.9974e-01   9.7013e-01
1.0000e+00   1.0000e+00   1.0000e+00   9.9963e-01   9.6466e-01
1.0000e+00   1.0000e+00   1.0000e+00   9.9950e-01   9.5932e-01
1.0000e+00   1.0000e+00   9.9999e-01   9.9936e-01   9.5414e-01
1.0000e+00   1.0000e+00   9.9999e-01   9.9920e-01   9.4951e-01
==   1.0000e+00   1.0000e+00   9.9999e-01   9.9903e-01   9.5065e-01=== 11th time step
1.0000e+00   1.0000e+00   9.9999e-01   9.9894e-01   1.0235e+00
1.0000e+00   1.0000e+00   1.0000e+00   1.0166e+00   1.4504e+01
1.0000e+00   1.0000e+00   1.0003e+00   1.2295e+00   1.7303e+02
1.0000e+00   1.0000e+00   1.0039e+00   3.9296e+00   2.1823e+03
1.0000e+00   1.0001e+00   1.0499e+00   3.8166e+01   2.7658e+04''
it seems that is  working well until it reach  the 11th time step! Anyway I know that my J matrix is not stable because the rcond is 1.475e-10, but from my point of view my equations are written correctly.
I tried to use' pdepe ' but I have problems to impose two conditions at the same boundary ( that are the flow continuity and an equilibrium condition; the flow continuity is like : D_liq*dcliq/dx=D_gaz*dcgaz/dx (x= liquid height )  and cgaz=P*cliq, where P is a  partition coefficient)!
Thank you very much for answering me and if you have any other ideas please tell me!
Best regards,
A. Stoian
```
 0
Alina
6/7/2010 10:02:05 AM