Blasius Model Solution in Matlab | Boundary Layer Profiles without ODE45

  • Thread starter Thread starter Bluestribute
  • Start date Start date
  • Tags Tags
    Matlab Model
AI Thread Summary
The discussion focuses on programming a solution to the Blasius equation in Matlab without using built-in functions like ODE45. Participants express confusion about how to manipulate the equations and relate the variables f and g, especially in the context of initial conditions and boundary layer profiles. The need to convert the third-order Blasius equation into a system of first-order ODEs for numerical solution is emphasized, along with the importance of understanding initial guesses for iteration. A sample Matlab code using the second-order Runge-Kutta method is provided, but questions remain about how to interpret the results and generate velocity profiles from the computed data. Overall, the thread highlights the challenges of numerical methods for solving differential equations in a programming context.
Bluestribute
Messages
192
Reaction score
0

Homework Statement


Program, without any built in functions (like ODE45), a solution to the Blasius Equation in Matlab that outputs boundary layer profiles for given x values, u values, etc.

Homework Equations


2f''' + f''f = 0
fj = fj-1 + Δη/2 * (gj + gj-1)
gj = [Δη2/4][2gj+1/Δη2 + 2gj-1/Δη2 + fj*(gj+1 - gj-1)/2Δη]
η = y[U/νx]1/2

The Attempt at a Solution


So I'm not sure how to do this in Matlab. What do I put for f? I understand I can loop through once I have j-1, j, and j+1 terms, but I guess getting there and getting them into a form that I can manipulate evades me. And then afterwards what to do. How to I relate η to f in order to create boundary layer profiles? I can't use any built in functions like ODE45, but I wouldn't even know how to use that either so I guess that's ok!
 
Physics news on Phys.org
Bluestribute said:

Homework Statement


Program, without any built in functions (like ODE45), a solution to the Blasius Equation in Matlab that outputs boundary layer profiles for given x values, u values, etc.

Homework Equations


2f''' + f''f = 0
fj = fj-1 + Δη/2 * (gj + gj-1)
gj = [Δη2/4][2gj+1/Δη2 + 2gj-1/Δη2 + fj*(gj+1 - gj-1)/2Δη]
η = y[U/νx]1/2

The Attempt at a Solution


So I'm not sure how to do this in Matlab. What do I put for f? I understand I can loop through once I have j-1, j, and j+1 terms, but I guess getting there and getting them into a form that I can manipulate evades me. And then afterwards what to do. How to I relate η to f in order to create boundary layer profiles? I can't use any built in functions like ODE45, but I wouldn't even know how to use that either so I guess that's ok!
You can't solve any differential equation numerically unless you know some initial conditions to start with.

The Blasius equation is discussed in more detail here:

https://en.wikipedia.org/wiki/Blasius_boundary_layer

Doing a web search will turn up other hits.

As far as the mechanics of the solution are concerned, you are forbidden to use canned routines like ODE45, but that doesn't mean you are exempt from using the method, just that you must code it up for Matlab. You should study Runge-Kutta type methods for solving ODEs.
 
The B.C.'s we have are f(0) = 0, f'(0) = 0, and f'(∞) = 1, and that's directly relatable to η (so pretty much f(η), or at least that's what it looks like).

I guess that math sort of confuses me than. I'm looking at this without much going on upstairs. I have a whole bunch of letters, like f and g, and I know I'm solving for f and g, but I have no clue how I can solve for f and g when the definition of them include f1, g1, etc. And that link is showing that f is a function of x and y, among other things? But I don't have an f . . .
 
Bluestribute said:
The B.C.'s we have are f(0) = 0, f'(0) = 0, and f'(∞) = 1, and that's directly relatable to η (so pretty much f(η), or at least that's what it looks like).

I guess that math sort of confuses me than. I'm looking at this without much going on upstairs. I have a whole bunch of letters, like f and g, and I know I'm solving for f and g, but I have no clue how I can solve for f and g when the definition of them include f1, g1, etc. And that link is showing that f is a function of x and y, among other things? But I don't have an f . . .
If you've never solved an ODE numerically, the notation can look pretty confusing. This seems like a difficult problem to start with, being a third order equation.

Numerical techniques are usually designed to solve first order equations, which means you'll have to convert the Blasius equation into an equivalent system of first order ODEs in order to solve it numerically. Have you been shown how to do this?
 
. . . Possibly I have learned that? . . .

So here's the equations for fj and gj we were given:
gj = [∆η2/4][2gj+1/∆η2 + 2gj-1/∆η2 + fj([gj+1-gj-1]/2∆η)]
fj = ∆η[fj-1/∆η + (gj+gj-1)/2] = fj-1 + ∆η(gj + gj-1)

So to solve that, do I need to put in random initial guess to help iterate through? Because I have no gj+1 terms . . . or any j+1 terms for that matter. And nothing is really making sense when I read through it.
 
I found this Matlab code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Program: blasius
%
% Solve the Blasius problem
% using 2nd order Runge-Kutta
%
% Mark Blyth 2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all
close all
clc % Clears the command window

%%
% Set initial condition, step length (h)
% and termination point
%%

h= 0.05; tend = 5.0;

alpha=0.4696;

y1(1)=0; y2(1)=0; y3(1)=alpha; %%%%%%%%%
% Advance solution up to tend
%%%%%%%%%

t(1)=0;

i=1;

while t(i) < tend

i=i+1;

%%%
% Step from t(i-1) to t(i) using
% the provisional step tt inbetween
%%%

% 1. Compute f(t,y)

f10 = y2(i-1);
f20 = y3(i-1);
f30 = -y1(i-1)*y3(i-1);

% 2. Set provisional values

yt1 = y1(i-1) + h*f10;
yt2 = y2(i-1) + h*f20;
yt3 = y3(i-1) + h*f30;

% 3. Compute phase speed ft at provisional point

ft1 = yt2;
ft2 = yt3;
ft3 = -yt1*yt3;

% 4. Compute final phase speed ff

ff1 = (1/2)*f10 + (1/2)*ft1;
ff2 = (1/2)*f20 + (1/2)*ft2;
ff3 = (1/2)*f30 + (1/2)*ft3;

% 5. Set new solution value at t(i)

y1(i) = y1(i-1) + h*ff1;
y2(i) = y2(i-1) + h*ff2;
y3(i) = y3(i-1) + h*ff3;

% 6. Update time

t(i) = t(i-1) + h;

end%%
% Plot solution for df/dx
%%

plot(t,y2)
hold on
plot(t,y3,'--')

How does this make the profile? I don't see anything in there that looks familiar, and I'm trying to dissect these codes to maybe get sent on the right track. And how can you use this to create velocity profiles?
 

Similar threads

Back
Top