MathGroup Archive 2003

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

Search the Archive

Re: Boundary Conditions for NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41416] Re: [mg41385] Boundary Conditions for NDSolve
  • From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
  • Date: Sun, 18 May 2003 05:04:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Start this way:

ClearAll[F, rh]
F[t_?NumericQ] := phi /. FindRoot[phi - 0.1*Sin[phi] == t, {phi, 0}]
rh[t_?NumericQ] = 1 - 0.1*Cos[F[t]]

With that I get a single error for the line

sol = NDSolve[{
      D[u[x, t], t] == D[u[x, t], x, x],
      u[x, 0] == 30,
      Derivative[1, 0][u][1, t] == 0,
      Derivative[1, 0][u][0, t] == (1/rh[t])^2 - u[0,
      t]^4}, u, {x, 0, 1}, {t, 0, 5}]

saying the Boundary and ititial conditions are inconsistent.  Yet a 
solution is output; I'll leave it to you to decide whether it's any 
good.

Bobby

-----Original Message-----
From: Lindsey Malcom <planetlem01 at netscape.net>
To: mathgroup at smc.vnet.net
Subject: [mg41416] [mg41385] Boundary Conditions for NDSolve


Dear MathGroup,

I am trying to use mathematica to numerically solve the diffusion
equation for a body orbiting the sun. In order to do this, I must solve
for the heliocentric distance as a function of time t, and use this as 
a
part of my boundary condition.

First, I use FindRoot to solve for the eccentric anomaly (I am leaving
out the constants and just setting eccentricity to 0.1 and semimajor
axis = 1)

F[t_]:=phi /. FindRoot[phi-0.1*Sin[phi]==t,{phi,0}]

Next, I use this result to solve for the heliocentric distance:

rh[t_]:=1-0.1*Cos[F[t]]


These two functions work fine, and produce numeric results when i
evaluate them at a specifc time. However the problems start when I try
to use the function rh[t] in my boundary condition.

To solve for the temperature at any depth and time, call this function
u, I do


sol= NDSolve[{D[u[x,t],t] == D[u[x,t],x,x], u[x,0]==30,
    Derivative[1,0][u][1,t]==0,
    Derivative[1,0][u][0,t]== (1/rh[t])^2-u[0,t]^4},u,{x,0,1},{t,0,5}]




When i try to find the numerical solution, i get all sorts of error
messages like

FindRoot::frnum:
Function{0.403324-1.t} is not a length 1 list of numbers at 
{phi}={0.446506}

and also something about FindRoot[phi-0.1*Sin[phi]==t, {phi, Random[]}]
is neither a list of replacement rules nor a valid dispatch table, and
so cannot be used for replacing.


Can anyone offer any suggestions? I am desperate for help.


Thanks.

Sincerely,

Lindsey Malcom


  • Prev by Date: Re: Boundary Conditions for NDSolve
  • Next by Date: Re: HoldForm Question
  • Previous by thread: Re: Boundary Conditions for NDSolve
  • Next by thread: Re: Boundary Conditions for NDSolve