Updates for ANSYS Chemkin 17.0:
As Chemkin (Reaction Design) has been a part of ANSYS, a new version, ANSYS Chemkin 17.0, has been released.
To compile the user-programmed subroutines for ANSYS Chemkin 17.0, Visual Studio 2012 together with Intel Parallel Studio XE 2015 are needed.
The versions of Visual Studio and Intel compiler are very important. Otherwise, you will have some errors in compiling your user-defined subroutines.
This is an instruction for using reduced combustion kinetic models developed by Prof. Tianfeng Lu.
To download the reduced models, you can go to:
You can download the reaction model package from the above website, including chem.inp, therm.dat, tran.dat, and a reaction rate subroutine ckwyp.f (FORTRAN code).
1, Configure the compiler environment
The following configuration based on:
Windows 64-bit system
CHEMKIN is installed in C:\Program Files\Reaction\chemkin15112_win64
Compiler and VS: Intel Parallel Studio XE 2015 with Visual Studio 2012
Intel Fortran Compiler is included in Intel Parallel Studio XE 2015
Set up the environment variable FLEXLM_ARCH for the compiler:
Open the Intel Fortran compiler command window, type: SET FLEXLM_ARCH=win64
Then check it, type: ECHO %FLEXLM_ARCH%
It should return: win64
Before you make any changes, I strongly suggest to back up three folders in the installed folder of CHEMKIN
They are: bin, lib and user_routines.
2, Revise the input file: chem.inp
Add a keyword “USRPROD” in the line of REACTIONS as follows
REACTIONS MOLES CAL/MOLE USRPROD
This is to tell CHEMKIN to use user-provide reaction rate subroutine.
3, Revise the cklib_user_routines.f file
cklib_user_routines.f file is located in the installed folder of CHEMKIN
Revise the subroutine CKUPROD in cklib_user_routines.f, which is the user supplied subroutine to calculate species production rate using T (temperature) and C (species concentration).
SUBROUTINE CKUPROD (LOUT, NKK, KTYP, T, C, ICKWRK, RCKWRK, RPROD, IFLAG)
IMPLICIT DOUBLE PRECISION (A-H, O-Z), INTEGER (I-N)
DIMENSION ICKWRK(*), RCKWRK(*), C(*), T(*)
C In the original codes, there is no Y, add Y(NKK) here
DIMENSION RPROD(NKK), KTYP(NKK), Y(NKK)
PARAMETER (LIPAR=1000, LRPAR=1000, KMAX=100, IMAX=500)
DIMENSION IPAR(LIPAR), RPAR(LRPAR), WT(KMAX)
C Obtain pressure from T and C
CALL CKPC (T, C, ICKWRK, RCKWRK, P)
C Convert C to Y
CALL CKCTY(C, ICKWRK, RCKWRK, Y)
C Compute RPROD, moles/(cm**3*sec), using P, T, Y
CALL CKWYP_USER(P,T(1),Y,ICKWRK, RCKWRK,RPROD)
Copy the code in the ckwyp.f file for the specific reduced model to the end of cklib_user_routines.f.
Because CKWYP and CKWYR are default subroutine names in CHEMKIN, to avoid compiling errors, you should change the name “CKWYP” to “CKWYP_USER”. If “CKWYR” exists, you should also change it to “CKWYR_USER”.
SUBROUTINE CKWYP_USER(P,T,Y,ICKWRK, RCKWRK,RPROD)
SUBROUTINE CKWYR_USER(RHO,T,Y,ICKWRK, RCKWRK,RPROD)
Note that, ICKWRK, RCKWRK are not used in the CKWYP_USER. Just keep consistent, leave it as it is.
4, Recompile and link the new routines
Open the Intel Fortran compiler command window, go to the location of user_routines folder:
nmake –i –f user_routines_pc.mak
Then go to drivers_cpp folder by:
Type: cd ..\drivers_cpp
Next step will compile the specific program you want to use.
Then take aurora, which is for 0-D auto-ignition calculation, for example
Before you type this command, you can go to ..\bin folder to rename or delete the auroradll.dll, auroradll.exp and auroradll.lib. But make sure you have backup.
nmake –i –f drivers_cpp_pc.mak ..\bin\auroradll.dll
This command will generate a new aurora program (0-D auto-ignition) for the reduced model in ..\bin, including three files (auroradll.dll, auroradll.exp, auroradll.lib).
If you want to use other applications, just replace auroradll.dllwith other xxx.dll in this command.
After the above steps, you can use the reduced model as a regular one in CHEMKIN. But for each different reduced model, you should use different cklib_user_routines.f file, recompile and link the user subroutine.
For more detailed information, refer to API.PDF document in CHEMKIN, Chapter 2: User Supplemental Programming.