solving a system of COUPLED partial differential equations

  • Permalink
  • submit to reddit
  • Email
  • Follow


"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
Reply Alina 6/1/2010 1:54:04 PM

See related articles to this posting


> "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
Reply 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
Reply Alina 6/7/2010 10:02:05 AM
comp.soft-sys.matlab 203823 articles. 539 followers. Post

2 Replies
1136 Views

Similar Articles

[PageSpeed] 40


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

solving a system of COUPLED partial differential equations #2
"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 cr...

How can I solve a system of nonlinear equations AND partial differential equations?
Hi there, I have a system of nonlinear equations that need to be solved simultaneously. The result of these equations, then is needed to be incorporated to a system of PDEs. I know that for the first part I can use "Fsolve", and for the second one I can use "pdetool" but I don't know if i want to link them, that is solve all the equations as one system, how that would be possible. On 10/2/2013 9:34 AM, Roya wrote: > Hi there, > I have a system of nonlinear equations that need to be solved > simultaneously. The result of these equations, then is neede...

Solving of coupled partial differential equation
I have two coupled partial differential equation with two initial conditions and four boundary conditions.First i tried to solve this by "pdepe" solver but since this is a 'stiff' problem, i have to go for "ode15s" solver. And i got this type of error- ??? Error using ==> Mass_balance Unknown flag 'init'. Error in ==> funfun\private\odearguments at 57 [def_tspan,def_y0,def_options] = feval (ode,[ ],[ ],'init',extras{:}); Error in ==> ode15s at 227 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ... Now what shou...

solve a system of partial differential equations
hi, I have a system of partial differential equations to solve. I looked up pdepe function. But seems like it requires initial conditions. But the system I have is comprised with just boundary value problems. can I still use pdepe solver? If not what solver can I use in this regard? Following are the four pde's that I'm trying to solve. p(x)*G''+q(x)*G'+A*G*G'+B*(S^(3/2))*G+B*(T^(3/2))*G+C*(S^(3/2))=0 ...(1) G'+H'=0 ...(2) HS'=D*(r(x)-S)*(E*S^(1/2)+F*H') ...(3) GT'=D*(r(x)-T)*(E*T^(1/2)+F*G') ...(4) where: (1) p(x), q(x) and r(x) are va...

'solving a system of 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...

system of partial differential and differential equations
Hello, I´m trying to solve a system of partial differential and ordinary differential equations. The system of equations is described by the following two equations: du1/dt=A*du2/dx du2/dx=B*(u1-u2) u1 is only dependent on the time t; u2 is dependent on the two variables time t and position x. It follows that u1 is an ordinary differential equations and u2 is a partial differential. So my question is now, how can I solve this system of equations in matlab? I am very grateful for any help. > Hello, > I´m trying to solve a system of partial differential > an...

Solve a system of partial differential equations modeling a column of adsorption with axial dispersion
Hello I did a Matlab script using pdepe to solve a system of partial differential equations representing a column of adsorption : d(C)/dt = kl*a*(x-xi) d(x)/dt = - kl*a*(1-eps)/eps * (x-xi) - wb/(eps*S) * d(x)/dt + Da*d²(x)/dz² C = qmax*K*xi / (1+K*xi) The script is working when the axial dispersion term "Da" is 0, but the results are all falses when Da different from 0. When Da = 0, the mass adsorbed in the solid phase is equal to the difference between the mass entered in the column and the mass that left the column, but when Da is differ...

Solving system of differential equations
Hello I am trying to solve a system of differential equations and I need some help getting started. I have not used matlab that much, so I am not sure how to get started. The equations I have to solve look something like this: (M^2 - 1)*dW/W = -(1+c*M^2)*dG/G - c*(g/a^2)*dL; (M^2 - 1)*dp/p = 2*c*M^2*(1 + ((c-1)/2)*M^2)*dG/G + c*(g/a^2)*(1+(c-1)*M^2)dL; (M^2 - 1)*drho/rho = (1+c)M^2*dG/G + c(g/a^2)dL; (M^2 - 1)*dT/T = (c-1)*(1+c*M^2)*dG/G + c*(g/a^2)*(c-1)*M^2dL; I do have expressions for dL, dG, M, c, a, so these could be taken as constants. The thing I am wonderin...

Solving systems of differential equations
Hi, if I have three sets of DE, how do I solve that in Matlab? dX/dt = 0.2SX/(1+S) dP/dt = 0.02SX/(1+S) dS/dt = -0.8SX/(1+S) Thanks ...

Solving a system of differential equations
Hello all, first time poster here and as a caveat I have never used Matlab seriously before. I have a set of vector differential equations (I have written them in LaTex): (\partial_t - i x) \textbf{b} = -\frac{3}{2 \bar{\omega}_A} b_x \hat{y} + i \textbf{u} (\partial_t - i x) \textbf{u} = \frac{2}{\bar{\omega}_A} u_y \hat{x} - \frac{1}{2 \bar{\omega}_A} u_x \hat{y} - \frac{3}{2 \bar{\omega}_A} \partial_x Q \hat{x} - i Q \hat{y} - i \frac{1}{\kappa} Q \hat{z} + i \textbf{b} \frac{3}{2} \partial_x u_x + i \bar{\omega}_A u_y + \frac{i \bar{\omega}_A}{\kappa} u_z = 0 \textbf{u} and ...

Solving systems of differential equations
I have a question as to an apparent inconsistency I noticed while using Mathematica to solve differential equations, I have 2 ODE like this, and I solve them symbolically using Mathematica 7.0: system = {p'[t] == -(rho + d)*p[t], n'[t] == rho*p[t] + (rho - d)*n[t]}; sol = DSolve[system, {p, n}, t][[1]] I get the following solution: {p -> Function[{t}, E^((-d - rho) t) C[1]], n -> Function[{t}, 1/2 (-E^((-d - rho) t) + E^((-d + rho) t)) C[1] + E^((-d + rho) t) C[2]]} It looks to be correct. Then, manually, I know p(0)=C1, n(0)=0, so C1=p0, C2=0. I know the...

Solving Partial Differential equations
I've a set of 4 partial differential equations dNIT/dt = Kf(No-NIT) -Kr NHNIT (x=0) dNIT/dt = DH(dNH/dx) + &#948;/2(dNH/dt) (0<x< &#948;) DH(d2NH/dx2) = dNH/(dt (&#948;<x<Tphy) DH (dNH/dx) =KpNH (x > TPHY ) I've a system of first order and second odrer partial differential equations. I could not find out any example for first order PDE. Can this be solved using MATLAB? I tried this way function [c,f,s] = pdex4pde(x,t,u,DuDx) Kf=6*10^-3; Kp=1*10^7; No=5*10^12; Kr=3*10^-9; Dh=3*10e-13; Kh=1.4*10^-3; Del=0.8*10^-7; Tox=2.0*10^-7; if x...

solving partial differential equation
I am try to solve a system of partial differential equation of the following type du1/dt = a1(du1/dx)+b1(du1/dy)+c1 du2/dt = a2(du2/dx)+b2(du2/dy)+c2 It seems to me that the PEDPE only treat one variable(x) and the PDE tool box only treat d(m(du/dx))/dx(second derivatives). So is there any way to solve the 2D first derivative problem? Thank you in advance for your help. F. Jin wrote: > > > I am try to solve a system of partial differential equation of the > following type > du1/dt = a1(du1/dx)+b1(du1/dy)+c1 > du2/dt = a2(du2/dx)+b2(du2/dy)+c2 > It seems to me that the PED...

How to solve system of differential equations
Hi all! I want to know how to make a coding (in matlab)of system of differential equations as below, dY(k)/dz=f(z,y(j)) (1) k=1,2,3,...N and j=k+1,..N Here the function takes a complicated form which i haven't written here. Another thing, like above equation(1), I have 3 more such equation which all are nonlinear as well as coupled. I have to solve a such system of equations. Can someone please help me in formulating these equations in matlab? your help will be highly appreciated. regards, Shailendra In article <eef65e5.-1@webx.raydaftYaTP>, shailendra <chap_japan@yahoo....

How to solve coupled differential equations
I am working with a system of coupled second order nonlinear differential equations. I converted it to a system of coupled first order differential equations of this form: function xdot=xdot(t,x) global a b A B C D E F L n q r s xdot(1) = x(2); xdot(2) = C*(1+a*sin(b*t)-10*(1+r*cos(s*t))*x(1)-x(5)*sint-(n/2)*(1-cos(q*t)))-D*(x(1)-x(3))-E*(x(2)-x(4)); xdot(3) = x(4); xdot(4) = A*(x(1)-x(3))+B*(x(2)-x(4)); xdot(5) = x(6); xdot(6) =F*(1+r*cos(s*t))*(x(1)-x(5)*sin(t))-(n/2)*(1-cos(q*t))*sint-K*x(5)-L*x(6); xdot = [xdot(1) xdot(2) xdot(3) xdot(4) xdot(5) xdot(6)]; where [a b A B C D E F L n q r s] ...

Solving coupled differential equations
Hi All, I am trying to solve a system of coupled differential equations. The number of equations is normally quite high, typically of the order of 600. My differential equation is: dx/dt+Ax=B Where: - X is a 600x1 vector - A is a 600x600 matrix, and - B is a 600x1 vector. Firstly, is matrices and an intrinsic ode solver the best way to go? (ie ode23 etc?) The code that I have for this kind of solve is: ------------------------------------------- t0=0; %Start time tf=10; %Stop time tspan=0:0.1:10; init_conditions=zeros(1,6*N-2); [T, Z]=ode23(@dynamics,tspan,init_co...

Solve Nonlinear System of Differential Equations
Dear Matlab friends I'm a postgraduate student and currently have a very tough (for me) task. I have to solve a nonlinear system of Equations that have partial derivatives in them. I'm quite new to Matlab and cannot really make it happen. The equations I have to solve are: (1) df/dt=M*div(f*grad (m))+n*(f-g)-lamdaL*g-div(-grad(p)+m*grad(f)) (2) m=f^3-1.5*f^2+0.5*f-div(grad(f)) (3) dg/dt=M*div(g*grad (m))+heaviside(nN-n)*(f-g)-lamdaL*g-div(-grad(p)+m*grad(f)) (4) -div(grad(p))=n*(f-g)-lamdaL-div(m*grad(f)) (5) 0=div(D*grad(n))+(vp)*(nc-n)-n(f-g) where f,g,m,p and n are...

Solving a system of differential equations #2
Hello, I am a Matlab newbie with a question about differential equations. I apologize in advance if this question is too basic for this newsgroup. I am solving a system of about 20 equations with the "lsqnonlin" function. The entire system of equations is parameterized by time (t). It seems like a very easy process to solve this system, except a few of the equations are differential. For example, I need to find the radius (r) of a balloon-like object over time, as well as the velocity (v) at which it is expanding. A simplified version of the equation is: r_x = int(v(t),t,0,x) But...

solve partial differential equations with mathematica
Hello, I'd like to solve the following partial differential equation with Mathematica, eqn = D[u[r, t], t] == d D[u[r, t], r, r] - k u[r, t]/r by doing: DSolve[{eqn, u[r, 0] == 0, u[0.000000001, t] == ui, u[\[Infinity], t] == 0}, u[r, t], {r, t}] d,k and ui are constants. In DSolve i include also the boundary conditions but I am still not able to solve it. Do you have any suggestions for solving the problem? Thanks very much for your help. Dino. The PDEs that DSolve can solve are still mostly single first-order equations. Other than that, DSolve can find solution...

pdepe cannot solve partial differential equation
Dear all, I am trying to solve a system of three coupled (nonlinear) differential equations containing first order derivatives in time and space, e.g. x-direction. When I try to solve the system I get the following error: "This DAE appears to be of index greater than 1." Maybe I am not allowed to set the second order derivatives to zero, because it is then neither parabolic nor elliptic. Boundary conditions are all set to zero. Did anybody encounter this same problem before? Thanks David Source code: function SRS_pde_solver_pulsed lambda_p=1.545e-6; % [m] g_R=10.5e-11; % Stim...

Solving coupled differential equations iteratively.
Dear all, The have to do the following: NDSolve the coupled differential equations : x'(t) = c1 - k1x(t) - k/(Abs(x(t) -y(t)))^2 y'(t) = c2 - k1y(t) - k/(Abs(x(t) -y(t)))^2 where c1 and c2 are two lists I already have (from these lists, the first value of c1 and the first value of c2 have to used in evaluation.) with initial condition for the first evaluation being provided by me. For the second step, the interpolating functions got as the answers (in the first step) have to be evaluated at t =0.001 and these values have to be used as the initial condition for NDSolving the...

Precision when solving a system of differential equations
Hi, I have a system with three differential equations with time as my variable. I would like to control the increment time step as some of my function are very stiff. Ideally I would like to use between 10 and 20 millions steps. How can I do that? (version used Mathematica 6.0.1) Thanks for help Marc _________________________________________________________________ Hi, you can't because NDSolve[] determine the step size from the precision you set. You can reduce the precision that NDSolve[] use but that is usual not a good idea. In a stiff equation one has typic...

how to solve system of differential equations #2
Hello All, I am wondering how to solve system of differential equations using simulink? plz do help me how to make a simulink model. regards, Shailendra "shailendra" <skvarshney17@gmail.com> wrote in message news:ef124ad.-1@webx.raydaftYaTP... > Hello All, > > I am wondering how to solve system of differential equations using > simulink? > > plz do help me how to make a simulink model. > > regards, > > Shailendra > This document seems to explain how to solve DE's using simulink in details. (including a 2 mass system, i.e. more tha...

Solving random partial differential equations
I am trying to solve a PDE with u a function of three variables x,y,z, with finite element modeling. The differential equation has the following form : du/dz = D1.d?u/dx? + D2.d?u/dy? With the standard PDE tool, I can not define different coefficients for the partial second derivative (D1 & D2), so I can not use it in the standard tool. Is there any other developped tool for such random PDEs, or is there any other method to let the standard tool solve it (such as change of variables). Thanks for the advices I reformulate here the right differential equation form, because some characters ...