Take the 2-minute tour ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

I've got a second order nonlinear ODE (nothing fancy), but the BC are a little odd to me:

  • $y'(0) = 0$
  • $y \rightarrow y_a$ as $x \rightarrow \infty$

What's a good numerical method for solving this? Thinking of MATLAB, but I'm open to libraries in C/C++ if there are any.

Thanks!

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

A common introductory way to solve a BVP like this is the Shooting Method. As you may know, solving the problem:

$y''(t) = f(t,y,y')$ with $y(x_0) = y_0$ and $y'(x_0) = y'_0$

is fairly straight forward using a technique such as Euler's method or any variety of RK methods. What time-stepping algorithm you choose depends on your problem's stiffness and stability.

You don't have exactly this problem however. The shooting method involves solving the above equation over and over with varying $y_0$ until your $y_\infty$ approaches $y_a$. This can be done by wrapping a root-finding method around your time-stepping algorithm.

Your problem also has the added complication of the right BC being defined in the far field, rather than some point. You obviously can't advance your solution out to infinity, so you must choose some arbitrary right boundary $x_{large}$ and solve it twice with the BC's:

$y(x_{large}) = y_a$ and $y(2 x_{large}) = y_a$

If your two solutions agree, then you know $x_{large}$ was choosen big enough that it was like having the boundary at $\infty$. If not, you must resolve it with an even higher boundary.

share|improve this answer
    
Thanks, this is actually what I thought about myself. This is what I will try first. –  Urban Jan 31 '13 at 17:46
add comment

From what little I know about it, the boundary element method (BEM) can handle asymptotic boundary conditions. It seems to be popular for acoustics and electromagnetics problems due to its simple handling of asymptotic boundary conditions. For a 1D problem it may work out especially well.

share|improve this answer
    
Thank you for your suggestion about BEM. I know too little about BEM and I guess this would be an opportunity to investigate it further. –  Urban Jan 31 '13 at 17:47
add comment

Godric's solution is a good one, but sometimes there's a better way of doing the shooting method for asymptotic boundary conditions.

Basically the idea is to approximate the ODE with another ODE which captures the behavior of the original in the large $x$ limit. For example, terms like

$$\left(x-\alpha\right)\frac{d \phi}{dx}$$ or $$\frac{\beta}{x^2}\phi $$

would become $$x\frac{d \phi}{dx}$$ and $$0$$

If the resulting differential equation is exactly solvable, you can pick the exact solution that has the asymptotic behavior you require and some $x$ large enough that the asymptotic approximation is good, and then use the shooting method to find the matching point.

Something like this technique also works for oscillatory asymptotic boundary conditions.

If you find yourself doing these kinds of problems a lot, you might want to check out Bender and Orszag's eldrich tome of asymptotics lore.

share|improve this answer
    
I haven't seen this idea before and I'm not sure it will be applicable in my case, but I thank you for the suggestion. –  Urban Jan 31 '13 at 17:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.