fluent ic tut 03 direct injection

38
Tutorial: Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model Introduction This tutorial describes the simulation process of non-premixed combustion in a direct injection natural gas engine. Direct injection natural gas engines are used in many heavy duty vehicles. Similar to diesel engines, high thermal efficiency and power density is main- tained in such direct injection natural gas engines. In such engines, natural gas is injected directly into the combustion chamber. Then the gas mixes with the high pressure air in the combustion chamber and combustion occurs. Due to the non-premixed nature of the combustion occurring in such engines, non-premixed combustion model of ANSYS FLUENT can be used to simulate the combustion process. The tutorial demonstrates how to do the following: Set up an in-cylinder (IC) case involving only a part of compression and power stroke with only a sector of mesh. Set up IC non-premixed combustion in ANSYS FLUENT. Use user-defined functions (UDF) to specify initial swirl and injection flow rate. Prerequisites This tutorial is written with the assumption that you have completed Tutorial 1 from ANSYS FLUENT 13.0 Tutorial Guide, and that you are familiar with the ANSYS FLUENT navigation pane and menu structure. Some steps in the setup and solution procedure will not be shown explicitly. In this tutorial, you will use the non-premixed combustion model and UDFs. For more information about this model, see Chapter 16, Modeling Non-Premixed Combustion in the ANSYS FLUENT 13.0 User’s Guide. If you have not used UDFs before, see ANSYS FLUENT 13.0 UDF Manual. Problem Description The problem to be solved in this tutorial is shown in Figure 1. A 30 degree sector of a 4-stroke engine which corresponds to one fuel injector hole is modeled. Since combustion simulation is to be studied, the simulation starts at 20 degree crank angle (CA) before the c ANSYS, Inc. October 11, 2010 1

Upload: karthikeyan-srinivasan

Post on 13-Apr-2015

396 views

Category:

Documents


23 download

DESCRIPTION

ansys

TRANSCRIPT

Page 1: FLUENT IC Tut 03 Direct Injection

Tutorial: Simulate Combustion in Direct Injection Natural

Gas Engine Using Non-Premixed Combustion Model

Introduction

This tutorial describes the simulation process of non-premixed combustion in a directinjection natural gas engine. Direct injection natural gas engines are used in many heavyduty vehicles. Similar to diesel engines, high thermal efficiency and power density is main-tained in such direct injection natural gas engines. In such engines, natural gas is injecteddirectly into the combustion chamber. Then the gas mixes with the high pressure air inthe combustion chamber and combustion occurs. Due to the non-premixed nature of thecombustion occurring in such engines, non-premixed combustion model of ANSYS FLUENTcan be used to simulate the combustion process.

The tutorial demonstrates how to do the following:

• Set up an in-cylinder (IC) case involving only a part of compression and power strokewith only a sector of mesh.

• Set up IC non-premixed combustion in ANSYS FLUENT.

• Use user-defined functions (UDF) to specify initial swirl and injection flow rate.

Prerequisites

This tutorial is written with the assumption that you have completed

Tutorial 1 from ANSYS FLUENT 13.0 Tutorial Guide, and that you are familiar with theANSYS FLUENT navigation pane and menu structure. Some steps in the setup and solutionprocedure will not be shown explicitly.

In this tutorial, you will use the non-premixed combustion model and UDFs. For moreinformation about this model, see Chapter 16, Modeling Non-Premixed Combustion in theANSYS FLUENT 13.0 User’s Guide. If you have not used UDFs before, see ANSYS FLUENT13.0 UDF Manual.

Problem Description

The problem to be solved in this tutorial is shown in Figure 1. A 30 degree sector of a4-stroke engine which corresponds to one fuel injector hole is modeled. Since combustionsimulation is to be studied, the simulation starts at 20 degree crank angle (CA) before the

c© ANSYS, Inc. October 11, 2010 1

Page 2: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

start of injection (SOI) and ends at 50 degree CA after top dead center (TDC). A simplifiedmodel of the engine with no valves is modeled since during the entire combustion process,both the valves remain closed.

Figure 1: Sector Geometry of a Direct Injection Natural Gas Engine

Setup and Solution

Preparation

1. Copy the mesh file (natural gas-comb-CA0360.msh.gz) and the UDF source files(initialize.c, injection ch4.c) to your working folder.

2. Use FLUENT Launcher to start the 3D version of ANSYS FLUENT.

For more information about FLUENT Launcher see Section 1.1.2, StartingANSYS FLUENT Using FLUENT Launcher in the ANSYS FLUENT 13.0 User’s Guide.

3. Enable Double-Precision in the Options list.

4. Click the UDF Compiler tab and ensure that the Setup Compilation Environment forUDF is enabled.

The path to the .bat file which is required to compile the UDF will be displayed as soonas you enable Setup Compilation Environment for UDF.

If the UDF Compiler tab does not appear in the FLUENT Launcher dialog box by default,click the Show Additional Options >> button to view the additional settings.

The Display Options are enabled by default. Therefore, after you read in the mesh, itwill be displayed in the embedded graphics window.

2 c© ANSYS, Inc. October 11, 2010

Page 3: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Step 1: Mesh

1. Read the mesh file (natural gas-comb-CA0360.msh).

File −→ Read −→Mesh...

As the mesh file is read, ANSYS FLUENT will report the progress in the console.

Step 2: General Settings

1. Define the solver settings.

General −→ Transient

2. Check the mesh (see Figure 2).

General −→ Check

Warnings will be displayed regarding unassigned interface zones, resulting in the failureof the mesh check. You do not need to take any action at this point, as this issue willbe rectified when you define the mesh interfaces in a later step.

c© ANSYS, Inc. October 11, 2010 3

Page 4: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Figure 2: Mesh Display

3. Scale the mesh.

General −→ Scale...

(a) Select mm from the View Length Unit In drop-down list.

(b) Close the Scale Mesh dialog box.

4 c© ANSYS, Inc. October 11, 2010

Page 5: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Step 3: Dynamic Mesh

1. Set up IC parameters.

Dynamic Mesh

(a) Enable the Dynamic Mesh option.

(b) Disable Smoothing in the Mesh Methods group box.

(c) Enable Layering in the Mesh Methods group box.

(d) Click Settings... to open Mesh Method Settings dialog box.

c© ANSYS, Inc. October 11, 2010 5

Page 6: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

i. Enter 0.1 for Collapse Factor under Layering tab.

ii. Click OK to close the Mesh Method Settings dialog box.

(e) Enable In-Cylinder in the Options group box.

(f) Click Settings... to open In-Cylinder Settings dialog box.

i. Enter the values as shown in the Table 1.

Parameter ValueCrank Shaft Speed (rpm) 2000Starting Crank Angle (deg) 360Crank Period (deg) 720Crank Angle Step Size (deg) 0.25Piston Stroke (mm) 120Connecting Rod Length (mm) 220Piston Stroke Cutoff (mm) 0Minimum Valve Lift (mm) 0

Table 1: Values for IC Parameters

ii. Click OK to close In-Cylinder Settings dialog box.

6 c© ANSYS, Inc. October 11, 2010

Page 7: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

2. Set up dynamic zones.

Dynamic Mesh (Dynamic Mesh Zones)−→ Create/Edit...

(a) Define dynamic mesh zone for fluid-outer.

i. Select fluid-outer from the Zone Names drop-down list.

ii. Ensure that Rigid Body is selected in the Type group box.

iii. Ensure the selection of **piston-full** from the Motion UDF/Profile drop-down list under Motion Attributes tab.

iv. Enter the values of X, Y, and Z as 0, 0, and 1 respectively.

v. Click Create.

(b) Define dynamic mesh zone for bowl.

c© ANSYS, Inc. October 11, 2010 7

Page 8: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

i. Select bowl from the Zone Names drop-down list.

ii. Retain the default settings for Motion Attributes tab.

iii. Enter 0.8 mm for Cell Height under Meshing Options tab.

iv. Click Create.

(c) Define dynamic mesh zone for bowl:019.

8 c© ANSYS, Inc. October 11, 2010

Page 9: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

i. Select bowl:017 from the Zone Names drop-down list.

ii. Retain the default settings for Motion Attributes tab.

iii. Retain 0.8 mm for Cell Height under Meshing Options tab.

iv. Click Create.

(d) Define dynamic mesh zone for wall top outer.

c© ANSYS, Inc. October 11, 2010 9

Page 10: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

i. Select wall top outer from the Zone Names drop-down list.

ii. Select Stationary in the Type group box.

iii. Retain 0.8 mm for Cell Height under Meshing Options tab.

iv. Click Create.

(e) Close the Dynamic Mesh Zones dialog box.

3. Create mesh interfaces.

Mesh Interfaces −→ Create/Edit...

10 c© ANSYS, Inc. October 11, 2010

Page 11: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(a) Enter intf for Mesh Interface.

(b) Select intf-inner from Interface Zone 1 list.

(c) Select intf-outer from Interface Zone 2 list.

(d) Click Create and close the Create/Edit Mesh Interfaces dialog box.

4. Create periodic boundary.

(a) Create periodic boundary out of face zone period inner1 and period inner2 usingthe text command /grid/mz/make-periodic.

Periodic zone [()] period inner1

Shadow zone [()] period inner2

Rotational periodic? (if no, translational) [yes]

Create periodic zones? [yes]

all 1296 faces matched for zones 12 and 11.

zone 11 deleted

created periodic zones.

c© ANSYS, Inc. October 11, 2010 11

Page 12: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(b) Create periodic boundary out of face zone period outer1 and period outer2 usingthe text command /grid/mz/make-periodic.

Periodic zone [()] period outer1

Shadow zone [()] period outer2

Rotational periodic? (if no, translational) [yes]

Create periodic zones? [yes]

all 779 faces matched for zones 14 and 13.

zone 13 deleted

created periodic zones.

5. Check the mesh.

General −→ Check

This ensures that the periodic boundary is correctly created. ANSYS FLUENT showsthe progress in the console (as shown below). Ensure that the stored rotation angle isequal to the average rotation angle.

Checking periodic boundaries.

Periodic Zone 12: average rotation angle (deg) = -30.000 (-30.000 to -30.000)

stored zone rotation angle (deg) = -30.000

stored axis , (0.000000e+00, 0.000000e+00, 1.000000e+00)

stored origin, (0.000000e+00, 0.000000e+00, 0.000000e+00)

Periodic Zone 14: average rotation angle (deg) = -30.000 (-30.000 to -30.000)

stored zone rotation angle (deg) = -30.000

stored axis , (0.000000e+00, 0.000000e+00, 1.000000e+00)

stored origin, (0.000000e+00, 0.000000e+00, 0.000000e+00)

6. Perform a mesh motion preview.

(a) Display the mesh.

Graphics and Animations −→ Mesh −→ Set Up...

12 c© ANSYS, Inc. October 11, 2010

Page 13: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

i. Click Display and close the Mesh Display dialog box.

(b) Preview the mesh motion.

Dynamic Mesh −→ Preview Mesh Motion...

i. Enter 1360 for Number of Time Steps .

ii. Click Apply and then click Preview.

(c) Save the case file (natural gas-comb-CA0700.cas.gz).

File −→ Write −→Case...

(d) Examine the UDF inputs as shown in Appendix A.

(e) Examine the UDF inputs for injection ch4.c as shown in Appendix B.

Open initialize.c, injection ch4.c in text editor. For this tutorial, the swirlratio is 2, swirl axis is z coordinate, and the swirl origin is (0, 0, 0).

Step 4: Models: Combustion Model Setup

1. Set up the combustion model.

(a) Read the case file (natural gas-comb-CA0700.cas.gz).

File −→ Read −→Case...

(b) Compile and load the UDF library.

Define −→ User-Defined −→ Functions −→Compiled...

c© ANSYS, Inc. October 11, 2010 13

Page 14: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(c) Click Add... to open Select File dialog box.

i. Select initialize.c and injection ch4.c from the Source Files list.

ii. Click OK to close the Select File dialog box.

(d) Click Build to build the library.

Ensure that the UDF source files are in same directory that contains your caseand data files.

(e) Click Load to close the Compiled UDFs dialog box.

2. Hook your model to the UDF library.

Define −→ User-Defined −→Function Hooks...

(a) Click Edit... for Initialization to open Initialization Functions dialog box.

i. Select my init function::libudf from the Available Initialization Functions list.

ii. Click Add to add it in the Selected Initialization Functions list.

iii. Click OK to close Initialization Functions dialog box.

(b) Close User-Defined Function Hooks dialog box.

3. Enable the standard k-epsilon turbulence model.

Models −→ Viscous −→ Edit...

(a) Select k-epsilon in the Model group box.

(b) Retain the default settings and click OK to close Viscous Model dialog box.

14 c© ANSYS, Inc. October 11, 2010

Page 15: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

4. Define the species model.

Models −→ Species −→ Edit...

(a) Select Non-Premixed Combustion in the Model group box.

(b) Click the Chemistry tab.

i. Ensure Equilibrium is selected in the State Relation group box.

ii. Select Non-Adiabatic in the Energy Treatment group box.

iii. Enter 3000000 pascal for Equilibrium Operating Pressure.

iv. Retain 0.1 for Fuel Stream Rich Flammability Limit.

v. Enable Inlet Diffusion and Compressibility Effects in the PDF Options groupbox.

c© ANSYS, Inc. October 11, 2010 15

Page 16: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(c) Click the Boundary tab.

i. Select Mole Fraction in the Specify Species in group box.

ii. Enter the values as shown in the Table 2.

Species Fuel Oxidch4 1 0n2 0 0.78992o2 0 0.21008

Table 2: Fuel and Oxid Values for Species

iii. Retain 300 K for Fuel and Oxid in the Temperature group box.

16 c© ANSYS, Inc. October 11, 2010

Page 17: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(d) Click the Table tab.

i. Retain the default settings.

ii. Click Calculate PDF Table.

iii. Click Display PDF Table... to open PDF Table dialog box.

A. Click Display (see Figure 3).

c© ANSYS, Inc. October 11, 2010 17

Page 18: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Figure 3: PDF Table

B. Close the PDF Table dialog box.

(e) Click OK to close the Species Model dialog box.

5. Save the PDF file.

File −→ Write −→PDF...

(a) Enter natural gas-comb-CA0700.pdf.gz for the filename.

(b) Click OK to close Select File dialog box.

Step 7: Boundary Conditions

Boundary Conditions −→ inlet

18 c© ANSYS, Inc. October 11, 2010

Page 19: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

1. Select mass-flow-inlet from the Type drop-down list.

The question dialog box appears to confirm the change of type from axis to mass-flow-inlet. Click Yes to open the Mass-Flow Inlet dialog box.

c© ANSYS, Inc. October 11, 2010 19

Page 20: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(a) Ensure that Absolute is selected from the Reference Frame drop-down list.

(b) Select Mass Flux from the Mass Flow Specification Method drop-down list.

(c) Select udf fuel flux::libudf from the Mass Flux drop-down list.

(d) Select Normal to Boundary from the Direction Specification Method drop-downlist.

(e) Select Intensity and Length Scale from the Specification Method drop-down list.

(f) Enter 2 mm for Turbulent Length Scale.

(g) Click the Species tab.

i. Enter 1 for Mean Mixture Fraction.

ii. Retain 0 for Mixture Fraction Variance.

(h) Click OK to close Mass-Flow Inlet dialog box.

Step 8: Solution

1. Set the solution parameters.

Solution Methods

20 c© ANSYS, Inc. October 11, 2010

Page 21: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(a) Select PISO from the Scheme drop-down list.

(b) Set Skewness Correction to 0.

(c) Retain Standard for Pressure drop-down list.

(d) Select Second Order Upwind from the Momentum drop-down list.

(e) Retain First Order Upwind for all other equations.

2. Set the under-relaxation factors.

Solution Controls

(a) Set the Under-Relaxation Factors for Pressure to 0.5.

3. Enable the plotting of residuals during calculation.

Monitors −→ Residuals −→ Edit...

c© ANSYS, Inc. October 11, 2010 21

Page 22: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(a) Enter 100 for Iterations to Plot.

(b) Click OK to close the Residual Monitors dialog box.

4. Set up surface monitor for mass flow rate.

Monitors (Surface Monitors)−→ Create...

(a) Enable Plot and Write in the Options group box.

(b) Enter mass flow rate inlet.out for the File Name.

(c) Select Flow Time from X Axis drop-down list.

22 c© ANSYS, Inc. October 11, 2010

Page 23: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(d) Select Time Step from the Every drop-down list.

(e) Select Mass Flow Rate from Report Type drop-down list.

(f) Select inlet from Surfaces list.

(g) Click OK to close the Surface Monitor dialog box.

5. Set up volume monitor for mass-averaged temperature.

Monitors (Volume Monitors)−→ Create...

(a) Enable Plot and Write in the Options group box.

(b) Enter vol temp.out for the File Name.

(c) Select Flow Time from X Axis drop-down list.

(d) Select Time Step from the Every drop-down list.

(e) Select Mass-Average from the Report Type drop-down list.

(f) Select Temperature... and Static Temperature from the Field Variable drop-downlist.

(g) Select fluid-inj, fluid-outer, and fluid-inner from the Cell Zones list.

(h) Click OK to close the Volume Monitor dialog box.

6. Set up volume monitor for mass-averaged pressure.

Monitors (Volume Monitors)−→ Create...

(a) Enable Plot and Write in the Options group box.

(b) Enter vol press.out for the File Name.

(c) Select Flow Time from X Axis drop-down list.

c© ANSYS, Inc. October 11, 2010 23

Page 24: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(d) Select Time Step from the Every drop-down list.

(e) Select Mass-Average from the Report Type drop-down list.

(f) Select Pressure... and Static Pressure from the Field Variable drop-down list.

(g) Select fluid-inj, fluid-outer, and fluid-inner from the Cell Zones list.

(h) Click OK to close the Volume Monitor dialog box.

Solution Initialization

Initialize the variables carefully because the simulation will start at CA = 700 degrees,which is almost the end of the compression stroke. Assuming adiabatic compressionand atmospheric conditions (i.e. atmospheric pressure = 1 and temperature = 300k) at the start of compression stroke (i.e. at BDC or 360 CA), calculate the pressureand the temperature at 700 CA. For this engine, the Gause Pressure and Temperatureat 700 CA can be assumed as 1898675 pascal and 690 K respectively.

7. Initialize the solution.

(a) Enter 1898675 pascal for Gauge Pressure.

24 c© ANSYS, Inc. October 11, 2010

Page 25: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(b) Retain 1 m2/s2 for Turbulent Kinetic Energy and Turbulent Dissipation Rate.

(c) Enter 690 K for Temperature.

(d) Click Initialize.

8. Set auto save option.

Calculation Activities

(a) Enter 20 for Autosave Every (Time Steps).

(b) Click Edit... to open Autosave dialog box.

i. Retain the default settings.

ii. Click OK to close Autosave dialog box.

Step 9: Postprocessing

1. Create a new surface for animation.

Surface −→Iso-Surface...

c© ANSYS, Inc. October 11, 2010 25

Page 26: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(a) Select Mesh... and Abs. Angular Coordinate from the Surface of Constantdrop-down list.

(b) Enter 90 for Iso-Values.

(c) Enter theta=90 for New Surface Name.

(d) Click Create and close the Iso-Surface dialog box.

2. Define the plot for animation view (plot-view).

Graphics and Animations −→ Views...

(a) Enter plot-view under Save Name and click Save.

(b) Close the Views dialog box.

3. Execute commands for the animation setup.

Calculation Activities (Execute Commands)−→ Create/Edit...

26 c© ANSYS, Inc. October 11, 2010

Page 27: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(a) Set the Defined Commands to 4.

(b) Enable Active for command-1.

i. Set Every to 5.

ii. Select Time Step from the When drop-down list.

iii. Enter /dis/sw 3 /dis/view/rv plot-view /dis/set/cont/fc y /dis/set/cont/surf(theta=90) /dis/cont ch4 0 1 for Command.

(c) Enable Active for command-2.

i. Set Every to 5.

ii. Select Time Step from the When drop-down list.

iii. Enter /display/hard-copy "ch4-%t.tif" for Command.

(d) Enable Active for command-3.

i. Set Every to 5.

ii. Select Time Step from the When drop-down list.

iii. Enter /display/cont temp 600 2500 for Command.

(e) Enable Active for command-4.

i. Set Every to 5.

ii. Select Time Step from the When drop-down list.

iii. Enter /display/hard-copy "temp-%t.tif" for Command.

(f) Click OK to close the Execute Commands dialog box.

4. Save the hardcopy of display.

File −→Save Picture...

c© ANSYS, Inc. October 11, 2010 27

Page 28: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(a) Select TIFF in the Format group box.

(b) Select Color in the Coloring group box.

(c) Click Apply and close the Save Picture dialog box.

5. Display the contours of mass fraction of ch4.

Graphics and Animations −→ Contours −→ Set Up...

(a) Enable Filled in the Options group box.

(b) Select Species... and Mass fraction of ch4 from the Contours of drop-down list.

(c) Select theta=90 from the Surfaces list.

(d) Click Display (see Figure 4).

28 c© ANSYS, Inc. October 11, 2010

Page 29: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Figure 4: Contours of Mass Fraction at 700 CA

6. Run the calculation.

Run calculation

(a) Enter 200 for Number of Time Steps.

(b) Retain 20 for Max Iterations/Time Step.

c© ANSYS, Inc. October 11, 2010 29

Page 30: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

(c) Click Calculate. The plots are as shown in Figures 5 and Figures 6.

Figure 5: Pressure as a Function of Time

Figure 6: Temperature as a Function of Time

30 c© ANSYS, Inc. October 11, 2010

Page 31: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

7. Save the case and data files (natural gas-comb-CA0700-final.cas/dat.gz).

At the end of the simulation you have:

(a) Tiff files for ch4 mass fraction and temperature at different crank angles.

(b) Auto-saved case and data files.

Contours of Mass Fraction of CH4 and Temperature at Different Crank Angles

Figure 7: CA = 721.25 (deg) Figure 8: CA = 723.75 (deg)

Figure 9: CA = 725 (deg) Figure 10: CA = 727.5 (deg)

c© ANSYS, Inc. October 11, 2010 31

Page 32: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Figure 11: CA = 730 (deg) Figure 12: CA = 732.5 (deg)

Figure 13: CA = 735 (deg) Figure 14: CA = 737.5 (deg)

Figure 15: CA = 740 (deg) Figure 16: CA = 742.5 (deg)

32 c© ANSYS, Inc. October 11, 2010

Page 33: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Figure 17: CA = 721.25 (deg) Figure 18: CA = 723.75 (deg)

Figure 19: CA = 726.25 (deg) Figure 20: CA = 728.75 (deg)

Figure 21: CA = 732.5 (deg) Figure 22: CA = 735 (deg)

c© ANSYS, Inc. October 11, 2010 33

Page 34: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Figure 23: CA = 737.5 (deg) Figure 24: CA = 738.75 (deg)

Figure 25: CA = 741.25 (deg) Figure 26: CA = 743.75 (deg)

Figure 27: CA = 746.25 (deg) Figure 28: CA = 750 (deg)

34 c© ANSYS, Inc. October 11, 2010

Page 35: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Appendix A

Examine the UDF input in initialize.c.

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

UDF for IC initialization with swirl

For IC flow, if only combustion and power stroke is of interest. The initial

condition normally contains swirl flow. This udf provides a tool to initialize

the flow field with user specified swirl ratio

How to use the udf:

- Set up your IC case

- Modify the user inputs part of the udf.

- Build the library

- Hook the DEFINE_INIT udf

- Initialize your flow field

Note:

- UDF works in 2d axisymmetry, and 3d.

- Pure 2d case does not have swirl and thus not supported (a warning will be given).

- UDF works in both serial and parallel.

****************************************************************************

# include "udf.h"

# include "sg.h"

# define RPM RP_Get_Real("dynamesh/in-cyn/crank-rpm")

/********************************* User input starts /

/* Initial swirl ratio and swirl axis*/

static real init_swirl_ratio=2.0;

static real swirl_axis[ND_ND]={0, 0, 1};

static real swirl_origin[ND_ND]={0, 0, 0};

/* This variable defines whether the inialization occurs to the whole domain or just some cell zones */

enum

{

whole_domain, defined_cell_zones

}method = defined_cell_zones;

/* If defined_cell_zones is used in the above, then specify cell zone ID list for initialization.

-1 is a flag so please keep it. */

static int Zone_ID[]={3, 4, -1};

/********************************** User input ends /

static void initialize_cell_zone(Thread * t, real * omega)

{

cell_t c;

real xc[ND_ND], x[ND_ND];

#if RP_2D

static int counter=0;

#endif

/* loop over all cells */

begin_c_loop(c,t)

{

C_CENTROID(xc,c,t);

NV_VV(x,=,xc,-,swirl_origin);

c© ANSYS, Inc. October 11, 2010 35

Page 36: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

#if RP_2D

if (rp_axi)

{

C_U(c,t)=NV_CROSS_X(omega, x);

C_V(c,t)=NV_CROSS_Y(omega, x);

C_W(c,t)=NV_CROSS_Z(omega, x);

}

else

{

if(counter == 0)

{

Message0("\nNo initialization for pure 2D. Needs to turn on 2d axisymmetric with swirl!\n");

counter++;

}

}

#else

C_U(c,t)=NV_CROSS_X(omega, x);

C_V(c,t)=NV_CROSS_Y(omega, x);

C_W(c,t)=NV_CROSS_Z(omega, x);

#endif

}

end_c_loop(c,t)

}

DEFINE_INIT(my_init_function, domain)

{

Thread *t;

int i;

real omega[ND_ND], mag;

/* Normalize swirl axis */

mag=NV_MAG(swirl_axis);

NV_S(swirl_axis, /=, mag);

if (RP_Get_Boolean("dynamesh/models/in-cylinder?")==TRUE)

{

NV_VS(omega, =, swirl_axis, *, RPM/60.*2.*M_PI*init_swirl_ratio);

if(method == whole_domain)

{

/* loop over all cell threads in the domain */

thread_loop_c (t,domain)

{

initialize_cell_zone(t, omega);

}

}

else if (method == defined_cell_zones)

{

i=0;

while(Zone_ID[i]>=0)

{

t=Lookup_Thread(domain, Zone_ID[i]);

initialize_cell_zone(t, omega);

i++;

}

}

else

{

Message0("\n\nWrong method for initialization calculation--aborting!!\n");

exit(0);

}

Init_Face_Flux(domain);

}

else

{

Message0("\nIC not turned on. No initialization is performed.\n");

}

}

36 c© ANSYS, Inc. October 11, 2010

Page 37: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Appendix B

Examine the UDF input in injection ch4.c.

#include "udf.h"

# define RPM RP_Get_Real("dynamesh/in-cyn/crank-rpm")

real fuel_injected = 7.4e-6;

real CAD = 20;

real CAP = 2;

real injection_CA = 720;

real inlet_area = 4.969325e-7;

static real fuel_mass_flow(real theta)

{

real fuel_mass_flow_rate_max, mdot;

fuel_mass_flow_rate_max = 6*RPM*fuel_injected/(CAD-CAP);

if(theta<=CAP)

{

mdot = fuel_mass_flow_rate_max/CAP*theta;

}

else if(theta<=(CAD-CAP))

{

mdot = fuel_mass_flow_rate_max;

}

else if(theta<CAD)

{

mdot = (fuel_mass_flow_rate_max - 0)/(-CAP)*(theta-CAD);

}

else

{

mdot = 0;

}

if(mdot<0)

mdot = 0;

return mdot;

}

DEFINE_PROFILE(fuel_flux, thread, i)

{

real CA;

face_t f;

CA = CURRENT_TIME*RPM*6.0+RP_Get_Real("dynamesh/in-cyn/crank-start-angle");

begin_f_loop(f,thread)

{

F_PROFILE(f,thread,i) = fuel_mass_flow(CA - injection_CA)/inlet_area;

}

end_f_loop(f,thread)

/* Message0("\n CA: %10.2f, in_CA: %10.2f, flow: %12.3e \n", CA, injection_CA, fuel_mass_flow

(CA - injection_CA)); */

}

c© ANSYS, Inc. October 11, 2010 37

Page 38: FLUENT IC Tut 03 Direct Injection

Simulate Combustion in Direct Injection Natural Gas Engine Using Non-Premixed Combustion Model

Summary

In this tutorial, you used ANSYS FLUENT to model combustion process in a direct injectionnatural gas engine. The tutorial explained entire process from setting up the dynamic meshmodel for an IC engine to setting up the non-premixed model for combustion in the engine.It also demonstrated the process of creating and using PDF tables.

38 c© ANSYS, Inc. October 11, 2010