Boundary Conditions for NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg41385] Boundary Conditions for NDSolve
- From: Lindsey Malcom <planetlem01 at netscape.net>
- Date: Sat, 17 May 2003 05:48:30 -0400 (EDT)
- Organization: California Institute of Technology, Pasadena
- Sender: owner-wri-mathgroup at wolfram.com
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