Sunday 22 May 2022

Fifth Generation Fighter Aircraft CFD Simulation (Backed-up by Wind Tunnel Data)

     This post is about the CFD analysis of a Sydney Standard Aerodynamic Model (SSAM-Gen5) in flight at various angles of attack. The SSAM-Gen5 model is based on the Lockheed Martin F-22 Raptor. The aircraft Geometry is shown in Fig. 1. The aircraft geometry is available here and here. Machine Learning can be read here.



Fig. 1, SSAM-Gen5 CAD

     The aircraft flight parameters and dimensions are given in [1]. The simulations are validated with published literature [1]. SolidWorks Flow Simulation Premium software is employed for the simulations. Fig. 2-4 shows results of Cl, Cd and L/D at various angles of attack. It can be seen that the results are in close agreement with the published experimental data.

Fig. 2, A comparison of coefficient of lift

Fig. 3, A comparison of coefficient of drag

Fig. 4, A comparison of coefficient of lift to drag ratio

     The mesh has 796,327 cells in total. With 68,630 cells on the aircraft surface. Special mesh refinements are added in the regions of interest i.e. regions with high gradients, the wake and on the control surfaces of the aircraft. The mesh for 15° angle of attack is shown in Fig. 5.

Fig. 5, The computational mesh

     The results from the CFD post processing are presented next. Velocity iso-surfaces showing pressure distribution around the aircraft, surface pressure distribution on the aircraft and vorticity in the direction of flight at the wake of the aircraft are shown in Fig. 6. Within Fig. 6, the black arrows represent the direction of on coming flow. The angle of attack for Fig. 6 is at 15°.

Fig. 5, The post processing

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

[1] Tamas Bykerk, Nicholas F. Giannelis and Gareth A. Vio. "Static Aerodynamic Analysis of a Generic Fifth Generation Fighter Aircraft," AIAA SCITECH 2022 Forum, 2022-1951, 2022 doi.org/10.2514/6.2022-1951

Sunday 24 April 2022

1D Laplace's equation using Finite Difference Method

This post is about FDM for Laplace Equation with various boundary conditions.

MATLAB Code (1D, Dirichlet Boundary Conditions)

%% initialize the workspace, clear the command window


clear; clc


%% finite difference 1D laplace dirichlet boundary conditions %% d2u/dx2 = 0 %% u(o) = 10, u(L) = 4 %% Ax=b%%


N = 4 ; %number of grid points

L = 1; %length of domain

dx = L/(N-1); %element size


%% initialize variables %%


l = linspace(0,L,N); %independent

u=zeros(1,N); %dependent


%% boundary conditions %%


u(1)=10;

u(end)=4;


%% b vector %%


b=zeros(N-2,1);

b(1) = b(1) - u(1);

b(end) = b(end) - u(end);


%% A matrix


A = -2*eye(N-2,N-2);

for i=1:N-2

    if i<N-2

        A(i,i+1)=1;

    end

    if i>1

        A(i,i-1)=1;

    end

end


%% solve for unknowns %%


x = A\b;


%% fill the u vector with unknowns %%


u(2:end-1) = x;


%% plot the results %%


hold on; grid on; box on, grid minor

set(gca,'FontSize',40)

set(gca, 'FontName', 'Times New Roman')

ylabel('u','FontSize',44)

xlabel('l','FontSize',44)


plot(l,u,'-o','color',[0 0 0],'LineWidth',2,'MarkerSize',20)


MATLAB Code (1D, Mixed Boundary Conditions)

%% initialize the workspace, clear the command window

clear; clc

%% finite difference 1D laplace mixed boundary conditions %% d2u/dx2 = 0 %% u(o) = 10, du/dx(L) = 4 %% Ax=b%%

N = 5; %number of grid points
L = 1; %length of domain
dx = L/(N-1); %element size
a = 4;
%% initialize variables %%

l = linspace(0,L,N); %independent
u=zeros(1,N); %dependent

%% dirichlet boundary condition %%

u(1) = 10;

%% b vector %%

b=zeros(N-1,1);
b(1) = b(1) - u(1);
b(end) = b(end) + dx*a; %neumann boundary condition added to b vector

%% A matrix

A = -2*eye(N-1,N-1);
for i=1:N-1
    if i<N-1
        A(i,i+1)=1;
    end
    if i>1
        A(i,i-1)=1;
    end
end
A(N-1,N-1) = -1; %neumann boundary condition added to A matrix
%% solve for unknowns %%

x = A\b;

% fill the u vector with unknowns %%

u(2:end) = x;

%% plot the results %%

hold on; grid on; box on, grid minor
set(gca,'FontSize',40)
set(gca, 'FontName', 'Times New Roman')
ylabel('u','FontSize',44)
xlabel('l','FontSize',44)

plot(l,u','-o','color',[0 0 0],'LineWidth',2,'MarkerSize',20)

Wednesday 18 August 2021

Computational Fluid Dynamics Simulation of a Swimming Fish (Includes UDF)

      This post is about the simulation of a swimming fish. The fish body is made of NACA 0020 and 0015 aero-foils (air-foils). The fluke is made of NACA 0025 aero-foil (air-foil), as shown in Fig. 1. the CAD files with computational domain modelled around the fish is available here.



Fig. 1, The generic fish CAD model

      The motion of the fish's body is achieved using a combination of two user-defined functions (UDF). The UDFs use DEFINE_GRID_MOTION script mentioned below, for the head/front portion. This is taken from the ANSYS Fluent software manual, available in its original form here. The original UDF is modified for present use as required. To move the mesh, dynamic mesh option within ANSYS Fluent is enabled; with smoothing and re-meshing options. The period of oscillation is kept at 2.0 s. The Reynolds number of flow is kept at 100,000; which is typical for a swimming fish.

/**********************************************************

 node motion based on simple beam deflection equation
 compiled UDF
 **********************************************************/
#include "udf.h"

DEFINE_GRID_MOTION(undulating_head,domain,dt,time,dtime)
{
  Thread *tf = DT_THREAD(dt);
  face_t f;
  Node *v;
  real NV_VEC(omega), NV_VEC(axis), NV_VEC(dx);
  real NV_VEC(origin), NV_VEC(rvec);
  real sign;
  int n;
  
  /* set deforming flag on adjacent cell zone */
  SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

  sign = 0.15707963267948966192313216916398 * cos (3.1415926535897932384626433832795 * time);
  
  Message ("time = %f, omega = %f\n", time, sign);
  
  NV_S(omega, =, 0.0);
  NV_D(axis, =, 0.0, 1.0, 0.0);
  NV_D(origin, =, 0.7, 0.0, 0.0);
  
  begin_f_loop(f,tf)
    {
      f_node_loop(f,tf,n)
        {
          v = F_NODE(f,tf,n);

          /* update node if x position is greater than 0.02
             and that the current node has not been previously
             visited when looping through previous faces */
          if (NODE_X(v) > 0.05 && NODE_X(v) < 0.7 && NODE_POS_NEED_UPDATE (v))
            {
              /* indicate that node position has been update
                 so that it's not updated more than once */
              NODE_POS_UPDATED(v);

              omega[1] = sign * pow (NODE_X(v), 0.5);
              NV_VV(rvec, =, NODE_COORD(v), -, origin);
              NV_CROSS(dx, omega, rvec);
              NV_S(dx, *=, dtime);
              NV_V(NODE_COORD(v), +=, dx);
            }
        }
    }

  end_f_loop(f,tf);
}

      The computational mesh, as shown in Fig. 2, uses cut-cell method with inflation layers. The mesh has 2,633,133 cells. The near wall y+ is kept at 5. The Spalart-Allmaras turbulence model is used to model the turbulence. The second order upwind scheme is used to discretize the momentum and modified turbulent viscosity equations. The time-step for this study is kept at 100th/period of oscillation.


Fig. 2, The mesh and zoom in view of the trailing edge.

      The animation showing fish motion is shown in Fig. 3. Within Fig. 3, the left side showcases the velocity iso-surfaces coloured by pressure and the vorticity iso-surfaces coloured by velocity magnitude is shown on the right.


Fig. 3, The animation.

      Another animation showing the fish motion is shown in Fig.4. Within Fig. 4, the left side shows surface pressure while the right side shows pressure iso-surfaces coloured by vorticity.


Fig. 4, The animation.

      If you want to collaborate on the research projects related to turbo-machinery, aerodynamics, renewable energy, please reach out. Thank you very much for reading.

Saturday 15 May 2021

Finner Missile CFD Simulation

     This post is about the CFD analysis of a missile in flight at an ambient mach number of 0.5 - 4.5. The missile geometry is shown in Fig. 1. The CAD files for the missile are available to download here.


Fig. 1, Finner missile CAD

     The projectile had dimensions as given in [1]. The simulations are validated with published literature [1, 2]. SolidWorks Flow Simulation Premium software is employed for the simulations. Fig. 2 shows results of C, C and Cd at various Mach numbers compared with the published results [1, 2]. It can be seen that the results are in close agreement with the experimental data.

Fig. 2, Δα = 1°

The mesh has 7,486,591 cells in total. With 417,064 cells on the missile surface. Special mesh refinements are added in the regions of interest i.e. regions with high gradients, the wake and on the surface of the missile. The mesh is shown in Fig. 3.

Fig. 3, The computational mesh

The results from the CFD post processing are presented next. iso-surfaces showing pressure distribution around the missile, coloured by Mach number are shown in Fig. 4. the scale for Fig. 4 ranges from 0 - 6.0.

Fig. 4, CFD post processing

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

[1] Vishal A. Bhagwandin and Jubaraj Sahu, "Numerical Prediction of Pitch Damping Stability Derivatives for Finned Projectiles Numerical Prediction of Pitch Damping Stability Derivatives for Finned Projectiles", Journal of Spacecraft and Rockets, volume 51, number 5, 2014
[2] Jacob Allen and Mehdi Ghoreyshi, "Forced motions design for aerodynamic identification and modeling of a generic missile configuration", Aerospace Science and Technology, volume 77, pp 742-754, 2018