Showing posts with label Simulation. Show all posts
Showing posts with label Simulation. Show all posts

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.

Sunday, 7 October 2018

High Camber Wing CFD Simulation

     This post is about the numerical simulation of a high camber, large aspect ratio wing. The wing had an aspect ratio of 5:1. The Reynolds number of flow was 500,000. The wing was at an angle of attack of zero degree. The aero-foil employed had a cross section of NACA 9410.

     The software employed was Flow Simulation Premium. A Cartesian mesh was created using the immersed boundary method. The mesh had 581,005 cells. Among those 581,005 cells, 55,882 were at the solid-fluid boundary. A time step of ~0.00528167 s was employed*. The domain was large enough to accurately trace the flow around the wing without any numerical or reversed flow errors. The software employs κ-ε turbulence model with damping functions, SIMPLE-R (modified) as the numerical algorithm and second order upwind and central approximations as the spatial discretization schemes for the convective fluxes and diffusive terms. The time derivatives are approximated with an implicit first-order Euler scheme.

     The mesh is shown in Fig. 1. The four layers of different mesh density are also visible in Fig. 1, the mesh is refined near the wing surface using a mesh control. The velocity around the wing section is shown in Fig. 2, using a cut plot at  the center of the wing. In Fig. 2, the wing body is super imposed by pressure plot. The velocity vectors showing the direction of flow are superimposed on both the wing body and the velocity cut plot.


Fig. 1, The computational domain.


Fig. 2, The velocity and pressure plots.

     The results of the simulation was validated against the results from XFLR5 software. XFLR5 predicted slightly higher lift and slightly less drag on the wing for same boundary conditions because the XFLR5 simulations were inviscid.

     Thank you for reading. If you would like to contribute to the research, both financially and scientifically, please feel free to reach out.

     *Time step is averaged because of the fact that a smaller time step was employed at the start of the numerical simulation.

Saturday, 28 July 2018

Steady-State VS Transient Propeller Numerical Simulation Comparison

     This post is about the comparison between steady-state and transient computational fluid dynamics analysis of two different propellers. The propellers under investigation are 11x7 and 11x4.7 propellers. The first number in the propeller nomenclature is the propeller diameter and the second number represents the propeller pitch, both parameters are in inch. The transient analysis was carried out using the sliding mesh technique while the steady-state results were obtained by the local rotating region-averaging method. For details about 11x7 propeller click here, for the details about 11x4.7 propeller, click here.
 
     As expected, the propeller efficiencies of transient and steady-state analysis are within 0.9% of each other, as shown in Fig. 1-2. Therefore, it is advised to simulate propellers and horizontal axis wind turbines using the steady-state technique as long as no time-dependent boundary conditions are employed.
 
Fig. 1, Propeller efficiency plot.
  
 Fig. 2, Propeller efficiency plot.
 
     It can be seen from Fig. 3-4 that time taken by the steady-state simulation to converge is on average 42.37% less that the transient analysis.  The steady-state analysis takes considerably less time to give a solution then a transient analysis.
 
Fig. 3, Solution time.
 
Fig. 4, Solution time.
 
Thank you for reading. If you would like to collaborate on research projects, please reach out.

Friday, 23 October 2015

Pipe Flow Simulation

Just ran another simulation related to HMT, this problem became steady state after about 36 seconds.

Water at 318 K starts flowing (0.00035 m^3/s) through a steel pipe initially at 298 K. The steel pipe had convection to air at 298 K at 3,000 W/m^2.K. A simple simulation yielded inner and outer wall temperatures of the pipe to be 309.07 K and 311.26 K respectively. Then I ran a transient simulation, to find out the time taken by the pipe’s walls to reach these temperatures (f...rom 298 K) as water flows through it. It came out to be around 36 seconds.

Then I ran a FEA. To calculate stresses induced in the pipe due to water pressure, thermal effects, gravity etc. The pipe’s diameter increased by 0.005866 mm and von-mises stress induced was 117,016,056 N/m^2 with a factor of safety of 5.302.

Then I ran fatigue study to see if the pipe will survive under these loads for 20 years or not. It will I think. The fatigue S-N curves were not available so I used the ones for carbon steel (slightly different from the ones I used for CFD analysis and FEA); so will it last for 20 years I am not sure yet (searching for curves).



 Temperatures at inner wall surface
 Temperature at outer wall surface
displacement and stress animation

Sunday, 5 July 2015

Canal Turbine Concept


It's a concept I am currently working on, so far I gave made a CAD model (renderings attached) of it in SolidWorks and analyzed it using its built in CFD module.

There are many advantages of canal turbines over wind turbines, prominent one's being:

 

Unidirectional flow


Water flows in one direction in a canal so we don't need pitch and yaw control surfaces. That simplifies the design process and reduces weight.

Constant flow rate


We (humans) control water flow rate through canals and it's almost same all year, so we don't have to worry about blade aero foil design to suit variable/abruptly variable flow rate, that makes design process further straight forward.

Large Electricity potential


Canals are 100s of km long, imagine the electricity potential in the canals. You can put these turbines in irrigation canals and it'll power nearby villages and all the irrigation equipment etc.

Higher Power/Discharge Ratio


Water is ~816 times dense (powerful) than air, so for the same discharge (flow) rate we get potentially 816 times more power. Which means more we can make designs that are lighter, smaller and easier to manage and maintain.

Easy maintenance


Fitted less than ~1 m deep inside the canal and can be retracted for maintenance at ground level, making maintenance very easy or better yet, we can maintain them while canals are being cleaned.


Plots for Comparison between Lift and Drag Produced by a Legacy Wing VS a Wing with Tubercles (Humpback Whale Fin's Inspired)

Comparison between Lift and Drag Produced by a Legacy Wing VS a Wing with Tubercles (Humpback Whale Fin's Inspired)

* Link for Plots (now showing here for some reason) http://3dimensionaldesigningandmanufacturing.blogspot.com/2015/07/plots-for-comparison-between-lift-and.html

Following data was obtained from the CFD Simulations carried out in SolidWorks Flow Simulation Premium.

Project: Design of a Wing/Blade with Tubercles for Airplanes and/or Turbines


Without Tubercles

Air Speed in Km/h

Lift in N

Drag in N

150
46.307
14.775
140
39.942
12.917
130
33.432
11.057
                         120
28.807
9.498
110
24.234
7.928
100
20.593
6.625
90
15.836
5.352
80
12.482
4.205
70
9.411
3.243
60
7.272
2.406
50
4.873
1.680
40
3.130
1.082
30
1.763
0.612
20
0.810
0.279
10
0.231
0.072

 

 

With Tubercles

Air Speed in Km/h

Lift in N

Drag in N

150
50.616
11.360
140
48.131
10.008
130
37.190
8.505
120
30.988
7.309
110
24.784
6.079
100
20.892
5.094
90
17.225
4.146
80
13.412
3.287
70
9.955
2.507
60
7.444
1.849
50
4.955
1.286
40
2.991
0.828
30
1.652
0.468
20
0.725
0.212
10
0.214
0.057

 

Comparison between Lift and Drag


Air Speed in Km/h
Percentage Less Drag
Percentage More Lift
150
23.113
 
8.513
140
22.520
 
17.014
130
23.080
 
10.105
120
22.974
7.038
110
23.322
2.219
100
23.109
1.431
90
22.534
8.064
80
21.831
6.934
70
22.695
5.465
60
23.150
2.311
50
23.452
1.655
40
23.475
-7.523
30
23.529
-6.719
20
24.014
-11.72
10
20.833
-7.94
 
 
 
 

 

It is clear that the wing with tubercles not only produces more lift at a particular velocity but also less drag.

Data for the Wing without Tubercles:


Wing Span: 1.07 m

Chord Length: 0.229 m

Air Velocity: 0-150 Km/h head on

Vertical Pitch: 0 Degree

Gravity Considered

Fluid: Dry Air at STP

Mesh Settings: Coarse (3/8)


Data for the Wing with Tubercles:


Wing Span: 1.067 m

Chord Length Large: 0.229 m

Chord Length Small: 0.203 m

Air Velocity: 0-150 Km/h head on

Vertical Pitch: 0 Degree

Gravity Considered

Fluid: Dry Air at STP

Mesh Settings: Coarse (3/8)


Let's now take a look at visual representation of data.


This Plot Shows Air Velocity VS Drag, Lift by the Wing without Tubercles


This Plot Shows Air Velocity VS Drag, Lift by the Wing with Tubercles

As you can see from above two plots; the wing with tubercles generates more lift and less drag.


This Plot Shows Air Velocity VS Lift Generated by the Wings

The green line represents the Lift generated by the wing with tubercles. It is between two to six percent more at each velocity.


This Plot Shows Air Velocity VS Drag Generated by the Wings

The green line represents the Drag generated by the wing with tubercles. It is around twenty two percent less at each velocity.


This Plot Shows Air velocity VS Lift to Drag Ratio

It is clear from this plot that Lift to Drag ratio of the wing with tubercles is around thirty three percent more for the wing without tubercles at a velocity point.

 


This Plot Shows Air Flow around the Wings at 150 Km/h from the Right Side


This Plot Shows Air Flow around the Wings at 150 Km/h

The Need for Tubercles


In aviation there are four forces at play, Lift which over comes Weight and Thrust which overcomes Drag. For a cruise speed at a particular altitude, three of these forces are almost constant. Our goal is to minimize Thrust, Drag and Weight and maximize Lift, this is because Thrust costs in terms of fuel flow rate and Weight and Drag negatively impacts on the agility of the aircraft. Aerodynamically efficient Wings and/or Blades with "Tubercles" will not only increase Lift and but also decrease Drag. This all means that we will need less Thrust for a cruise speed than before, that results in savings in terms of fuel which will result in healthier environment.

 

Applications:


 


Canal Turbine Concept


It's a concept I am currently working on, so far I gave made a CAD model (renderings attached) of it in SolidWorks and analyzed it using its built in CFD module.

There are many advantages of canal turbines over wind turbines, prominent one's being:

 

Unidirectional flow


Water flows in one direction in a canal so we don't need pitch and yaw control surfaces. That simplifies the design process and reduces weight.

Constant flow rate


We (humans) control water flow rate through canals and it's almost same all year, so we don't have to worry about blade aero foil design to suit variable/abruptly variable flow rate, that makes design process further straight forward.

Large Electricity potential


Canals are 100s of km long, imagine the electricity potential in the canals. You can put these turbines in irrigation canals and it'll power nearby villages and all the irrigation equipment etc.

Higher Power/Discharge Ratio


Water is ~816 times dense (powerful) than air, so for the same discharge (flow) rate we get potentially 816 times more power. Which means more we can make designs that are lighter, smaller and easier to manage and maintain.

Easy maintenance


Fitted less than ~1 m deep inside the canal and can be retracted for maintenance at ground level, making maintenance very easy or better yet, we can maintain them while canals are being cleaned.