MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

better example on method of lines and system of ode's

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41270] [mg41249] better example on method of lines and system of ode's
  • From: sean kim <shawn_s_kim at yahoo.com>
  • Date: Sun, 11 May 2003 03:50:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

[This message was sent out previously with the wrong author due to
 a mailer error - moderator]
 
 Hello group,
 
 I think I have made a big mistake in using someone else's example. I
 figured the group might be more familiar with it. But I don't fully
 understand what the other users were posting about... How could I use
 those as examples( though one seemed like typical coupled diffusion
 and
 the other belousov-zhbotinsky reaction)
 
 Please disregard the previous examples.  Here's a system that I have
 been working on using the information I have learned from the group.
 As
 I have said in the other post, I have a single second order
 derivative
 in a system of otherwise ODE's.
 
 once the system is discretized using center difference method, it
 should be solvable as a system of ode's; but for some reason,
 mathematica isn't doing that. And I can't figure out what I'm doing
 wrong here. I know the numerical soution exists for this system( It's
 an old system that has been solved by other people)
 
 Could the group please look over my codes for this system, and make
 some suggestions as to how to solve it using mathematica?  I don't
 have
 any problems with normal initial value problems. It's when I have
 intial boundary value problems and discretizing, I struggle a lot.  I
 need to use this for my own simulated annealing algorithm which I
 have
 implemented, so it's pretty important that I solve this system,
 unless
 I have a solution to the system, i can't use it in my algorithm.
 
 (*here is the system before discretizing.*)
 
 {D[L[t], t] == koff LRout[t] - kon L[t] Rout[t] + df
 D[D[L[x,t],x],x],
 D[LRout[t], t] == kon L[t] Rout[t] + kout LRin[t] - koff LRout[t] -
 kin
 LRout[t],
 D[ LRin[t], t] ==  kin  LRout[t] - kout LRin[t] - kdeg  LRin[t],
 D [Rout[t], t] ==  krout Rin[t] - krin Rout[t] - kon L[t] Rout[t] +
 koff LRout[t],
 D[ Rin[t], t] ==  wmax + krin Rout[t] - krdeg Rin[t] - krout Rin[t]}
 
 np =  {v -> 5.05* 10^-12, Ro -> 3.00* 10^-08, kon -> 1.40* 10^+06,
     kin -> 6.00* 10^-04, koff -> 1.00* 10^-05, kout -> 6.70* 10^-05,
     kdeg -> 3.30* 10^-05, krin -> 1.37* 10^-03, krout -> 5.90*
 10^-04,
     krdeg -> 1.00* 10^-04, wmax -> 6.95* 10^-12, df -> 1* 10^-7}
 
 
 (*and here's my discretized system, I think the system should only
 have
 ode's, which then can be treated as initial value problem, but it
 appears mathematica can't solve it.*)
 
 xmin = 0; xmax = 100;
 bins = 5;
 dx = Abs[(xmax - xmin)/(bins)];
 
 eqns =
 Join[Table[D[L[i][t], t] == koff  LRout[t] - kon  L[i][t]  Rout[t] +
 df
 ((L[i + 1][t] - 2L[i][t] + L[i - 1][t])/(dx^2)), {i, 1, bins}] /.
 {L[0][t] -> -(krdeg krin (v + (koff (kdeg + kout) v)/kdeg kin)/(kon
 (krdeg + krout) v - kon krout wmax)) /. np, L[bins + 1][t] -> 0},
 {D[LRout[t], t] == kon L[i][t] Rout[t]  + kout LRin[t] - koff
 LRout[t]
 - kin LRout[t],
 D[LRin[t], t] ==  kin  LRout[t] - kout LRin[t] - kdeg  LRin[t],
 D[Rout[t], t] ==  krout Rin[t] - krin  Rout[t] - kon L[i][t] Rout[t]
 +
 koff LRout[t],
 D[Rin[t], t] ==  wmax + krin Rout[t] - krdeg Rin[t] - krout Rin[t]}]
 /.
 np
 
 (*here're the initial coniditons*)
 
 initc = Join[ Table[ L[i][0] == 0, {i, 1, bins}],
     {LRout[0] == 0,
       LRin[0] == 0 ,
       Rout[0] == (krout wmax)/(krdeg krin) /. np ,
       Rin[0] == wmax/(krdeg) /. np}]
 
 variables =
   Join[Table[L[i][t], {i, 1, bins}], {LRout[t], LRin[t], Rout[t],
 Rin[t]}]
 
 (*now here's the solution. *)
 
 discretesystem  = Join[eqns, initc]
 
 dsoln = NDSolve[discretesystem, variables, {t, 0, 2000}]
 
 (* plotting down here. but the solution didn't work so no need for
 this*)
 
 
 << Graphics`MultipleListPlot`
 solnlists = Table[Flatten[Table[Evaluate[(L[j][t] /. dsoln)], {t, 0,
 20, 4}]], {j, 1, 5}]
 
 tsollist = Transpose[solnlists]
 
 MultipleListPlot[Transpose[solnlists], PlotRange -> All,
 PlotJoined -> True]
 
 and of course, by the way I'm doing it... it gives me the following
 error.( which I do not understand... What does this error mean? )
 
 NDSolve::"ndnum": "Encountered non-numerical value for a derivative
 at
 \
 \!\(t\) == \!\(1.5631463870599635`*^-294\)."
 Out[1175]=
 {{L[1][t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     L[2][t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     L[3][t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     L[4][t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     L[5][t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     LRout[t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     LRin[t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     Rout[t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t],
     Rin[t] -> InterpolatingFunction[{{0., 0.}}, "<>"][t]}}
 
 I would love to hear from anyone who can get this to work.  I mean,
 any
 help is truly appreciated.  Thank you all very much in advance. (
 once
 again)
 
 PS.  Thank you Dr. Hollis. your package seems like a fantastic tool
 for
 people who work on coupled diffusion problems. unfortunately, I can't
 use it since I don't have a coupled diffusion problem... i wish there
 was another package like it for systems such as mine. Is there a way
 to
 modify your package or some ways to apply it to my system as shown
 above?
 
 And for Dr. Malek-Madani.  Thank you for the great book by the way. I
 took it out of the my school library--albeit it's a bit over my head.
 I'm not a mathematician or an engineer. I'm a biology grad student
 working on some modeling projects(and it appears that there are a few
 of us biologists posting and askig questions in here...I know from
 the
 questions they ask, they seem familiar.)
 
 The boundary condition is dirichlet. I'm specifying what the value of
 the solution is. I have obtained this boundary condition after making
 some assumptions such as steady states(setting the time derivatives
 to
 0) and solving the system algebraically for L[t] at the boundaries at
 steady state.
 
 
 
 
 =====
 when riding a dead horse,  some dismount.
 
 while others...
 
 form a committee to examine the deadness of the horse, then form an
 oversight committee to examine the validity of the finding of the
 previous committee.
 
 __________________________________


  • Prev by Date: Re: Setting working directory
  • Next by Date: graph from incidence matrix
  • Previous by thread: Re: better example on method of lines and system of ode's
  • Next by thread: Palettes always on top