Falkner-Skan code
    4 views (last 30 days)
  
       Show older comments
    
    Cesar Cardenas
 on 26 Mar 2023
  
    
    
    
    
    Answered: John D'Errico
      
      
 on 26 Mar 2023
            Hello, I would like to know how to include or implement this equation:
tau = (mu/(2*delta_y))*(4*un,2-un,3)
into this code:? Any help will be greatly appreciated. I'm really stuck.
function BLSolver(xstart,xend,delta_x, ...
    Ny,ymax,A,m,nu,L)
% Inputs
% xstart: starting location (m)
% xend: ending location (m)
% delta_x: x step size (m)
% Ny: number of points in the wall-normal direction
% ymax: maximum value of wall-normal coordinate (m)
% A, m, L: constants for Falkner-Skan edge velocity distribution, Ue =
% A(x/L)^m
% nu: kinematic viscosity (m^2/s)
% Create a vector of x locations, where we will solve for the boundary
% layer profiles.
x = (xstart:delta_x:xend)'; 
Nx = length(x);
% Calculate the edge velocity
Ue = A*(x/L).^m;
% Initialize variables
u = zeros(Ny,1);
v = zeros(Ny,1);
u_ns = u; v_ns = v;
% Calculate the y points and the y spacing
y = linspace(0,ymax,Ny)';
delta_y = y(2)-y(1);
% Initialize skin friction coefficient, momentum thickness vectors
theta = zeros(Nx,1);
cf = zeros(Nx,1);
% Initialize Solution at xstart by loading the starting profile
% ENTER CODE HERE %
u = ...
v = ...
% Calculate theta, cf for initial profile
% ENTER CODE HERE %
theta(1) = ...
cf(1) = ...
% Start Finite Difference Solution
for LCVx = 2:Nx 
    % Toggle display for troubleshooting
    % disp(['Calculating Streamwise Position ' ...
    %    num2str(LCVx) ' of ' num2str(Nx) ' (x = ' ...
    %    num2str(x(LCVx)) ' m)'])
    % Solve for u at the next x location
    % ENTER CODE HERE % 
    u_ns = ...
    % Solve for v at the next x location using the continuity equation
    % ENTER CODE HERE %
    v_ns = ...
    % Update velocity profiles
    u = u_ns;
    v = v_ns;
    % Calculate momentum thickness
    % ENTER CODE HERE %
    theta(LCV) = ...
    % Calculate skin friction coefficient
    % ENTER CODE HERE %
    cf(LCV) = ...
end
% Save theta, cf data to file
ascii_out = [x_plot theta cf];
save 'output.txt' -ASCII ascii_out
0 Comments
Accepted Answer
  John D'Errico
      
      
 on 26 Mar 2023
        You write:
tau = (mu/(2*delta_y))*(4*un,2-un,3)
But what des that mean to you? Is the fragment 
(4*un,2-un,3)
intended to be a vector of length 3? Then you need to use square brackets to create a vector. So you would write:
tau = (mu/(2*delta_y))*[4*un,2-un,3];
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
