140 likes | 304 Views
GTI and ERC WAVE/Chemkin Interface Reference. Version 05-27-04 (contains information about the WAVE/Chemkin interface developed at the ERC). Sponsors and Contributors Chol-Bum Kweon and John Pratapas Gas Technology Institute
E N D
GTI and ERC WAVE/Chemkin Interface Reference Version 05-27-04 (contains information about the WAVE/Chemkin interface developed at the ERC) Sponsors and Contributors Chol-Bum Kweon and John PratapasGas Technology Institute Kushal Narayanaswamy and Randy HesselUniversity of Wisconsin-Madison, Engine Research Center
Introduction This document discusses the WAVE/Chemkin interface developed at the ERC. The interface was developed by Kushal Narayanaswamy under the sponsorship of the DOE and exercised by Randy Hessel under the sponsorship of the Gas Technology Institute. This document covers: • description of engine modeled and operating conditions • information passed between WAVE and Chemkin • how the two programs are interfaced • sample results
Engine description and operating conditions These conditions are for diesel operation.
The WAVE model Single cylinder with direct injection Dual intake ports Dual exhaust ports Exhaust surge tank Intake surge tank Exhaust ducts Intake ducts This model is for diesel operation.
WAVE/Chemkin interface type WAVE uses Chemkin to estimate the amount of fuel burned each computational time step. In WAVE terminology, this is called a User Burn Rate Model. In our case, WAVE supplies Chemkin with sufficient information to calculate the fuel burn rate at each time step, then Chemkin returns to WAVE the amount of fuel burned. The group of subroutines written by the user that allow this information to be exchanged between WAVE and Chemkin is called an interface.
Simplified flowchart Interface WAVE Chemkin Ricardo supplies sample interface subroutines that the user can modify to communicate with their own combustion model. The first subroutine, user_init_comb_case, is used to initialize many quantities and is called only once at the beginning of the simulation. WAVE calls a second subroutine, user_comb, which in turn calls Chemkin at every time step for a current estimate of the amount of fuel burned. Chemkin is its own set of subroutines and is used to estimate the amount of fuel burned, based on current combustion chamber pressure, temperature and species concentration. WAVE is a self-contained commercial program that can calculate engine performance, 1D gas dynamics and a host of other quantities. WAVE has its own combustion models, but in this application, WAVE will be calling Chemkin through an interface.
Linking the programs together The user subroutines, that is, the subroutines that constitute the interface and Chemkin, are compiled into a dynamic link library. We used Digital Visual Fortran to build this library, but other compilers can also be used. WAVE uses dynamic link libraries when properly assigned. Assigning is done through Model Engine Combustion Profile, then selecting User Model and entering the User Model DLL path and file name.
Minimum information passed from WAVE to Chemkin These variables are passed via the wave_to_user array. Columns are array element, variable name and units. All angle values are measured relative to TDC firing.
How the interface works • The initialization interface subroutine, user_init_comb_case, is called once at the beginning of the simulation. user_init_comb_case has three main purposes. They are: • to make variable values defined in WAVE’s constants table available to the combustion model, • to specify how frequently the combustion model is to be called, and • to tell WAVE whether burn rate fraction, or cumulative burn fraction [(kg burned so far)/(kg injected or trapped in cycle)] values will be passed back to WAVE.Note that our interface passes back cumulative burn fraction, but since it is dimensionless, the calculation is actually the cumulative heat release divided by the total fuel energy. • Upon completion of this subroutine, control returns to WAVE. user_init_comb_case WAVE
How the interface works The subroutine user_comb is called every engine cycle. The first time user_comb is called, it in turn calls a Chemkin initialization subroutine called wisckinit. wisckinit initializes reaction mechanism and species information based on CHEMKIN interpreter. Note that the interpreter of CHEMKIN is run as a preprocessor to generate the 'cklink‘ file.
How the interface works • Some of the things required to initialize for Chemkin via wisckinit are: • CKLEN gets the length of real, integer and character working arrays. • CKINIT assigns values to the working arrays, ICKWRK, CCKWRK, and RCKWORK by reading the linking file. • ICKWRK - Array of integer workspace. • RCKWRK - Array of real work space. • CCKWRK - Array of character work space. • CKINDX gets a group of indices that define the size of the particular reaction mechanism. • CKSYMS returns the character strings of species names. • CKWT returns the molecular weights of the species. • CKRP returns universal gas constants and the pressure of one standard atm. • Read initial species mass fractions, pressure and temperature from an input file, ckinp.in. Currently this is set to air, 1 atm and 331 K. Perhaps ckinp.in should be created based on initial conditions at the start of combustion??? • CKXTY given mole fractions, returns mass fractions. • CKRHOX given pressure, temperature and mole fraction, returns total density. • CKHML returns enthalpies in molar units, array ckhk. • CKHML returns enthalpy of formation by calling with temperature = 298. user_comb WAVE wisckinit
How the interface works continue in section of user_comb just before where comb is called. and figure out flow chart below. if 1st call for combustion user_comb WAVE wisckinit if no combustion if combustion comb
Questions I have been going through wiscinit. I see that the initial species specified in ckinp.in are air (0.21 o2 and 0.79 n2), 1 atm pressure and 331 K temperature. The title of this ckinp.in is "Dec's Case 1 2D Bomb c7h16.“ Why are kiva species assigned in user_comb after wisckinit is called? We are using this with WAVE. Are things hard-coded for a particular mechanism? For example “if(theta2.lt.-5.3) …” in user_comb. This ‘if’ appears more than once. (perfer to use tchop in ‘if’ statement, as is used in the line above this if, but is commented out. What are these statements in user_comb !mass fraction of fuel vapor+liquid fuel - burned fuel yc(1)=wave_to_user(15)+wave_to_user(18)-wave_to_user(17) !mass fraction of o2 yc(2)=0.2328*wave_to_user(14) !mass fraction of n2 + burned air mass fraction yc(3)=0.7372*wave_to_user(14)+wave_to_user(16) In user_comb, why have this statement if (icycle.gt.1)then combustion flag cmode is always on (value = 0.0).