Re: pde's and method of lines
- To: mathgroup at smc.vnet.net
- Subject: [mg41243] Re: pde's and method of lines
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 9 May 2003 03:22:35 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <b9dnhc$1fr$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, it depend on your system in your example below > du/dt = 1-4 u_i + .02 d^2u/dx^2+ (u)^3 v > dv/dt = 3 u_i - (u)^3 v it is not clear what you mean, do you mean D[u[x,t],t]== 1- 4 u[x,t]+G*D[u[x,t],{x,2}]+u[x,t]*v[x,t] D[v[x,t],t]== 3 u[x,t] -u[x,t]^2 *v[x,t] (than you need a dicrete v[x,t] even when v[x,t] can not diffuse it is still local) or do you mean D[u[x,t],t]== 1- 4 u[x,t]+G*D[u[x,t],{x,2}]+u[x,t]*v[t] D[v[t],t]== 3 u[x,t] -U[x,t]^2 *v[t] and v[t] is infinite fast. Regards Jens sean kim wrote: > > hello group, > > once again, I catch myself, resorting to asking question to the group. > > I have a question regarding pde's and method of lines. ( it appears > there are a couple of posts regarding this, but not the question I'm > going to ask) > > please consider the following which was p[osted by one of the wolfram > researcher as an answer to a post regarding a couple diffusion > problem.(http://forums.wolfram.com/mathgroup/archive/2002/Aug/msg00437.html) > > the systems of, > du/dt = 1-4 u_i + .02 d^2u/dx^2+ (u)^3 v > dv/dt = 3 u_i + .02 d^2v/dx^2 - (u)^3 v > > will be discretized as > > n = 10; > X = N[Range[1, n]/(n + 1)]; > U[t_] = Map[u[#][t] &, Range[1, n]]; > V[t_] = Map[v[#][t] &, Range[1, n]]; > > eqns = Join[ > Thread[D[U[t], t] == > 1 - 4 U[t] + > 0.02 ListCorrelate[N[{1, -2, 1} n^2], U[t], {2, 2}, 1] + > U[t]^2 V[t]], > Thread[ D[V[t], t] == > 3 U[t] + 0.02 ListCorrelate[N[{1, -2, 1} n^2], V[t], {2, 2}, > 3] + > U[t]^2 V[t]], Thread[U[0] == 1 + Sin[2 Pi X]], > Thread[V[0] == 3 + 0. X]]; NDSolve[eqns, Join[U[t], V[t]], {t, 0, > 10}] > > above is more or less what I have been trying to recreate with my own > diffusion system except I don't have a couple diffusion as above. Since > there are two term,s diffusing. both equations need to be discretized. > > but let's say we have single diffusible term in a system of ode's. Do I > still have to discretize all the other equations? > > for instance, let's say we have a single diffusible term, as (instead > of above) the following. this is an hypothetical situation modified > from above equations. > > new system is > > du/dt = 1-4 u_i + .02 d^2u/dx^2+ (u)^3 v > dv/dt = 3 u_i - (u)^3 v > > which means that with u[t][x] discretized, this is an system of ode's, > so if you try to solve them as such doesn't seem to work too well. > > In[20]:= > n = 10; > X = N[Range[1, n]/(n + 1)]; > U[t_] = Map[u[#][t] &, Range[1, n]]; > > eqns = Join[ > Thread[D[U[t], t] == > 1 - 4 U[t] + 0.02 ListCorrelate[N[{1, -2, 1} n^2], U[t], {2, > 2}, 1] + > U[t]^2 v[t]], D[v[t], t] == 3 u[t] + u[t]^2 v[t], > Thread[U[0] == 1 + Sin[2 Pi X]], v[0] == 3 ] > ; > NDSolve[eqns, > Join[U[t], v[t]], {t, 0, 10}] > > above code fails with following error messages. > > positions \!\(1\) and \\!\(2\) are expected to be the same." > > \!\(1\) and \!\(2\) \ are expected to be the same." > > equation and an \ initial condition." > > What am I doing wrong here? My first guess is that even when you only > have a single diffusible term, all the equations needs to be > discretized as the initial example shows. > > This is a bit of problem for me since my actual system have 9 > equations. Even when I use 10 bin's, that's 90 differential equations > that needs to be solved. > > with additional coefficient choices, you can see the problems becomes > intractable rapidly.( well, at least computationally intensive) > > I have used the above as an example. But the idea is the discretize > second order spatial derivative using method of lines in a system of > ode's, then solve that system as a initial value problem. I can give > more examples if the group would like to see. > > Could someone please suggest some ways out of this? > > It appears lotta biologists(as according to previous posts regarding > coupled diffusions and catalysis kinetic rates) are now using > mathematica to do their modeling, maybe this will be a nice exapmple > for future users also. > > as always, all helpful comments are most sincerely welcome. > > sean from UCIrvine > > ===== > 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. > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com