In the operator-splitting method for transient simulation, the chemistry source terms are typically solved on a cell-by-cell basis. However, the chemical kinetic equations are independent of the mass and volume of a specific cell. Thus, cells that have the same temperature, pressure, and species mass fractions, will yield the same result upon solution of the kinetic equations. To take advantage of this fact, a Dynamic Cell Clustering (DCC) method proposed by Liang et al. (Liang, Stevens et al. 2009 [1]) is available for transient simulation. The DCC method groups computational cells of high similarity into clusters using an efficient data-clustering method and solves the kinetic equations only once for each cluster. The optimal number of clusters is determined for each CFD time step. The clustering algorithm is solely based on the cells' thermochemical states and is independent of their locations in the CFD mesh. In addition, the clustering algorithm is highly automated and requires minimal user-provided inputs. For typical hydrocarbon combustion computation, cell temperature and equivalence ratio are used as the clustering indices. Further, you only are required to set two parameters: the maximum dispersions of temperature, and the equivalence ratio allowable in each cluster.
The KINetics calls designed for the DCC method can be used in two ways:
(1) For serial computation, the DCC method can be implemented using two function calls for each CFD time step: KINApplyDCC and KINGetDCCResult/KINGetDCCMassFraction. The first function KINApplyDCC performs the first two steps of the DCC method. The second function carries out the backward-mapping and returns the results of the DCC calculation, where KINGetDCCResult returns the updated temperature, species mass fractions, species mass production rates, and cell enthalpy production rate in all the cells, while KINGetDCCMassFraction returns only the updated species mass fractions. Either KINGetDCCResult or KINGetDCCMassFraction can be used depending on the need of the CFD program. This approach minimizes programming effort.
(2) For parallel computation, instead of being wrapped in the single function KINApplyDCC, the first two steps of the DCC method are split into several functions, that is, KINClustering, KINAveraging, KINCalculateCluster, and KINSaveAverageSolution.
KINClustering performs the data-clustering and returns the number of clusters; KINAveraging calculates the average state variables (temperature, pressure, species mass fraction) and cluster volume for each cluster
KINCalculateCluster integrates the kinetic equations for each cluster using the average state variables
KINSaveAverageSolution saves the updated average state variables in the DCC module. In this way, the step for solving the kinetic equation (KINCalculateCluster) is isolated and can be parallelized.
To solve the kinetic equations for all clusters, you need to write a do-loop over the clusters on the CFD side, within the loop KINCalculateCluster is called for each cluster. Similar to the first approach, the DCC results can be obtained by calling KINGetDCCResult or KINGetDCCMassFraction. It should be noted that the second approach can also be used for serial computation if you prefer.
With either approach, the function KINInitializeDCC should be called for each chemistry set at the beginning of the calculation. This function obtains necessary information from the chemistry mechanism and stores the information in the DCC module for subsequent use.
In addition, the Dynamic Adaptive Chemistry method is built in KINApplyDCC and KINCalculateCluster, respectively. To activate the DAC method, KINSetSolverOptions should be called at the beginning of the calculation to set iSolver to 2. The control parameters needed by the DAC method should be passed through the interface of KINApplyDCC and KINCalculateCluster.
"Pseudo code" is proided, demonstrating the usage of the DCC functions, in "Guidelines to Usage" in the Ansys KINetics API documentation on the Ansys Developer Portal at https://developer.ansys.com/.