Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

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[0] = c[0] = sc[0] = 0,  
s[1]= c[1] = sc[1] = 1.

Here's a function that solves the initial-value problem, for given 
values of s'[0], c'[0], sc'[0]. 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] == 0, c[0] == 0,  sc[0] == 0,
             ds[0] == u, dc[0] == v, dsc[0] == 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[0], 
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
> to start with a simpler problem, something like
>
>     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:
>
>    http://www.math.armstrong.edu/faculty/hollis/mmade/RDL/
>
> 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?]