Engine Tutorial
Engine Tutorial
Model
Introduction
For diesel engines, fuel is directly injected into the combustion chamber when the piston is
close to top dead center (TDC). Due to high temperature and pressure, the fuel will auto-
ignite after some delay, and and then there will be full combustion. The combustion process
can be assumed to be non-premixed. In this tutorial, the process of simulating such cases
is demonstrated using eddy-dissipation (ED) model, which is suitable for non-premixed
combustion.
The tutorial demonstrates how to do the following:
Set up an in-cylinder (IC) case involving only compression and power stroke with only
a sector of mesh.
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.
Problem Description
In this tutorial, a 60 degree simplified sector model of a 4-stroke diesel engine which corre-
sponds to one fuel injector is used to model compression and power stroke. The schematic
is as shown in Figure 1. There are no valves involved as the simulation starts at IVC and
ends at EVO. Since given meshed model is at TDC condition, first part of tutorial describes
steps required to set up dynamic mesh model and bring the system to IVC position and
later part describes model setups required for combustion modeling.
c ANSYS, Inc. January 3, 2011 1
Simulate Diesel Combustion Using Eddy-Dissipation Model
Figure 1: Schematic
Preparation
1. Copy the file (diesel CA000.msh.gz) and the UDF source file (initialize.c) to the
working folder.
4. Click the Environment tab and ensure that the Setup Compilation Environment for UDF
is enabled.
The path to the .bat file which is required to compile the UDF will be displayed as
soon as you enable Setup Compilation Environment for UDF.
If the Environment tab does not appear in the FLUENT Launcher dialog box by default,
click the Show More Options button to view the additional settings.
The Display Options are enabled by default. Therefore, after you read in the mesh, it
will be displayed in the embedded graphics window.
2
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
Step 1: Mesh
c ANSYS, Inc. January 3, 2011 3
Simulate Diesel Combustion Using Eddy-Dissipation Model
4
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
1. Set up IC parameters.
Dynamic Mesh
(a) Enable Dynamic Mesh option.
(b) Disable Smoothing in the Mesh Methods group box.
(c) Enable Layering in the Mesh Methods group box.
c ANSYS, Inc. January 3, 2011 5
Simulate Diesel Combustion Using Eddy-Dissipation Model
6
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
Parameter Value
Crank Shaft Speed(rpm) 1668
Starting Crank Angle(deg) 360
Crank Period(deg) 720
Crank Angle Step Size(deg) 0.2
Piston Stroke(in) 6.5
Connecting Rod Length(in) 10.35
Piston Stroke Cutoff(in) 0
Minimum Valve Lift(in) 0
c ANSYS, Inc. January 3, 2011 7
Simulate Diesel Combustion Using Eddy-Dissipation Model
8
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
c ANSYS, Inc. January 3, 2011 9
Simulate Diesel Combustion Using Eddy-Dissipation Model
zone 3 deleted
10
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
c ANSYS, Inc. January 3, 2011 11
Simulate Diesel Combustion Using Eddy-Dissipation Model
12
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
Step 4: Models
c ANSYS, Inc. January 3, 2011 13
Simulate Diesel Combustion Using Eddy-Dissipation Model
(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.
14
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
The Information dialog box will appear informing that available material properties
or methods have changed. Confirm the property values. Click OK to close the
Information dialog box.
(h) Click OK to close the Species Model dialog box.
c ANSYS, Inc. January 3, 2011 15
Simulate Diesel Combustion Using Eddy-Dissipation Model
(a) Enable Interaction with Continuous Phase in the Interaction group box.
16
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
(b) Enter 100 for the Number of Continuous Phase Iterations per DPM Iteration.
(c) Ensure Unsteady Particle Tracking and Track with Fluid Flow Time Step are enabled
in the Particle Treatment group box.
(d) Click Physical Models tab.
i. Enable Droplet Collision and Droplet Breakup in the Spray Model group box.
ii. Enable Wave in the Breakup Model group box.
iii. Enter 15 for B1 in the Breakup Constants group box.
(e) Click OK to close the Discrete Phase Model dialog box.
ANSYS FLUENT will display information that coalescence is turned off. This is
because you have not created the injection, hence the injection material is not
specified at this point. ANSYS FLUENT will automatically turn coalescence on
once injection is setup.
Step 5: Materials
c ANSYS, Inc. January 3, 2011 17
Simulate Diesel Combustion Using Eddy-Dissipation Model
18
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
c ANSYS, Inc. January 3, 2011 19
Simulate Diesel Combustion Using Eddy-Dissipation Model
Parameter Value
X-Position (in) 0.0197
Y-Position (in) 0.00984
Z-Position (in) 6.98
Diameter (in) 0.01
Temperature (k) 341
Start Crank Angle (deg) 722
Stop Crank Angle (deg) 744
X-Axis 0.866
Y-Axis 0.5
Z-Axis -0.4617
Velocity Mag. (m/s) 468
Cone Angle (deg) 8
Radius (in) 0
Total Flow Rate (kg/s) 0.00807
20
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
(f) Click Turbulent Dispersion tab and enable Discrete Random Walk Model.
ANSYS FLUENT will display a message that coalescence is turned on. Click OK to acknowl-
edge this information.
c ANSYS, Inc. January 3, 2011 21
Simulate Diesel Combustion Using Eddy-Dissipation Model
Step 7: Solution
(a) Select PISO from the Scheme drop-down list in the Pressure-Velocity Coupling
group box.
(b) Set Skewness Correction to 0.
(c) Ensure Standard is selected from the Pressure drop-down list in the Spatial Dis-
cretization group box.
(d) Select Second Order Upwind for all other equations in the Spatial Discretization
group box.
22
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
c ANSYS, Inc. January 3, 2011 23
Simulate Diesel Combustion Using Eddy-Dissipation Model
24
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
c ANSYS, Inc. January 3, 2011 25
Simulate Diesel Combustion Using Eddy-Dissipation Model
Parameter Value
Gauge Pressure (pascal) 75105
X Velocity (m/s) 0
Y Velocity (m/s) 0
Z Velocity (m/s) 0
Turbulence Kinetic Energy (m2/s2) 1
Turbulence Dissipation Rate (m2/s3) 1
c7h16 0
o2 0.228
co2 0.00383
h2o 0.00168
Temperature (k) 358
Autoignition Variable 0
26
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
Step 8: Postprocessing
c ANSYS, Inc. January 3, 2011 27
Simulate Diesel Combustion Using Eddy-Dissipation Model
(a) Select Mesh... and Abs. Angular Coordinate from the Surface of Constant drop-
down list.
(b) Enter 60 for Iso-Values.
(c) Enter theta=60 for New Surface Name.
(d) Click Create and close the Iso-Surface dialog box.
28
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
c ANSYS, Inc. January 3, 2011 29
Simulate Diesel Combustion Using Eddy-Dissipation Model
(d) Click Display to display the pressure contours as shown in (Figure 3).
30
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
c ANSYS, Inc. January 3, 2011 31
Simulate Diesel Combustion Using Eddy-Dissipation Model
32
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
/*********************************************************************************************
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
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")
/* This variable defines whether the inialization occurs to the whole domain or just some cell zones */
enum
{
whole_domain, defined_cell_zones
}method = whole_domain;
/* 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[]={2, -1};
#if RP_2D
static int counter=0;
#endif
c ANSYS, Inc. January 3, 2011 33
Simulate Diesel Combustion Using Eddy-Dissipation Model
NV_VV(x,=,xc,-,swirl_origin);
#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;
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]);
34
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model
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");
}
}
Summary
In this tutorial, you learned how to use the eddy-dissipation model to simulate combustion
in a diesel engine.
c ANSYS, Inc. January 3, 2011 35