Asked by zhou liu
on 13 Oct 2019

Hi, i hope someone can help me. I want to find the solution to the compressible boundary layer equations, this problem is part of my thesis project, but I'm running into some problems.

here is the ODEs

here is the boundary conditions

here is the matlab code

function [x,y] = shooting

% Use fsolve to ensure the boundary function is zero. The result is the

% unknown initial condition.

opt = optimset('Display','off','TolFun',1E-20);

F = fsolve(@(F) eval_boundary(F),[0.0826,0,0,0,25.8],opt);

% Solve the ODE-IVP with the converged initial condition

[x,y] = solve_ode(F);

end

function [x,y] = solve_ode(F)

%basic value of outer flow

Te = 218.6; mach = 8.0; Pr = 0.75;

he = 1004.68 * Te; ue = mach * sqrt(1.4 * 8.29586 * Te / 0.02885);

ratio1 = ue * ue / he; cm = 110.4 / Te; ck = 110.4 / Te;

% C = sqrt(y(5))*(1.0+ratio2)/(y(5)+ratio2);

% Solve the ODE-IVP with initial condition F on [0 100] (arbitrary upper bound)

[x,y] = ode45(@(x,y) [ -y(3) * y(1) / ( sqrt(y(5)) * (1.0 + cm) / ( y(5) + cm ) );

y(1) / ( sqrt(y(5)) * (1.0 + cm) / ( y(5) + cm ) );

y(2);

-Pr * ( y(3) * y(4) / ( sqrt(y(5)) * (1.0 + ck) / ( y(5) + ck ) ) + ratio1 * y(1) * y(1) / ( sqrt(y(5)) * (1.0 + cm) / ( y(5) + cm ) ) ) ;

y(4) / ( sqrt(y(5)) * (1.0 + ck) / ( y(5) + ck ) ) ] , [0 100] , F); %solve BVP

end

function [g] = eval_boundary(F)

% Get the solution to the ODE with inital condition F

[x,y] = solve_ode(F);

% Get the function values (for BCs) at the starting/end points

y2_start = y(1,2); %f(0) = 0

y3_start = y(1,3); %f'(0) = 0

y4_start = y(1,4); %g'(0) = 0

y1_end = y(end,1); %f''(end) = 0

y2_end = y(end,2); %f'(end) = 1

y4_end = y(end,4); %g'(end) = 0

y5_end = y(end,5); %g(0) = 1

% Evaluate the boundary function

g = [

y2_start

y3_start

y4_start

% y1_end

y2_end-1

% y4_end

y5_end-1

];

end

this code is come from Mohammad A Alkhadra (https://ww2.mathworks.cn/matlabcentral/fileexchange/69310-solving-blasius-equation-with-the-shooting-method) for solving blasius boundary layer equations. I changed the equations and BCs but it can not get correct answers (the code return complex number which must be wrong).

I have checked many times for the code and equations deduction, but did not find the wrong place.

I don't know if it is because these ODEs are differential equation with variable coefficients ？ this is one different point from the original code.

Answer by darova
on 15 Oct 2019

Accepted Answer

bvp4c should work

see attached script

darova
on 15 Oct 2019

But can i have one more try?

I differentiated C function and it looks like below

According to this origin equations can be re-written as:

Unable to solve the collocation equations -- a singular Jacobian encountered.

I just changed initial conditions: all ones. See attached script. This time it should be cool!

zhou liu
on 16 Oct 2019

Thanks again!

You have different function structure from mine. I define Cf'' as a function of eta, but you define f'' as a function. So both of us are correct in math, right?

In addition, I tried your code, and indeed the five parameters(f, f', f'', g, g' ) are consistent with the boundary values. But it seems not consistent with the correct answer as follows:

PS：

I I differentiated C function and found:

which is different from you :(

However, both of our equations can not get the correct answer, and I found that the "nspan" is quite sensitive. When I increase the span number from [0 1] to [0 25], it will get "a singular Jacobian encountered". Sad...

darova
on 16 Oct 2019

Indeed, you differentiated C function in a correct way

The shape of results looks similar

What about Y axis? Maybe it's about scaling?

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## darova (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/484998-shooting-method-solving-compressible-boundary-layer-equations#comment_755627

## zhou liu (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/484998-shooting-method-solving-compressible-boundary-layer-equations#comment_756271

Sign in to comment.