0% found this document useful (0 votes)
103 views35 pages

Engine Tutorial

The document provides a tutorial for simulating diesel combustion using the eddy-dissipation model in ANSYS Fluent. It demonstrates how to set up an in-cylinder case involving compression and power strokes using a 60 degree sector mesh. It shows how to use dynamic meshing to model the piston motion and set up non-premixed combustion modeling using the eddy-dissipation model with user-defined functions to specify initial swirl and an ignition delay model. Prerequisites and the problem description of using a simplified sector model from intake valve closing to exhaust valve opening are also provided.

Uploaded by

ganesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
103 views35 pages

Engine Tutorial

The document provides a tutorial for simulating diesel combustion using the eddy-dissipation model in ANSYS Fluent. It demonstrates how to set up an in-cylinder case involving compression and power strokes using a 60 degree sector mesh. It shows how to use dynamic meshing to model the piston motion and set up non-premixed combustion modeling using the eddy-dissipation model with user-defined functions to specify initial swirl and an ignition delay model. Prerequisites and the problem description of using a simplified sector model from intake valve closing to exhaust valve opening are also provided.

Uploaded by

ganesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 35

Tutorial: Simulate Diesel Combustion Using Eddy-Dissipation

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.

Set up IC non-premixed combustion inside ANSYS FLUENT using ED model.

Use user-defined functions (UDF) to specify initial swirl.

Set up ignition delay model.

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

Setup and Solution

Preparation

1. Copy the file (diesel CA000.msh.gz) and the UDF source file (initialize.c) to the
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, Starting
ANSYS FLUENT Using FLUENT Launcher in the ANSYS FLUENT 13.0 Users Guide.

3. Enable Double-Precision in the Options list.

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

1. Read the mesh file (diesel CA000.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

(a) Select Transient in the Time list.

2. Check the mesh (Figure 2).


General Check
ANSYS FLUENT will perform various checks on the mesh and will report the progress
in the console. Make sure the minimum volume reported is a positive number.


c ANSYS, Inc. January 3, 2011 3
Simulate Diesel Combustion Using Eddy-Dissipation Model

Figure 2: Mesh Display

3. Scale the mesh.


General Scale...

(a) Select in from the Mesh Was Created In drop-down list.


(b) Select in from the View Length Unit In drop-down list.
(c) Close the Scale Mesh dialog box.

4
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

Step 3: Dynamic Mesh

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.

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


c ANSYS, Inc. January 3, 2011 5
Simulate Diesel Combustion Using Eddy-Dissipation Model

i. Enter 0.04 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.

6
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

i. Enter the values as shown in Table 1.

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

Table 1: Values for IC Parameters

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


Note: For cold flow, the value of the Crank Angle Step Size should be either
0.2 or 0.25 CA. For cases involving combustion, you may use smaller
time step size. The time step size of 0.2 CA entered here will be reduced
automatically when combustion occurs which will be set up later.


c ANSYS, Inc. January 3, 2011 7
Simulate Diesel Combustion Using Eddy-Dissipation Model

2. Set up dynamic zones.


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

(a) Define dynamic mesh zone for fluid.

i. Select fluid 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.

8
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

(b) Define dynamic mesh zone for piston.


i. Select piston from the Zone Names drop-down list.
ii. Retain the settings.
iii. Retain 0 (in) for the Cell Height under Meshing Options tab.
iv. Click Create.
(c) Define dynamic mesh zone for head.


c ANSYS, Inc. January 3, 2011 9
Simulate Diesel Combustion Using Eddy-Dissipation Model

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


ii. Select Stationary in the Type group box.
iii. Enter 0.1 (in) for the Cell Height under Meshing Options tab.
iv. Click Create and close Dynamic Mesh Zones dialog box.

3. Creating periodic boundary.


(a) Create periodic boundary out of face zone periodic1 and periodic 2 using the
text command /grid/mz/make-periodic.

Periodic zone [()] periodic1

Shadow zone [()] periodic2

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

Create periodic zones? [yes]

all 221 faces matched for zones 7 and 3.

zone 3 deleted

created periodic zones.

10
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

(b) Check the mesh.


General Check
This will ensure that the periodic boundary is correctly created. The part of the
information printed out by ANSYS FLUENT is given below. Make sure that the
stored rotation angle is equal to the average rotation angle.
Checking periodic boundaries.

Zone 7: average rotation angle (deg) = 60.000 (60.000 to 60.000)

stored zone rotation angle (deg) = 60.000

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

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

4. Set dynamic mesh events.


Dynamic Mesh Events...

(a) Set Number of Events to 2.


(b) Enable On for the first event.
(c) Enter reduce-time-step-size for Name.
(d) Enter 720 (deg) for At Crank Angle.
(e) Click Define.


c ANSYS, Inc. January 3, 2011 11
Simulate Diesel Combustion Using Eddy-Dissipation Model

i. Select Change Time Step Size from Type drop-down list.


ii. Enter 0.1 (deg) for Crank Angle Step Size.
iii. Click OK to close Define Event dialog box.
(f) Enable On for the second event.
(g) Enter increase-time-step-size for Name.
(h) Enter 760 (deg) for At Crank Angle.
(i) Click Define.
i. Select Change Time Step Size from Type drop-down list.
ii. Enter 0.2 (deg) for Crank Angle Step Size.
iii. Click OK to close Define Event dialog box.
(j) Click Apply and close Dynamic Mesh Events dialog box.

5. Perform a mesh motion preview.


(a) Display the mesh.
General Display...
i. Click Display and close the Mesh Display dialog box.
(b) Preview the mesh motion.
Dynamic Mesh Preview Mesh Motion...

i. Enter Number of Time Steps to 1065.

12
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

ii. Click Apply and then click Preview.


(c) Save the case file (diesel CA573.cas.gz).
Write Case...
(d) Examine the UDF inputs as shown in Appendix.
Open initialize.c in text editor. For this tutorial, the swirl ratio is 2, swirl
axis is z coordinate, and the swirl origin is (0, 0, 0).

Step 4: Models

1. Set up the combustion model.


(a) Read the case file (diesel CA573.cas).
File Read Case...
(b) Compile and load the UDF library.
Define User-Defined Functions Compiled...
(c) Click Add... and select initialize.c.

(d) Click OK to close the Select File dialog box.


(e) Click Build to build the library.
Make sure that the UDF source files are in same directory that contains your
case and data files.
(f) Click Load to close the Compiled UDFs dialog box.


c ANSYS, Inc. January 3, 2011 13
Simulate Diesel Combustion Using Eddy-Dissipation Model

2. Hook 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 (2 eqn) in the Model group box to open Viscous Model dialog box.
(b) Retain the default settings and click OK to close Viscous Model dialog box.

4. Define the species model.


Models Species Edit...

14
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

(a) Select Species Transport in the Model group box.


(b) Enable Volumetric in Reactions group box.
(c) Enable Inlet Diffusion in the Options group box.
(d) Ensure Diffusion Energy Source is enabled in the Options group box.
(e) Select n-heptane-air from the Mixture Material drop-down list.
(f) Select Eddy-Dissipation in the Turbulence-Chemistry Interaction group box.
(g) Click Apply.

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.

5. Set up auto-ignition model.


Models Autoignition Edit...


c ANSYS, Inc. January 3, 2011 15
Simulate Diesel Combustion Using Eddy-Dissipation Model

(a) Enable Ignition Delay Model in the Model group box.


(b) Enter 10830.36 (j/mol) for Activation Energy.
(c) Enter 32.14 for Cetane Number.
(d) Click OK to close the Autoignition Model dialog box.
6. Define the discrete phase model.
Models Discrete Phase Edit...

(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

1. Change the properties of n-heptane-air.


Materials n-heptane-air Create/Edit...


c ANSYS, Inc. January 3, 2011 17
Simulate Diesel Combustion Using Eddy-Dissipation Model

(a) Select ideal-gas from the Density drop-down list.


(b) Select mass-weighted-mixing-law from the Thermal Conductivity drop-down list.
(c) Select mass-weighted-mixing-law from the Viscosity drop-down list.
(d) Click Edit... for Reaction to open Reactions dialog box.

i. Enter 15 for A in the Mixing Rate group box.


ii. Click OK to close Reactions dialog box.
(e) Click Change/Create and close the Create/Edit Materials dialog box.

2. Change the properties of species.


Materials Create/Edit...

(a) Select fluid from the Material Type drop-down list.


(b) Select carbon-dioxide (co2) from the FLUENT Fluid Materials drop-down list.
(c) Ensure piecewise-polynomial is selected from the Cp (Specific Heat) drop-down
list.
(d) Click Edit... to open Piecewise-Polynomial Profile dialog box.

18
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

i. Retain the default settings.


ii. Click OK to close Piecewise-Polynomial Profile dialog box.
(e) Repeat step 2: c for all other species under Fluent Fluid Materials.
(f) Click Change/Create and close the Create/Edit Materials dialog box.
This is done because FLUENT Database... does not have piecewise linear profile
for n-heptane-vapor (c7h16).
Cp will significantly affect peak temperature and pressure. So this step is impor-
tant to set non-constant and temperature dependent Cp (Specific Heat).

Step 6: Injection Setup


Define Injections...

1. Click Create to open Set Injection Properties dialog box.


c ANSYS, Inc. January 3, 2011 19
Simulate Diesel Combustion Using Eddy-Dissipation Model

(a) Select solid-cone from the Injection Type drop-down list.


(b) Enter 20 for Number of Particle Streams.
(c) Select Droplet in the Particle Type group box.
(d) Select n-heptane-liquid from the Material drop-down list.
(e) Enter the values under Point Properties tab as shown in the Table 2.

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

Table 2: Parameters for Point Properties

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.

(g) Click OK to close Set Injection Properties dialog box.

2. Close the Injections dialog box.

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

1. Set the solution parameters.


Solution Methods

(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

2. Set the under-relaxation factors.


Solution Controls

(a) Set Pressure to 0.5 in the Under-Relaxation Factors group box.

3. Enable the plotting of residuals during calculation.


Monitors Residuals Edit...

(a) Ensure that Plot is enabled.


c ANSYS, Inc. January 3, 2011 23
Simulate Diesel Combustion Using Eddy-Dissipation Model

(b) Enter 100 for Iterations to Plot.


(c) Reduce the Convergence Absolute Criteria for continuity to 0.1.
(d) Click OK to close the Residual Monitors dialog box.

4. Set up volume monitors for mass-averaged pressure.


Monitors (Volume Monitors) Create...

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


(b) Enter pressure.out for the File Name.
(c) Select Flow Time from X Axis drop-down list.
(d) Select Time Step from the Get Data Every drop-down list.
(e) Select Mass-Average from the Report Type drop-down list.
(f) Retain Pressure... and Static Pressure from the Field Variable drop-down list.
(g) Select fluid from the Cell Zones list.
(h) Click OK to close the Volume Monitor dialog box.

24
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

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


Monitors (Volume Monitors) Create...

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


(b) Enter temperature.out for the File Name.
(c) Select Flow Time from X Axis drop-down list.
(d) Select Time Step from the Get Data 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-down
list.
(g) Select fluid from the Cell Zones list.
(h) Click OK to close the Volume Monitor dialog box.

6. Initialize the solution.


Solution Initialization


c ANSYS, Inc. January 3, 2011 25
Simulate Diesel Combustion Using Eddy-Dissipation Model

(a) Enter the values shown in Table 3.

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

Table 3: Values for Solution Initialization

26
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

(b) Click Initialize.

7. Patch the values to species.


Solution Initialization Patch...

(a) Select c7h16 from the Variable list.


(b) Retain 0 for Value.
(c) Select fluid from the Zones to Patch list.
(d) Click Patch and close the Patch dialog box.
This step is necessary to bring the fuel concentration to zero. After initialization,
the fuel concentration is set to 0.01 automatically by ANSYS FLUENT, which is
required for premixed combustion. For non-premixed combustion, it is neces-
sary to bring fuel concentration back to zero for ignition delay model to function
properly.

Step 8: Postprocessing

1. Create a new surface for animation.


Surface Iso-Surface...


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.

2. Set the auto save option.


Calculation Activities
(a) Enter 200 for Autosave Every (Time Steps).

3. Execute commands for the animation setup.


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

28
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

(a) Set the Defined Commands to 2.


(b) Enable Active for Command.
i. Set Every to 10.
ii. Select Time Step from the When drop-down list.
iii. Enter /display/set/contours/surfaces (theta=60) /display/contour
c7h16 ,, /display/view restore-view top for command-1.
This command displays species contour of c7h16.
(c) Enable Active for command-2.
i. Set Every to 10.
ii. Select Time Step from the When drop-down list.
iii. Enter /display/hard-copy "c7h16-%t.tif" for Command.
This command saves the hard copy of the contours.
(d) Click OK to close the Execute Commands dialog box.

4. Save the hardcopy of display.


File Save Picture...

(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 pressure contours.


Graphics and Animations Contours Set Up...

(a) Enable Filled in the Options group box.


(b) Select Species... and Mass fraction of c7h16 from the Contours of drop-down list.
(c) Select theta=60 from the Surfaces list.


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).

Figure 3: Contours of Mass Fraction of c7h16

(e) Close the Contours dialog box.

30
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

6. Run the calculation.


Run calculation

(a) Enter 1675 for Number of Time Steps.


(b) Enter 50 for Max Iterations/Time Step.
(c) Click Calculate.
Figures 4 and 5 show the pressure and temperature plots. In this case, the ignition
delay is approximately 6 degrees.

7. Save the case and data files (diesel CA573 final.cas/dat.gz).


File Write Case & Data...


c ANSYS, Inc. January 3, 2011 31
Simulate Diesel Combustion Using Eddy-Dissipation Model

Figure 4: Pressure as a Function of Time

Figure 5: Temperature as a Function of Time

32
c ANSYS, Inc. January 3, 2011
Simulate Diesel Combustion Using Eddy-Dissipation Model

Appendix: 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 = 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};

/********************************** 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


c ANSYS, Inc. January 3, 2011 33
Simulate Diesel Combustion Using Eddy-Dissipation Model

/* loop over all cells */


begin_c_loop(c,t)
{
C_CENTROID(xc,c,t);

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;

/* 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]);

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

You might also like