Showing posts with label Computational. Show all posts
Showing posts with label Computational. Show all posts

Thursday 14 March 2019

Computational Fluid Dynamics Analysis of a Drone

     This post is about the computational fluid dynamics analysis of a small drone. The drone features a blended body-wing design with various cross sections at different span-wise locations. The drone has a wing-span and length of 6 ft. and 4.92 ft., respectively. The root (center) portion of the drone is relatively thicker and symmetrical in cross section for increased mechanical strength while the the mid-section and wing tips are thinner and utilize more cambered aero-foils. This is purely a concept design and as of now, no physical model of this drone exists.

     The numerical simulations for the present study were carried out using SolidWorks Flow Simulation Premium© code. The code employs κ-ε model with Two-Scales Wall Functions approach as the turbulence model. The numerical algorithm implemented is the SIMPLE-R, modified. The second-order upwind discretization scheme is used to approximate the convective fluxes while the diffusive terms are approximated using the central differencing scheme. The time derivatives are approximated with an implicit first order Euler scheme. The SolidWorks Flow Simulation© solves the Navier-Stokes equations, equations 1-3, which are formulations of mass, momentum and energy conservation laws for fluid flows. Turbulent flows are predicted using the Favre-averaged Navier-Stokes equations.

     The mesh independence test was carried out starting with 348,679 fluid cells. The mesh density was then increased up to 2,360,514 cells. The results of mesh independence study are mentioned below.
                          Mesh Name             Cells            Lift [N]         Drag [N]      Lift/Drag
                          M1                          348,679       382.41 -48.14      7.95
                          M2                          1,032,665    466.08      -48.73      9.57
                          M3                          1,559,516    473.48 -47.89      9.89
                          M4                          1,990,010    486.38 -48.08      10.12
                          M5                          2,360,514    491.07 -48.32      10.16

     It can be seen that as the mesh density increased, the difference in the critical parameters between two successive meshes also reduced. The mesh independence test was stopped as the difference between all of the critical parameters was less than one percent for the meshes M4 and M5.

     The pressure and velocity plots at various span-wise locations are shown in Fig. 1-2. It can be clearly seen that there is a negligible change in the velocity and pressure distributions around the drone between meshes M4 and M5. It can also be seen that as the mesh becomes finer, the resolution of both the pressure and velocity plots also increases.

Fig. 1, Velocity contours of various meshes.

Fig. 2, Pressure contours of various meshes.

     Aero-acoustics around the drone were also examined, as shown Fig. 3.

Fig. 3, Sound level contours of various meshes.

     A zoomed in view of the computational mesh is shown in Fig. 4. The refined mesh at the drone walls as a result of the mesh controls employed is clearly visible. The hump near the root of the drone is also visible, it was added in order to prevent the span-wise flow.

Fig. 4, Mesh level M4.

     The boundary conditions and the computational domain are shown in Fig. 5. The large red arrows represents inlet velocity boundary condition and the large blue arrows represents the atmospheric pressure outlet boundary condition. The red squares represents real wall boundary condition (slip) applied to the computational domain walls so that the boundary layer from the walls does not effect the flow around the drone.



An animation of an aileron roll can be seen here.

Thank you for reading. If you would like to collaborate on research projects, please reach out.


Thursday 16 June 2016

Computational Fluid Dynamics: 1 Core VS 2 Cores VS 3 Cores VS 4 Cores. (SolidWorks Flow Simulation Premium)

Problem:
Lift and Drag calculation for a rectangular wing (0.5 m span x 0.15 m chord x uniform cross section of NACA 9410), at horizontal velocity of 10 km/h.

A very simple CFD problem (with 177250 cells) solved on a 4 core Haswell-DT, varying the number of CPU cores used each time; CPU times are as below:

Cores used            CPU time taken for solution (1 travel convergence)
1/4 core                 782 seconds (2.31x slower)
2/4 cores               468 seconds (1.38x slower)
3/4 cores               380 seconds (1.12x slower)
4/4 cores               339 seconds (1x)

Computational Fluid Dynamics: Finite Difference Approximations VS Analytical Differentiation (MATLAB)

Description of the Program

The program takes user input for the function of the variable ‘x’ e.g. x2, sin(x), cos(x)/x2 etc., the point on which the derivative is evaluated and initial and final grid sizes.

The program then calculates its first derivative analytically.

It then calculates finite difference approximations of the first derivative of order h, with point A unknown and the point A known, using various step sizes, with maximum and minimum step size enter by the user.

 It then calculates and plots the error between the exact value and the approximations of the first derivative.

Code along with Guidelines


clc; %clears the command window

 

%data input and analytical differentiation

 

syms x

fx=input('Enter the function of ''x'' to be differentiated '); %input a function like sin(x) or x.^4 + x.^3

clc; %clears the command window

fxp=(diff (fx,x)); %calculate the derivative analytically

x=input('Enter the point at which the derivative is to be evaluated '); %input the value at which the derivative to be evaluated

clc; %clears the command window

y=inline(fxp,'x'); %convert a statement in to a function so it can be evaluated at some point

z=y(x); %derivative evaluated at the point

 

 

dxmin=input('Enter the smallest value of increment ');

clc;

dxmax=input('Enter the largest value of increment ');

clc;

%finite difference approximation

for dx=dxmin:0.001:dxmax; %loop for different values of grid spacing, dx=h1

    a=1.5;

    h1=a*dx; %h2 in the problem sheet

    h2=(2*a*dx); %h3 in the problem sheet

   

    fc=cos(5+h2)/(5+h2).^2; %value of the function at point c

    fb=cos(5+h1)/(5+h1).^2; %of the function at point b

    fa=cos(5-dx)/(5-dx).^2; %of the function at point a

    fi=cos(x)/(x).^2; %of the function at point A

    fxpu=(fc+fb-(2*fa))/((2*dx)+h1+h2); %formulation with A unknown

    fxpa=(fc+fb+(2*fa)-(4*fi))/((-2*dx)+h1+h2); %formulation with A known

    hold on

    plot ((z-fxpa)/z,dx,'.k') %error plot for approximation with A known

    plot ((z-fxpu)/z,dx,'.r') %error plot for approximation with A unknown

end

%text editing

title('Plot Between Error VS Grid Spacing') %title of the graph

xlabel('Error from the Exact Value'); %x-axis label

ylabel('Step Size/Grid Spacing') %y-axis label

text(0.6, 0.9,'Red: Error plot for approximation with A unknown') %identification

text(0.6, 0.85,'Black: Error plot for approximation with A known') %identification

Calculation


Sample Problem

Command Window after running the code

At Step One


Enter the function of 'x' to be differentiated cos(x)/x.^2

At Step Two


Enter the point at which the derivative is to be evaluated 5

At Step Three


Enter the smallest value of increment 0.001

At Step Four


Enter the largest value of increment 1
Result

 

Observations and Recommendations

It was observed that the error in the finite difference approximation when the value of the function at point A is unknown is less as compared to the case where value of the function at point A is known.
In physical/real-world problems, the exact derivatives of the functions are not known, therefore the error values between the exact and the finite difference approximation cannot be calculated. As it is also observed that the error between finite difference approximation and the exact value of the derivative decreases as the step size decreases, it is advisable to use a step size of ~1/1000 to make a compromise between CPU/RAM usage, time taken to solve the problem and error.