MATLAB SCRIPT TO CALCULATE THE TURBULENCE PROPERTIES AND TO ESTIMATE THE WALL DISTANCE

This script is an adaptation of the original script written by Dr. Nguyen Vinh Tan, Agency for Science, Technology and Research, Singapore. A matlab script with (.m) extension can be adopted from the following formula and the same can be run using mathwork or octave on the linux platform. The turbulence properties and mesh layer thicknesses can be predicted using the same. 

rho=1000; %This is density, a value 1.225 for air can be assigned
nu=1.0e-6; %kinematic viscosity for air/water
L=0.5; %L is the wheelbase length of a car/length of a flatplate/diameter for a cylinder simulation


% If the reynolds number is assigned and the flow velocity has to be found out use:
ReL = 60000; %global reynolds number
Va = ReL*nu/L

%If the flow velocity is assigned and the Reynolds number has to be calculated use:
Va = 30;
ReL = Va*L/nu

%Turulence intensity can either be assigned or calculated
I = 0.02; % 2 percentage(assigned)
I = 0.05; % 5 percentage(assigned)
I = 0.10; % 10 percentage(assigned)
I=0.16*((ReD)^(-1/8)) % calculated from global properties

%Turbulence length scale
l=0.07*L;     % L is base length/ L=D for cylinder

nuTilda = sqrt(3/2)*Va*I*l     %modified turbulence viscosity

%Turbulence kinematic energy
k = 3/2*(Va*I)^2

%Turbulence dissipation rate
Cm = 0.09       %constant
epsilon =Cm^(3/4)*k^(3/2)/l

%Specific dissipation rate
omega = sqrt(k)/(Cm^0.25*l)

%Height of the first cell layer can be predicted using y+ values
yPlus = 30    %can also be assigned 0.5 for resolved B.L mesh
Cf = 0.058*ReD^(-0.2);    %external flow skin friction coefficient
tauW=0.5*Cf*rho*Va^2;    %wall shear stress
Utau = sqrt(tauW/rho);    %frictional velocity
dy1 = yPlus*nu/Utau    %first layer height

ywall=dy1
omegawall = 10*6*nu/(0.075*ywall^2)


%Assume a firstLayerThickness of 0.1 0r 0.2. firstLayerThickness is the reciprocal of the stretching ratio. From this the delS, dCyl(for cylinder), dx or surface cell width can be calculated.
% theta is 1/firstLayerThickness

theta=5   %also a value of 10
dCyl=theta*dy1   %for cylinder geometry 
       %or
firstLayerThickness=dy1/dCyl

%When there are 5 layers in the Boundary, then
finalLayerThickness=dCyl/dy5
                                                                                          
https://www.a-star.edu.sg/ihpc/People/tid/38/Nguyen-Vinh-Tan.aspx

Comments

Popular posts from this blog

snappyHexMesh tutorial for a simple Geometry

snappyHexMesh Tutorial For a Complex Geometry and External Aerodynamics

How to refine a 2D cylinder blockMesh