0
$\begingroup$

As a variation on my previous post I have two ordinary differential equations:

$\quad$ $\frac{dP}{dx}$ = $f(x,P,T)$

$\quad$ $\frac{dT}{dx}$ = $g(x,P,T)$

which I need to integrate from $x$ = $0$ to $x=X$.

The boundary condition on $P$ is at $x=0$, however the boundary condition on $T$ is at $x=X$. So $P=P_0$ at $x=0$ and $T=T_f$ at $x=X$.

What is the best ODE method to use to tackle this problem?

(I am currently using Runge-Kutta with automated step length control for the situation where the boundary condition on $T$ is also at $x=0$, which works fine as I just move in steps from $x$ = $0$ to $x=X$ but cannot do that here as I do not have $T_0$ at $x=0$)

  • 0
    The title implies you _must_ use Runge-Kutta (which isn't true, is it?) but it also only specifies one boundary condition, whereas you actually have two. Do you actually want "An ODE solver with boundary conditions at each end"?2017-02-10
  • 0
    Look for "shooting method" on wikipedia or the numerical methods source of your choice. Essentially, you treat the direct method as a scalar real function that assigns to a $T_0$ argument a $T_f$ value and use your scalar root solver of your choice.2017-02-10
  • 0
    @David K yes that is what I mean, I fixed the title.2017-02-10
  • 0
    @LutzL thanks I will take a look2017-02-10
  • 0
    @LutzL just looked at the shooting method. So it's an iterative process you're suggesting? ie guess $T_0$, use RK or whatever to solve the ODE to get $T_f$. If not close, choose another $T_0$ and get a new $T_f$. Use linear interpolation to guess a better $T_0$. And so forth.2017-02-10
  • 0
    Yes, that sounds like the secant method as the root finder. Depending on the complexity of the ODE, there may be more than one solution (or sometimes none).2017-02-10
  • 0
    @LutzL ok, so it's an iterative solution. I was wondering if there is a direct solution as there is with the case where $T_0$ is known.2017-02-11
  • 0
    Only for linear ODE, as then $T_f$ depends linearly on $T_0$. In general the dependency is non-linear. Check also out multiple-shooting as that goes a fair distance in dealing with the global search part of finding a root. However, at that point the problem gets non-scalar, derivative computation or approximation will be involved.2017-02-11

0 Answers 0