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

Monday 14 December 2020

Flapping Aerofoil For Propulsion

     This post is about a 2D NACA 0012 aerofoil undergoing forced flapping motion for propulsion purposes. Heaving motion is achieved by applying a vertical velocity on the aerofoil based on the Eqn. 1. Similarly the pitching motion is achieved by applying a rotational velocity, governed by Eqn. 2.


vy = 2*π*fh*Ho*sin(2*π*fh*t)                                              Eqn. 1

ω = -2*π*fh*ϑ*sin[(2*π*fh*t) + 1.5708]                               Eqn. 2

     w.r.t. Eqn. 1-2 reduced frequency is defined as (2*π*fh*Ho/U∞)), fh is the frequency of oscillations, while ωt and ϑo represent rotational velocity, instantaneous time and maximum pitching angle. Ho is the heaving amplitude and U∞ is the free stream velocity.

     The flapping motion is achieved by a combination of the heaving and pitching. In this particular simulation, the aerofoil is in the propulsion mode, meaning the feathering parameter χ is less in magnitude than 1.0. Feathering parameter is defined by Eqn. 3.

χ = ϑ/arctan(h0*2*π*fh/U∞)                                  Eqn. 3

     The boundary conditions employed for the simulation are at Re 1,000, K = 1.41, Ho = aerofoil chord lengthχ = 0.5489 and fh = 0.003391 Hz. The animation of the pressure, vorticity and velocity contours is shown in Fig. 1.


Fig. 1, Flow animation, fluid flow direction is from left to right.

     The results of present simulation are compared with [1]. In terms of maximum lift, a maximum deviation of 5% is observed as compared to [1], as shown in Fig. 2. The maximum lift coefficient for available data is ~4.224 while the maximum lift coefficient from the present simulation is ~4.057. The average thrust produced is within 2% of [1]. Average thrust coefficient per cycle from [1] is 0.9957 while the result from present simulation reveals the thrust coefficient to be 1.0098.


Fig. 2, A comparison of coefficient of lift.

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.

References

[1] https://doi.org/10.1017/jfm.2017.508

Thursday 20 August 2020

The Fan Car

     The idea to reduce Drag and/or improve Downforce on a vehicle using fans at the rear has been around for decades. Specially in the world of motorsports. Examples include Gordon Murray's BT46 and the T50. Here an explanation is made as to why placing a fan behind a car or a container-carrier truck can be used to improve fuel economy.

     The sample car model is of the renowned Ahmed Body. For validation of the numerical simulation, please refer to this post.

     Fig. 1 shows pressure isosurfaces around the car body both with and without fans installed at the rear. It is clear that the pressure difference between rear and front of the car is more when the fans are not available. More pressure difference results in more Drag and a relatively bad fuel economy.


Fig. 1, T-B; Fan disabled, fan enabled


     Fig. 2 shows cross section view of the car. It can be seen that the the boundary layer is re-energized and as a result the flow separation is significantly reduced by adding a fan at the rear. By adding a fan, the vortices are not only moved away from the rear-end of the car but also have smaller size and less intensity, as shown in Fig. 3.


Fig. 2, T-B; Fan disabled, fan enabled. Red arrows represent direction of airflow


Fig. 3, L-R; Fan disabled, fan enabled

Thank you for reading. Please share my work. If you would like to collaborate on a project please reach out.