联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2018-09-16 02:24

The University of Queensland

School of Mechanical and Mining Engineering

ENGG7601 Experimental Design (2018)

Assignment – Computer Experiment for Aircraft Design

Introduction

Being in Australia, we often wish for fast, supersonic passenger aircraft. Examples of such

aircraft include the Tu-144 (shown below, image from wikipedia) and the British/French

Concorde. Although these aircraft are no longer operational, there are proposals for

building new a generation of supersonic passenger aircraft.

For this design exercise, we will concentrate on just the nose of the aircraft and, for a

supersonic flight, this nose is expected to be long and slender, much like a sharp cone.

The older generation of aircraft flew at conditions more like Mach 1.6 or 2, however, we

are going to be ambitious and select a cruise Mach number of 3. While the aircraft is

travelling at its cruise condition, much of the drag force on the surface of the nose is due

to the pressure required to push the air aside. Your goal for this assignment is to design

the profile (shape) of the nose such that the pressure drag on the surface is a minimum.

It turns out that you can do significantly better than just a simple conical surface.

For flow analysis, the Eilmer CFD code is available, as discussed in lecture. Also provided

is an input script that models an axisymmetric flow over our proposed nose design and

command scripts that run a single flow simulation. You will be able to run test flows for

particular nose shapes by editing a few parameters in the input script and then running

the CFD code. Output from the CFD code includes several snapshots of the entire flow

1

field (that may be used to make pretty pictures, as shown below) and a small surfaceloads

file that contains enough data for you to compute the drag force. We are going to

fix the length of the nose at 5 metres and its base radius at 1.5 metres. Your goal is to

select values of the control parameters (that set the shape of the nose profile) so that you

achieve minimum drag force in the axial direction.

The particular experimental procedure is for you to decide, however, we do like the NelderMead

nonlinear simplex method for deciding what values of the control parameters to set.

Tasks

1. Get familiar with Linux, enough to use the command line and be able to edit files.

If you wish to run the flow simulations on your own computer, you will need a

Linux environment on it. Notes on setting up a virtual machine are available on the

Blackboard site. Alternatively, you may just use the computer workstations in the

engineering faculty where the VM is already set up.

2. Read the introductory sections of the Eilmer 4 Users’ Guide and run the sharp-cone

example discussed in the section on running your first simulation.

3. Using the files in the Appendices of this document, run the Eilmer code for a set of

noses with varying profile but fixed Mach 3 flow conditions. You will need to decide

the particular test conditions (i.e. the sets of values for the defining nose profile)

for your experimental trials. The resulting profile for the given parameter values in

the supplied input script are shown schematically in Appendix A. As mentioned

above, we think that the Nelder-Mead method is a good way to proceed. Note that

the input files are available in machine-readable form in the examples/eilmer/2D/

sharp-body-optimize/ subdirectory of the code repository.

2

4. You will also need to calculate the integrated drag force from the data along the

surface of the nose. For each run of the flow solver, the loads data along the nozzle

wall are written to the loads/t0009/b0001.t0009.loads.dat file. The first few

lines of an example loads file are shown in Appendix E. You might like to make

yourself a function in R, to render the summation less tedious.

5. Tabulate all of your test conditions and the resulting drag values. Remember that

you are trying to determine the profile parameters that generate minimum drag. If

you are using the Nelder-Mead approach to determining which parameter values to

set, you will notice that, as you approach the optimum, all of the drag values for your

simplex will approach the same (good) value. You will need to decide when you have

done enough test cases to be confident in your estimate of the optimum parameter

values. Plot the drag for each test condition against test-condition number, to show

the progress of your iterative procedure.

6. Compare the drag on your best nose profile with that of an equivalent straight cone.

The equivalent conical nose is easily defined by setting the intermediate points of

its Bezier to be linearly interpolated between apex and base. A good place to get

validation data for conical flow is from Charts 5 and 6 in the NACA Report 1135

“Equations, Tables and Charts for Compressible Flow”. This is an old report, from

1953, and can be found on the NASA Technical Report Server.

Submission Notes and Assessment Criteria

Work individually or in pairs and submit a single report. This report should provide the

detail of your analysis, code and results for tasks listed above. This report should be well

structured, so that the tutor can easily interpret your results. Explain the methodology

that you have used to select the control parameters of your test conditions. Include your

table of test conditions and any postprocessing code you might have developed to remove

some of the tedium from the experimental procedure. Combine it all together into a single

PDF document, with a cover page that clearly tells us who you are and what contribution

you have made to the project.

For assessment of your work, the tutors will be looking for answers to the following

questions.

• Have you done what the tasks require? Note that your report should be well structured

and tidy so that the tutor can easily find your answers. Having your figures

labelled and plots correctly titled, with axes labelled, also helps a lot here.

• Are your design calculations and records accurate?

• Is your code well-structured and clearly written, with suitable documentation comments?

• Are your conclusions consistent with your results?

• Have you used a clear and efficient procedure to iterate toward the best solution?

3

A Profile definition

In your simulations, the profile of the nose is defined by a Bezier curve with 5 points:

b0, b1, b2, b3 and b4. The b1, b2 and b3 points are adjustable and should set manually

with x- and y-coordinates in your input script on lines 44 through 46. If you keep the xcoordinates

fixed, the y-coordinates become your design parameters. Given the particular

values in the input script shown below, the resulting profile (which happens to be not

very good for drag) is shown as the solid black line in the figure above.

B Input script

You do not need to understand all of the content of this script in order to make use of it.

Note small numbers at the left of the lines. Those numbers are not part of the text file.

Note also that some lines are wrapped to fit the width of this document. In the original

text file, those lines are not broken.

1 -- sbo . lua

2 -- Optimize the profile of a sharp body for ENGG7601 assignment .

3 -- Peter J . 2018 -09 -03

4 --

5 config . title = " Supersonic flow over a sharp 2D - axisymmetric body "

6 config . axisymmetric = true

7 print ( config . title )

8

4

9 -- Flight conditions .

10 T_inf = 300.0

11 p_inf = 5000.0

12 M_inf = 3.0

13

14 -- Gas model and flow states for simulation .

15 nsp , nmodes = setGasModel ( ’ ideal - air - gas - model . lua ’)

16 print (" GasModel set to ideal air . nsp = " , nsp , " nmodes = " , nmodes )

17 initial = FlowState : new { p =0.1* p_inf , T = T_inf }

18 a_inf = initial . a -- sound - speed same as for inflow

19 v_inf = M_inf * a_inf

20 print (" a_inf =" , a_inf , " v_inf =" , v_inf , " m / s ")

21 inflow = FlowState : new { p = p_inf , T = T_inf , velx = v_inf }

22 print (" density =" , inflow . rho , " kg / m ^3")

23 print (" dynamic_pressure =" , 0.5* inflow . rho * v_inf * v_inf , " Pa ")

24

25 -- Geometry of flow domain ; leave these fixed .

26 L0 = 1.0 -- metres

27 L1 = 5.0

28 L2 = 1.0

29 Rbase = 1.5

30 H1 = 3* Rbase

31 H2 = 5* Rbase

32

33 -- The shape of the fairing is defined by the Bezier curve

34 -- through the points b0 through b4 .

35 -- Of these , the end points must remain fixed but the interior

36 -- points b1 , b2 and b3 may have their y - values adjusted .

37 -- Below , these values are set , scaled on the base radius

38 -- of the fairing .

39 -- The values 0.25 , 0.50 and 0.75 will define the Bezier

40 -- as a straight line and the fairing will be a cone .

41 pnts = {

42 a = Vector3 : new { x = - L0 , y =0.0} ,

43 b0 = Vector3 : new { x =0.0 , y =0.0} ,

44 b1 = Vector3 : new { x =0.25* L1 , y =0.80* Rbase } , -- y is adjustable

45 b2 = Vector3 : new { x =0.50* L1 , y =1.40* Rbase } , -- y is adjustable

46 b3 = Vector3 : new { x =0.75* L1 , y =1.20* Rbase } , -- y is adjustable

47 b4 = Vector3 : new { x = L1 , y = Rbase } ,

48 c = Vector3 : new { x = L1 + L2 , y =0.5* Rbase } ,

49 d = Vector3 : new { x = - L0 , y = H1 } ,

50 e = Vector3 : new { x =0.0 , y = H1 } ,

51 f = Vector3 : new { x =0.5* L1 , y = H2 } ,

52 g = Vector3 : new { x = L1 , y = H2 } ,

53 h = Vector3 : new { x = L1 + L2 , y = H2 }

54 }

55

56 lines = {}

57 patches = {}

58 -- inflow and outflow blocks are quadrilaterals in xy - plane

59 patches [0] = CoonsPatch : new { p00 = pnts .a , p10 = pnts . b0 , p11 = pnts .e , p01 =

pnts . d }

60 patches [2] = CoonsPatch : new { p00 = pnts . b4 , p10 = pnts .c , p11 = pnts .h , p01 =

pnts . g }

61 -- lower boundary of middle block is body surface

62 lines . body = Bezier : new { points ={ pnts . b0 , pnts . b1 , pnts . b2 , pnts . b3 , pnts

5

. b4 }}

63 -- upper boundary of middle block is a low - order Bezier

64 lines . upper = Bezier : new { points ={ pnts .e , pnts .f , pnts . g }}

65 -- vertical lines to provide west and east edges

66 lines . b0e = Line : new { p0 = pnts . b0 , p1 = pnts . e }

67 lines . b4g = Line : new { p0 = pnts . b4 , p1 = pnts . g }

68 patches [1] = CoonsPatch : new { north = lines . upper , south = lines . body ,

69 west = lines . b0e , east = lines . b4g }

70

71 -- Mesh the patches , with particular discretisation .

72 ny = 60

73 clustery = RobertsFunction : new { end0 = true , end1 = false , beta =1.2}

74 grids = {}

75 grids [0] = StructuredGrid : new { psurface = patches [0] ,

76 cfList ={ west = clustery , east = clustery } ,

77 niv =17 , njv = ny +1}

78 grids [1] = StructuredGrid : new { psurface = patches [1] ,

79 cfList ={ west = clustery , east = clustery } ,

80 niv =81 , njv = ny +1}

81 grids [2] = StructuredGrid : new { psurface = patches [2] ,

82 cfList ={ west = clustery , east = clustery } ,

83 niv =17 , njv = ny +1}

84

85 -- Define the flow - solution blocks .

86 blks = {}

87 blks [0] = FluidBlock : new { grid = grids [0] , initialState = inflow }

88 blks [1] = FluidBlock : new { grid = grids [1] , initialState = initial }

89 blks [2] = FluidBlock : new { grid = grids [2] , initialState = initial }

90

91 -- Set boundary conditions .

92 identifyBlockConnections ()

93 inBC = InFlowBC_Supersonic : new { flowState = inflow }

94 blks [0]. bcList [ west ] = inBC

95 blks [0]. bcList [ north ] = inBC

96 blks [1]. bcList [ north ] = inBC

97 blks [1]. bcList [ south ] = WallBC_WithSlip : new { group =" loads "}

98 blks [2]. bcList [ east ] = OutFlowBC_Simple : new {}

99

100 -- Some more configuration .

101 config . max_time = 30.0 e -3 -- seconds

102 config . max_step = 2500

103 config . dt_init = 1.0 e -6

104 config . dt_plot = config . max_time /10.0

105 config . dt_loads = config . max_time /10.0

106

107 dofile (" sketch - domain . lua ")

C Run scripts

The following shell scripts will set up a gas model, prepare a set of initial grid and flow

files, run a simulation, and then do a bit of post-processing to generate some plotting files

for display with Paraview. Although the plotting is not necessary to estimate the thrust

force for a particular simulation, you might like to view the flow field to get an idea of

how the gas responds to your nozzle shape.

6

1 #!/ bin / bash

2 # prep . sh

3 prep - gas ideal - air . inp ideal - air - gas - model . lua

4 e4shared -- prep -- job = sbo

1 #!/ bin / bash

2 # run . sh

3 e4shared -- run -- job = sbo -- verbosity =1

1 #!/ bin / bash

2 # post . sh

3 e4shared -- post -- job = sbo -- tindx - plot = all -- add - vars =" mach " -- vtk - xml

D Gas model input file

There is not much in this file, but it is enough to define an ideal-gas model of air, as you

would encounter in most fluid mechanics text books.

1 model = " IdealGas "

2 species = { ’ air ’}

E Loads file

Here are the first few lines of the loads file that is written to the loads/ subdirectory.

Each line represents the data for a single cell-face on the nozzle profile. The quantities of

interest are:

• Column 2 is the y or radial coordinate for the surface.

• Column 4 is the area per unit radian for the cell face at that point. Note that we

are running the flow in an axisymmetric geometry, with the x-axis being the axis of

symmetry.

• Column 12 (sigma) is the pressure of the gas against the cell-face.

• Columns 13 through 14 are the direction cosines for the face-normal.

1 # t = 0.0300084

2 # 1: pos . x 2: pos . y 3: pos . z 4: area 5: q_total 6: q_cond 7: q_diff 8: tau 9:

l_tau 10: m_tau 11: n_tau 12: sigma 13: n . x 14: n . y 15: n . z 16: T 17: Re_wall

18: y + 19: cellWidthNormalToSurface

3 3.1249999999999993 e -02 2.9855885009764632 e -02 0.0000000000000000 e +00

2.5807205739931290 e -03 0.0000000000000000 e +00 0.0000000000000000 e +00

0.0000000000000000 e +00 0.0000000000000000 e +00 0.0000000000000000 e +00

0.0000000000000000 e +00 0.0000000000000000 e +00 2.1435318565193607 e +04

-6.9079456233969760 e -01 7.2305108577603694 e -01 0.0000000000000000 e +00

5.8368515769514624 e +02 0.0000000000000000 e +00 0.0000000000000000 e +00

3.3580057888786041 e -02

My R script for computing the drag force on and volume of the nose profile is:

7

1 # A function for computing drag and volume of the sharp body

2 # Peter J , 2018 -09 -03

3

4 computeDragVol = function ( fileName ) {

5 # Pick up the loads data file and sum the pressure forces

6 # on the individual cell faces .

7 # Also compute the volume of the body from the discrete profile .

8 # Note that quantities in an axisymmetric simulation are per radian .

9 wallData = read . table ( fileName )

10 p = wallData$V12

11 A = wallData$V4

12 # Note that the surface normals for facets on a left - facing surface

13 # point in the negative - x direction .

14 nx = wallData$V13

15 x = wallData$V1

16 y = wallData$V2

17 dx = x [2: length ( x ) ] - x [1: length ( x ) -1]

18 yavg = 0.5*( y [2: length ( y ) ]+ y [1: length ( y ) -1])

19 # Sum (1) surface forces to get drag

20 # (2) volumes of slices to get body volume

21 c ( - sum ( p * A * nx ) * pi *2 , sum ( dx * yavg * yavg ) * pi )

22 }

Be aware that, if the loads files exist when a new simulation is started, the new data will

be put into new files with the “t” index incremented. This is potentially confusing, so it is

best to move the file file of interest at the end of each simulation to another directory and

name. Then delete the “loads” directory and its contents. If you use a regular naming

pattern, it will be handy to retain all files from your trials, in case you need to repeat

your calculations.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp