Clear Filters
Clear Filters

Reynolds stress plot error

6 views (last 30 days)
Cesar Cardenas
Cesar Cardenas on 28 Mar 2023
Answered: VBBV on 28 Mar 2023
I'm getting this error when trying to plot this:
Error in BL_9 (line 15)
R = (1./delta) * trapz(y, tau .* u - tau' .* u); % Reynolds stress
not sure how to fix it, any help will be appreciated. thanks
clear all; close all; clc;
U_inf = 100; % free stream velocity in m/s
L = 1; % plate length in m
nu = 1.5e-5; % kinematic viscosity of air in m^2/s
rho = 1.2; % air density in kg/m^3
Re = U_inf * L / nu; % Reynolds number
n = 1/7; % power law exponent for laminar flow
x = linspace(0, 1, 100); % distance from leading edge in m
delta = 5.0 * x / sqrt(Re); % boundary layer thickness
u = U_inf * (x ./ delta).^n; % velocity profile
dudy = n * U_inf ./ delta .* (x ./ delta).^(n-1); % velocity gradient
tau = rho * u .* dudy; % shear stress
R = (1./delta) * trapz(y, tau .* u - tau' .* u); % Reynolds stress
plot(y, R);
xlabel('Distance from leading edge (m)');
ylabel('Reynolds stress (Pa)');
title('Reynolds stress profile');

Accepted Answer

VBBV
VBBV on 28 Mar 2023
clear all; close all; clc;
U_inf = 100; % free stream velocity in m/s
L = 1; % plate length in m
nu = 1.5e-5; % kinematic viscosity of air in m^2/s
rho = 1.2; % air density in kg/m^3
Re = U_inf * L / nu; % Reynolds number
n = 1/7; % power law exponent for laminar flow
x = linspace(0.1, 1, 100); % distance from leading edge in m
delta = 5.0 * x / sqrt(Re); % boundary layer thickness
u = U_inf * (x ./ delta).^n % velocity profile
u = 1×100
244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008 244.1008
dudy = n * U_inf ./ delta .* (x ./ delta).^(n-1); % velocity gradient
tau = rho * u .* dudy % shear stress
tau = 1×100
1.0e+05 * 1.0215 0.9363 0.8643 0.8026 0.7491 0.7023 0.6609 0.6242 0.5914 0.5618 0.5351 0.5107 0.4885 0.4682 0.4494 0.4322 0.4162 0.4013 0.3875 0.3745 0.3625 0.3511 0.3405 0.3305 0.3210 0.3121 0.3037 0.2957 0.2881 0.2809
R = (1./delta).*trapz(x.', tau .* u - tau.' * u) % Reynolds stress
R = 1×100
1.0e+10 * 8.6226 7.0188 5.7875 4.8238 4.0571 3.4384 2.9329 2.5154 2.1672 1.8743 1.6261 1.4142 1.2323 1.0751 0.9386 0.8195 0.7152 0.6234 0.5424 0.4706 0.4068 0.3499 0.2990 0.2535 0.2126 0.1758 0.1426 0.1126 0.0854 0.0608
plot(x, R);
xlabel('Distance from leading edge (m)');
ylabel('Reynolds stress (Pa)');
title('Reynolds stress profile');

More Answers (0)

Categories

Find more on Stress and Strain in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!