differential equations - Power::infy: "Infinite expression 1/0. encountered" (ODE Solution using NDSolve)
While solving the following ode,
Eq1 = f'''[x] - f'[x]*f'[x] + f[x]*f''[x] - K1*(2 f'[x]* f'''[x] - f[x]* f''''[x] - f''[x]*f''[x]) - f'[x] == 0
with the conditions
deqsys = {Eq1, f[0] == 0, f'[0] == 1, f'[N1] == 0, f''[N1] == 0}
and
K1 = 1.0;
Here N1=2
, which is an approximation of N1=Infinity
. It does not sound right but even for N1=2
, I am unable to obtain a solution using NDSolve
.
Now calling upon the numerical solver
NDSolve[deqsys, f, {x, 0, N1}]
I'm facing this persistent error,
Power::infy: "Infinite expression 1/0. encountered."
I have no idea, whether there is something wrong with the syntax, or the ode is a stiff one, or there is no solution to it?
Answer
Here's a way that gets fairly close. Perhaps further tweaking could improve the result.
Block[{K1 = 1},
{sol} = NDSolve[deqsys, f, {x, 0, 2},
Method -> {"Shooting",
"StartingInitialConditions" ->
{f[0] == 10^-4, f'[0] == 1, f''[0] == 0.1, f'''[0] == -0.1},
Method -> "StiffnessSwitching"}]
]
This avoids the singularity when f[x] == 0
by starting the boundary condition f[0]
close to zero. Then the shooting method tries to get the initial conditions so that the boundary conditions are satisfied. They get close, but not close enough for the default NDSolve
measure:
NDSolve::berr:
There are significant errors{0.00267854,-4.06858*10^-11,0.0000859285,0.000110968}
in the boundary value residuals. Returning the best solution found. >>
Plot[{f[x], f'[x], f''[x]} /. First[sol] // Evaluate, {x, 0, 2}]
One can try raising "MaxIterations"
higher than 100
.
Comments
Post a Comment