# Boundary Layer over a surface

 Register Blogs Members List Search Today's Posts Mark Forums Read

March 22, 2018, 09:07
Boundary Layer over a surface
#1
New Member

Asif Shahriar Nafi
Join Date: Dec 2015
Location: Conway, SC, USA
Posts: 8
Rep Power: 10
Hi,
I am trying to solve this problem numerically (Boundary Layer over a flat plate, see attached).
Matlab code:

nx=2001;ny=51;
xmax=1; ymax=0.25; vis = 1.4e-5;
dx = xmax/(nx-1);dy = ymax / (ny - 1);
%grid
u = nan (nx,ny); v = nan (nx,ny);

%Boundary condition
u(1, : ) = 0; v(1,: ) = 0; u(nx,: ) = 10;

%calc

for p = 1:nx-1
for k = 2:ny-1
u(p+1,k)= u(p,k) + (vis*dx / u(p,k)*(dy^2)) * (u(p,k+1) - 2*u(p,k) ...
+ u(p,k-1)) - (v(p,k)*dx / 2*u(p,k)*dy) * (u(p,k+1) - u(p,k-1));

v(p+1,k) = v(p+1,k-1) - 0.5* dy * ((u(p+1,k) - u(p,k))/dx + ...
(u(p+1,k-1) - u(p,k-1))/dx);

end
end

But i dont get any value of u and v. I would very much appreciate your help
Attached Images
 BL over a surface.jpg (21.5 KB, 18 views)

Last edited by asifnafi; March 22, 2018 at 11:15. Reason: typo

 March 26, 2018, 09:36 #2 Member   Philipp Wiedemer Join Date: Dec 2016 Location: Munich, Germany Posts: 42 Rep Power: 9 Well you're dividing by u(p,k) in your formula for u(p+1,k) but your boundary condition is set to zero. As a result you get a NaN because the numerator is zero aswell (0/0 = NaN in Matlab). This NaN gets then propagated through your whole calculation because you always have NaN's from the row before (If you have a NaN in the formula the result will be a NaN aswell). Maybe you have the indices mixed up or something.

 March 26, 2018, 10:40 #3 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,763 Rep Power: 71 You can solve this problem in a simplified equation using the von Mises transformation

April 29, 2020, 22:27
#4
New Member

Colin
Join Date: Apr 2020
Posts: 7
Rep Power: 5
Quote:
 Originally Posted by MangoNrFive Well you're dividing by u(p,k) in your formula for u(p+1,k) but your boundary condition is set to zero. As a result you get a NaN because the numerator is zero aswell (0/0 = NaN in Matlab). This NaN gets then propagated through your whole calculation because you always have NaN's from the row before (If you have a NaN in the formula the result will be a NaN aswell). Maybe you have the indices mixed up or something.
would you have to change your boundary condition or start at the next step?

 Tags boundary layer, fdm, flat plate, numerical simulation