       Re: Re: discretization and plotting pde system

• To: mathgroup at smc.vnet.net
• Subject: [mg40062] Re: [mg40042] Re: discretization and plotting pde system
• From: Selwyn Hollis <selwynh at earthlink.net>
• Date: Tue, 18 Mar 2003 02:21:34 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```This may be somewhat more helpful than my previous suggestions...

I'm not sure I'm using exactly the steady-state system you're trying to
solve, but this should serve as a good example. I'm going to assume the
following boundary values at x=0 and x=1:   s = c = sc = 0,
s= c = sc = 1.

Here's a function that solves the initial-value problem, for given
values of s', c', sc'. Note that the system of 3 second-order
ODEs has been converted to a system of 6 first-order ODEs.

solns[u_, v_, w_] :=  First[ {s[x], c[x], sc[x]} /. NDSolve[{
s'[x] == ds[x],
c'[x] == dc[x],
sc'[x] == dsc[x],
1*ds'[x]  - c[x]*s[x] - 10*sc[x]  == 0,
0.1*dc'[x]  - c[x]*s[x] + 10*sc[x] == 0,
1*dsc'[x] +  c[x]*s[x] - 10*sc[x]  == 0,
s == 0, c == 0,  sc == 0,
ds == u, dc == v, dsc == w},
{s[x], c[x], sc[x], ds[x], dc[x], dsc[x]},  {x, 0, 1} ]  ]

Now define

endvals[u_,v_,w_] := solns[u,v,w] /. x->1

and use FindRoot as follows:

slopes= {u, v, w} /.  FindRoot[ endvals[u, v, w] - {1, 1, 1}, {u,
{0, 1}}, {v, {0, 1}}, {w, {0, 1}}]

{0.0499949, 7.86619, 0.313381}

Now plot the solution:

Plot[Evaluate[solns@@slopes],  {x, 0, 1},   PlotStyle -> {Hue,
Hue[.7], {}}]

-----
Selwyn Hollis

On Monday, March 17, 2003, at 03:33  AM, Selwyn Hollis wrote:

> If you're intent on doing this kind of thing from scratch, I'd suggest
> that you begin with a basic numerical analysis book that treats finite
> differences and the Crank-Nicolson method. It would also be a good idea
>
>     dy/dt == d^2y/dx^2 + y(1-y) ,   0 < x < 1,
>     y(t,0)= 0, y(t,1) = 1,
>     y(0,x) = x^2.
>
> On the other hand, you may want to look at the ReactionDiffusionLab
> package found here:
>
>
> With it, you can solve problems such as the one you have, but in two
> space dimensions instead of one.
>
>
> -----
> Selwyn Hollis
> http://www.math.armstrong.edu/faculty/hollis
>
>

```

• Prev by Date: Re: Increase in efficiency with Module
• Next by Date: RE: Increase in efficiency with Module
• Previous by thread: Re: discretization and plotting pde system
• Next by thread: RE: Functions with multiple groups of arguments? [David Park?]