error in RANS graph
Show older comments
I want graph of law of the wall (including both the viscous sublayer and log-law) and my turbuelnce model is k-esplion RNG . I am attached the code and the graph for reference.
%% Data read
filename = 'final_calibration.dat';
data = load('final_calibration.dat');
% Extract the two columns into separate arrays, ensure columns match!!!
ycoord = data(:, 1);
vel = data(:, 2);
%% Constants and Law of the wall
kappa = 0.4; % von Kármán constant
B = 5.2; % constant, can be adjusted based on the specific flow conditions
% Generate a range of y+ values
y_plus = logspace(-1, 3, 100); % Adjust the range and number of points as needed
% Calculate U+ using the Law of the Wall equation
U_plus_loglaw = 1/kappa * log(y_plus) + B;
% Calculate U+ for the viscous sublayer
U_plus_viscous = y_plus;
%% Calculaitng U plus for RANS simulation
rho=1.1002; %density
nu=0.0000165; %kinematic viscosity
u_b=28.05; %flow velocity (uref)
d= 5.4656; %char. length(you may use hydraulic diameter, not too sure of this)
Re_b = u_b*d/nu; %bulk reynolds number
Cf= 0.027/(Re_b.^(1/7)); %Skin Friction Coefficient
Tw=(Cf*rho*u_b^2)/2; %Shear stress
utau=(Tw/rho)^0.5; %friction velocity- velocity at the first cell height
y_p=(utau*ycoord)./nu;
%U-plus for RANS simulation
Uplus_RANS = vel./utau;
%% Plot the graph
figure(2)
semilogx(y_plus, U_plus_loglaw, 'r', 'DisplayName', 'Log Law');
hold on
semilogx(y_plus, U_plus_viscous, 'b', 'DisplayName', 'Viscous Sublayer');
hold on
loglog(y_p, Uplus_RANS, 'o', 'DisplayName', 'RANS (k-e-model)');
xlabel('$y^+$','Interpreter','latex','FontSize',14);
ylabel('$U^+$','Interpreter','latex','FontSize',14);
title('Law of the Wall Validation for Wind Tunnel Simulation','Interpreter','latex','FontSize',10);
grid on;
ylim([0, 20]);
legend('Location', 'Best');

Answers (0)
Categories
Find more on Morphological Operations 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!