Shooting Method to solve Blasius equation

AI Thread Summary
The discussion focuses on solving the Blasius equation using MATLAB, specifically addressing issues with the integration method and boundary conditions. The original poster is struggling with a loop that isn't effectively driving the derivative to the desired boundary condition of 1. Respondents recommend using more robust integration methods, such as rkf45, instead of forward Euler, and emphasize the importance of intelligently modifying initial conditions to converge on the solution. They also suggest integrating to a fixed value of eta, such as 10, to ensure accuracy and testing the boundary condition at that point. Efficient iteration methods, like Newton's method, are advised for rapid convergence to the desired solution.
HoosierDaddy
Messages
4
Reaction score
0
Hello all,
I'm trying to write a bit of Matlab to solve the Blasius Equation f*f'' + f''' = 0, where at eta = 0, f' = 0, and at eta = infinity, f' = 1.

What I have so far is below...I'm a bit rusty. Two specific questions:

1. I'm trying to drive y2 to the b.c. of 1, however my loop appear to not be working.

2. Once I've solved the transformed equation in Matlab, how does it physically relate back to reality, in terms of boundary layer thickness and Cf?

Code:
%Define variables
%n = eta
%y1 = f
%y2 = df/dn = d(y1)/dn
%y3 = d^2f/dn^2 = d(y2)/dn
%d(y3)/dn = d^3/dn^3 = -y1*y3

%Clear values
clear;
clc;

%Initial conditions at n = 0
%f(0) = 0
y1 = 0;
%df/dn(0) = 0
y2 = 0;
%Need iniial guess for d^f/dn^2
y3 = .1;

%Need step size in eta
dn = 0.1;

%Set debugging counter
count = 0;

%Integration loop seeking target value of 1 for y2 = df/dn


if abs(y2-1) > 0.001
for n = dn:dn:10 %establish incremental range over eta
y1 = y1 + y2*dn;
y2 = y2 + y3*dn;
y3 = y3 + (-y1*y3)*dn;
end
count = count + 1;
end

y2
count
y3

Any help you can provide is greatly appreciated!

Thanks!
 
Physics news on Phys.org
HoosierDaddy said:
%Integration loop seeking target value of 1 for y2 = df/dn


if abs(y2-1) > 0.001
for n = dn:dn:10 %establish incremental range over eta
y1 = y1 + y2*dn;
y2 = y2 + y3*dn;
y3 = y3 + (-y1*y3)*dn;
end
count = count + 1;
end
What are you doing here?

First, that is not an acceptable way to integrate a system of ODEs. Since you are using Matlab, take a robust method such as rkf45.

Second, you don't loop over the integration many times until you (magically) get the right boundary condition. You have to integrate every time starting from a set of initial conditions, and these have to be modified intelligently so that at each iteration you get closer to the desired target.
 
Dr Claude is right. You have to reset the initial conditions on all the dependent variables each time you restart the integration. You also need to use a better algorithm for converging to the final solution using the shooting method. I always use Newton's method, evaluating the partial derivative of the error with respect to the unknown initial condition numerically. This requires you to got through the integration twice in advance of the actual set of iterations, using two slightly different values of the unknown initial condition. Make sure you integrate far enough out in eta to be sure you are close enough to infinity. What final value of eta are you using?

chet
 
I have some additional comments.

1. Dr. Claude is also right about the integration formula you are using. You are using a forward Euler integration, which is very inaccurate. You should be using an automatic integration package or a more accurate integration algorithm.

2. You are cutting off the integration when y' exceeds 1.0, but y' might also level off before it reaches 1.0. You need to decide on a fixed value of eta that you integrate up to, and regard that as essentially infinity. You then test the boundary condition at that location. I recommend eta = 10.

3. You know the answer to this problem before you begin. So, substitute this value in for the unknown boundary condition, as see if your integration comes close to matching the far boundary condition. This will give you a check on your coding, and also on the accuracy of your integration.

4. You need to decide on how to iterate upon the initial guess in an efficient way so that you converge rapidly to the desired solution. As I mentioned in my previous post, I recommend Newton's method (or modified Newton's method).

Chet
 
hellow everyone i need help to find the value f''(0) in blasius equation f'''+f*f''=0 or post a easy MATLAB code.
thanks
 

Similar threads

Replies
1
Views
2K
Replies
10
Views
2K
Replies
11
Views
6K
Replies
1
Views
4K
Replies
2
Views
2K
Replies
1
Views
2K
Back
Top