diff --git a/Exec/Production/JetInCrossflow/GNUmakefile b/Exec/Production/JetInCrossflow/GNUmakefile index 5eea5ae4d..aaf37b362 100644 --- a/Exec/Production/JetInCrossflow/GNUmakefile +++ b/Exec/Production/JetInCrossflow/GNUmakefile @@ -26,7 +26,8 @@ FSANITIZER = FALSE THREAD_SANITIZER = FALSE # PelePhysics -Chemistry_Model = LiDryer +USE_CUSTOM_CHEMISTRY = TRUE +Chemistry_Model = LiDryer_CO2_He Eos_Model = Fuego Transport_Model = Simple diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/Make.package b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/Make.package new file mode 100644 index 000000000..373b3baea --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/Make.package @@ -0,0 +1 @@ +CEXE_sources+=mechanism.cpp \ No newline at end of file diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/convert.sh b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/convert.sh new file mode 100755 index 000000000..488208f39 --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/convert.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +MECH_HOME="$(pwd)" +MECH_FILE="${MECH_HOME}/mechanism.yaml" +bash ../converter.sh -f "${MECH_FILE}" diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.H b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.H new file mode 100644 index 000000000..af5a166e7 --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.H @@ -0,0 +1,6254 @@ +#ifndef MECHANISM_H +#define MECHANISM_H + +#include +#include + +/* Elements +0 H +1 O +2 N +3 C +4 He +*/ + +// Species +#define H2_ID 0 +#define O2_ID 1 +#define H2O_ID 2 +#define H_ID 3 +#define O_ID 4 +#define OH_ID 5 +#define HO2_ID 6 +#define H2O2_ID 7 +#define N2_ID 8 +#define HE_ID 9 +#define CO2_ID 10 + +#define NUM_GAS_ELEMENTS 5 // Elements in the homogeneous phase +#define NUM_GAS_SPECIES 11 // Species in the homogeneous phase +#define NUM_GAS_REACTIONS 21 // Reactions in the homogeneous phase + +#define SITE_DENSITY 0.000000E+00 // mol/cm^2 + +#define NUM_SURFACE_ELEMENTS 0 // Additional elements in heterogeneous phase +#define NUM_SURFACE_SPECIES 0 // Species in the heterogeneous phase +#define NUM_SURFACE_REACTIONS 0 // Reactions in the heterogeneous phase + +#define NUM_ELEMENTS (NUM_GAS_ELEMENTS + NUM_SURFACE_ELEMENTS) +#define NUM_SPECIES (NUM_GAS_SPECIES + NUM_SURFACE_SPECIES) +#define NUM_REACTIONS (NUM_GAS_REACTIONS + NUM_SURFACE_REACTIONS) + +#define NUM_IONS 0 + +#define NUM_FIT 4 + +// ALWAYS on CPU stuff -- can have different def depending on if we are CPU or +// GPU based. Defined in mechanism.cpp +void atomicWeight(amrex::Real* awt); +// MISC +void CKAWT(amrex::Real* awt); +void CKNCF(int* ncf); +void CKSYME_STR(amrex::Vector& ename); +void CKSYMS_STR(amrex::Vector& kname); +void GET_RMAP(int* _rmap); +void CKINU(const int i, int& nspec, int* ki, int* nu); +void CKKFKR( + const amrex::Real P, + const amrex::Real T, + const amrex::Real* x, + amrex::Real* q_f, + amrex::Real* q_r); +void progressRateFR( + amrex::Real* q_f, amrex::Real* q_r, amrex::Real* sc, amrex::Real T); +// SPARSE INFORMATION +void SPARSITY_INFO(int* nJdata, const int* consP, int NCELLS); +void SPARSITY_INFO_SYST(int* nJdata, const int* consP, int NCELLS); +void SPARSITY_INFO_SYST_SIMPLIFIED(int* nJdata, const int* consP); +void +SPARSITY_PREPROC_CSC(int* rowVals, int* colPtrs, const int* consP, int NCELLS); +void SPARSITY_PREPROC_CSR( + int* colVals, int* rowPtrs, const int* consP, int NCELLS, int base); +void SPARSITY_PREPROC_SYST_CSR( + int* colVals, int* rowPtrs, const int* consP, int NCELLS, int base); +void SPARSITY_PREPROC_SYST_SIMPLIFIED_CSC( + int* rowVals, int* colPtrs, int* indx, const int* consP); +void SPARSITY_PREPROC_SYST_SIMPLIFIED_CSR( + int* colVals, int* rowPtr, const int* consP, int base); + +// A few mechanism parameters +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKINDX(int& mm, int& kk, int& ii, int& nfit) +{ + mm = 5; + kk = 11; + ii = 21; + nfit = -1; // Why do you need this anyway ? +} + +// inverse molecular weights +#ifdef AMREX_USE_GPU +AMREX_GPU_CONSTANT const amrex::Real global_imw[11] = { + 4.9603174603174605e-01, // H2 + 3.1251953247077940e-02, // O2 + 5.5509297807382736e-02, // H2O + 9.9206349206349209e-01, // H + 6.2503906494155881e-02, // O + 5.8799317927912029e-02, // OH + 3.0297521662727988e-02, // HO2 + 2.9399658963956014e-02, // H2O2 + 3.5696437495537948e-02, // N2 + 2.4983748071879239e-01, // HE + 2.2722624917630486e-02, // CO2 +}; +#endif +const amrex::Real h_global_imw[11] = { + 4.9603174603174605e-01, // H2 + 3.1251953247077940e-02, // O2 + 5.5509297807382736e-02, // H2O + 9.9206349206349209e-01, // H + 6.2503906494155881e-02, // O + 5.8799317927912029e-02, // OH + 3.0297521662727988e-02, // HO2 + 2.9399658963956014e-02, // H2O2 + 3.5696437495537948e-02, // N2 + 2.4983748071879239e-01, // HE + 2.2722624917630486e-02, // CO2 +}; + +// molecular weights +#ifdef AMREX_USE_GPU +AMREX_GPU_CONSTANT const amrex::Real global_mw[11] = { + 2.0160000000000000e+00, // H2 + 3.1998000000000001e+01, // O2 + 1.8015000000000001e+01, // H2O + 1.0080000000000000e+00, // H + 1.5999000000000001e+01, // O + 1.7007000000000001e+01, // OH + 3.3006000000000000e+01, // HO2 + 3.4014000000000003e+01, // H2O2 + 2.8013999999999999e+01, // N2 + 4.0026020000000004e+00, // HE + 4.4009000000000000e+01, // CO2 +}; +#endif +const amrex::Real h_global_mw[11] = { + 2.0160000000000000e+00, // H2 + 3.1998000000000001e+01, // O2 + 1.8015000000000001e+01, // H2O + 1.0080000000000000e+00, // H + 1.5999000000000001e+01, // O + 1.7007000000000001e+01, // OH + 3.3006000000000000e+01, // HO2 + 3.4014000000000003e+01, // H2O2 + 2.8013999999999999e+01, // N2 + 4.0026020000000004e+00, // HE + 4.4009000000000000e+01, // CO2 +}; + +// inverse molecular weights +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +get_imw(amrex::Real* imw_new) +{ + imw_new[0] = 4.9603174603174605e-01; // H2 + imw_new[1] = 3.1251953247077940e-02; // O2 + imw_new[2] = 5.5509297807382736e-02; // H2O + imw_new[3] = 9.9206349206349209e-01; // H + imw_new[4] = 6.2503906494155881e-02; // O + imw_new[5] = 5.8799317927912029e-02; // OH + imw_new[6] = 3.0297521662727988e-02; // HO2 + imw_new[7] = 2.9399658963956014e-02; // H2O2 + imw_new[8] = 3.5696437495537948e-02; // N2 + imw_new[9] = 2.4983748071879239e-01; // HE + imw_new[10] = 2.2722624917630486e-02; // CO2 +} + +// inverse molecular weight +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real +imw(const int n) +{ +#if AMREX_DEVICE_COMPILE + return global_imw[n]; +#else + return h_global_imw[n]; +#endif +} +// molecular weights +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +get_mw(amrex::Real* mw_new) +{ + mw_new[0] = 2.0160000000000000e+00; // H2 + mw_new[1] = 3.1998000000000001e+01; // O2 + mw_new[2] = 1.8015000000000001e+01; // H2O + mw_new[3] = 1.0080000000000000e+00; // H + mw_new[4] = 1.5999000000000001e+01; // O + mw_new[5] = 1.7007000000000001e+01; // OH + mw_new[6] = 3.3006000000000000e+01; // HO2 + mw_new[7] = 3.4014000000000003e+01; // H2O2 + mw_new[8] = 2.8013999999999999e+01; // N2 + mw_new[9] = 4.0026020000000004e+00; // HE + mw_new[10] = 4.4009000000000000e+01; // CO2 +} + +// molecular weight +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real +mw(const int n) +{ +#if AMREX_DEVICE_COMPILE + return global_mw[n]; +#else + return h_global_mw[n]; +#endif +} + +// Returns R, Rc, Patm +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKRP(amrex::Real& ru, amrex::Real& ruc, amrex::Real& pa) +{ + ru = 8.31446261815324e+07; + ruc = 1.98721558317399615845; + pa = 1.01325e+06; +} + +// compute Cv/R at the given temperature +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +cv_R(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + + // species with no change across T + // species 3: H + species[3] = +1.50000000e+00; + // species 9: HE + species[9] = +1.50000000e+00; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = +2.29812431e+00 + 8.24944174e-04 * T - 8.14301529e-07 * T2 - + 9.47543433e-11 * T3 + 4.13487224e-13 * T4; + // species 1: O2 + species[1] = +2.21293640e+00 + 1.12748635e-03 * T - 5.75615047e-07 * T2 + + 1.31387723e-09 * T3 - 8.76855392e-13 * T4; + // species 2: H2O + species[2] = +2.38684249e+00 + 3.47498246e-03 * T - 6.35469633e-06 * T2 + + 6.96858127e-09 * T3 - 2.50658847e-12 * T4; + // species 4: O + species[4] = +1.94642878e+00 - 1.63816649e-03 * T + 2.42103170e-06 * T2 - + 1.60284319e-09 * T3 + 3.89069636e-13 * T4; + // species 5: OH + species[5] = +3.12530561e+00 - 3.22544939e-03 * T + 6.52764691e-06 * T2 - + 5.79853643e-09 * T3 + 2.06237379e-12 * T4; + // species 6: HO2 + species[6] = +3.30179801e+00 - 4.74912051e-03 * T + 2.11582891e-05 * T2 - + 2.42763894e-08 * T3 + 9.29225124e-12 * T4; + // species 7: H2O2 + species[7] = +2.38875365e+00 + 6.56922581e-03 * T - 1.48501258e-07 * T2 - + 4.62580552e-09 * T3 + 2.47151475e-12 * T4; + // species 8: N2 + species[8] = +2.29867700e+00 + 1.40824000e-03 * T - 3.96322200e-06 * T2 + + 5.64151500e-09 * T3 - 2.44485500e-12 * T4; + // species 10: CO2 + species[10] = +1.27572500e+00 + 9.92207200e-03 * T - 1.04091100e-05 * T2 + + 6.86668700e-09 * T3 - 2.11728000e-12 * T4; + } else { + // species 0: H2 + species[0] = +1.99142337e+00 + 7.00064411e-04 * T - 5.63382869e-08 * T2 - + 9.23157818e-12 * T3 + 1.58275179e-15 * T4; + // species 1: O2 + species[1] = +2.69757819e+00 + 6.13519689e-04 * T - 1.25884199e-07 * T2 + + 1.77528148e-11 * T3 - 1.13643531e-15 * T4; + // species 2: H2O + species[2] = +1.67214561e+00 + 3.05629289e-03 * T - 8.73026011e-07 * T2 + + 1.20099639e-10 * T3 - 6.39161787e-15 * T4; + // species 4: O + species[4] = +1.54205966e+00 - 2.75506191e-05 * T - 3.10280335e-09 * T2 + + 4.55106742e-12 * T3 - 4.36805150e-16 * T4; + // species 5: OH + species[5] = +1.86472886e+00 + 1.05650448e-03 * T - 2.59082758e-07 * T2 + + 3.05218674e-11 * T3 - 1.33195876e-15 * T4; + // species 6: HO2 + species[6] = +3.01721090e+00 + 2.23982013e-03 * T - 6.33658150e-07 * T2 + + 1.14246370e-10 * T3 - 1.07908535e-14 * T4; + // species 7: H2O2 + species[7] = +3.57316685e+00 + 4.33613639e-03 * T - 1.47468882e-06 * T2 + + 2.34890357e-10 * T3 - 1.43165356e-14 * T4; + // species 8: N2 + species[8] = +1.92664000e+00 + 1.48797700e-03 * T - 5.68476100e-07 * T2 + + 1.00970400e-10 * T3 - 6.75335100e-15 * T4; + // species 10: CO2 + species[10] = +3.45362300e+00 + 3.14016900e-03 * T - 1.27841100e-06 * T2 + + 2.39399700e-10 * T3 - 1.66903300e-14 * T4; + } +} + +// compute Cp/R at the given temperature +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +cp_R(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + + // species with no change across T + // species 3: H + species[3] = +2.50000000e+00; + // species 9: HE + species[9] = +2.50000000e+00; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = +3.29812431e+00 + 8.24944174e-04 * T - 8.14301529e-07 * T2 - + 9.47543433e-11 * T3 + 4.13487224e-13 * T4; + // species 1: O2 + species[1] = +3.21293640e+00 + 1.12748635e-03 * T - 5.75615047e-07 * T2 + + 1.31387723e-09 * T3 - 8.76855392e-13 * T4; + // species 2: H2O + species[2] = +3.38684249e+00 + 3.47498246e-03 * T - 6.35469633e-06 * T2 + + 6.96858127e-09 * T3 - 2.50658847e-12 * T4; + // species 4: O + species[4] = +2.94642878e+00 - 1.63816649e-03 * T + 2.42103170e-06 * T2 - + 1.60284319e-09 * T3 + 3.89069636e-13 * T4; + // species 5: OH + species[5] = +4.12530561e+00 - 3.22544939e-03 * T + 6.52764691e-06 * T2 - + 5.79853643e-09 * T3 + 2.06237379e-12 * T4; + // species 6: HO2 + species[6] = +4.30179801e+00 - 4.74912051e-03 * T + 2.11582891e-05 * T2 - + 2.42763894e-08 * T3 + 9.29225124e-12 * T4; + // species 7: H2O2 + species[7] = +3.38875365e+00 + 6.56922581e-03 * T - 1.48501258e-07 * T2 - + 4.62580552e-09 * T3 + 2.47151475e-12 * T4; + // species 8: N2 + species[8] = +3.29867700e+00 + 1.40824000e-03 * T - 3.96322200e-06 * T2 + + 5.64151500e-09 * T3 - 2.44485500e-12 * T4; + // species 10: CO2 + species[10] = +2.27572500e+00 + 9.92207200e-03 * T - 1.04091100e-05 * T2 + + 6.86668700e-09 * T3 - 2.11728000e-12 * T4; + } else { + // species 0: H2 + species[0] = +2.99142337e+00 + 7.00064411e-04 * T - 5.63382869e-08 * T2 - + 9.23157818e-12 * T3 + 1.58275179e-15 * T4; + // species 1: O2 + species[1] = +3.69757819e+00 + 6.13519689e-04 * T - 1.25884199e-07 * T2 + + 1.77528148e-11 * T3 - 1.13643531e-15 * T4; + // species 2: H2O + species[2] = +2.67214561e+00 + 3.05629289e-03 * T - 8.73026011e-07 * T2 + + 1.20099639e-10 * T3 - 6.39161787e-15 * T4; + // species 4: O + species[4] = +2.54205966e+00 - 2.75506191e-05 * T - 3.10280335e-09 * T2 + + 4.55106742e-12 * T3 - 4.36805150e-16 * T4; + // species 5: OH + species[5] = +2.86472886e+00 + 1.05650448e-03 * T - 2.59082758e-07 * T2 + + 3.05218674e-11 * T3 - 1.33195876e-15 * T4; + // species 6: HO2 + species[6] = +4.01721090e+00 + 2.23982013e-03 * T - 6.33658150e-07 * T2 + + 1.14246370e-10 * T3 - 1.07908535e-14 * T4; + // species 7: H2O2 + species[7] = +4.57316685e+00 + 4.33613639e-03 * T - 1.47468882e-06 * T2 + + 2.34890357e-10 * T3 - 1.43165356e-14 * T4; + // species 8: N2 + species[8] = +2.92664000e+00 + 1.48797700e-03 * T - 5.68476100e-07 * T2 + + 1.00970400e-10 * T3 - 6.75335100e-15 * T4; + // species 10: CO2 + species[10] = +4.45362300e+00 + 3.14016900e-03 * T - 1.27841100e-06 * T2 + + 2.39399700e-10 * T3 - 1.66903300e-14 * T4; + } +} + +// compute the g/(RT) at the given temperature +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +gibbs(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + const amrex::Real invT = 1.0 / T; + const amrex::Real logT = log(T); + + // species with no change across T + // species 3: H + species[3] = +2.547162700000000e+04 * invT + 2.960117638000000e+00 - + 2.500000000000000e+00 * logT; + // species 9: HE + species[9] = -7.453750000000000e+02 * invT + 1.584651100000000e+00 - + 2.500000000000000e+00 * logT; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = -1.012520870000000e+03 * invT + 6.592218400000000e+00 - + 3.298124310000000e+00 * logT - 4.124720870000000e-04 * T + + 1.357169215000000e-07 * T2 + 7.896195275000000e-12 * T3 - + 2.067436120000000e-14 * T4; + // species 1: O2 + species[1] = -1.005249020000000e+03 * invT - 2.821801190000000e+00 - + 3.212936400000000e+00 * logT - 5.637431750000000e-04 * T + + 9.593584116666666e-08 * T2 - 1.094897691666667e-10 * T3 + + 4.384276960000000e-14 * T4; + // species 2: H2O + species[2] = -3.020811330000000e+04 * invT + 7.966096399999998e-01 - + 3.386842490000000e+00 * logT - 1.737491230000000e-03 * T + + 1.059116055000000e-06 * T2 - 5.807151058333333e-10 * T3 + + 1.253294235000000e-13 * T4; + // species 4: O + species[4] = +2.914764450000000e+04 * invT - 1.756619999999964e-02 - + 2.946428780000000e+00 * logT + 8.190832450000000e-04 * T - + 4.035052833333333e-07 * T2 + 1.335702658333333e-10 * T3 - + 1.945348180000000e-14 * T4; + // species 5: OH + species[5] = +3.346309130000000e+03 * invT + 4.815738570000000e+00 - + 4.125305610000000e+00 * logT + 1.612724695000000e-03 * T - + 1.087941151666667e-06 * T2 + 4.832113691666666e-10 * T3 - + 1.031186895000000e-13 * T4; + // species 6: HO2 + species[6] = +2.948080400000000e+02 * invT + 5.851355599999999e-01 - + 4.301798010000000e+00 * logT + 2.374560255000000e-03 * T - + 3.526381516666666e-06 * T2 + 2.023032450000000e-09 * T3 - + 4.646125620000001e-13 * T4; + // species 7: H2O2 + species[7] = -1.766314650000000e+04 * invT - 3.396609550000000e+00 - + 3.388753650000000e+00 * logT - 3.284612905000000e-03 * T + + 2.475020966666667e-08 * T2 + 3.854837933333333e-10 * T3 - + 1.235757375000000e-13 * T4; + // species 8: N2 + species[8] = -1.020900000000000e+03 * invT - 6.516950000000001e-01 - + 3.298677000000000e+00 * logT - 7.041200000000000e-04 * T + + 6.605369999999999e-07 * T2 - 4.701262500000001e-10 * T3 + + 1.222427500000000e-13 * T4; + // species 10: CO2 + species[10] = -4.837314000000000e+04 * invT - 7.912765000000000e+00 - + 2.275725000000000e+00 * logT - 4.961036000000000e-03 * T + + 1.734851666666667e-06 * T2 - 5.722239166666667e-10 * T3 + + 1.058640000000000e-13 * T4; + } else { + // species 0: H2 + species[0] = -8.350339970000000e+02 * invT + 4.346533540000000e+00 - + 2.991423370000000e+00 * logT - 3.500322055000000e-04 * T + + 9.389714483333333e-09 * T2 + 7.692981816666667e-13 * T3 - + 7.913758950000000e-17 * T4; + // species 1: O2 + species[1] = -1.233930180000000e+03 * invT + 5.084126000000002e-01 - + 3.697578190000000e+00 * logT - 3.067598445000000e-04 * T + + 2.098069983333333e-08 * T2 - 1.479401233333333e-12 * T3 + + 5.682176550000000e-17 * T4; + // species 2: H2O + species[2] = -2.989920900000000e+04 * invT - 4.190671200000001e+00 - + 2.672145610000000e+00 * logT - 1.528146445000000e-03 * T + + 1.455043351666667e-07 * T2 - 1.000830325000000e-11 * T3 + + 3.195808935000000e-16 * T4; + // species 4: O + species[4] = +2.923080270000000e+04 * invT - 2.378248450000000e+00 - + 2.542059660000000e+00 * logT + 1.377530955000000e-05 * T + + 5.171338916666667e-10 * T2 - 3.792556183333333e-13 * T3 + + 2.184025750000000e-17 * T4; + // species 5: OH + species[5] = +3.683628750000000e+03 * invT - 2.836911870000000e+00 - + 2.864728860000000e+00 * logT - 5.282522400000000e-04 * T + + 4.318045966666667e-08 * T2 - 2.543488950000000e-12 * T3 + + 6.659793800000000e-17 * T4; + // species 6: HO2 + species[6] = +1.118567130000000e+02 * invT + 2.321087500000001e-01 - + 4.017210900000000e+00 * logT - 1.119910065000000e-03 * T + + 1.056096916666667e-07 * T2 - 9.520530833333334e-12 * T3 + + 5.395426750000000e-16 * T4; + // species 7: H2O2 + species[7] = -1.800696090000000e+04 * invT + 4.072029891000000e+00 - + 4.573166850000000e+00 * logT - 2.168068195000000e-03 * T + + 2.457814700000000e-07 * T2 - 1.957419641666667e-11 * T3 + + 7.158267800000000e-16 * T4; + // species 8: N2 + species[8] = -9.227977000000000e+02 * invT - 3.053888000000000e+00 - + 2.926640000000000e+00 * logT - 7.439885000000000e-04 * T + + 9.474601666666666e-08 * T2 - 8.414199999999999e-12 * T3 + + 3.376675500000000e-16 * T4; + // species 10: CO2 + species[10] = -4.896696000000000e+04 * invT + 5.409018900000000e+00 - + 4.453623000000000e+00 * logT - 1.570084500000000e-03 * T + + 2.130685000000000e-07 * T2 - 1.994997500000000e-11 * T3 + + 8.345165000000000e-16 * T4; + } +} + +// compute the a/(RT) at the given temperature +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +helmholtz(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + const amrex::Real invT = 1.0 / T; + const amrex::Real logT = log(T); + + // species with no change across T + // species 3: H + species[3] = +2.54716270e+04 * invT + 1.96011764e+00 - 2.50000000e+00 * logT; + // species 9: HE + species[9] = -7.45375000e+02 * invT + 5.84651100e-01 - 2.50000000e+00 * logT; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = -1.01252087e+03 * invT + 5.59221840e+00 - + 3.29812431e+00 * logT - 4.12472087e-04 * T + + 1.35716922e-07 * T2 + 7.89619527e-12 * T3 - + 2.06743612e-14 * T4; + // species 1: O2 + species[1] = -1.00524902e+03 * invT - 3.82180119e+00 - + 3.21293640e+00 * logT - 5.63743175e-04 * T + + 9.59358412e-08 * T2 - 1.09489769e-10 * T3 + + 4.38427696e-14 * T4; + // species 2: H2O + species[2] = -3.02081133e+04 * invT - 2.03390360e-01 - + 3.38684249e+00 * logT - 1.73749123e-03 * T + + 1.05911606e-06 * T2 - 5.80715106e-10 * T3 + + 1.25329424e-13 * T4; + // species 4: O + species[4] = +2.91476445e+04 * invT - 1.01756620e+00 - + 2.94642878e+00 * logT + 8.19083245e-04 * T - + 4.03505283e-07 * T2 + 1.33570266e-10 * T3 - + 1.94534818e-14 * T4; + // species 5: OH + species[5] = +3.34630913e+03 * invT + 3.81573857e+00 - + 4.12530561e+00 * logT + 1.61272470e-03 * T - + 1.08794115e-06 * T2 + 4.83211369e-10 * T3 - + 1.03118689e-13 * T4; + // species 6: HO2 + species[6] = +2.94808040e+02 * invT - 4.14864440e-01 - + 4.30179801e+00 * logT + 2.37456025e-03 * T - + 3.52638152e-06 * T2 + 2.02303245e-09 * T3 - + 4.64612562e-13 * T4; + // species 7: H2O2 + species[7] = -1.76631465e+04 * invT - 4.39660955e+00 - + 3.38875365e+00 * logT - 3.28461290e-03 * T + + 2.47502097e-08 * T2 + 3.85483793e-10 * T3 - + 1.23575738e-13 * T4; + // species 8: N2 + species[8] = -1.02090000e+03 * invT - 1.65169500e+00 - + 3.29867700e+00 * logT - 7.04120000e-04 * T + + 6.60537000e-07 * T2 - 4.70126250e-10 * T3 + + 1.22242750e-13 * T4; + // species 10: CO2 + species[10] = -4.83731400e+04 * invT - 8.91276500e+00 - + 2.27572500e+00 * logT - 4.96103600e-03 * T + + 1.73485167e-06 * T2 - 5.72223917e-10 * T3 + + 1.05864000e-13 * T4; + } else { + // species 0: H2 + species[0] = -8.35033997e+02 * invT + 3.34653354e+00 - + 2.99142337e+00 * logT - 3.50032206e-04 * T + + 9.38971448e-09 * T2 + 7.69298182e-13 * T3 - + 7.91375895e-17 * T4; + // species 1: O2 + species[1] = -1.23393018e+03 * invT - 4.91587400e-01 - + 3.69757819e+00 * logT - 3.06759845e-04 * T + + 2.09806998e-08 * T2 - 1.47940123e-12 * T3 + + 5.68217655e-17 * T4; + // species 2: H2O + species[2] = -2.98992090e+04 * invT - 5.19067120e+00 - + 2.67214561e+00 * logT - 1.52814644e-03 * T + + 1.45504335e-07 * T2 - 1.00083033e-11 * T3 + + 3.19580894e-16 * T4; + // species 4: O + species[4] = +2.92308027e+04 * invT - 3.37824845e+00 - + 2.54205966e+00 * logT + 1.37753096e-05 * T + + 5.17133892e-10 * T2 - 3.79255618e-13 * T3 + + 2.18402575e-17 * T4; + // species 5: OH + species[5] = +3.68362875e+03 * invT - 3.83691187e+00 - + 2.86472886e+00 * logT - 5.28252240e-04 * T + + 4.31804597e-08 * T2 - 2.54348895e-12 * T3 + + 6.65979380e-17 * T4; + // species 6: HO2 + species[6] = +1.11856713e+02 * invT - 7.67891250e-01 - + 4.01721090e+00 * logT - 1.11991006e-03 * T + + 1.05609692e-07 * T2 - 9.52053083e-12 * T3 + + 5.39542675e-16 * T4; + // species 7: H2O2 + species[7] = -1.80069609e+04 * invT + 3.07202989e+00 - + 4.57316685e+00 * logT - 2.16806820e-03 * T + + 2.45781470e-07 * T2 - 1.95741964e-11 * T3 + + 7.15826780e-16 * T4; + // species 8: N2 + species[8] = -9.22797700e+02 * invT - 4.05388800e+00 - + 2.92664000e+00 * logT - 7.43988500e-04 * T + + 9.47460167e-08 * T2 - 8.41420000e-12 * T3 + + 3.37667550e-16 * T4; + // species 10: CO2 + species[10] = -4.89669600e+04 * invT + 4.40901890e+00 - + 4.45362300e+00 * logT - 1.57008450e-03 * T + + 2.13068500e-07 * T2 - 1.99499750e-11 * T3 + + 8.34516500e-16 * T4; + } +} + +// compute the e/(RT) at the given temperature +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +speciesInternalEnergy(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + const amrex::Real invT = 1.0 / T; + + // species with no change across T + // species 3: H + species[3] = +1.50000000e+00 + 2.54716270e+04 * invT; + // species 9: HE + species[9] = +1.50000000e+00 - 7.45375000e+02 * invT; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = +2.29812431e+00 + 4.12472087e-04 * T - 2.71433843e-07 * T2 - + 2.36885858e-11 * T3 + 8.26974448e-14 * T4 - + 1.01252087e+03 * invT; + // species 1: O2 + species[1] = +2.21293640e+00 + 5.63743175e-04 * T - 1.91871682e-07 * T2 + + 3.28469308e-10 * T3 - 1.75371078e-13 * T4 - + 1.00524902e+03 * invT; + // species 2: H2O + species[2] = +2.38684249e+00 + 1.73749123e-03 * T - 2.11823211e-06 * T2 + + 1.74214532e-09 * T3 - 5.01317694e-13 * T4 - + 3.02081133e+04 * invT; + // species 4: O + species[4] = +1.94642878e+00 - 8.19083245e-04 * T + 8.07010567e-07 * T2 - + 4.00710797e-10 * T3 + 7.78139272e-14 * T4 + + 2.91476445e+04 * invT; + // species 5: OH + species[5] = +3.12530561e+00 - 1.61272470e-03 * T + 2.17588230e-06 * T2 - + 1.44963411e-09 * T3 + 4.12474758e-13 * T4 + + 3.34630913e+03 * invT; + // species 6: HO2 + species[6] = +3.30179801e+00 - 2.37456025e-03 * T + 7.05276303e-06 * T2 - + 6.06909735e-09 * T3 + 1.85845025e-12 * T4 + + 2.94808040e+02 * invT; + // species 7: H2O2 + species[7] = +2.38875365e+00 + 3.28461290e-03 * T - 4.95004193e-08 * T2 - + 1.15645138e-09 * T3 + 4.94302950e-13 * T4 - + 1.76631465e+04 * invT; + // species 8: N2 + species[8] = +2.29867700e+00 + 7.04120000e-04 * T - 1.32107400e-06 * T2 + + 1.41037875e-09 * T3 - 4.88971000e-13 * T4 - + 1.02090000e+03 * invT; + // species 10: CO2 + species[10] = +1.27572500e+00 + 4.96103600e-03 * T - 3.46970333e-06 * T2 + + 1.71667175e-09 * T3 - 4.23456000e-13 * T4 - + 4.83731400e+04 * invT; + } else { + // species 0: H2 + species[0] = +1.99142337e+00 + 3.50032206e-04 * T - 1.87794290e-08 * T2 - + 2.30789455e-12 * T3 + 3.16550358e-16 * T4 - + 8.35033997e+02 * invT; + // species 1: O2 + species[1] = +2.69757819e+00 + 3.06759845e-04 * T - 4.19613997e-08 * T2 + + 4.43820370e-12 * T3 - 2.27287062e-16 * T4 - + 1.23393018e+03 * invT; + // species 2: H2O + species[2] = +1.67214561e+00 + 1.52814644e-03 * T - 2.91008670e-07 * T2 + + 3.00249098e-11 * T3 - 1.27832357e-15 * T4 - + 2.98992090e+04 * invT; + // species 4: O + species[4] = +1.54205966e+00 - 1.37753096e-05 * T - 1.03426778e-09 * T2 + + 1.13776685e-12 * T3 - 8.73610300e-17 * T4 + + 2.92308027e+04 * invT; + // species 5: OH + species[5] = +1.86472886e+00 + 5.28252240e-04 * T - 8.63609193e-08 * T2 + + 7.63046685e-12 * T3 - 2.66391752e-16 * T4 + + 3.68362875e+03 * invT; + // species 6: HO2 + species[6] = +3.01721090e+00 + 1.11991006e-03 * T - 2.11219383e-07 * T2 + + 2.85615925e-11 * T3 - 2.15817070e-15 * T4 + + 1.11856713e+02 * invT; + // species 7: H2O2 + species[7] = +3.57316685e+00 + 2.16806820e-03 * T - 4.91562940e-07 * T2 + + 5.87225893e-11 * T3 - 2.86330712e-15 * T4 - + 1.80069609e+04 * invT; + // species 8: N2 + species[8] = +1.92664000e+00 + 7.43988500e-04 * T - 1.89492033e-07 * T2 + + 2.52426000e-11 * T3 - 1.35067020e-15 * T4 - + 9.22797700e+02 * invT; + // species 10: CO2 + species[10] = +3.45362300e+00 + 1.57008450e-03 * T - 4.26137000e-07 * T2 + + 5.98499250e-11 * T3 - 3.33806600e-15 * T4 - + 4.89669600e+04 * invT; + } +} + +// compute the h/(RT) at the given temperature (Eq 20) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +speciesEnthalpy(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + const amrex::Real invT = 1.0 / T; + + // species with no change across T + // species 3: H + species[3] = +2.50000000e+00 + 2.54716270e+04 * invT; + // species 9: HE + species[9] = +2.50000000e+00 - 7.45375000e+02 * invT; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = +3.29812431e+00 + 4.12472087e-04 * T - 2.71433843e-07 * T2 - + 2.36885858e-11 * T3 + 8.26974448e-14 * T4 - + 1.01252087e+03 * invT; + // species 1: O2 + species[1] = +3.21293640e+00 + 5.63743175e-04 * T - 1.91871682e-07 * T2 + + 3.28469308e-10 * T3 - 1.75371078e-13 * T4 - + 1.00524902e+03 * invT; + // species 2: H2O + species[2] = +3.38684249e+00 + 1.73749123e-03 * T - 2.11823211e-06 * T2 + + 1.74214532e-09 * T3 - 5.01317694e-13 * T4 - + 3.02081133e+04 * invT; + // species 4: O + species[4] = +2.94642878e+00 - 8.19083245e-04 * T + 8.07010567e-07 * T2 - + 4.00710797e-10 * T3 + 7.78139272e-14 * T4 + + 2.91476445e+04 * invT; + // species 5: OH + species[5] = +4.12530561e+00 - 1.61272470e-03 * T + 2.17588230e-06 * T2 - + 1.44963411e-09 * T3 + 4.12474758e-13 * T4 + + 3.34630913e+03 * invT; + // species 6: HO2 + species[6] = +4.30179801e+00 - 2.37456025e-03 * T + 7.05276303e-06 * T2 - + 6.06909735e-09 * T3 + 1.85845025e-12 * T4 + + 2.94808040e+02 * invT; + // species 7: H2O2 + species[7] = +3.38875365e+00 + 3.28461290e-03 * T - 4.95004193e-08 * T2 - + 1.15645138e-09 * T3 + 4.94302950e-13 * T4 - + 1.76631465e+04 * invT; + // species 8: N2 + species[8] = +3.29867700e+00 + 7.04120000e-04 * T - 1.32107400e-06 * T2 + + 1.41037875e-09 * T3 - 4.88971000e-13 * T4 - + 1.02090000e+03 * invT; + // species 10: CO2 + species[10] = +2.27572500e+00 + 4.96103600e-03 * T - 3.46970333e-06 * T2 + + 1.71667175e-09 * T3 - 4.23456000e-13 * T4 - + 4.83731400e+04 * invT; + } else { + // species 0: H2 + species[0] = +2.99142337e+00 + 3.50032206e-04 * T - 1.87794290e-08 * T2 - + 2.30789455e-12 * T3 + 3.16550358e-16 * T4 - + 8.35033997e+02 * invT; + // species 1: O2 + species[1] = +3.69757819e+00 + 3.06759845e-04 * T - 4.19613997e-08 * T2 + + 4.43820370e-12 * T3 - 2.27287062e-16 * T4 - + 1.23393018e+03 * invT; + // species 2: H2O + species[2] = +2.67214561e+00 + 1.52814644e-03 * T - 2.91008670e-07 * T2 + + 3.00249098e-11 * T3 - 1.27832357e-15 * T4 - + 2.98992090e+04 * invT; + // species 4: O + species[4] = +2.54205966e+00 - 1.37753096e-05 * T - 1.03426778e-09 * T2 + + 1.13776685e-12 * T3 - 8.73610300e-17 * T4 + + 2.92308027e+04 * invT; + // species 5: OH + species[5] = +2.86472886e+00 + 5.28252240e-04 * T - 8.63609193e-08 * T2 + + 7.63046685e-12 * T3 - 2.66391752e-16 * T4 + + 3.68362875e+03 * invT; + // species 6: HO2 + species[6] = +4.01721090e+00 + 1.11991006e-03 * T - 2.11219383e-07 * T2 + + 2.85615925e-11 * T3 - 2.15817070e-15 * T4 + + 1.11856713e+02 * invT; + // species 7: H2O2 + species[7] = +4.57316685e+00 + 2.16806820e-03 * T - 4.91562940e-07 * T2 + + 5.87225893e-11 * T3 - 2.86330712e-15 * T4 - + 1.80069609e+04 * invT; + // species 8: N2 + species[8] = +2.92664000e+00 + 7.43988500e-04 * T - 1.89492033e-07 * T2 + + 2.52426000e-11 * T3 - 1.35067020e-15 * T4 - + 9.22797700e+02 * invT; + // species 10: CO2 + species[10] = +4.45362300e+00 + 1.57008450e-03 * T - 4.26137000e-07 * T2 + + 5.98499250e-11 * T3 - 3.33806600e-15 * T4 - + 4.89669600e+04 * invT; + } +} + +// compute the S/R at the given temperature (Eq 21) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +speciesEntropy(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + const amrex::Real logT = log(T); + + // species with no change across T + // species 3: H + species[3] = +2.50000000e+00 * logT - 4.60117638e-01; + // species 9: HE + species[9] = +2.50000000e+00 * logT + 9.15348900e-01; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = +3.29812431e+00 * logT + 8.24944174e-04 * T - + 4.07150765e-07 * T2 - 3.15847811e-11 * T3 + + 1.03371806e-13 * T4 - 3.29409409e+00; + // species 1: O2 + species[1] = +3.21293640e+00 * logT + 1.12748635e-03 * T - + 2.87807523e-07 * T2 + 4.37959077e-10 * T3 - + 2.19213848e-13 * T4 + 6.03473759e+00; + // species 2: H2O + species[2] = +3.38684249e+00 * logT + 3.47498246e-03 * T - + 3.17734817e-06 * T2 + 2.32286042e-09 * T3 - + 6.26647117e-13 * T4 + 2.59023285e+00; + // species 4: O + species[4] = +2.94642878e+00 * logT - 1.63816649e-03 * T + + 1.21051585e-06 * T2 - 5.34281063e-10 * T3 + + 9.72674090e-14 * T4 + 2.96399498e+00; + // species 5: OH + species[5] = +4.12530561e+00 * logT - 3.22544939e-03 * T + + 3.26382346e-06 * T2 - 1.93284548e-09 * T3 + + 5.15593447e-13 * T4 - 6.90432960e-01; + // species 6: HO2 + species[6] = +4.30179801e+00 * logT - 4.74912051e-03 * T + + 1.05791445e-05 * T2 - 8.09212980e-09 * T3 + + 2.32306281e-12 * T4 + 3.71666245e+00; + // species 7: H2O2 + species[7] = +3.38875365e+00 * logT + 6.56922581e-03 * T - + 7.42506290e-08 * T2 - 1.54193517e-09 * T3 + + 6.17878688e-13 * T4 + 6.78536320e+00; + // species 8: N2 + species[8] = +3.29867700e+00 * logT + 1.40824000e-03 * T - + 1.98161100e-06 * T2 + 1.88050500e-09 * T3 - + 6.11213750e-13 * T4 + 3.95037200e+00; + // species 10: CO2 + species[10] = +2.27572500e+00 * logT + 9.92207200e-03 * T - + 5.20455500e-06 * T2 + 2.28889567e-09 * T3 - + 5.29320000e-13 * T4 + 1.01884900e+01; + } else { + // species 0: H2 + species[0] = +2.99142337e+00 * logT + 7.00064411e-04 * T - + 2.81691434e-08 * T2 - 3.07719273e-12 * T3 + + 3.95687948e-16 * T4 - 1.35511017e+00; + // species 1: O2 + species[1] = +3.69757819e+00 * logT + 6.13519689e-04 * T - + 6.29420995e-08 * T2 + 5.91760493e-12 * T3 - + 2.84108828e-16 * T4 + 3.18916559e+00; + // species 2: H2O + species[2] = +2.67214561e+00 * logT + 3.05629289e-03 * T - + 4.36513005e-07 * T2 + 4.00332130e-11 * T3 - + 1.59790447e-15 * T4 + 6.86281681e+00; + // species 4: O + species[4] = +2.54205966e+00 * logT - 2.75506191e-05 * T - + 1.55140167e-09 * T2 + 1.51702247e-12 * T3 - + 1.09201287e-16 * T4 + 4.92030811e+00; + // species 5: OH + species[5] = +2.86472886e+00 * logT + 1.05650448e-03 * T - + 1.29541379e-07 * T2 + 1.01739558e-11 * T3 - + 3.32989690e-16 * T4 + 5.70164073e+00; + // species 6: HO2 + species[6] = +4.01721090e+00 * logT + 2.23982013e-03 * T - + 3.16829075e-07 * T2 + 3.80821233e-11 * T3 - + 2.69771337e-15 * T4 + 3.78510215e+00; + // species 7: H2O2 + species[7] = +4.57316685e+00 * logT + 4.33613639e-03 * T - + 7.37344410e-07 * T2 + 7.82967857e-11 * T3 - + 3.57913390e-15 * T4 + 5.01136959e-01; + // species 8: N2 + species[8] = +2.92664000e+00 * logT + 1.48797700e-03 * T - + 2.84238050e-07 * T2 + 3.36568000e-11 * T3 - + 1.68833775e-15 * T4 + 5.98052800e+00; + // species 10: CO2 + species[10] = +4.45362300e+00 * logT + 3.14016900e-03 * T - + 6.39205500e-07 * T2 + 7.97999000e-11 * T3 - + 4.17258250e-15 * T4 - 9.55395900e-01; + } +} + +// compute d(Cp/R)/dT and d(Cv/R)/dT at the given temperature +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +dcvpRdT(amrex::Real* species, const amrex::Real T) +{ + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + + // species with no change across T + // species 3: H + species[3] = 0.0; + // species 9: HE + species[9] = 0.0; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + species[0] = +8.24944174e-04 - 1.62860306e-06 * T - 2.84263030e-10 * T2 + + 1.65394890e-12 * T3; + // species 1: O2 + species[1] = +1.12748635e-03 - 1.15123009e-06 * T + 3.94163169e-09 * T2 - + 3.50742157e-12 * T3; + // species 2: H2O + species[2] = +3.47498246e-03 - 1.27093927e-05 * T + 2.09057438e-08 * T2 - + 1.00263539e-11 * T3; + // species 4: O + species[4] = -1.63816649e-03 + 4.84206340e-06 * T - 4.80852957e-09 * T2 + + 1.55627854e-12 * T3; + // species 5: OH + species[5] = -3.22544939e-03 + 1.30552938e-05 * T - 1.73956093e-08 * T2 + + 8.24949516e-12 * T3; + // species 6: HO2 + species[6] = -4.74912051e-03 + 4.23165782e-05 * T - 7.28291682e-08 * T2 + + 3.71690050e-11 * T3; + // species 7: H2O2 + species[7] = +6.56922581e-03 - 2.97002516e-07 * T - 1.38774166e-08 * T2 + + 9.88605900e-12 * T3; + // species 8: N2 + species[8] = +1.40824000e-03 - 7.92644400e-06 * T + 1.69245450e-08 * T2 - + 9.77942000e-12 * T3; + // species 10: CO2 + species[10] = +9.92207200e-03 - 2.08182200e-05 * T + 2.06000610e-08 * T2 - + 8.46912000e-12 * T3; + } else { + // species 0: H2 + species[0] = +7.00064411e-04 - 1.12676574e-07 * T - 2.76947345e-11 * T2 + + 6.33100716e-15 * T3; + // species 1: O2 + species[1] = +6.13519689e-04 - 2.51768398e-07 * T + 5.32584444e-11 * T2 - + 4.54574124e-15 * T3; + // species 2: H2O + species[2] = +3.05629289e-03 - 1.74605202e-06 * T + 3.60298917e-10 * T2 - + 2.55664715e-14 * T3; + // species 4: O + species[4] = -2.75506191e-05 - 6.20560670e-09 * T + 1.36532023e-11 * T2 - + 1.74722060e-15 * T3; + // species 5: OH + species[5] = +1.05650448e-03 - 5.18165516e-07 * T + 9.15656022e-11 * T2 - + 5.32783504e-15 * T3; + // species 6: HO2 + species[6] = +2.23982013e-03 - 1.26731630e-06 * T + 3.42739110e-10 * T2 - + 4.31634140e-14 * T3; + // species 7: H2O2 + species[7] = +4.33613639e-03 - 2.94937764e-06 * T + 7.04671071e-10 * T2 - + 5.72661424e-14 * T3; + // species 8: N2 + species[8] = +1.48797700e-03 - 1.13695220e-06 * T + 3.02911200e-10 * T2 - + 2.70134040e-14 * T3; + // species 10: CO2 + species[10] = +3.14016900e-03 - 2.55682200e-06 * T + 7.18199100e-10 * T2 - + 6.67613200e-14 * T3; + } +} + +// Returns the mean specific heat at CP (Eq. 33) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCPBL(const amrex::Real T, const amrex::Real x[], amrex::Real& cpbl) +{ + amrex::Real result = 0; + amrex::Real cpor[11]; // temporary storage + cp_R(cpor, T); + + // perform dot product + for (int id = 0; id < 11; ++id) { + result += x[id] * cpor[id]; + } + + cpbl = result * 8.31446261815324e+07; +} + +// Returns the mean specific heat at CP (Eq. 34) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCPBS(const amrex::Real T, const amrex::Real y[], amrex::Real& cpbs) +{ + amrex::Real result = 0.0; + + // compute Cp/R at the given temperature + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + + // species with no change across T + // species 3: H + result += y[3] * (+2.50000000e+00) * 0.9920634920634921; + // species 9: HE + result += y[9] * (+2.50000000e+00) * 0.2498374807187924; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + result += y[0] * + (+3.29812431e+00 + 8.24944174e-04 * T - 8.14301529e-07 * T2 - + 9.47543433e-11 * T3 + 4.13487224e-13 * T4) * + 0.4960317460317460; + // species 1: O2 + result += y[1] * + (+3.21293640e+00 + 1.12748635e-03 * T - 5.75615047e-07 * T2 + + 1.31387723e-09 * T3 - 8.76855392e-13 * T4) * + 0.0312519532470779; + // species 2: H2O + result += y[2] * + (+3.38684249e+00 + 3.47498246e-03 * T - 6.35469633e-06 * T2 + + 6.96858127e-09 * T3 - 2.50658847e-12 * T4) * + 0.0555092978073827; + // species 4: O + result += y[4] * + (+2.94642878e+00 - 1.63816649e-03 * T + 2.42103170e-06 * T2 - + 1.60284319e-09 * T3 + 3.89069636e-13 * T4) * + 0.0625039064941559; + // species 5: OH + result += y[5] * + (+4.12530561e+00 - 3.22544939e-03 * T + 6.52764691e-06 * T2 - + 5.79853643e-09 * T3 + 2.06237379e-12 * T4) * + 0.0587993179279120; + // species 6: HO2 + result += y[6] * + (+4.30179801e+00 - 4.74912051e-03 * T + 2.11582891e-05 * T2 - + 2.42763894e-08 * T3 + 9.29225124e-12 * T4) * + 0.0302975216627280; + // species 7: H2O2 + result += y[7] * + (+3.38875365e+00 + 6.56922581e-03 * T - 1.48501258e-07 * T2 - + 4.62580552e-09 * T3 + 2.47151475e-12 * T4) * + 0.0293996589639560; + // species 8: N2 + result += y[8] * + (+3.29867700e+00 + 1.40824000e-03 * T - 3.96322200e-06 * T2 + + 5.64151500e-09 * T3 - 2.44485500e-12 * T4) * + 0.0356964374955379; + // species 10: CO2 + result += y[10] * + (+2.27572500e+00 + 9.92207200e-03 * T - 1.04091100e-05 * T2 + + 6.86668700e-09 * T3 - 2.11728000e-12 * T4) * + 0.0227226249176305; + } else { + // species 0: H2 + result += y[0] * + (+2.99142337e+00 + 7.00064411e-04 * T - 5.63382869e-08 * T2 - + 9.23157818e-12 * T3 + 1.58275179e-15 * T4) * + 0.4960317460317460; + // species 1: O2 + result += y[1] * + (+3.69757819e+00 + 6.13519689e-04 * T - 1.25884199e-07 * T2 + + 1.77528148e-11 * T3 - 1.13643531e-15 * T4) * + 0.0312519532470779; + // species 2: H2O + result += y[2] * + (+2.67214561e+00 + 3.05629289e-03 * T - 8.73026011e-07 * T2 + + 1.20099639e-10 * T3 - 6.39161787e-15 * T4) * + 0.0555092978073827; + // species 4: O + result += y[4] * + (+2.54205966e+00 - 2.75506191e-05 * T - 3.10280335e-09 * T2 + + 4.55106742e-12 * T3 - 4.36805150e-16 * T4) * + 0.0625039064941559; + // species 5: OH + result += y[5] * + (+2.86472886e+00 + 1.05650448e-03 * T - 2.59082758e-07 * T2 + + 3.05218674e-11 * T3 - 1.33195876e-15 * T4) * + 0.0587993179279120; + // species 6: HO2 + result += y[6] * + (+4.01721090e+00 + 2.23982013e-03 * T - 6.33658150e-07 * T2 + + 1.14246370e-10 * T3 - 1.07908535e-14 * T4) * + 0.0302975216627280; + // species 7: H2O2 + result += y[7] * + (+4.57316685e+00 + 4.33613639e-03 * T - 1.47468882e-06 * T2 + + 2.34890357e-10 * T3 - 1.43165356e-14 * T4) * + 0.0293996589639560; + // species 8: N2 + result += y[8] * + (+2.92664000e+00 + 1.48797700e-03 * T - 5.68476100e-07 * T2 + + 1.00970400e-10 * T3 - 6.75335100e-15 * T4) * + 0.0356964374955379; + // species 10: CO2 + result += y[10] * + (+4.45362300e+00 + 3.14016900e-03 * T - 1.27841100e-06 * T2 + + 2.39399700e-10 * T3 - 1.66903300e-14 * T4) * + 0.0227226249176305; + } + + cpbs = result * 8.31446261815324e+07; +} + +// Returns the mean specific heat at CV (Eq. 35) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCVBL(const amrex::Real T, const amrex::Real x[], amrex::Real& cvbl) +{ + amrex::Real result = 0; + amrex::Real cvor[11]; // temporary storage + cv_R(cvor, T); + + // perform dot product + for (int id = 0; id < 11; ++id) { + result += x[id] * cvor[id]; + } + + cvbl = result * 8.31446261815324e+07; +} + +// Returns the mean specific heat at CV (Eq. 36) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCVBS(const amrex::Real T, const amrex::Real y[], amrex::Real& cvbs) +{ + amrex::Real result = 0.0; + // compute Cv/R at the given temperature + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + + // species with no change across T + // species 3: H + result += y[3] * (+1.50000000e+00) * 0.9920634920634921; + // species 9: HE + result += y[9] * (+1.50000000e+00) * 0.2498374807187924; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + result += y[0] * + (+2.29812431e+00 + 8.24944174e-04 * T - 8.14301529e-07 * T2 - + 9.47543433e-11 * T3 + 4.13487224e-13 * T4) * + 0.4960317460317460; + // species 1: O2 + result += y[1] * + (+2.21293640e+00 + 1.12748635e-03 * T - 5.75615047e-07 * T2 + + 1.31387723e-09 * T3 - 8.76855392e-13 * T4) * + 0.0312519532470779; + // species 2: H2O + result += y[2] * + (+2.38684249e+00 + 3.47498246e-03 * T - 6.35469633e-06 * T2 + + 6.96858127e-09 * T3 - 2.50658847e-12 * T4) * + 0.0555092978073827; + // species 4: O + result += y[4] * + (+1.94642878e+00 - 1.63816649e-03 * T + 2.42103170e-06 * T2 - + 1.60284319e-09 * T3 + 3.89069636e-13 * T4) * + 0.0625039064941559; + // species 5: OH + result += y[5] * + (+3.12530561e+00 - 3.22544939e-03 * T + 6.52764691e-06 * T2 - + 5.79853643e-09 * T3 + 2.06237379e-12 * T4) * + 0.0587993179279120; + // species 6: HO2 + result += y[6] * + (+3.30179801e+00 - 4.74912051e-03 * T + 2.11582891e-05 * T2 - + 2.42763894e-08 * T3 + 9.29225124e-12 * T4) * + 0.0302975216627280; + // species 7: H2O2 + result += y[7] * + (+2.38875365e+00 + 6.56922581e-03 * T - 1.48501258e-07 * T2 - + 4.62580552e-09 * T3 + 2.47151475e-12 * T4) * + 0.0293996589639560; + // species 8: N2 + result += y[8] * + (+2.29867700e+00 + 1.40824000e-03 * T - 3.96322200e-06 * T2 + + 5.64151500e-09 * T3 - 2.44485500e-12 * T4) * + 0.0356964374955379; + // species 10: CO2 + result += y[10] * + (+1.27572500e+00 + 9.92207200e-03 * T - 1.04091100e-05 * T2 + + 6.86668700e-09 * T3 - 2.11728000e-12 * T4) * + 0.0227226249176305; + } else { + // species 0: H2 + result += y[0] * + (+1.99142337e+00 + 7.00064411e-04 * T - 5.63382869e-08 * T2 - + 9.23157818e-12 * T3 + 1.58275179e-15 * T4) * + 0.4960317460317460; + // species 1: O2 + result += y[1] * + (+2.69757819e+00 + 6.13519689e-04 * T - 1.25884199e-07 * T2 + + 1.77528148e-11 * T3 - 1.13643531e-15 * T4) * + 0.0312519532470779; + // species 2: H2O + result += y[2] * + (+1.67214561e+00 + 3.05629289e-03 * T - 8.73026011e-07 * T2 + + 1.20099639e-10 * T3 - 6.39161787e-15 * T4) * + 0.0555092978073827; + // species 4: O + result += y[4] * + (+1.54205966e+00 - 2.75506191e-05 * T - 3.10280335e-09 * T2 + + 4.55106742e-12 * T3 - 4.36805150e-16 * T4) * + 0.0625039064941559; + // species 5: OH + result += y[5] * + (+1.86472886e+00 + 1.05650448e-03 * T - 2.59082758e-07 * T2 + + 3.05218674e-11 * T3 - 1.33195876e-15 * T4) * + 0.0587993179279120; + // species 6: HO2 + result += y[6] * + (+3.01721090e+00 + 2.23982013e-03 * T - 6.33658150e-07 * T2 + + 1.14246370e-10 * T3 - 1.07908535e-14 * T4) * + 0.0302975216627280; + // species 7: H2O2 + result += y[7] * + (+3.57316685e+00 + 4.33613639e-03 * T - 1.47468882e-06 * T2 + + 2.34890357e-10 * T3 - 1.43165356e-14 * T4) * + 0.0293996589639560; + // species 8: N2 + result += y[8] * + (+1.92664000e+00 + 1.48797700e-03 * T - 5.68476100e-07 * T2 + + 1.00970400e-10 * T3 - 6.75335100e-15 * T4) * + 0.0356964374955379; + // species 10: CO2 + result += y[10] * + (+3.45362300e+00 + 3.14016900e-03 * T - 1.27841100e-06 * T2 + + 2.39399700e-10 * T3 - 1.66903300e-14 * T4) * + 0.0227226249176305; + } + + cvbs = result * 8.31446261815324e+07; +} + +// Returns the mean enthalpy of the mixture in molar units +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKHBML(const amrex::Real T, const amrex::Real x[], amrex::Real& hbml) +{ + amrex::Real result = 0; + amrex::Real hml[11]; // temporary storage + amrex::Real RT = 8.31446261815324e+07 * T; // R*T + speciesEnthalpy(hml, T); + + // perform dot product + for (int id = 0; id < 11; ++id) { + result += x[id] * hml[id]; + } + + hbml = result * RT; +} + +// Returns mean enthalpy of mixture in mass units +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKHBMS(const amrex::Real T, const amrex::Real y[], amrex::Real& hbms) +{ + amrex::Real result = 0.0; + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + const amrex::Real invT = 1.0 / T; + + // species with no change across T + // species 3: H + result += + y[3] * (+2.50000000e+00 + 2.54716270e+04 * invT) * 0.9920634920634921; + // species 9: HE + result += + y[9] * (+2.50000000e+00 - 7.45375000e+02 * invT) * 0.2498374807187924; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + result += + y[0] * + (+3.29812431e+00 + 4.12472087e-04 * T - 2.71433843e-07 * T2 - + 2.36885858e-11 * T3 + 8.26974448e-14 * T4 - 1.01252087e+03 * invT) * + 0.4960317460317460; + // species 1: O2 + result += + y[1] * + (+3.21293640e+00 + 5.63743175e-04 * T - 1.91871682e-07 * T2 + + 3.28469308e-10 * T3 - 1.75371078e-13 * T4 - 1.00524902e+03 * invT) * + 0.0312519532470779; + // species 2: H2O + result += + y[2] * + (+3.38684249e+00 + 1.73749123e-03 * T - 2.11823211e-06 * T2 + + 1.74214532e-09 * T3 - 5.01317694e-13 * T4 - 3.02081133e+04 * invT) * + 0.0555092978073827; + // species 4: O + result += + y[4] * + (+2.94642878e+00 - 8.19083245e-04 * T + 8.07010567e-07 * T2 - + 4.00710797e-10 * T3 + 7.78139272e-14 * T4 + 2.91476445e+04 * invT) * + 0.0625039064941559; + // species 5: OH + result += + y[5] * + (+4.12530561e+00 - 1.61272470e-03 * T + 2.17588230e-06 * T2 - + 1.44963411e-09 * T3 + 4.12474758e-13 * T4 + 3.34630913e+03 * invT) * + 0.0587993179279120; + // species 6: HO2 + result += + y[6] * + (+4.30179801e+00 - 2.37456025e-03 * T + 7.05276303e-06 * T2 - + 6.06909735e-09 * T3 + 1.85845025e-12 * T4 + 2.94808040e+02 * invT) * + 0.0302975216627280; + // species 7: H2O2 + result += + y[7] * + (+3.38875365e+00 + 3.28461290e-03 * T - 4.95004193e-08 * T2 - + 1.15645138e-09 * T3 + 4.94302950e-13 * T4 - 1.76631465e+04 * invT) * + 0.0293996589639560; + // species 8: N2 + result += + y[8] * + (+3.29867700e+00 + 7.04120000e-04 * T - 1.32107400e-06 * T2 + + 1.41037875e-09 * T3 - 4.88971000e-13 * T4 - 1.02090000e+03 * invT) * + 0.0356964374955379; + // species 10: CO2 + result += + y[10] * + (+2.27572500e+00 + 4.96103600e-03 * T - 3.46970333e-06 * T2 + + 1.71667175e-09 * T3 - 4.23456000e-13 * T4 - 4.83731400e+04 * invT) * + 0.0227226249176305; + } else { + // species 0: H2 + result += + y[0] * + (+2.99142337e+00 + 3.50032206e-04 * T - 1.87794290e-08 * T2 - + 2.30789455e-12 * T3 + 3.16550358e-16 * T4 - 8.35033997e+02 * invT) * + 0.4960317460317460; + // species 1: O2 + result += + y[1] * + (+3.69757819e+00 + 3.06759845e-04 * T - 4.19613997e-08 * T2 + + 4.43820370e-12 * T3 - 2.27287062e-16 * T4 - 1.23393018e+03 * invT) * + 0.0312519532470779; + // species 2: H2O + result += + y[2] * + (+2.67214561e+00 + 1.52814644e-03 * T - 2.91008670e-07 * T2 + + 3.00249098e-11 * T3 - 1.27832357e-15 * T4 - 2.98992090e+04 * invT) * + 0.0555092978073827; + // species 4: O + result += + y[4] * + (+2.54205966e+00 - 1.37753096e-05 * T - 1.03426778e-09 * T2 + + 1.13776685e-12 * T3 - 8.73610300e-17 * T4 + 2.92308027e+04 * invT) * + 0.0625039064941559; + // species 5: OH + result += + y[5] * + (+2.86472886e+00 + 5.28252240e-04 * T - 8.63609193e-08 * T2 + + 7.63046685e-12 * T3 - 2.66391752e-16 * T4 + 3.68362875e+03 * invT) * + 0.0587993179279120; + // species 6: HO2 + result += + y[6] * + (+4.01721090e+00 + 1.11991006e-03 * T - 2.11219383e-07 * T2 + + 2.85615925e-11 * T3 - 2.15817070e-15 * T4 + 1.11856713e+02 * invT) * + 0.0302975216627280; + // species 7: H2O2 + result += + y[7] * + (+4.57316685e+00 + 2.16806820e-03 * T - 4.91562940e-07 * T2 + + 5.87225893e-11 * T3 - 2.86330712e-15 * T4 - 1.80069609e+04 * invT) * + 0.0293996589639560; + // species 8: N2 + result += + y[8] * + (+2.92664000e+00 + 7.43988500e-04 * T - 1.89492033e-07 * T2 + + 2.52426000e-11 * T3 - 1.35067020e-15 * T4 - 9.22797700e+02 * invT) * + 0.0356964374955379; + // species 10: CO2 + result += + y[10] * + (+4.45362300e+00 + 1.57008450e-03 * T - 4.26137000e-07 * T2 + + 5.98499250e-11 * T3 - 3.33806600e-15 * T4 - 4.89669600e+04 * invT) * + 0.0227226249176305; + } + + const amrex::Real RT = 8.31446261815324e+07 * T; // R*T + + hbms = result * RT; +} + +// get mean internal energy in molar units +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKUBML(const amrex::Real T, const amrex::Real x[], amrex::Real& ubml) +{ + amrex::Real result = 0; + amrex::Real uml[11]; // temporary energy array + amrex::Real RT = 8.31446261815324e+07 * T; // R*T + speciesInternalEnergy(uml, T); + + // perform dot product + for (int id = 0; id < 11; ++id) { + result += x[id] * uml[id]; + } + + ubml = result * RT; +} + +// get mean internal energy in mass units +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKUBMS(const amrex::Real T, const amrex::Real y[], amrex::Real& ubms) +{ + amrex::Real result = 0.0; + const amrex::Real T2 = T * T; + const amrex::Real T3 = T * T2; + const amrex::Real T4 = T * T3; + const amrex::Real invT = 1.0 / T; + + // species with no change across T + // species 3: H + result += + y[3] * (+1.50000000e+00 + 2.54716270e+04 * invT) * 0.9920634920634921; + // species 9: HE + result += + y[9] * (+1.50000000e+00 - 7.45375000e+02 * invT) * 0.2498374807187924; + + // species with midpoint at T=1000 kelvin + if (T < 1000) { + // species 0: H2 + result += + y[0] * + (+2.29812431e+00 + 4.12472087e-04 * T - 2.71433843e-07 * T2 - + 2.36885858e-11 * T3 + 8.26974448e-14 * T4 - 1.01252087e+03 * invT) * + 0.4960317460317460; + // species 1: O2 + result += + y[1] * + (+2.21293640e+00 + 5.63743175e-04 * T - 1.91871682e-07 * T2 + + 3.28469308e-10 * T3 - 1.75371078e-13 * T4 - 1.00524902e+03 * invT) * + 0.0312519532470779; + // species 2: H2O + result += + y[2] * + (+2.38684249e+00 + 1.73749123e-03 * T - 2.11823211e-06 * T2 + + 1.74214532e-09 * T3 - 5.01317694e-13 * T4 - 3.02081133e+04 * invT) * + 0.0555092978073827; + // species 4: O + result += + y[4] * + (+1.94642878e+00 - 8.19083245e-04 * T + 8.07010567e-07 * T2 - + 4.00710797e-10 * T3 + 7.78139272e-14 * T4 + 2.91476445e+04 * invT) * + 0.0625039064941559; + // species 5: OH + result += + y[5] * + (+3.12530561e+00 - 1.61272470e-03 * T + 2.17588230e-06 * T2 - + 1.44963411e-09 * T3 + 4.12474758e-13 * T4 + 3.34630913e+03 * invT) * + 0.0587993179279120; + // species 6: HO2 + result += + y[6] * + (+3.30179801e+00 - 2.37456025e-03 * T + 7.05276303e-06 * T2 - + 6.06909735e-09 * T3 + 1.85845025e-12 * T4 + 2.94808040e+02 * invT) * + 0.0302975216627280; + // species 7: H2O2 + result += + y[7] * + (+2.38875365e+00 + 3.28461290e-03 * T - 4.95004193e-08 * T2 - + 1.15645138e-09 * T3 + 4.94302950e-13 * T4 - 1.76631465e+04 * invT) * + 0.0293996589639560; + // species 8: N2 + result += + y[8] * + (+2.29867700e+00 + 7.04120000e-04 * T - 1.32107400e-06 * T2 + + 1.41037875e-09 * T3 - 4.88971000e-13 * T4 - 1.02090000e+03 * invT) * + 0.0356964374955379; + // species 10: CO2 + result += + y[10] * + (+1.27572500e+00 + 4.96103600e-03 * T - 3.46970333e-06 * T2 + + 1.71667175e-09 * T3 - 4.23456000e-13 * T4 - 4.83731400e+04 * invT) * + 0.0227226249176305; + } else { + // species 0: H2 + result += + y[0] * + (+1.99142337e+00 + 3.50032206e-04 * T - 1.87794290e-08 * T2 - + 2.30789455e-12 * T3 + 3.16550358e-16 * T4 - 8.35033997e+02 * invT) * + 0.4960317460317460; + // species 1: O2 + result += + y[1] * + (+2.69757819e+00 + 3.06759845e-04 * T - 4.19613997e-08 * T2 + + 4.43820370e-12 * T3 - 2.27287062e-16 * T4 - 1.23393018e+03 * invT) * + 0.0312519532470779; + // species 2: H2O + result += + y[2] * + (+1.67214561e+00 + 1.52814644e-03 * T - 2.91008670e-07 * T2 + + 3.00249098e-11 * T3 - 1.27832357e-15 * T4 - 2.98992090e+04 * invT) * + 0.0555092978073827; + // species 4: O + result += + y[4] * + (+1.54205966e+00 - 1.37753096e-05 * T - 1.03426778e-09 * T2 + + 1.13776685e-12 * T3 - 8.73610300e-17 * T4 + 2.92308027e+04 * invT) * + 0.0625039064941559; + // species 5: OH + result += + y[5] * + (+1.86472886e+00 + 5.28252240e-04 * T - 8.63609193e-08 * T2 + + 7.63046685e-12 * T3 - 2.66391752e-16 * T4 + 3.68362875e+03 * invT) * + 0.0587993179279120; + // species 6: HO2 + result += + y[6] * + (+3.01721090e+00 + 1.11991006e-03 * T - 2.11219383e-07 * T2 + + 2.85615925e-11 * T3 - 2.15817070e-15 * T4 + 1.11856713e+02 * invT) * + 0.0302975216627280; + // species 7: H2O2 + result += + y[7] * + (+3.57316685e+00 + 2.16806820e-03 * T - 4.91562940e-07 * T2 + + 5.87225893e-11 * T3 - 2.86330712e-15 * T4 - 1.80069609e+04 * invT) * + 0.0293996589639560; + // species 8: N2 + result += + y[8] * + (+1.92664000e+00 + 7.43988500e-04 * T - 1.89492033e-07 * T2 + + 2.52426000e-11 * T3 - 1.35067020e-15 * T4 - 9.22797700e+02 * invT) * + 0.0356964374955379; + // species 10: CO2 + result += + y[10] * + (+3.45362300e+00 + 1.57008450e-03 * T - 4.26137000e-07 * T2 + + 5.98499250e-11 * T3 - 3.33806600e-15 * T4 - 4.89669600e+04 * invT) * + 0.0227226249176305; + } + + const amrex::Real RT = 8.31446261815324e+07 * T; // R*T + + ubms = result * RT; +} + +// get mixture entropy in molar units +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKSBML( + const amrex::Real P, + const amrex::Real T, + const amrex::Real x[], + amrex::Real& sbml) +{ + amrex::Real result = 0; + // Log of normalized pressure in cgs units dynes/cm^2 by Patm + amrex::Real logPratio = log(P / 1013250.0); + amrex::Real sor[11]; // temporary storage + speciesEntropy(sor, T); + + // Compute Eq 42 + for (int id = 0; id < 11; ++id) { + result += x[id] * (sor[id] - log((x[id] + 1e-100)) - logPratio); + } + + sbml = result * 8.31446261815324e+07; +} + +// get mixture entropy in mass units +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKSBMS( + const amrex::Real P, + const amrex::Real T, + const amrex::Real y[], + amrex::Real& sbms) +{ + amrex::Real result = 0; + // Log of normalized pressure in cgs units dynes/cm^2 by Patm + amrex::Real logPratio = log(P / 1013250.0); + amrex::Real sor[11]; // temporary storage + amrex::Real x[11]; // need a ytx conversion + amrex::Real YOW = 0; // See Eq 4, 6 in CK Manual + + // Compute inverse of mean molecular wt first + for (int i = 0; i < 11; i++) { + YOW += y[i] * imw(i); + } + // Now compute y to x conversion + x[0] = y[0] / (2.0160000000000000e+00 * YOW); + x[1] = y[1] / (3.1998000000000001e+01 * YOW); + x[2] = y[2] / (1.8015000000000001e+01 * YOW); + x[3] = y[3] / (1.0080000000000000e+00 * YOW); + x[4] = y[4] / (1.5999000000000001e+01 * YOW); + x[5] = y[5] / (1.7007000000000001e+01 * YOW); + x[6] = y[6] / (3.3006000000000000e+01 * YOW); + x[7] = y[7] / (3.4014000000000003e+01 * YOW); + x[8] = y[8] / (2.8013999999999999e+01 * YOW); + x[9] = y[9] / (4.0026020000000004e+00 * YOW); + x[10] = y[10] / (4.4009000000000000e+01 * YOW); + speciesEntropy(sor, T); + // Perform computation in Eq 42 and 43 + for (int i = 0; i < 11; i++) { + result += x[i] * (sor[i] - log((x[i] + 1e-100)) - logPratio); + } + // Scale by R/W + sbms = result * 8.31446261815324e+07 * YOW; +} + +// get temperature given internal energy in mass units and mass fracs +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +GET_T_GIVEN_EY( + const amrex::Real e, const amrex::Real y[], amrex::Real& t, int& ierr) +{ +#ifdef CONVERGENCE + const int maxiter = 5000; + const amrex::Real tol = 1.e-12; +#else + const int maxiter = 200; + const amrex::Real tol = 1.e-6; +#endif + amrex::Real tmin = 300.0; // max lower bound for thermo def + amrex::Real tmax = 3500.0; // min upper bound for thermo def + amrex::Real e1, emin, emax, cv, t1, dt; + CKUBMS(tmin, y, emin); + CKUBMS(tmax, y, emax); + if (e < emin) { + // Linear Extrapolation below tmin + CKCVBS(tmin, y, cv); + t = tmin - (emin - e) / cv; + ierr = 1; + return; + } + if (e > emax) { + // Linear Extrapolation above tmax + CKCVBS(tmax, y, cv); + t = tmax - (emax - e) / cv; + ierr = 1; + return; + } + t1 = t; + if (t1 < tmin || t1 > tmax) { + t1 = tmin + (tmax - tmin) / (emax - emin) * (e - emin); + } + for (int i = 0; i < maxiter; ++i) { + CKUBMS(t1, y, e1); + CKCVBS(t1, y, cv); + dt = (e - e1) / cv; + if (dt > 100.) { + dt = 100.; + } else if (dt < -100.) { + dt = -100.; + } else if (fabs(dt) < tol) { + break; + } + t1 += dt; + } + t = t1; + ierr = 0; +} + +// get temperature given enthalpy in mass units and mass fracs +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +GET_T_GIVEN_HY( + const amrex::Real h, const amrex::Real y[], amrex::Real& t, int& ierr) +{ +#ifdef CONVERGENCE + const int maxiter = 5000; + const amrex::Real tol = 1.e-12; +#else + const int maxiter = 200; + const amrex::Real tol = 1.e-6; +#endif + amrex::Real tmin = 300.0; // max lower bound for thermo def + amrex::Real tmax = 3500.0; // min upper bound for thermo def + amrex::Real h1, hmin, hmax, cp, t1, dt; + CKHBMS(tmin, y, hmin); + CKHBMS(tmax, y, hmax); + if (h < hmin) { + // Linear Extrapolation below tmin + CKCPBS(tmin, y, cp); + t = tmin - (hmin - h) / cp; + ierr = 1; + return; + } + if (h > hmax) { + // Linear Extrapolation above tmax + CKCPBS(tmax, y, cp); + t = tmax - (hmax - h) / cp; + ierr = 1; + return; + } + t1 = t; + if (t1 < tmin || t1 > tmax) { + t1 = tmin + (tmax - tmin) / (hmax - hmin) * (h - hmin); + } + for (int i = 0; i < maxiter; ++i) { + CKHBMS(t1, y, h1); + CKCPBS(t1, y, cp); + dt = (h - h1) / cp; + if (dt > 100.) { + dt = 100.; + } else if (dt < -100.) { + dt = -100.; + } else if (fabs(dt) < tol) { + break; + } + t1 += dt; + } + t = t1; + ierr = 0; +} + +// Compute P = rhoRT/W(x) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKPX( + const amrex::Real rho, + const amrex::Real T, + const amrex::Real x[], + amrex::Real& P) +{ + amrex::Real XW = 0; // To hold mean molecular wt + XW += x[0] * 2.0160000000000000e+00; // H2 + XW += x[1] * 3.1998000000000001e+01; // O2 + XW += x[2] * 1.8015000000000001e+01; // H2O + XW += x[3] * 1.0080000000000000e+00; // H + XW += x[4] * 1.5999000000000001e+01; // O + XW += x[5] * 1.7007000000000001e+01; // OH + XW += x[6] * 3.3006000000000000e+01; // HO2 + XW += x[7] * 3.4014000000000003e+01; // H2O2 + XW += x[8] * 2.8013999999999999e+01; // N2 + XW += x[9] * 4.0026020000000004e+00; // HE + XW += x[10] * 4.4009000000000000e+01; // CO2 + P = rho * 8.31446261815324e+07 * T / XW; // P = rho*R*T/W +} + +// Compute P = rhoRT/W(y) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKPY( + const amrex::Real rho, + const amrex::Real T, + const amrex::Real y[], + amrex::Real& P) +{ + amrex::Real YOW = 0; // for computing mean MW + + for (int i = 0; i < 11; i++) { + YOW += y[i] * imw(i); + } + P = rho * 8.31446261815324e+07 * T * YOW; // P = rho*R*T/W +} + +// Compute P = rhoRT/W(c) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKPC( + const amrex::Real rho, + const amrex::Real T, + const amrex::Real c[], + amrex::Real& P) +{ + // See Eq 5 in CK Manual + amrex::Real W = 0; + amrex::Real sumC = 0; + W += c[0] * 2.0160000000000000e+00; // H2 + W += c[1] * 3.1998000000000001e+01; // O2 + W += c[2] * 1.8015000000000001e+01; // H2O + W += c[3] * 1.0080000000000000e+00; // H + W += c[4] * 1.5999000000000001e+01; // O + W += c[5] * 1.7007000000000001e+01; // OH + W += c[6] * 3.3006000000000000e+01; // HO2 + W += c[7] * 3.4014000000000003e+01; // H2O2 + W += c[8] * 2.8013999999999999e+01; // N2 + W += c[9] * 4.0026020000000004e+00; // HE + W += c[10] * 4.4009000000000000e+01; // CO2 + + for (int id = 0; id < 11; ++id) { + sumC += c[id]; + } + P = rho * 8.31446261815324e+07 * T * sumC / W; // P = rho*R*T/W +} + +// Compute rho = PW(x)/RT +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKRHOX( + const amrex::Real P, + const amrex::Real T, + const amrex::Real x[], + amrex::Real& rho) +{ + amrex::Real XW = 0; // To hold mean molecular wt + XW += x[0] * 2.0160000000000000e+00; // H2 + XW += x[1] * 3.1998000000000001e+01; // O2 + XW += x[2] * 1.8015000000000001e+01; // H2O + XW += x[3] * 1.0080000000000000e+00; // H + XW += x[4] * 1.5999000000000001e+01; // O + XW += x[5] * 1.7007000000000001e+01; // OH + XW += x[6] * 3.3006000000000000e+01; // HO2 + XW += x[7] * 3.4014000000000003e+01; // H2O2 + XW += x[8] * 2.8013999999999999e+01; // N2 + XW += x[9] * 4.0026020000000004e+00; // HE + XW += x[10] * 4.4009000000000000e+01; // CO2 + rho = P * XW / (8.31446261815324e+07 * T); // rho = P*W/(R*T) +} + +// Compute rho = P*W(y)/RT +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKRHOY( + const amrex::Real P, + const amrex::Real T, + const amrex::Real y[], + amrex::Real& rho) +{ + amrex::Real YOW = 0; + + for (int i = 0; i < 11; i++) { + YOW += y[i] * imw(i); + } + + rho = P / (8.31446261815324e+07 * T * YOW); // rho = P*W/(R*T) +} + +// Compute rho = P*W(c)/(R*T) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKRHOC( + const amrex::Real P, + const amrex::Real T, + const amrex::Real c[], + amrex::Real& rho) +{ + // See Eq 5 in CK Manual + amrex::Real W = 0; + amrex::Real sumC = 0; + W += c[0] * 2.0160000000000000e+00; // H2 + W += c[1] * 3.1998000000000001e+01; // O2 + W += c[2] * 1.8015000000000001e+01; // H2O + W += c[3] * 1.0080000000000000e+00; // H + W += c[4] * 1.5999000000000001e+01; // O + W += c[5] * 1.7007000000000001e+01; // OH + W += c[6] * 3.3006000000000000e+01; // HO2 + W += c[7] * 3.4014000000000003e+01; // H2O2 + W += c[8] * 2.8013999999999999e+01; // N2 + W += c[9] * 4.0026020000000004e+00; // HE + W += c[10] * 4.4009000000000000e+01; // CO2 + + for (int id = 0; id < 11; ++id) { + sumC += c[id]; + } + rho = P * W / (sumC * T * 8.31446261815324e+07); // rho = PW/(R*T) +} + +// get molecular weight for all species +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKWT(amrex::Real wt[]) +{ + get_mw(wt); +} + +// given y[species]: mass fractions +// s mean molecular weight (gm/mole) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKMMWY(const amrex::Real y[], amrex::Real& wtm) +{ + amrex::Real YOW = 0; + + for (int i = 0; i < 11; i++) { + YOW += y[i] * imw(i); + } + + wtm = 1.0 / YOW; +} + +// given x[species]: mole fractions +// returns mean molecular weight (gm/mole) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKMMWX(const amrex::Real x[], amrex::Real& wtm) +{ + amrex::Real XW = 0; // see Eq 4 in CK Manual + XW += x[0] * 2.0160000000000000e+00; // H2 + XW += x[1] * 3.1998000000000001e+01; // O2 + XW += x[2] * 1.8015000000000001e+01; // H2O + XW += x[3] * 1.0080000000000000e+00; // H + XW += x[4] * 1.5999000000000001e+01; // O + XW += x[5] * 1.7007000000000001e+01; // OH + XW += x[6] * 3.3006000000000000e+01; // HO2 + XW += x[7] * 3.4014000000000003e+01; // H2O2 + XW += x[8] * 2.8013999999999999e+01; // N2 + XW += x[9] * 4.0026020000000004e+00; // HE + XW += x[10] * 4.4009000000000000e+01; // CO2 + wtm = XW; +} + +// given c[species]: molar concentration +// returns mean molecular weight (gm/mole) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKMMWC(const amrex::Real c[], amrex::Real& wtm) +{ + // See Eq 5 in CK Manual + amrex::Real W = 0; + amrex::Real sumC = 0; + W += c[0] * 2.0160000000000000e+00; // H2 + W += c[1] * 3.1998000000000001e+01; // O2 + W += c[2] * 1.8015000000000001e+01; // H2O + W += c[3] * 1.0080000000000000e+00; // H + W += c[4] * 1.5999000000000001e+01; // O + W += c[5] * 1.7007000000000001e+01; // OH + W += c[6] * 3.3006000000000000e+01; // HO2 + W += c[7] * 3.4014000000000003e+01; // H2O2 + W += c[8] * 2.8013999999999999e+01; // N2 + W += c[9] * 4.0026020000000004e+00; // HE + W += c[10] * 4.4009000000000000e+01; // CO2 + + for (int id = 0; id < 11; ++id) { + sumC += c[id]; + } + // CK provides no guard against division by zero + wtm = W / sumC; +} + +// get Cp/R as a function of T +// for all species (Eq 19) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCPOR(const amrex::Real T, amrex::Real cpor[]) +{ + cp_R(cpor, T); +} + +// get H/RT as a function of T +// for all species (Eq 20) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKHORT(const amrex::Real T, amrex::Real hort[]) +{ + speciesEnthalpy(hort, T); +} + +// get S/R as a function of T +// for all species (Eq 21) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKSOR(const amrex::Real T, amrex::Real sor[]) +{ + speciesEntropy(sor, T); +} + +// convert y[species] (mass fracs) to x[species] (mole fracs) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKYTX(const amrex::Real y[], amrex::Real x[]) +{ + amrex::Real YOW = 0; + + for (int i = 0; i < 11; i++) { + YOW += y[i] * imw(i); + } + + amrex::Real YOWINV = 1.0 / YOW; + + for (int i = 0; i < 11; i++) { + x[i] = y[i] * imw(i) * YOWINV; + } +} + +// convert y[species] (mass fracs) to c[species] (molar conc) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKYTCP( + const amrex::Real P, + const amrex::Real T, + const amrex::Real y[], + amrex::Real c[]) +{ + amrex::Real YOW = 0; + amrex::Real PWORT; + + // Compute inverse of mean molecular wt first + for (int i = 0; i < 11; i++) { + c[i] = y[i] * imw(i); + } + for (int i = 0; i < 11; i++) { + YOW += c[i]; + } + + // PW/RT (see Eq. 7) + PWORT = P / (YOW * 8.31446261815324e+07 * T); + // Now compute conversion + + for (int i = 0; i < 11; i++) { + c[i] = PWORT * y[i] * imw(i); + } +} + +// convert y[species] (mass fracs) to c[species] (molar conc) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKYTCR( + const amrex::Real rho, + amrex::Real /*T*/, + const amrex::Real y[], + amrex::Real c[]) +{ + + for (int i = 0; i < 11; i++) { + c[i] = rho * y[i] * imw(i); + } +} + +// convert x[species] (mole fracs) to y[species] (mass fracs) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKXTY(const amrex::Real x[], amrex::Real y[]) +{ + amrex::Real XW = 0; // See Eq 4, 9 in CK Manual + // Compute mean molecular wt first + XW += x[0] * 2.0160000000000000e+00; // H2 + XW += x[1] * 3.1998000000000001e+01; // O2 + XW += x[2] * 1.8015000000000001e+01; // H2O + XW += x[3] * 1.0080000000000000e+00; // H + XW += x[4] * 1.5999000000000001e+01; // O + XW += x[5] * 1.7007000000000001e+01; // OH + XW += x[6] * 3.3006000000000000e+01; // HO2 + XW += x[7] * 3.4014000000000003e+01; // H2O2 + XW += x[8] * 2.8013999999999999e+01; // N2 + XW += x[9] * 4.0026020000000004e+00; // HE + XW += x[10] * 4.4009000000000000e+01; // CO2 + // Now compute conversion + amrex::Real XWinv = 1.0 / XW; + y[0] = x[0] * 2.0160000000000000e+00 * XWinv; + y[1] = x[1] * 3.1998000000000001e+01 * XWinv; + y[2] = x[2] * 1.8015000000000001e+01 * XWinv; + y[3] = x[3] * 1.0080000000000000e+00 * XWinv; + y[4] = x[4] * 1.5999000000000001e+01 * XWinv; + y[5] = x[5] * 1.7007000000000001e+01 * XWinv; + y[6] = x[6] * 3.3006000000000000e+01 * XWinv; + y[7] = x[7] * 3.4014000000000003e+01 * XWinv; + y[8] = x[8] * 2.8013999999999999e+01 * XWinv; + y[9] = x[9] * 4.0026020000000004e+00 * XWinv; + y[10] = x[10] * 4.4009000000000000e+01 * XWinv; +} + +// convert x[species] (mole fracs) to c[species] (molar conc) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKXTCP( + const amrex::Real P, + const amrex::Real T, + const amrex::Real x[], + amrex::Real c[]) +{ + amrex::Real PORT = P / (8.31446261815324e+07 * T); // P/RT + + // Compute conversion, see Eq 10 + for (int id = 0; id < 11; ++id) { + c[id] = x[id] * PORT; + } +} + +// convert x[species] (mole fracs) to c[species] (molar conc) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKXTCR( + const amrex::Real rho, + const amrex::Real /*T*/, + const amrex::Real x[], + amrex::Real c[]) +{ + amrex::Real XW = 0; // See Eq 4, 11 in CK Manual + amrex::Real ROW; + // Compute mean molecular wt first + XW += x[0] * 2.0160000000000000e+00; // H2 + XW += x[1] * 3.1998000000000001e+01; // O2 + XW += x[2] * 1.8015000000000001e+01; // H2O + XW += x[3] * 1.0080000000000000e+00; // H + XW += x[4] * 1.5999000000000001e+01; // O + XW += x[5] * 1.7007000000000001e+01; // OH + XW += x[6] * 3.3006000000000000e+01; // HO2 + XW += x[7] * 3.4014000000000003e+01; // H2O2 + XW += x[8] * 2.8013999999999999e+01; // N2 + XW += x[9] * 4.0026020000000004e+00; // HE + XW += x[10] * 4.4009000000000000e+01; // CO2 + ROW = rho / XW; + + // Compute conversion, see Eq 11 + for (int id = 0; id < 11; ++id) { + c[id] = x[id] * ROW; + } +} + +// convert c[species] (molar conc) to x[species] (mole fracs) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCTX(const amrex::Real c[], amrex::Real x[]) +{ + amrex::Real sumC = 0; + + // compute sum of c + for (int id = 0; id < 11; ++id) { + sumC += c[id]; + } + + // See Eq 13 + amrex::Real sumCinv = 1.0 / sumC; + for (int id = 0; id < 11; ++id) { + x[id] = c[id] * sumCinv; + } +} + +// convert c[species] (molar conc) to y[species] (mass fracs) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCTY(const amrex::Real c[], amrex::Real y[]) +{ + amrex::Real CW = 0; // See Eq 12 in CK Manual + // compute denominator in eq 12 first + CW += c[0] * 2.0160000000000000e+00; // H2 + CW += c[1] * 3.1998000000000001e+01; // O2 + CW += c[2] * 1.8015000000000001e+01; // H2O + CW += c[3] * 1.0080000000000000e+00; // H + CW += c[4] * 1.5999000000000001e+01; // O + CW += c[5] * 1.7007000000000001e+01; // OH + CW += c[6] * 3.3006000000000000e+01; // HO2 + CW += c[7] * 3.4014000000000003e+01; // H2O2 + CW += c[8] * 2.8013999999999999e+01; // N2 + CW += c[9] * 4.0026020000000004e+00; // HE + CW += c[10] * 4.4009000000000000e+01; // CO2 + // Now compute conversion + amrex::Real CWinv = 1.0 / CW; + y[0] = c[0] * 2.0160000000000000e+00 * CWinv; + y[1] = c[1] * 3.1998000000000001e+01 * CWinv; + y[2] = c[2] * 1.8015000000000001e+01 * CWinv; + y[3] = c[3] * 1.0080000000000000e+00 * CWinv; + y[4] = c[4] * 1.5999000000000001e+01 * CWinv; + y[5] = c[5] * 1.7007000000000001e+01 * CWinv; + y[6] = c[6] * 3.3006000000000000e+01 * CWinv; + y[7] = c[7] * 3.4014000000000003e+01 * CWinv; + y[8] = c[8] * 2.8013999999999999e+01 * CWinv; + y[9] = c[9] * 4.0026020000000004e+00 * CWinv; + y[10] = c[10] * 4.4009000000000000e+01 * CWinv; +} + +// get specific heat at constant volume as a function +// of T for all species (molar units) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCVML(const amrex::Real T, amrex::Real cvml[]) +{ + cv_R(cvml, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + cvml[id] *= 8.31446261815324e+07; + } +} + +// get specific heat at constant pressure as a +// function of T for all species (molar units) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCPML(const amrex::Real T, amrex::Real cpml[]) +{ + cp_R(cpml, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + cpml[id] *= 8.31446261815324e+07; + } +} + +// get internal energy as a function +// of T for all species (molar units) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKUML(const amrex::Real T, amrex::Real uml[]) +{ + amrex::Real RT = 8.31446261815324e+07 * T; // R*T + speciesInternalEnergy(uml, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + uml[id] *= RT; + } +} + +// get enthalpy as a function +// of T for all species (molar units) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKHML(const amrex::Real T, amrex::Real hml[]) +{ + amrex::Real RT = 8.31446261815324e+07 * T; // R*T + speciesEnthalpy(hml, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + hml[id] *= RT; + } +} + +// Returns the standard-state entropies in molar units +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKSML(const amrex::Real T, amrex::Real sml[]) +{ + speciesEntropy(sml, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + sml[id] *= 8.31446261815324e+07; + } +} + +// Returns the specific heats at constant volume +// in mass units (Eq. 29) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCVMS(const amrex::Real T, amrex::Real cvms[]) +{ + cv_R(cvms, T); + // multiply by R/molecularweight + cvms[0] *= 4.124237409798234e+07; // H2 + cvms[1] *= 2.598431970171023e+06; // O2 + cvms[2] *= 4.615299815794193e+06; // H2O + cvms[3] *= 8.248474819596468e+07; // H + cvms[4] *= 5.196863940342046e+06; // O + cvms[5] *= 4.888847308845322e+06; // OH + cvms[6] *= 2.519076112874398e+06; // HO2 + cvms[7] *= 2.444423654422661e+06; // H2O2 + cvms[8] *= 2.967966951578939e+06; // N2 + cvms[9] *= 2.077264394049980e+07; // HE + cvms[10] *= 1.889264154639560e+06; // CO2 +} + +// Returns the specific heats at constant pressure +// in mass units (Eq. 26) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCPMS(const amrex::Real T, amrex::Real cpms[]) +{ + cp_R(cpms, T); + // multiply by R/molecularweight + cpms[0] *= 4.124237409798234e+07; // H2 + cpms[1] *= 2.598431970171023e+06; // O2 + cpms[2] *= 4.615299815794193e+06; // H2O + cpms[3] *= 8.248474819596468e+07; // H + cpms[4] *= 5.196863940342046e+06; // O + cpms[5] *= 4.888847308845322e+06; // OH + cpms[6] *= 2.519076112874398e+06; // HO2 + cpms[7] *= 2.444423654422661e+06; // H2O2 + cpms[8] *= 2.967966951578939e+06; // N2 + cpms[9] *= 2.077264394049980e+07; // HE + cpms[10] *= 1.889264154639560e+06; // CO2 +} + +// Returns internal energy in mass units (Eq 30.) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKUMS(const amrex::Real T, amrex::Real ums[]) +{ + amrex::Real RT = 8.31446261815324e+07 * T; // R*T + + speciesInternalEnergy(ums, T); + + for (int i = 0; i < 11; i++) { + ums[i] *= RT * imw(i); + } +} + +// Returns enthalpy in mass units (Eq 27.) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKHMS(const amrex::Real T, amrex::Real hms[]) +{ + amrex::Real RT = 8.31446261815324e+07 * T; // R*T + + speciesEnthalpy(hms, T); + + for (int i = 0; i < 11; i++) { + hms[i] *= RT * imw(i); + } +} + +// Returns the entropies in mass units (Eq 28.) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKSMS(const amrex::Real T, amrex::Real sms[]) +{ + speciesEntropy(sms, T); + // multiply by R/molecularweight + sms[0] *= 4.124237409798234e+07; // H2 + sms[1] *= 2.598431970171023e+06; // O2 + sms[2] *= 4.615299815794193e+06; // H2O + sms[3] *= 8.248474819596468e+07; // H + sms[4] *= 5.196863940342046e+06; // O + sms[5] *= 4.888847308845322e+06; // OH + sms[6] *= 2.519076112874398e+06; // HO2 + sms[7] *= 2.444423654422661e+06; // H2O2 + sms[8] *= 2.967966951578939e+06; // N2 + sms[9] *= 2.077264394049980e+07; // HE + sms[10] *= 1.889264154639560e+06; // CO2 +} + +// GPU version of productionRate: no more use of thermo namespace vectors +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +comp_qfqr( + amrex::Real* qf, + amrex::Real* qr, + const amrex::Real* sc, + const amrex::Real* /*sc_qss*/, + const amrex::Real T, + const amrex::Real invT, + const amrex::Real logT) +{ + + // reaction 8: H + O2 (+M) <=> HO2 (+M) + qf[0] = sc[1] * sc[3]; + qr[0] = sc[6]; + + // reaction 15: H2O2 (+M) <=> 2 OH (+M) + qf[1] = sc[7]; + qr[1] = (sc[5] * sc[5]); + + // reaction 4: H2 + M <=> 2 H + M + qf[2] = sc[0]; + qr[2] = (sc[3] * sc[3]); + + // reaction 5: 2 O + M <=> O2 + M + qf[3] = (sc[4] * sc[4]); + qr[3] = sc[1]; + + // reaction 6: H + O + M <=> OH + M + qf[4] = sc[3] * sc[4]; + qr[4] = sc[5]; + + // reaction 7: H + OH + M <=> H2O + M + qf[5] = sc[3] * sc[5]; + qr[5] = sc[2]; + + // reaction 0: H + O2 <=> O + OH + qf[6] = sc[1] * sc[3]; + qr[6] = sc[4] * sc[5]; + + // reaction 1: H2 + O <=> H + OH + qf[7] = sc[0] * sc[4]; + qr[7] = sc[3] * sc[5]; + + // reaction 2: H2 + OH <=> H + H2O + qf[8] = sc[0] * sc[5]; + qr[8] = sc[2] * sc[3]; + + // reaction 3: H2O + O <=> 2 OH + qf[9] = sc[2] * sc[4]; + qr[9] = (sc[5] * sc[5]); + + // reaction 9: H + HO2 <=> H2 + O2 + qf[10] = sc[3] * sc[6]; + qr[10] = sc[0] * sc[1]; + + // reaction 10: H + HO2 <=> 2 OH + qf[11] = sc[3] * sc[6]; + qr[11] = (sc[5] * sc[5]); + + // reaction 11: HO2 + O <=> O2 + OH + qf[12] = sc[4] * sc[6]; + qr[12] = sc[1] * sc[5]; + + // reaction 12: HO2 + OH <=> H2O + O2 + qf[13] = sc[5] * sc[6]; + qr[13] = sc[1] * sc[2]; + + // reaction 13: 2 HO2 <=> H2O2 + O2 + qf[14] = (sc[6] * sc[6]); + qr[14] = sc[1] * sc[7]; + + // reaction 14: 2 HO2 <=> H2O2 + O2 + qf[15] = (sc[6] * sc[6]); + qr[15] = sc[1] * sc[7]; + + // reaction 16: H + H2O2 <=> H2O + OH + qf[16] = sc[3] * sc[7]; + qr[16] = sc[2] * sc[5]; + + // reaction 17: H + H2O2 <=> H2 + HO2 + qf[17] = sc[3] * sc[7]; + qr[17] = sc[0] * sc[6]; + + // reaction 18: H2O2 + O <=> HO2 + OH + qf[18] = sc[4] * sc[7]; + qr[18] = sc[5] * sc[6]; + + // reaction 19: H2O2 + OH <=> H2O + HO2 + qf[19] = sc[5] * sc[7]; + qr[19] = sc[2] * sc[6]; + + // reaction 20: H2O2 + OH <=> H2O + HO2 + qf[20] = sc[5] * sc[7]; + qr[20] = sc[2] * sc[6]; + + // compute the mixture concentration + amrex::Real mixture = 0.0; + for (int i = 0; i < 11; ++i) { + mixture += sc[i]; + } + + // compute the Gibbs free energy + amrex::Real g_RT[11]; + gibbs(g_RT, T); + + // reference concentration: P_atm / (RT) in inverse mol/m^3 + amrex::Real refC = 101325 / 8.31446 * invT; + amrex::Real refCinv = 1 / refC; + + // Evaluate the kfs + amrex::Real k_f, Corr; + amrex::Real redP, F, logPred, logFcent, troe_c, troe_n, troe, F_troe; + + // reaction 0: H + O2 <=> O + OH + k_f = 3547000000 * exp((-0.406) * logT - (8352.89343569254) * invT); + qf[6] *= k_f; + qr[6] *= k_f * exp(-(g_RT[1] + g_RT[3] - g_RT[4] - g_RT[5])); + // reaction 1: H2 + O <=> H + OH + k_f = 0.0508 * exp((2.67) * logT - (3165.23282791169) * invT); + qf[7] *= k_f; + qr[7] *= k_f * exp(-(g_RT[0] - g_RT[3] + g_RT[4] - g_RT[5])); + // reaction 2: H2 + OH <=> H + H2O + k_f = 216 * exp((1.51) * logT - (1726.03316371019) * invT); + qf[8] *= k_f; + qr[8] *= k_f * exp(-(g_RT[0] - g_RT[2] - g_RT[3] + g_RT[5])); + // reaction 3: H2O + O <=> 2 OH + k_f = 2.97 * exp((2.02) * logT - (6743.10332178324) * invT); + qf[9] *= k_f; + qr[9] *= k_f * exp(-(g_RT[2] + g_RT[4] - 2.000000 * g_RT[5])); + // reaction 4: H2 + M <=> 2 H + M + k_f = 45770000000000 * exp((-1.4) * logT - (52525.7555766966) * invT); + Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + qf[2] *= Corr * k_f; + qr[2] *= Corr * k_f * exp(-(g_RT[0] - 2.000000 * g_RT[3])) * (refCinv); + // reaction 5: 2 O + M <=> O2 + M + k_f = 6165 * exp((-0.5) * logT); + Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + qf[3] *= Corr * k_f; + qr[3] *= Corr * k_f * exp(-(-g_RT[1] + 2.000000 * g_RT[4])) * (refC); + // reaction 6: H + O + M <=> OH + M + k_f = 4714000 * exp((-1) * logT); + Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + qf[4] *= Corr * k_f; + qr[4] *= Corr * k_f * exp(-(g_RT[3] + g_RT[4] - g_RT[5])) * (refC); + // reaction 7: H + OH + M <=> H2O + M + k_f = 38000000000 * exp((-2) * logT); + Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + qf[5] *= Corr * k_f; + qr[5] *= Corr * k_f * exp(-(-g_RT[2] + g_RT[3] + g_RT[5])) * (refC); + // reaction 8: H + O2 (+M) <=> HO2 (+M) + k_f = 1475000 * exp((0.6) * logT); + Corr = mixture + sc[0] + (-0.22) * sc[1] + (10) * sc[2]; + redP = Corr / k_f * 636600000 * exp(-1.72 * logT - (264.088106214317) * invT); + F = redP / (1.0 + redP); + logPred = log10(redP); + logFcent = log10((0.2) * exp(-T * 1e+30) + 0.8 * exp(-T * 1e-30) + 0.0); + troe_c = -0.4 - 0.67 * logFcent; + troe_n = 0.75 - 1.27 * logFcent; + troe = (troe_c + logPred) / (troe_n - 0.14 * (troe_c + logPred)); + F_troe = exp(M_LN10 * logFcent / (1.0 + troe * troe)); + Corr = F * F_troe; + qf[0] *= Corr * k_f; + qr[0] *= Corr * k_f * exp(-(g_RT[1] + g_RT[3] - g_RT[6])) * (refC); + // reaction 9: H + HO2 <=> H2 + O2 + k_f = 16600000 * exp(-(414.147315957284) * invT); + qf[10] *= k_f; + qr[10] *= k_f * exp(-(-g_RT[0] - g_RT[1] + g_RT[3] + g_RT[6])); + // reaction 10: H + HO2 <=> 2 OH + k_f = 70790000 * exp(-(148.448916412392) * invT); + qf[11] *= k_f; + qr[11] *= k_f * exp(-(g_RT[3] - 2.000000 * g_RT[5] + g_RT[6])); + // reaction 11: HO2 + O <=> O2 + OH + k_f = 32500000; + qf[12] *= k_f; + qr[12] *= k_f * exp(-(-g_RT[1] + g_RT[4] - g_RT[5] + g_RT[6])); + // reaction 12: HO2 + OH <=> H2O + O2 + k_f = 28900000 * exp(-(-250.098682904946) * invT); + qf[13] *= k_f; + qr[13] *= k_f * exp(-(-g_RT[1] - g_RT[2] + g_RT[5] + g_RT[6])); + // reaction 13: 2 HO2 <=> H2O2 + O2 + k_f = 420000000 * exp(-(6029.54208967215) * invT); + qf[14] *= k_f; + qr[14] *= k_f * exp(-(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7])); + // reaction 14: 2 HO2 <=> H2O2 + O2 + k_f = 130000 * exp(-(-819.89091359563) * invT); + qf[15] *= k_f; + qr[15] *= k_f * exp(-(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7])); + // reaction 15: H2O2 (+M) <=> 2 OH (+M) + k_f = 295100000000000 * exp(-(24370.7831249226) * invT); + Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + redP = Corr / k_f * 120200000000 * exp(-(22896.3582941147) * invT); + F = redP / (1.0 + redP); + logPred = log10(redP); + logFcent = log10((0.5) * exp(-T * 1e+30) + 0.5 * exp(-T * 1e-30) + 0.0); + troe_c = -0.4 - 0.67 * logFcent; + troe_n = 0.75 - 1.27 * logFcent; + troe = (troe_c + logPred) / (troe_n - 0.14 * (troe_c + logPred)); + F_troe = exp(M_LN10 * logFcent / (1.0 + troe * troe)); + Corr = F * F_troe; + qf[1] *= Corr * k_f; + qr[1] *= Corr * k_f * exp(-(-2.000000 * g_RT[5] + g_RT[7])) * (refCinv); + // reaction 16: H + H2O2 <=> H2O + OH + k_f = 24100000 * exp(-(1997.77016324474) * invT); + qf[16] *= k_f; + qr[16] *= k_f * exp(-(-g_RT[2] + g_RT[3] - g_RT[5] + g_RT[7])); + // reaction 17: H + H2O2 <=> H2 + HO2 + k_f = 48200000 * exp(-(4000.57249314752) * invT); + qf[17] *= k_f; + qr[17] *= k_f * exp(-(-g_RT[0] + g_RT[3] - g_RT[6] + g_RT[7])); + // reaction 18: H2O2 + O <=> HO2 + OH + k_f = 9.55 * exp((2) * logT - (1997.77016324474) * invT); + qf[18] *= k_f; + qr[18] *= k_f * exp(-(g_RT[4] - g_RT[5] - g_RT[6] + g_RT[7])); + // reaction 19: H2O2 + OH <=> H2O + HO2 + k_f = 1000000; + qf[19] *= k_f; + qr[19] *= k_f * exp(-(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7])); + // reaction 20: H2O2 + OH <=> H2O + HO2 + k_f = 580000000 * exp(-(4809.24167509571) * invT); + qf[20] *= k_f; + qr[20] *= k_f * exp(-(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7])); +} + +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +productionRate(amrex::Real* wdot, const amrex::Real* sc, const amrex::Real T) +{ + const amrex::Real invT = 1.0 / T; + const amrex::Real logT = log(T); + + // reference concentration: P_atm / (RT) in inverse mol/m^3 + const amrex::Real refC = 101325 / 8.31446 * invT; + const amrex::Real refCinv = 1 / refC; + + for (int i = 0; i < 11; ++i) { + wdot[i] = 0.0; + } + + // compute the mixture concentration + amrex::Real mixture = 0.0; + for (int i = 0; i < 11; ++i) { + mixture += sc[i]; + } + + // compute the Gibbs free energy + amrex::Real g_RT[11]; + gibbs(g_RT, T); + + { + // reaction 8: H + O2 (+M) <=> HO2 (+M) + const amrex::Real k_f = 1475000 * exp((0.6) * logT); + amrex::Real Corr = mixture + sc[0] + (-0.22) * sc[1] + (10) * sc[2]; + const amrex::Real redP = + Corr / k_f * 636600000 * exp(-1.72 * logT - 264.088106214317 * invT); + const amrex::Real F = redP / (1.0 + redP); + const amrex::Real logPred = log10(redP); + const amrex::Real logFcent = + log10(0.2 * exp(-T * 1e+30) + 0.8 * exp(-T * 1e-30) + 0.0); + const amrex::Real troe_c = -0.4 - 0.67 * logFcent; + const amrex::Real troe_n = 0.75 - 1.27 * logFcent; + const amrex::Real troe = + (troe_c + logPred) / (troe_n - 0.14 * (troe_c + logPred)); + const amrex::Real F_troe = exp(M_LN10 * logFcent / (1.0 + troe * troe)); + Corr = F * F_troe; + const amrex::Real qf = Corr * k_f * (sc[1] * sc[3]); + const amrex::Real qr = + Corr * k_f * exp(-(g_RT[1] + g_RT[3] - g_RT[6])) * (refC) * (sc[6]); + const amrex::Real qdot = qf - qr; + wdot[1] -= qdot; + wdot[3] -= qdot; + wdot[6] += qdot; + } + + { + // reaction 15: H2O2 (+M) <=> 2 OH (+M) + const amrex::Real k_f = 295100000000000 * exp(-(24370.7831249226) * invT); + amrex::Real Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + const amrex::Real redP = + Corr / k_f * 120200000000 * exp(-22896.3582941147 * invT); + const amrex::Real F = redP / (1.0 + redP); + const amrex::Real logPred = log10(redP); + const amrex::Real logFcent = + log10(0.5 * exp(-T * 1e+30) + 0.5 * exp(-T * 1e-30) + 0.0); + const amrex::Real troe_c = -0.4 - 0.67 * logFcent; + const amrex::Real troe_n = 0.75 - 1.27 * logFcent; + const amrex::Real troe = + (troe_c + logPred) / (troe_n - 0.14 * (troe_c + logPred)); + const amrex::Real F_troe = exp(M_LN10 * logFcent / (1.0 + troe * troe)); + Corr = F * F_troe; + const amrex::Real qf = Corr * k_f * (sc[7]); + const amrex::Real qr = Corr * k_f * exp(-(-2.000000 * g_RT[5] + g_RT[7])) * + (refCinv) * ((sc[5] * sc[5])); + const amrex::Real qdot = qf - qr; + wdot[5] += 2.000000 * qdot; + wdot[7] -= qdot; + } + + { + // reaction 4: H2 + M <=> 2 H + M + const amrex::Real k_f = + 45770000000000 * exp((-1.4) * logT - (52525.7555766966) * invT); + const amrex::Real Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + const amrex::Real qf = Corr * k_f * (sc[0]); + const amrex::Real qr = Corr * k_f * exp(-(g_RT[0] - 2.000000 * g_RT[3])) * + (refCinv) * ((sc[3] * sc[3])); + const amrex::Real qdot = qf - qr; + wdot[0] -= qdot; + wdot[3] += 2.000000 * qdot; + } + + { + // reaction 5: 2 O + M <=> O2 + M + const amrex::Real k_f = 6165 * exp((-0.5) * logT); + const amrex::Real Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + const amrex::Real qf = Corr * k_f * ((sc[4] * sc[4])); + const amrex::Real qr = + Corr * k_f * exp(-(-g_RT[1] + 2.000000 * g_RT[4])) * (refC) * (sc[1]); + const amrex::Real qdot = qf - qr; + wdot[1] += qdot; + wdot[4] -= 2.000000 * qdot; + } + + { + // reaction 6: H + O + M <=> OH + M + const amrex::Real k_f = 4714000 * exp((-1) * logT); + const amrex::Real Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + const amrex::Real qf = Corr * k_f * (sc[3] * sc[4]); + const amrex::Real qr = + Corr * k_f * exp(-(g_RT[3] + g_RT[4] - g_RT[5])) * (refC) * (sc[5]); + const amrex::Real qdot = qf - qr; + wdot[3] -= qdot; + wdot[4] -= qdot; + wdot[5] += qdot; + } + + { + // reaction 7: H + OH + M <=> H2O + M + const amrex::Real k_f = 38000000000 * exp((-2) * logT); + const amrex::Real Corr = mixture + (1.5) * sc[0] + (11) * sc[2]; + const amrex::Real qf = Corr * k_f * (sc[3] * sc[5]); + const amrex::Real qr = + Corr * k_f * exp(-(-g_RT[2] + g_RT[3] + g_RT[5])) * (refC) * (sc[2]); + const amrex::Real qdot = qf - qr; + wdot[2] += qdot; + wdot[3] -= qdot; + wdot[5] -= qdot; + } + + { + // reaction 0: H + O2 <=> O + OH + const amrex::Real k_f = + 3547000000 * exp((-0.406) * logT - (8352.89343569254) * invT); + const amrex::Real qf = k_f * (sc[1] * sc[3]); + const amrex::Real qr = + k_f * exp(-(g_RT[1] + g_RT[3] - g_RT[4] - g_RT[5])) * (sc[4] * sc[5]); + const amrex::Real qdot = qf - qr; + wdot[1] -= qdot; + wdot[3] -= qdot; + wdot[4] += qdot; + wdot[5] += qdot; + } + + { + // reaction 1: H2 + O <=> H + OH + const amrex::Real k_f = + 0.0508 * exp((2.67) * logT - (3165.23282791169) * invT); + const amrex::Real qf = k_f * (sc[0] * sc[4]); + const amrex::Real qr = + k_f * exp(-(g_RT[0] - g_RT[3] + g_RT[4] - g_RT[5])) * (sc[3] * sc[5]); + const amrex::Real qdot = qf - qr; + wdot[0] -= qdot; + wdot[3] += qdot; + wdot[4] -= qdot; + wdot[5] += qdot; + } + + { + // reaction 2: H2 + OH <=> H + H2O + const amrex::Real k_f = + 216 * exp((1.51) * logT - (1726.03316371019) * invT); + const amrex::Real qf = k_f * (sc[0] * sc[5]); + const amrex::Real qr = + k_f * exp(-(g_RT[0] - g_RT[2] - g_RT[3] + g_RT[5])) * (sc[2] * sc[3]); + const amrex::Real qdot = qf - qr; + wdot[0] -= qdot; + wdot[2] += qdot; + wdot[3] += qdot; + wdot[5] -= qdot; + } + + { + // reaction 3: H2O + O <=> 2 OH + const amrex::Real k_f = + 2.97 * exp((2.02) * logT - (6743.10332178324) * invT); + const amrex::Real qf = k_f * (sc[2] * sc[4]); + const amrex::Real qr = + k_f * exp(-(g_RT[2] + g_RT[4] - 2.000000 * g_RT[5])) * ((sc[5] * sc[5])); + const amrex::Real qdot = qf - qr; + wdot[2] -= qdot; + wdot[4] -= qdot; + wdot[5] += 2.000000 * qdot; + } + + { + // reaction 9: H + HO2 <=> H2 + O2 + const amrex::Real k_f = 16600000 * exp(-(414.147315957284) * invT); + const amrex::Real qf = k_f * (sc[3] * sc[6]); + const amrex::Real qr = + k_f * exp(-(-g_RT[0] - g_RT[1] + g_RT[3] + g_RT[6])) * (sc[0] * sc[1]); + const amrex::Real qdot = qf - qr; + wdot[0] += qdot; + wdot[1] += qdot; + wdot[3] -= qdot; + wdot[6] -= qdot; + } + + { + // reaction 10: H + HO2 <=> 2 OH + const amrex::Real k_f = 70790000 * exp(-(148.448916412392) * invT); + const amrex::Real qf = k_f * (sc[3] * sc[6]); + const amrex::Real qr = + k_f * exp(-(g_RT[3] - 2.000000 * g_RT[5] + g_RT[6])) * ((sc[5] * sc[5])); + const amrex::Real qdot = qf - qr; + wdot[3] -= qdot; + wdot[5] += 2.000000 * qdot; + wdot[6] -= qdot; + } + + { + // reaction 11: HO2 + O <=> O2 + OH + const amrex::Real k_f = 32500000; + const amrex::Real qf = k_f * (sc[4] * sc[6]); + const amrex::Real qr = + k_f * exp(-(-g_RT[1] + g_RT[4] - g_RT[5] + g_RT[6])) * (sc[1] * sc[5]); + const amrex::Real qdot = qf - qr; + wdot[1] += qdot; + wdot[4] -= qdot; + wdot[5] += qdot; + wdot[6] -= qdot; + } + + { + // reaction 12: HO2 + OH <=> H2O + O2 + const amrex::Real k_f = 28900000 * exp(-(-250.098682904946) * invT); + const amrex::Real qf = k_f * (sc[5] * sc[6]); + const amrex::Real qr = + k_f * exp(-(-g_RT[1] - g_RT[2] + g_RT[5] + g_RT[6])) * (sc[1] * sc[2]); + const amrex::Real qdot = qf - qr; + wdot[1] += qdot; + wdot[2] += qdot; + wdot[5] -= qdot; + wdot[6] -= qdot; + } + + { + // reaction 13: 2 HO2 <=> H2O2 + O2 + const amrex::Real k_f = 420000000 * exp(-(6029.54208967215) * invT); + const amrex::Real qf = k_f * ((sc[6] * sc[6])); + const amrex::Real qr = + k_f * exp(-(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7])) * (sc[1] * sc[7]); + const amrex::Real qdot = qf - qr; + wdot[1] += qdot; + wdot[6] -= 2.000000 * qdot; + wdot[7] += qdot; + } + + { + // reaction 14: 2 HO2 <=> H2O2 + O2 + const amrex::Real k_f = 130000 * exp(-(-819.89091359563) * invT); + const amrex::Real qf = k_f * ((sc[6] * sc[6])); + const amrex::Real qr = + k_f * exp(-(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7])) * (sc[1] * sc[7]); + const amrex::Real qdot = qf - qr; + wdot[1] += qdot; + wdot[6] -= 2.000000 * qdot; + wdot[7] += qdot; + } + + { + // reaction 16: H + H2O2 <=> H2O + OH + const amrex::Real k_f = 24100000 * exp(-(1997.77016324474) * invT); + const amrex::Real qf = k_f * (sc[3] * sc[7]); + const amrex::Real qr = + k_f * exp(-(-g_RT[2] + g_RT[3] - g_RT[5] + g_RT[7])) * (sc[2] * sc[5]); + const amrex::Real qdot = qf - qr; + wdot[2] += qdot; + wdot[3] -= qdot; + wdot[5] += qdot; + wdot[7] -= qdot; + } + + { + // reaction 17: H + H2O2 <=> H2 + HO2 + const amrex::Real k_f = 48200000 * exp(-(4000.57249314752) * invT); + const amrex::Real qf = k_f * (sc[3] * sc[7]); + const amrex::Real qr = + k_f * exp(-(-g_RT[0] + g_RT[3] - g_RT[6] + g_RT[7])) * (sc[0] * sc[6]); + const amrex::Real qdot = qf - qr; + wdot[0] += qdot; + wdot[3] -= qdot; + wdot[6] += qdot; + wdot[7] -= qdot; + } + + { + // reaction 18: H2O2 + O <=> HO2 + OH + const amrex::Real k_f = 9.55 * exp((2) * logT - (1997.77016324474) * invT); + const amrex::Real qf = k_f * (sc[4] * sc[7]); + const amrex::Real qr = + k_f * exp(-(g_RT[4] - g_RT[5] - g_RT[6] + g_RT[7])) * (sc[5] * sc[6]); + const amrex::Real qdot = qf - qr; + wdot[4] -= qdot; + wdot[5] += qdot; + wdot[6] += qdot; + wdot[7] -= qdot; + } + + { + // reaction 19: H2O2 + OH <=> H2O + HO2 + const amrex::Real k_f = 1000000; + const amrex::Real qf = k_f * (sc[5] * sc[7]); + const amrex::Real qr = + k_f * exp(-(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7])) * (sc[2] * sc[6]); + const amrex::Real qdot = qf - qr; + wdot[2] += qdot; + wdot[5] -= qdot; + wdot[6] += qdot; + wdot[7] -= qdot; + } + + { + // reaction 20: H2O2 + OH <=> H2O + HO2 + const amrex::Real k_f = 580000000 * exp(-(4809.24167509571) * invT); + const amrex::Real qf = k_f * (sc[5] * sc[7]); + const amrex::Real qr = + k_f * exp(-(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7])) * (sc[2] * sc[6]); + const amrex::Real qdot = qf - qr; + wdot[2] += qdot; + wdot[5] -= qdot; + wdot[6] += qdot; + wdot[7] -= qdot; + } +} + +// compute the production rate for each species +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKWC(const amrex::Real T, amrex::Real C[], amrex::Real wdot[]) +{ + + // convert to SI + for (int id = 0; id < 11; ++id) { + C[id] *= 1.0e6; + } + + // convert to chemkin units + productionRate(wdot, C, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + C[id] *= 1.0e-6; + wdot[id] *= 1.0e-6; + } +} + +// Returns the molar production rate of species +// Given P, T, and mass fractions +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKWYP( + const amrex::Real P, + const amrex::Real T, + const amrex::Real y[], + amrex::Real wdot[]) +{ + amrex::Real c[11]; // temporary storage + amrex::Real YOW = 0; + amrex::Real PWORT; + + // Compute inverse of mean molecular wt first + for (int i = 0; i < 11; i++) { + YOW += y[i] * imw(i); + } + // PW/RT (see Eq. 7) + PWORT = P / (YOW * 8.31446261815324e+07 * T); + // multiply by 1e6 so c goes to SI + PWORT *= 1e6; + // Now compute conversion (and go to SI) + for (int i = 0; i < 11; i++) { + c[i] = PWORT * y[i] * imw(i); + } + + // convert to chemkin units + productionRate(wdot, c, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + wdot[id] *= 1.0e-6; + } +} + +// Returns the molar production rate of species +// Given P, T, and mole fractions +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKWXP( + const amrex::Real P, + const amrex::Real T, + const amrex::Real x[], + amrex::Real wdot[]) +{ + amrex::Real c[11]; // temporary storage + amrex::Real PORT = + 1e6 * P / (8.31446261815324e+07 * T); // 1e6 * P/RT so c goes to SI units + + // Compute conversion, see Eq 10 + for (int id = 0; id < 11; ++id) { + c[id] = x[id] * PORT; + } + + // convert to chemkin units + productionRate(wdot, c, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + wdot[id] *= 1.0e-6; + } +} + +// Returns the molar production rate of species +// Given rho, T, and mass fractions +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKWYR( + const amrex::Real rho, + const amrex::Real T, + const amrex::Real y[], + amrex::Real wdot[]) +{ + amrex::Real c[11]; // temporary storage + + // See Eq 8 with an extra 1e6 so c goes to SI + for (int i = 0; i < 11; i++) { + c[i] = 1e6 * rho * y[i] * imw(i); + } + + // call productionRate + productionRate(wdot, c, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + wdot[id] *= 1.0e-6; + } +} + +// Returns the molar production rate of species +// Given rho, T, and mole fractions +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKWXR( + const amrex::Real rho, + const amrex::Real T, + const amrex::Real x[], + amrex::Real wdot[]) +{ + amrex::Real c[11]; // temporary storage + amrex::Real XW = 0; // See Eq 4, 11 in CK Manual + amrex::Real ROW; + // Compute mean molecular wt first + XW += x[0] * 2.0160000000000000e+00; // H2 + XW += x[1] * 3.1998000000000001e+01; // O2 + XW += x[2] * 1.8015000000000001e+01; // H2O + XW += x[3] * 1.0080000000000000e+00; // H + XW += x[4] * 1.5999000000000001e+01; // O + XW += x[5] * 1.7007000000000001e+01; // OH + XW += x[6] * 3.3006000000000000e+01; // HO2 + XW += x[7] * 3.4014000000000003e+01; // H2O2 + XW += x[8] * 2.8013999999999999e+01; // N2 + XW += x[9] * 4.0026020000000004e+00; // HE + XW += x[10] * 4.4009000000000000e+01; // CO2 + // Extra 1e6 factor to take c to SI + ROW = 1e6 * rho / XW; + + // Compute conversion, see Eq 11 + for (int id = 0; id < 11; ++id) { + c[id] = x[id] * ROW; + } + + // convert to chemkin units + productionRate(wdot, c, T); + + // convert to chemkin units + for (int id = 0; id < 11; ++id) { + wdot[id] *= 1.0e-6; + } +} + +// species unit charge number +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCHRG(int kcharge[]) +{ + kcharge[0] = 0; // H2 + kcharge[1] = 0; // O2 + kcharge[2] = 0; // H2O + kcharge[3] = 0; // H + kcharge[4] = 0; // O + kcharge[5] = 0; // OH + kcharge[6] = 0; // HO2 + kcharge[7] = 0; // H2O2 + kcharge[8] = 0; // N2 + kcharge[9] = 0; // HE + kcharge[10] = 0; // CO2 +} + +// species charge per unit mass +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +CKCHRGMASS(amrex::Real zk[]) +{ + + int kchrg[11]; + CKCHRG(kchrg); + + for (int id = 0; id < 11; ++id) { + zk[id] = 6.02214076e+23 * 1.60217663e-19 * kchrg[id] * imw(id); + } +} + +// compute an approx to the reaction Jacobian +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +aJacobian_precond( + amrex::Real* J, const amrex::Real* sc, const amrex::Real T, const int HP) +{ + +#if defined(PELE_COMPILE_AJACOBIAN) || !defined(AMREX_USE_HIP) + for (int i = 0; i < 144; i++) { + J[i] = 0.0; + } + + amrex::Real wdot[11]; + for (auto& val : wdot) { + val = 0.0; + } + + const amrex::Real invT = 1.0 / T; + const amrex::Real invT2 = invT * invT; + const amrex::Real logT = log(T); + + // reference concentration: P_atm / (RT) in inverse mol/m^3 + amrex::Real refC = 101325 / 8.31446 / T; + amrex::Real refCinv = 1.0 / refC; + + // compute the mixture concentration + amrex::Real mixture = 0.0; + for (int k = 0; k < 11; ++k) { + mixture += sc[k]; + } + + // compute the Gibbs free energy + amrex::Real g_RT[11]; + gibbs(g_RT, T); + + // compute the species enthalpy + amrex::Real h_RT[11]; + speciesEnthalpy(h_RT, T); + + amrex::Real phi_f, k_f, k_r, phi_r, Kc, q, q_nocor, Corr, alpha; + amrex::Real dlnkfdT, dlnk0dT, dlnKcdT, dkrdT, dqdT; + amrex::Real dqdci, dcdc_fac, dqdc[11]; + amrex::Real Pr, fPr, F, k_0, logPr; + amrex::Real logFcent, troe_c, troe_n, troePr_den, troePr, troe; + amrex::Real Fcent1, Fcent2, Fcent3, Fcent; + amrex::Real dlogFdc, dlogFdn, dlogFdcn_fac; + amrex::Real dlogPrdT, dlogfPrdT, dlogFdT, dlogFcentdT, dlogFdlogPr, dlnCorrdT; + const amrex::Real ln10 = log(10.0); + const amrex::Real log10e = 1.0 / log(10.0); + // reaction 8: H + O2 (+M) <=> HO2 (+M) + // a third-body and pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + sc[0] + (0.78 - 1) * sc[1] + (11 - 1) * sc[2]; + // forward + phi_f = sc[1] * sc[3]; + k_f = 1475000 * exp(0.6 * logT); + dlnkfdT = 0.6 * invT; + // pressure-fall-off + k_0 = 6.366e+20 * exp(-1.72 * logT - (264.088106214317) * invT); + Pr = 1e-12 * alpha / k_f * k_0; + fPr = Pr / (1.0 + Pr); + dlnk0dT = -1.72 * invT + (264.088106214317) * invT2; + dlogPrdT = log10e * (dlnk0dT - dlnkfdT); + dlogfPrdT = dlogPrdT / (1.0 + Pr); + // Troe form + logPr = log10(Pr); + Fcent1 = (1. - 0.8) * exp(-T / 1e-30); + Fcent2 = 0.8 * exp(-T / 1e+30); + Fcent3 = 0.; + Fcent = Fcent1 + Fcent2 + Fcent3; + logFcent = log10(Fcent); + troe_c = -.4 - .67 * logFcent; + troe_n = .75 - 1.27 * logFcent; + troePr_den = 1.0 / (troe_n - .14 * (troe_c + logPr)); + troePr = (troe_c + logPr) * troePr_den; + troe = 1.0 / (1.0 + troePr * troePr); + F = exp(M_LN10 * logFcent * troe); + dlogFcentdT = log10e / Fcent * (-Fcent1 / 1e-30 - Fcent2 / 1e+30); + dlogFdcn_fac = 2.0 * logFcent * troe * troe * troePr * troePr_den; + dlogFdc = -troe_n * dlogFdcn_fac * troePr_den; + dlogFdn = dlogFdcn_fac * troePr; + dlogFdlogPr = dlogFdc; + dlogFdT = dlogFcentdT * (troe - 0.67 * dlogFdc - 1.27 * dlogFdn) + + dlogFdlogPr * dlogPrdT; + // reverse + phi_r = sc[6]; + Kc = refCinv * exp(g_RT[1] + g_RT[3] - g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[1] + h_RT[3]) + (h_RT[6]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + Corr = fPr * F; + q = Corr * q_nocor; + dlnCorrdT = ln10 * (dlogfPrdT + dlogFdT); + dqdT = Corr * (dlnkfdT * k_f * phi_f - dkrdT * phi_r) + dlnCorrdT * q; + // update wdot + wdot[1] -= q; // O2 + wdot[3] -= q; // H + wdot[6] += q; // HO2 + // for convenience + k_f *= Corr; + k_r *= Corr; + dcdc_fac = 0.0; + dqdc[0] = 2 * dcdc_fac; + dqdc[1] = 0.78 * dcdc_fac + k_f * sc[3]; + dqdc[2] = 11 * dcdc_fac; + dqdc[3] = dcdc_fac + k_f * sc[1]; + dqdc[4] = dcdc_fac; + dqdc[5] = dcdc_fac; + dqdc[6] = dcdc_fac - k_r; + dqdc[7] = dcdc_fac; + dqdc[8] = dcdc_fac; + dqdc[9] = dcdc_fac; + dqdc[10] = dcdc_fac; + for (int k = 0; k < 11; k++) { + J[12 * k + 1] -= dqdc[k]; + J[12 * k + 3] -= dqdc[k]; + J[12 * k + 6] += dqdc[k]; + } + J[133] -= dqdT; // dwdot[O2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[138] += dqdT; // dwdot[HO2]/dT + + // reaction 15: H2O2 (+M) <=> 2 OH (+M) + // a third-body and pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[7]; + k_f = 295100000000000 * exp(-(24370.7831249226) * invT); + dlnkfdT = (24370.7831249226) * invT2; + // pressure-fall-off + k_0 = 1.202e+17 * exp(-(22896.3582941147) * invT); + Pr = 1e-6 * alpha / k_f * k_0; + fPr = Pr / (1.0 + Pr); + dlnk0dT = (22896.3582941147) * invT2; + dlogPrdT = log10e * (dlnk0dT - dlnkfdT); + dlogfPrdT = dlogPrdT / (1.0 + Pr); + // Troe form + logPr = log10(Pr); + Fcent1 = (1. - 0.5) * exp(-T / 1e-30); + Fcent2 = 0.5 * exp(-T / 1e+30); + Fcent3 = 0.; + Fcent = Fcent1 + Fcent2 + Fcent3; + logFcent = log10(Fcent); + troe_c = -.4 - .67 * logFcent; + troe_n = .75 - 1.27 * logFcent; + troePr_den = 1.0 / (troe_n - .14 * (troe_c + logPr)); + troePr = (troe_c + logPr) * troePr_den; + troe = 1.0 / (1.0 + troePr * troePr); + F = exp(M_LN10 * logFcent * troe); + dlogFcentdT = log10e / Fcent * (-Fcent1 / 1e-30 - Fcent2 / 1e+30); + dlogFdcn_fac = 2.0 * logFcent * troe * troe * troePr * troePr_den; + dlogFdc = -troe_n * dlogFdcn_fac * troePr_den; + dlogFdn = dlogFdcn_fac * troePr; + dlogFdlogPr = dlogFdc; + dlogFdT = dlogFcentdT * (troe - 0.67 * dlogFdc - 1.27 * dlogFdn) + + dlogFdlogPr * dlogPrdT; + // reverse + phi_r = (sc[5] * sc[5]); + Kc = refC * exp(-2.000000 * g_RT[5] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[7]) + (2.000000 * h_RT[5]) - 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + Corr = fPr * F; + q = Corr * q_nocor; + dlnCorrdT = ln10 * (dlogfPrdT + dlogFdT); + dqdT = Corr * (dlnkfdT * k_f * phi_f - dkrdT * phi_r) + dlnCorrdT * q; + // update wdot + wdot[5] += 2 * q; // OH + wdot[7] -= q; // H2O2 + // for convenience + k_f *= Corr; + k_r *= Corr; + dcdc_fac = 0.0; + dqdc[0] = 2.5 * dcdc_fac; + dqdc[1] = dcdc_fac; + dqdc[2] = 12 * dcdc_fac; + dqdc[3] = dcdc_fac; + dqdc[4] = dcdc_fac; + dqdc[5] = dcdc_fac - k_r * 2.000000 * sc[5]; + dqdc[6] = dcdc_fac; + dqdc[7] = dcdc_fac + k_f; + dqdc[8] = dcdc_fac; + dqdc[9] = dcdc_fac; + dqdc[10] = dcdc_fac; + for (int k = 0; k < 11; k++) { + J[12 * k + 5] += 2 * dqdc[k]; + J[12 * k + 7] -= dqdc[k]; + } + J[137] += 2 * dqdT; // dwdot[OH]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 4: H2 + M <=> 2 H + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[0]; + k_f = 45770000000000 * exp(-1.4 * logT - (52525.7555766966) * invT); + dlnkfdT = -1.4 * invT + (52525.7555766966) * invT2; + // reverse + phi_r = (sc[3] * sc[3]); + Kc = refC * exp(g_RT[0] - 2.000000 * g_RT[3]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[0]) + (2.000000 * h_RT[3]) - 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] -= q; // H2 + wdot[3] += 2 * q; // H + // for convenience + k_f *= alpha; + k_r *= alpha; + dqdc[0] = 2.5 * q_nocor + k_f; + dqdc[1] = q_nocor; + dqdc[2] = 12 * q_nocor; + dqdc[3] = q_nocor - k_r * 2.000000 * sc[3]; + dqdc[4] = q_nocor; + dqdc[5] = q_nocor; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 0] -= dqdc[k]; + J[12 * k + 3] += 2 * dqdc[k]; + } + J[132] -= dqdT; // dwdot[H2]/dT + J[135] += 2 * dqdT; // dwdot[H]/dT + + // reaction 5: 2 O + M <=> O2 + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = (sc[4] * sc[4]); + k_f = 6165 * exp(-0.5 * logT); + dlnkfdT = -0.5 * invT; + // reverse + phi_r = sc[1]; + Kc = refCinv * exp(-g_RT[1] + 2.000000 * g_RT[4]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(2.000000 * h_RT[4]) + (h_RT[1]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[4] -= 2 * q; // O + // for convenience + k_f *= alpha; + k_r *= alpha; + dqdc[0] = 2.5 * q_nocor; + dqdc[1] = q_nocor - k_r; + dqdc[2] = 12 * q_nocor; + dqdc[3] = q_nocor; + dqdc[4] = q_nocor + k_f * 2.000000 * sc[4]; + dqdc[5] = q_nocor; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 1] += dqdc[k]; + J[12 * k + 4] += -2 * dqdc[k]; + } + J[133] += dqdT; // dwdot[O2]/dT + J[136] += -2 * dqdT; // dwdot[O]/dT + + // reaction 6: H + O + M <=> OH + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[3] * sc[4]; + k_f = 4714000 * exp(-1 * logT); + dlnkfdT = -1 * invT; + // reverse + phi_r = sc[5]; + Kc = refCinv * exp(g_RT[3] + g_RT[4] - g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[4]) + (h_RT[5]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[3] -= q; // H + wdot[4] -= q; // O + wdot[5] += q; // OH + // for convenience + k_f *= alpha; + k_r *= alpha; + dqdc[0] = 2.5 * q_nocor; + dqdc[1] = q_nocor; + dqdc[2] = 12 * q_nocor; + dqdc[3] = q_nocor + k_f * sc[4]; + dqdc[4] = q_nocor + k_f * sc[3]; + dqdc[5] = q_nocor - k_r; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 3] -= dqdc[k]; + J[12 * k + 4] -= dqdc[k]; + J[12 * k + 5] += dqdc[k]; + } + J[135] -= dqdT; // dwdot[H]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + + // reaction 7: H + OH + M <=> H2O + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[3] * sc[5]; + k_f = 38000000000 * exp(-2 * logT); + dlnkfdT = -2 * invT; + // reverse + phi_r = sc[2]; + Kc = refCinv * exp(-g_RT[2] + g_RT[3] + g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[5]) + (h_RT[2]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[3] -= q; // H + wdot[5] -= q; // OH + // for convenience + k_f *= alpha; + k_r *= alpha; + dqdc[0] = 2.5 * q_nocor; + dqdc[1] = q_nocor; + dqdc[2] = 12 * q_nocor - k_r; + dqdc[3] = q_nocor + k_f * sc[5]; + dqdc[4] = q_nocor; + dqdc[5] = q_nocor + k_f * sc[3]; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 2] += dqdc[k]; + J[12 * k + 3] -= dqdc[k]; + J[12 * k + 5] -= dqdc[k]; + } + J[134] += dqdT; // dwdot[H2O]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[137] -= dqdT; // dwdot[OH]/dT + + // reaction 0: H + O2 <=> O + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[1] * sc[3]; + k_f = 3547000000 * exp(-0.406 * logT - (8352.89343569254) * invT); + dlnkfdT = -0.406 * invT + (8352.89343569254) * invT2; + // reverse + phi_r = sc[4] * sc[5]; + Kc = exp(g_RT[1] + g_RT[3] - g_RT[4] - g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[1] + h_RT[3]) + (h_RT[4] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] -= q; // O2 + wdot[3] -= q; // H + wdot[4] += q; // O + wdot[5] += q; // OH + // d()/d[O2] + dqdci = +k_f * sc[3]; + J[13] -= dqdci; // dwdot[O2]/d[O2] + J[15] -= dqdci; // dwdot[H]/d[O2] + J[16] += dqdci; // dwdot[O]/d[O2] + J[17] += dqdci; // dwdot[OH]/d[O2] + // d()/d[H] + dqdci = +k_f * sc[1]; + J[37] -= dqdci; // dwdot[O2]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[40] += dqdci; // dwdot[O]/d[H] + J[41] += dqdci; // dwdot[OH]/d[H] + // d()/d[O] + dqdci = -k_r * sc[5]; + J[49] -= dqdci; // dwdot[O2]/d[O] + J[51] -= dqdci; // dwdot[H]/d[O] + J[52] += dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[4]; + J[61] -= dqdci; // dwdot[O2]/d[OH] + J[63] -= dqdci; // dwdot[H]/d[OH] + J[64] += dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[133] -= dqdT; // dwdot[O2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[136] += dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + + // reaction 1: H2 + O <=> H + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[0] * sc[4]; + k_f = 0.0508 * exp(2.67 * logT - (3165.23282791169) * invT); + dlnkfdT = 2.67 * invT + (3165.23282791169) * invT2; + // reverse + phi_r = sc[3] * sc[5]; + Kc = exp(g_RT[0] - g_RT[3] + g_RT[4] - g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[0] + h_RT[4]) + (h_RT[3] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] -= q; // H2 + wdot[3] += q; // H + wdot[4] -= q; // O + wdot[5] += q; // OH + // d()/d[H2] + dqdci = +k_f * sc[4]; + J[0] -= dqdci; // dwdot[H2]/d[H2] + J[3] += dqdci; // dwdot[H]/d[H2] + J[4] -= dqdci; // dwdot[O]/d[H2] + J[5] += dqdci; // dwdot[OH]/d[H2] + // d()/d[H] + dqdci = -k_r * sc[5]; + J[36] -= dqdci; // dwdot[H2]/d[H] + J[39] += dqdci; // dwdot[H]/d[H] + J[40] -= dqdci; // dwdot[O]/d[H] + J[41] += dqdci; // dwdot[OH]/d[H] + // d()/d[O] + dqdci = +k_f * sc[0]; + J[48] -= dqdci; // dwdot[H2]/d[O] + J[51] += dqdci; // dwdot[H]/d[O] + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[3]; + J[60] -= dqdci; // dwdot[H2]/d[OH] + J[63] += dqdci; // dwdot[H]/d[OH] + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[132] -= dqdT; // dwdot[H2]/dT + J[135] += dqdT; // dwdot[H]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + + // reaction 2: H2 + OH <=> H + H2O + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[0] * sc[5]; + k_f = 216 * exp(1.51 * logT - (1726.03316371019) * invT); + dlnkfdT = 1.51 * invT + (1726.03316371019) * invT2; + // reverse + phi_r = sc[2] * sc[3]; + Kc = exp(g_RT[0] - g_RT[2] - g_RT[3] + g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[0] + h_RT[5]) + (h_RT[2] + h_RT[3])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] -= q; // H2 + wdot[2] += q; // H2O + wdot[3] += q; // H + wdot[5] -= q; // OH + // d()/d[H2] + dqdci = +k_f * sc[5]; + J[0] -= dqdci; // dwdot[H2]/d[H2] + J[2] += dqdci; // dwdot[H2O]/d[H2] + J[3] += dqdci; // dwdot[H]/d[H2] + J[5] -= dqdci; // dwdot[OH]/d[H2] + // d()/d[H2O] + dqdci = -k_r * sc[3]; + J[24] -= dqdci; // dwdot[H2]/d[H2O] + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[27] += dqdci; // dwdot[H]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + // d()/d[H] + dqdci = -k_r * sc[2]; + J[36] -= dqdci; // dwdot[H2]/d[H] + J[38] += dqdci; // dwdot[H2O]/d[H] + J[39] += dqdci; // dwdot[H]/d[H] + J[41] -= dqdci; // dwdot[OH]/d[H] + // d()/d[OH] + dqdci = +k_f * sc[0]; + J[60] -= dqdci; // dwdot[H2]/d[OH] + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[63] += dqdci; // dwdot[H]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[132] -= dqdT; // dwdot[H2]/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[135] += dqdT; // dwdot[H]/dT + J[137] -= dqdT; // dwdot[OH]/dT + + // reaction 3: H2O + O <=> 2 OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[2] * sc[4]; + k_f = 2.97 * exp(2.02 * logT - (6743.10332178324) * invT); + dlnkfdT = 2.02 * invT + (6743.10332178324) * invT2; + // reverse + phi_r = (sc[5] * sc[5]); + Kc = exp(g_RT[2] + g_RT[4] - 2.000000 * g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[2] + h_RT[4]) + (2.000000 * h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] -= q; // H2O + wdot[4] -= q; // O + wdot[5] += 2 * q; // OH + // d()/d[H2O] + dqdci = +k_f * sc[4]; + J[26] -= dqdci; // dwdot[H2O]/d[H2O] + J[28] -= dqdci; // dwdot[O]/d[H2O] + J[29] += 2 * dqdci; // dwdot[OH]/d[H2O] + // d()/d[O] + dqdci = +k_f * sc[2]; + J[50] -= dqdci; // dwdot[H2O]/d[O] + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += 2 * dqdci; // dwdot[OH]/d[O] + // d()/d[OH] + dqdci = -k_r * 2.000000 * sc[5]; + J[62] -= dqdci; // dwdot[H2O]/d[OH] + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += 2 * dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[134] -= dqdT; // dwdot[H2O]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += 2 * dqdT; // dwdot[OH]/dT + + // reaction 9: H + HO2 <=> H2 + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[6]; + k_f = 16600000 * exp(-(414.147315957284) * invT); + dlnkfdT = (414.147315957284) * invT2; + // reverse + phi_r = sc[0] * sc[1]; + Kc = exp(-g_RT[0] - g_RT[1] + g_RT[3] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[6]) + (h_RT[0] + h_RT[1])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] += q; // H2 + wdot[1] += q; // O2 + wdot[3] -= q; // H + wdot[6] -= q; // HO2 + // d()/d[H2] + dqdci = -k_r * sc[1]; + J[0] += dqdci; // dwdot[H2]/d[H2] + J[1] += dqdci; // dwdot[O2]/d[H2] + J[3] -= dqdci; // dwdot[H]/d[H2] + J[6] -= dqdci; // dwdot[HO2]/d[H2] + // d()/d[O2] + dqdci = -k_r * sc[0]; + J[12] += dqdci; // dwdot[H2]/d[O2] + J[13] += dqdci; // dwdot[O2]/d[O2] + J[15] -= dqdci; // dwdot[H]/d[O2] + J[18] -= dqdci; // dwdot[HO2]/d[O2] + // d()/d[H] + dqdci = +k_f * sc[6]; + J[36] += dqdci; // dwdot[H2]/d[H] + J[37] += dqdci; // dwdot[O2]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[42] -= dqdci; // dwdot[HO2]/d[H] + // d()/d[HO2] + dqdci = +k_f * sc[3]; + J[72] += dqdci; // dwdot[H2]/d[HO2] + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[75] -= dqdci; // dwdot[H]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[132] += dqdT; // dwdot[H2]/dT + J[133] += dqdT; // dwdot[O2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 10: H + HO2 <=> 2 OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[6]; + k_f = 70790000 * exp(-(148.448916412392) * invT); + dlnkfdT = (148.448916412392) * invT2; + // reverse + phi_r = (sc[5] * sc[5]); + Kc = exp(g_RT[3] - 2.000000 * g_RT[5] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[6]) + (2.000000 * h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[3] -= q; // H + wdot[5] += 2 * q; // OH + wdot[6] -= q; // HO2 + // d()/d[H] + dqdci = +k_f * sc[6]; + J[39] -= dqdci; // dwdot[H]/d[H] + J[41] += 2 * dqdci; // dwdot[OH]/d[H] + J[42] -= dqdci; // dwdot[HO2]/d[H] + // d()/d[OH] + dqdci = -k_r * 2.000000 * sc[5]; + J[63] -= dqdci; // dwdot[H]/d[OH] + J[65] += 2 * dqdci; // dwdot[OH]/d[OH] + J[66] -= dqdci; // dwdot[HO2]/d[OH] + // d()/d[HO2] + dqdci = +k_f * sc[3]; + J[75] -= dqdci; // dwdot[H]/d[HO2] + J[77] += 2 * dqdci; // dwdot[OH]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[135] -= dqdT; // dwdot[H]/dT + J[137] += 2 * dqdT; // dwdot[OH]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 11: HO2 + O <=> O2 + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[4] * sc[6]; + k_f = 32500000; + dlnkfdT = 0.0; + // reverse + phi_r = sc[1] * sc[5]; + Kc = exp(-g_RT[1] + g_RT[4] - g_RT[5] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[4] + h_RT[6]) + (h_RT[1] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[4] -= q; // O + wdot[5] += q; // OH + wdot[6] -= q; // HO2 + // d()/d[O2] + dqdci = -k_r * sc[5]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[16] -= dqdci; // dwdot[O]/d[O2] + J[17] += dqdci; // dwdot[OH]/d[O2] + J[18] -= dqdci; // dwdot[HO2]/d[O2] + // d()/d[O] + dqdci = +k_f * sc[6]; + J[49] += dqdci; // dwdot[O2]/d[O] + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + J[54] -= dqdci; // dwdot[HO2]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[1]; + J[61] += dqdci; // dwdot[O2]/d[OH] + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + J[66] -= dqdci; // dwdot[HO2]/d[OH] + // d()/d[HO2] + dqdci = +k_f * sc[4]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[76] -= dqdci; // dwdot[O]/d[HO2] + J[77] += dqdci; // dwdot[OH]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 12: HO2 + OH <=> H2O + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[5] * sc[6]; + k_f = 28900000 * exp(-(-250.098682904946) * invT); + dlnkfdT = (-250.098682904946) * invT2; + // reverse + phi_r = sc[1] * sc[2]; + Kc = exp(-g_RT[1] - g_RT[2] + g_RT[5] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[5] + h_RT[6]) + (h_RT[1] + h_RT[2])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[2] += q; // H2O + wdot[5] -= q; // OH + wdot[6] -= q; // HO2 + // d()/d[O2] + dqdci = -k_r * sc[2]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[14] += dqdci; // dwdot[H2O]/d[O2] + J[17] -= dqdci; // dwdot[OH]/d[O2] + J[18] -= dqdci; // dwdot[HO2]/d[O2] + // d()/d[H2O] + dqdci = -k_r * sc[1]; + J[25] += dqdci; // dwdot[O2]/d[H2O] + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + J[30] -= dqdci; // dwdot[HO2]/d[H2O] + // d()/d[OH] + dqdci = +k_f * sc[6]; + J[61] += dqdci; // dwdot[O2]/d[OH] + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + J[66] -= dqdci; // dwdot[HO2]/d[OH] + // d()/d[HO2] + dqdci = +k_f * sc[5]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[74] += dqdci; // dwdot[H2O]/d[HO2] + J[77] -= dqdci; // dwdot[OH]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[137] -= dqdT; // dwdot[OH]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 13: 2 HO2 <=> H2O2 + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = (sc[6] * sc[6]); + k_f = 420000000 * exp(-(6029.54208967215) * invT); + dlnkfdT = (6029.54208967215) * invT2; + // reverse + phi_r = sc[1] * sc[7]; + Kc = exp(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(2.000000 * h_RT[6]) + (h_RT[1] + h_RT[7])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[6] -= 2 * q; // HO2 + wdot[7] += q; // H2O2 + // d()/d[O2] + dqdci = -k_r * sc[7]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[18] += -2 * dqdci; // dwdot[HO2]/d[O2] + J[19] += dqdci; // dwdot[H2O2]/d[O2] + // d()/d[HO2] + dqdci = +k_f * 2.000000 * sc[6]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[78] += -2 * dqdci; // dwdot[HO2]/d[HO2] + J[79] += dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = -k_r * sc[1]; + J[85] += dqdci; // dwdot[O2]/d[H2O2] + J[90] += -2 * dqdci; // dwdot[HO2]/d[H2O2] + J[91] += dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[138] += -2 * dqdT; // dwdot[HO2]/dT + J[139] += dqdT; // dwdot[H2O2]/dT + + // reaction 14: 2 HO2 <=> H2O2 + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = (sc[6] * sc[6]); + k_f = 130000 * exp(-(-819.89091359563) * invT); + dlnkfdT = (-819.89091359563) * invT2; + // reverse + phi_r = sc[1] * sc[7]; + Kc = exp(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(2.000000 * h_RT[6]) + (h_RT[1] + h_RT[7])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[6] -= 2 * q; // HO2 + wdot[7] += q; // H2O2 + // d()/d[O2] + dqdci = -k_r * sc[7]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[18] += -2 * dqdci; // dwdot[HO2]/d[O2] + J[19] += dqdci; // dwdot[H2O2]/d[O2] + // d()/d[HO2] + dqdci = +k_f * 2.000000 * sc[6]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[78] += -2 * dqdci; // dwdot[HO2]/d[HO2] + J[79] += dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = -k_r * sc[1]; + J[85] += dqdci; // dwdot[O2]/d[H2O2] + J[90] += -2 * dqdci; // dwdot[HO2]/d[H2O2] + J[91] += dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[138] += -2 * dqdT; // dwdot[HO2]/dT + J[139] += dqdT; // dwdot[H2O2]/dT + + // reaction 16: H + H2O2 <=> H2O + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[7]; + k_f = 24100000 * exp(-(1997.77016324474) * invT); + dlnkfdT = (1997.77016324474) * invT2; + // reverse + phi_r = sc[2] * sc[5]; + Kc = exp(-g_RT[2] + g_RT[3] - g_RT[5] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[7]) + (h_RT[2] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[3] -= q; // H + wdot[5] += q; // OH + wdot[7] -= q; // H2O2 + // d()/d[H2O] + dqdci = -k_r * sc[5]; + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[27] -= dqdci; // dwdot[H]/d[H2O] + J[29] += dqdci; // dwdot[OH]/d[H2O] + J[31] -= dqdci; // dwdot[H2O2]/d[H2O] + // d()/d[H] + dqdci = +k_f * sc[7]; + J[38] += dqdci; // dwdot[H2O]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[41] += dqdci; // dwdot[OH]/d[H] + J[43] -= dqdci; // dwdot[H2O2]/d[H] + // d()/d[OH] + dqdci = -k_r * sc[2]; + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[63] -= dqdci; // dwdot[H]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[H2O2] + dqdci = +k_f * sc[3]; + J[86] += dqdci; // dwdot[H2O]/d[H2O2] + J[87] -= dqdci; // dwdot[H]/d[H2O2] + J[89] += dqdci; // dwdot[OH]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[137] += dqdT; // dwdot[OH]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 17: H + H2O2 <=> H2 + HO2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[7]; + k_f = 48200000 * exp(-(4000.57249314752) * invT); + dlnkfdT = (4000.57249314752) * invT2; + // reverse + phi_r = sc[0] * sc[6]; + Kc = exp(-g_RT[0] + g_RT[3] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[7]) + (h_RT[0] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] += q; // H2 + wdot[3] -= q; // H + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[H2] + dqdci = -k_r * sc[6]; + J[0] += dqdci; // dwdot[H2]/d[H2] + J[3] -= dqdci; // dwdot[H]/d[H2] + J[6] += dqdci; // dwdot[HO2]/d[H2] + J[7] -= dqdci; // dwdot[H2O2]/d[H2] + // d()/d[H] + dqdci = +k_f * sc[7]; + J[36] += dqdci; // dwdot[H2]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[42] += dqdci; // dwdot[HO2]/d[H] + J[43] -= dqdci; // dwdot[H2O2]/d[H] + // d()/d[HO2] + dqdci = -k_r * sc[0]; + J[72] += dqdci; // dwdot[H2]/d[HO2] + J[75] -= dqdci; // dwdot[H]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[3]; + J[84] += dqdci; // dwdot[H2]/d[H2O2] + J[87] -= dqdci; // dwdot[H]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[132] += dqdT; // dwdot[H2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 18: H2O2 + O <=> HO2 + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[4] * sc[7]; + k_f = 9.55 * exp(2 * logT - (1997.77016324474) * invT); + dlnkfdT = 2 * invT + (1997.77016324474) * invT2; + // reverse + phi_r = sc[5] * sc[6]; + Kc = exp(g_RT[4] - g_RT[5] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[4] + h_RT[7]) + (h_RT[5] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[4] -= q; // O + wdot[5] += q; // OH + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[O] + dqdci = +k_f * sc[7]; + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + J[54] += dqdci; // dwdot[HO2]/d[O] + J[55] -= dqdci; // dwdot[H2O2]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[6]; + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + J[66] += dqdci; // dwdot[HO2]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[HO2] + dqdci = -k_r * sc[5]; + J[76] -= dqdci; // dwdot[O]/d[HO2] + J[77] += dqdci; // dwdot[OH]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[4]; + J[88] -= dqdci; // dwdot[O]/d[H2O2] + J[89] += dqdci; // dwdot[OH]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 19: H2O2 + OH <=> H2O + HO2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[5] * sc[7]; + k_f = 1000000; + dlnkfdT = 0.0; + // reverse + phi_r = sc[2] * sc[6]; + Kc = exp(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[5] + h_RT[7]) + (h_RT[2] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[5] -= q; // OH + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[H2O] + dqdci = -k_r * sc[6]; + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + J[30] += dqdci; // dwdot[HO2]/d[H2O] + J[31] -= dqdci; // dwdot[H2O2]/d[H2O] + // d()/d[OH] + dqdci = +k_f * sc[7]; + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + J[66] += dqdci; // dwdot[HO2]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[HO2] + dqdci = -k_r * sc[2]; + J[74] += dqdci; // dwdot[H2O]/d[HO2] + J[77] -= dqdci; // dwdot[OH]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[5]; + J[86] += dqdci; // dwdot[H2O]/d[H2O2] + J[89] -= dqdci; // dwdot[OH]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[137] -= dqdT; // dwdot[OH]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 20: H2O2 + OH <=> H2O + HO2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[5] * sc[7]; + k_f = 580000000 * exp(-(4809.24167509571) * invT); + dlnkfdT = (4809.24167509571) * invT2; + // reverse + phi_r = sc[2] * sc[6]; + Kc = exp(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[5] + h_RT[7]) + (h_RT[2] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[5] -= q; // OH + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[H2O] + dqdci = -k_r * sc[6]; + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + J[30] += dqdci; // dwdot[HO2]/d[H2O] + J[31] -= dqdci; // dwdot[H2O2]/d[H2O] + // d()/d[OH] + dqdci = +k_f * sc[7]; + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + J[66] += dqdci; // dwdot[HO2]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[HO2] + dqdci = -k_r * sc[2]; + J[74] += dqdci; // dwdot[H2O]/d[HO2] + J[77] -= dqdci; // dwdot[OH]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[5]; + J[86] += dqdci; // dwdot[H2O]/d[H2O2] + J[89] -= dqdci; // dwdot[OH]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[137] -= dqdT; // dwdot[OH]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + amrex::Real c_R[11], dcRdT[11], e_RT[11]; + amrex::Real* eh_RT; + if (HP == 1) { + cp_R(c_R, T); + dcvpRdT(dcRdT, T); + eh_RT = &h_RT[0]; + } else { + cv_R(c_R, T); + dcvpRdT(dcRdT, T); + speciesInternalEnergy(e_RT, T); + eh_RT = &e_RT[0]; + } + + amrex::Real cmix = 0.0, ehmix = 0.0, dcmixdT = 0.0, dehmixdT = 0.0; + for (int k = 0; k < 11; ++k) { + cmix += c_R[k] * sc[k]; + dcmixdT += dcRdT[k] * sc[k]; + ehmix += eh_RT[k] * wdot[k]; + dehmixdT += invT * (c_R[k] - eh_RT[k]) * wdot[k] + eh_RT[k] * J[132 + k]; + } + + amrex::Real cmixinv = 1.0 / cmix; + amrex::Real tmp1 = ehmix * cmixinv; + amrex::Real tmp3 = cmixinv * T; + amrex::Real tmp2 = tmp1 * tmp3; + amrex::Real dehmixdc; + // dTdot/d[X] + for (int k = 0; k < 11; ++k) { + dehmixdc = 0.0; + for (int m = 0; m < 11; ++m) { + dehmixdc += eh_RT[m] * J[k * 12 + m]; + } + J[k * 12 + 11] = tmp2 * c_R[k] - tmp3 * dehmixdc; + } + // dTdot/dT + J[143] = -tmp1 + tmp2 * dcmixdT - tmp3 * dehmixdT; +#else + amrex::Abort(); +#endif +} + +// compute an approx to the reaction Jacobian (for preconditioning) +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +DWDOT_SIMPLIFIED( + amrex::Real* J, const amrex::Real* sc, const amrex::Real* Tp, const int* HP) +{ + amrex::Real c[11]; + + for (int k = 0; k < 11; k++) { + c[k] = 1.e6 * sc[k]; + } + + aJacobian_precond(J, c, *Tp, *HP); + + // dwdot[k]/dT + // dTdot/d[X] + for (int k = 0; k < 11; k++) { + J[132 + k] *= 1.e-6; + J[k * 12 + 11] *= 1.e6; + } +} + +// compute the reaction Jacobian +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +aJacobian( + amrex::Real* J, const amrex::Real* sc, const amrex::Real T, const int consP) +{ + +#if defined(PELE_COMPILE_AJACOBIAN) || !defined(AMREX_USE_HIP) + for (int i = 0; i < 144; i++) { + J[i] = 0.0; + } + + amrex::Real wdot[11]; + for (auto& val : wdot) { + val = 0.0; + } + + const amrex::Real invT = 1.0 / T; + const amrex::Real invT2 = invT * invT; + const amrex::Real logT = log(T); + + // reference concentration: P_atm / (RT) in inverse mol/m^3 + amrex::Real refC = 101325 / 8.31446 / T; + amrex::Real refCinv = 1.0 / refC; + + // compute the mixture concentration + amrex::Real mixture = 0.0; + for (int k = 0; k < 11; ++k) { + mixture += sc[k]; + } + + // compute the Gibbs free energy + amrex::Real g_RT[11]; + gibbs(g_RT, T); + + // compute the species enthalpy + amrex::Real h_RT[11]; + speciesEnthalpy(h_RT, T); + + amrex::Real phi_f, k_f, k_r, phi_r, Kc, q, q_nocor, Corr, alpha; + amrex::Real dlnkfdT, dlnk0dT, dlnKcdT, dkrdT, dqdT; + amrex::Real dqdci, dcdc_fac, dqdc[11]; + amrex::Real Pr, fPr, F, k_0, logPr; + amrex::Real logFcent, troe_c, troe_n, troePr_den, troePr, troe; + amrex::Real Fcent1, Fcent2, Fcent3, Fcent; + amrex::Real dlogFdc, dlogFdn, dlogFdcn_fac; + amrex::Real dlogPrdT, dlogfPrdT, dlogFdT, dlogFcentdT, dlogFdlogPr, dlnCorrdT; + const amrex::Real ln10 = log(10.0); + const amrex::Real log10e = 1.0 / log(10.0); + // reaction 8: H + O2 (+M) <=> HO2 (+M) + // a third-body and pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + sc[0] + (0.78 - 1) * sc[1] + (11 - 1) * sc[2]; + // forward + phi_f = sc[1] * sc[3]; + k_f = 1475000 * exp(0.6 * logT); + dlnkfdT = 0.6 * invT; + // pressure-fall-off + k_0 = 6.366e+20 * exp(-1.72 * logT - (264.088106214317) * invT); + Pr = 1e-12 * alpha / k_f * k_0; + fPr = Pr / (1.0 + Pr); + dlnk0dT = -1.72 * invT + (264.088106214317) * invT2; + dlogPrdT = log10e * (dlnk0dT - dlnkfdT); + dlogfPrdT = dlogPrdT / (1.0 + Pr); + // Troe form + logPr = log10(Pr); + Fcent1 = (1. - 0.8) * exp(-T / 1e-30); + Fcent2 = 0.8 * exp(-T / 1e+30); + Fcent3 = 0.; + Fcent = Fcent1 + Fcent2 + Fcent3; + logFcent = log10(Fcent); + troe_c = -.4 - .67 * logFcent; + troe_n = .75 - 1.27 * logFcent; + troePr_den = 1.0 / (troe_n - .14 * (troe_c + logPr)); + troePr = (troe_c + logPr) * troePr_den; + troe = 1.0 / (1.0 + troePr * troePr); + F = exp(M_LN10 * logFcent * troe); + dlogFcentdT = log10e / Fcent * (-Fcent1 / 1e-30 - Fcent2 / 1e+30); + dlogFdcn_fac = 2.0 * logFcent * troe * troe * troePr * troePr_den; + dlogFdc = -troe_n * dlogFdcn_fac * troePr_den; + dlogFdn = dlogFdcn_fac * troePr; + dlogFdlogPr = dlogFdc; + dlogFdT = dlogFcentdT * (troe - 0.67 * dlogFdc - 1.27 * dlogFdn) + + dlogFdlogPr * dlogPrdT; + // reverse + phi_r = sc[6]; + Kc = refCinv * exp(g_RT[1] + g_RT[3] - g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[1] + h_RT[3]) + (h_RT[6]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + Corr = fPr * F; + q = Corr * q_nocor; + dlnCorrdT = ln10 * (dlogfPrdT + dlogFdT); + dqdT = Corr * (dlnkfdT * k_f * phi_f - dkrdT * phi_r) + dlnCorrdT * q; + // update wdot + wdot[1] -= q; // O2 + wdot[3] -= q; // H + wdot[6] += q; // HO2 + // for convenience + k_f *= Corr; + k_r *= Corr; + dcdc_fac = q / alpha * (1.0 / (Pr + 1.0) + dlogFdlogPr); + if (consP == 1) { + // d()/d[H2] + dqdci = (2 - 1) * dcdc_fac; + J[1] -= dqdci; // dwdot[O2]/d[H2] + J[3] -= dqdci; // dwdot[H]/d[H2] + J[6] += dqdci; // dwdot[HO2]/d[H2] + // d()/d[O2] + dqdci = (0.78 - 1) * dcdc_fac + k_f * sc[3]; + J[13] -= dqdci; // dwdot[O2]/d[O2] + J[15] -= dqdci; // dwdot[H]/d[O2] + J[18] += dqdci; // dwdot[HO2]/d[O2] + // d()/d[H2O] + dqdci = (11 - 1) * dcdc_fac; + J[25] -= dqdci; // dwdot[O2]/d[H2O] + J[27] -= dqdci; // dwdot[H]/d[H2O] + J[30] += dqdci; // dwdot[HO2]/d[H2O] + // d()/d[H] + dqdci = +k_f * sc[1]; + J[37] -= dqdci; // dwdot[O2]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[42] += dqdci; // dwdot[HO2]/d[H] + // d()/d[HO2] + dqdci = -k_r; + J[73] -= dqdci; // dwdot[O2]/d[HO2] + J[75] -= dqdci; // dwdot[H]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + } else { + dqdc[0] = 2 * dcdc_fac; + dqdc[1] = 0.78 * dcdc_fac + k_f * sc[3]; + dqdc[2] = 11 * dcdc_fac; + dqdc[3] = dcdc_fac + k_f * sc[1]; + dqdc[4] = dcdc_fac; + dqdc[5] = dcdc_fac; + dqdc[6] = dcdc_fac - k_r; + dqdc[7] = dcdc_fac; + dqdc[8] = dcdc_fac; + dqdc[9] = dcdc_fac; + dqdc[10] = dcdc_fac; + for (int k = 0; k < 11; k++) { + J[12 * k + 1] -= dqdc[k]; + J[12 * k + 3] -= dqdc[k]; + J[12 * k + 6] += dqdc[k]; + } + } + J[133] -= dqdT; // dwdot[O2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[138] += dqdT; // dwdot[HO2]/dT + + // reaction 15: H2O2 (+M) <=> 2 OH (+M) + // a third-body and pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[7]; + k_f = 295100000000000 * exp(-(24370.7831249226) * invT); + dlnkfdT = (24370.7831249226) * invT2; + // pressure-fall-off + k_0 = 1.202e+17 * exp(-(22896.3582941147) * invT); + Pr = 1e-6 * alpha / k_f * k_0; + fPr = Pr / (1.0 + Pr); + dlnk0dT = (22896.3582941147) * invT2; + dlogPrdT = log10e * (dlnk0dT - dlnkfdT); + dlogfPrdT = dlogPrdT / (1.0 + Pr); + // Troe form + logPr = log10(Pr); + Fcent1 = (1. - 0.5) * exp(-T / 1e-30); + Fcent2 = 0.5 * exp(-T / 1e+30); + Fcent3 = 0.; + Fcent = Fcent1 + Fcent2 + Fcent3; + logFcent = log10(Fcent); + troe_c = -.4 - .67 * logFcent; + troe_n = .75 - 1.27 * logFcent; + troePr_den = 1.0 / (troe_n - .14 * (troe_c + logPr)); + troePr = (troe_c + logPr) * troePr_den; + troe = 1.0 / (1.0 + troePr * troePr); + F = exp(M_LN10 * logFcent * troe); + dlogFcentdT = log10e / Fcent * (-Fcent1 / 1e-30 - Fcent2 / 1e+30); + dlogFdcn_fac = 2.0 * logFcent * troe * troe * troePr * troePr_den; + dlogFdc = -troe_n * dlogFdcn_fac * troePr_den; + dlogFdn = dlogFdcn_fac * troePr; + dlogFdlogPr = dlogFdc; + dlogFdT = dlogFcentdT * (troe - 0.67 * dlogFdc - 1.27 * dlogFdn) + + dlogFdlogPr * dlogPrdT; + // reverse + phi_r = (sc[5] * sc[5]); + Kc = refC * exp(-2.000000 * g_RT[5] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[7]) + (2.000000 * h_RT[5]) - 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + Corr = fPr * F; + q = Corr * q_nocor; + dlnCorrdT = ln10 * (dlogfPrdT + dlogFdT); + dqdT = Corr * (dlnkfdT * k_f * phi_f - dkrdT * phi_r) + dlnCorrdT * q; + // update wdot + wdot[5] += 2 * q; // OH + wdot[7] -= q; // H2O2 + // for convenience + k_f *= Corr; + k_r *= Corr; + dcdc_fac = q / alpha * (1.0 / (Pr + 1.0) + dlogFdlogPr); + if (consP == 1) { + // d()/d[H2] + dqdci = (2.5 - 1) * dcdc_fac; + J[5] += 2 * dqdci; // dwdot[OH]/d[H2] + J[7] -= dqdci; // dwdot[H2O2]/d[H2] + // d()/d[H2O] + dqdci = (12 - 1) * dcdc_fac; + J[29] += 2 * dqdci; // dwdot[OH]/d[H2O] + J[31] -= dqdci; // dwdot[H2O2]/d[H2O] + // d()/d[OH] + dqdci = -k_r * 2.000000 * sc[5]; + J[65] += 2 * dqdci; // dwdot[OH]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[H2O2] + dqdci = +k_f; + J[89] += 2 * dqdci; // dwdot[OH]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + } else { + dqdc[0] = 2.5 * dcdc_fac; + dqdc[1] = dcdc_fac; + dqdc[2] = 12 * dcdc_fac; + dqdc[3] = dcdc_fac; + dqdc[4] = dcdc_fac; + dqdc[5] = dcdc_fac - k_r * 2.000000 * sc[5]; + dqdc[6] = dcdc_fac; + dqdc[7] = dcdc_fac + k_f; + dqdc[8] = dcdc_fac; + dqdc[9] = dcdc_fac; + dqdc[10] = dcdc_fac; + for (int k = 0; k < 11; k++) { + J[12 * k + 5] += 2 * dqdc[k]; + J[12 * k + 7] -= dqdc[k]; + } + } + J[137] += 2 * dqdT; // dwdot[OH]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 4: H2 + M <=> 2 H + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[0]; + k_f = 45770000000000 * exp(-1.4 * logT - (52525.7555766966) * invT); + dlnkfdT = -1.4 * invT + (52525.7555766966) * invT2; + // reverse + phi_r = (sc[3] * sc[3]); + Kc = refC * exp(g_RT[0] - 2.000000 * g_RT[3]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[0]) + (2.000000 * h_RT[3]) - 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] -= q; // H2 + wdot[3] += 2 * q; // H + // for convenience + k_f *= alpha; + k_r *= alpha; + if (consP == 1) { + // d()/d[H2] + dqdci = (2.5 - 1) * q_nocor + k_f; + J[0] -= dqdci; // dwdot[H2]/d[H2] + J[3] += 2 * dqdci; // dwdot[H]/d[H2] + // d()/d[H2O] + dqdci = (12 - 1) * q_nocor; + J[24] -= dqdci; // dwdot[H2]/d[H2O] + J[27] += 2 * dqdci; // dwdot[H]/d[H2O] + // d()/d[H] + dqdci = -k_r * 2.000000 * sc[3]; + J[36] -= dqdci; // dwdot[H2]/d[H] + J[39] += 2 * dqdci; // dwdot[H]/d[H] + } else { + dqdc[0] = 2.5 * q_nocor + k_f; + dqdc[1] = q_nocor; + dqdc[2] = 12 * q_nocor; + dqdc[3] = q_nocor - k_r * 2.000000 * sc[3]; + dqdc[4] = q_nocor; + dqdc[5] = q_nocor; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 0] -= dqdc[k]; + J[12 * k + 3] += 2 * dqdc[k]; + } + } + J[132] -= dqdT; // dwdot[H2]/dT + J[135] += 2 * dqdT; // dwdot[H]/dT + + // reaction 5: 2 O + M <=> O2 + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = (sc[4] * sc[4]); + k_f = 6165 * exp(-0.5 * logT); + dlnkfdT = -0.5 * invT; + // reverse + phi_r = sc[1]; + Kc = refCinv * exp(-g_RT[1] + 2.000000 * g_RT[4]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(2.000000 * h_RT[4]) + (h_RT[1]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[4] -= 2 * q; // O + // for convenience + k_f *= alpha; + k_r *= alpha; + if (consP == 1) { + // d()/d[H2] + dqdci = (2.5 - 1) * q_nocor; + J[1] += dqdci; // dwdot[O2]/d[H2] + J[4] += -2 * dqdci; // dwdot[O]/d[H2] + // d()/d[O2] + dqdci = -k_r; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[16] += -2 * dqdci; // dwdot[O]/d[O2] + // d()/d[H2O] + dqdci = (12 - 1) * q_nocor; + J[25] += dqdci; // dwdot[O2]/d[H2O] + J[28] += -2 * dqdci; // dwdot[O]/d[H2O] + // d()/d[O] + dqdci = +k_f * 2.000000 * sc[4]; + J[49] += dqdci; // dwdot[O2]/d[O] + J[52] += -2 * dqdci; // dwdot[O]/d[O] + } else { + dqdc[0] = 2.5 * q_nocor; + dqdc[1] = q_nocor - k_r; + dqdc[2] = 12 * q_nocor; + dqdc[3] = q_nocor; + dqdc[4] = q_nocor + k_f * 2.000000 * sc[4]; + dqdc[5] = q_nocor; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 1] += dqdc[k]; + J[12 * k + 4] += -2 * dqdc[k]; + } + } + J[133] += dqdT; // dwdot[O2]/dT + J[136] += -2 * dqdT; // dwdot[O]/dT + + // reaction 6: H + O + M <=> OH + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[3] * sc[4]; + k_f = 4714000 * exp(-1 * logT); + dlnkfdT = -1 * invT; + // reverse + phi_r = sc[5]; + Kc = refCinv * exp(g_RT[3] + g_RT[4] - g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[4]) + (h_RT[5]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[3] -= q; // H + wdot[4] -= q; // O + wdot[5] += q; // OH + // for convenience + k_f *= alpha; + k_r *= alpha; + if (consP == 1) { + // d()/d[H2] + dqdci = (2.5 - 1) * q_nocor; + J[3] -= dqdci; // dwdot[H]/d[H2] + J[4] -= dqdci; // dwdot[O]/d[H2] + J[5] += dqdci; // dwdot[OH]/d[H2] + // d()/d[H2O] + dqdci = (12 - 1) * q_nocor; + J[27] -= dqdci; // dwdot[H]/d[H2O] + J[28] -= dqdci; // dwdot[O]/d[H2O] + J[29] += dqdci; // dwdot[OH]/d[H2O] + // d()/d[H] + dqdci = +k_f * sc[4]; + J[39] -= dqdci; // dwdot[H]/d[H] + J[40] -= dqdci; // dwdot[O]/d[H] + J[41] += dqdci; // dwdot[OH]/d[H] + // d()/d[O] + dqdci = +k_f * sc[3]; + J[51] -= dqdci; // dwdot[H]/d[O] + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + // d()/d[OH] + dqdci = -k_r; + J[63] -= dqdci; // dwdot[H]/d[OH] + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + } else { + dqdc[0] = 2.5 * q_nocor; + dqdc[1] = q_nocor; + dqdc[2] = 12 * q_nocor; + dqdc[3] = q_nocor + k_f * sc[4]; + dqdc[4] = q_nocor + k_f * sc[3]; + dqdc[5] = q_nocor - k_r; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 3] -= dqdc[k]; + J[12 * k + 4] -= dqdc[k]; + J[12 * k + 5] += dqdc[k]; + } + } + J[135] -= dqdT; // dwdot[H]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + + // reaction 7: H + OH + M <=> H2O + M + // a third-body and non-pressure-fall-off reaction + // 3-body correction factor + alpha = mixture + (2.5 - 1) * sc[0] + (12 - 1) * sc[2]; + // forward + phi_f = sc[3] * sc[5]; + k_f = 38000000000 * exp(-2 * logT); + dlnkfdT = -2 * invT; + // reverse + phi_r = sc[2]; + Kc = refCinv * exp(-g_RT[2] + g_RT[3] + g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[5]) + (h_RT[2]) + 1.000000); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q_nocor = k_f * phi_f - k_r * phi_r; + q = alpha * q_nocor; + dqdT = alpha * (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[3] -= q; // H + wdot[5] -= q; // OH + // for convenience + k_f *= alpha; + k_r *= alpha; + if (consP == 1) { + // d()/d[H2] + dqdci = (2.5 - 1) * q_nocor; + J[2] += dqdci; // dwdot[H2O]/d[H2] + J[3] -= dqdci; // dwdot[H]/d[H2] + J[5] -= dqdci; // dwdot[OH]/d[H2] + // d()/d[H2O] + dqdci = (12 - 1) * q_nocor - k_r; + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[27] -= dqdci; // dwdot[H]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + // d()/d[H] + dqdci = +k_f * sc[5]; + J[38] += dqdci; // dwdot[H2O]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[41] -= dqdci; // dwdot[OH]/d[H] + // d()/d[OH] + dqdci = +k_f * sc[3]; + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[63] -= dqdci; // dwdot[H]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + } else { + dqdc[0] = 2.5 * q_nocor; + dqdc[1] = q_nocor; + dqdc[2] = 12 * q_nocor - k_r; + dqdc[3] = q_nocor + k_f * sc[5]; + dqdc[4] = q_nocor; + dqdc[5] = q_nocor + k_f * sc[3]; + dqdc[6] = q_nocor; + dqdc[7] = q_nocor; + dqdc[8] = q_nocor; + dqdc[9] = q_nocor; + dqdc[10] = q_nocor; + for (int k = 0; k < 11; k++) { + J[12 * k + 2] += dqdc[k]; + J[12 * k + 3] -= dqdc[k]; + J[12 * k + 5] -= dqdc[k]; + } + } + J[134] += dqdT; // dwdot[H2O]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[137] -= dqdT; // dwdot[OH]/dT + + // reaction 0: H + O2 <=> O + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[1] * sc[3]; + k_f = 3547000000 * exp(-0.406 * logT - (8352.89343569254) * invT); + dlnkfdT = -0.406 * invT + (8352.89343569254) * invT2; + // reverse + phi_r = sc[4] * sc[5]; + Kc = exp(g_RT[1] + g_RT[3] - g_RT[4] - g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[1] + h_RT[3]) + (h_RT[4] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] -= q; // O2 + wdot[3] -= q; // H + wdot[4] += q; // O + wdot[5] += q; // OH + // d()/d[O2] + dqdci = +k_f * sc[3]; + J[13] -= dqdci; // dwdot[O2]/d[O2] + J[15] -= dqdci; // dwdot[H]/d[O2] + J[16] += dqdci; // dwdot[O]/d[O2] + J[17] += dqdci; // dwdot[OH]/d[O2] + // d()/d[H] + dqdci = +k_f * sc[1]; + J[37] -= dqdci; // dwdot[O2]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[40] += dqdci; // dwdot[O]/d[H] + J[41] += dqdci; // dwdot[OH]/d[H] + // d()/d[O] + dqdci = -k_r * sc[5]; + J[49] -= dqdci; // dwdot[O2]/d[O] + J[51] -= dqdci; // dwdot[H]/d[O] + J[52] += dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[4]; + J[61] -= dqdci; // dwdot[O2]/d[OH] + J[63] -= dqdci; // dwdot[H]/d[OH] + J[64] += dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[133] -= dqdT; // dwdot[O2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[136] += dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + + // reaction 1: H2 + O <=> H + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[0] * sc[4]; + k_f = 0.0508 * exp(2.67 * logT - (3165.23282791169) * invT); + dlnkfdT = 2.67 * invT + (3165.23282791169) * invT2; + // reverse + phi_r = sc[3] * sc[5]; + Kc = exp(g_RT[0] - g_RT[3] + g_RT[4] - g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[0] + h_RT[4]) + (h_RT[3] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] -= q; // H2 + wdot[3] += q; // H + wdot[4] -= q; // O + wdot[5] += q; // OH + // d()/d[H2] + dqdci = +k_f * sc[4]; + J[0] -= dqdci; // dwdot[H2]/d[H2] + J[3] += dqdci; // dwdot[H]/d[H2] + J[4] -= dqdci; // dwdot[O]/d[H2] + J[5] += dqdci; // dwdot[OH]/d[H2] + // d()/d[H] + dqdci = -k_r * sc[5]; + J[36] -= dqdci; // dwdot[H2]/d[H] + J[39] += dqdci; // dwdot[H]/d[H] + J[40] -= dqdci; // dwdot[O]/d[H] + J[41] += dqdci; // dwdot[OH]/d[H] + // d()/d[O] + dqdci = +k_f * sc[0]; + J[48] -= dqdci; // dwdot[H2]/d[O] + J[51] += dqdci; // dwdot[H]/d[O] + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[3]; + J[60] -= dqdci; // dwdot[H2]/d[OH] + J[63] += dqdci; // dwdot[H]/d[OH] + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[132] -= dqdT; // dwdot[H2]/dT + J[135] += dqdT; // dwdot[H]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + + // reaction 2: H2 + OH <=> H + H2O + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[0] * sc[5]; + k_f = 216 * exp(1.51 * logT - (1726.03316371019) * invT); + dlnkfdT = 1.51 * invT + (1726.03316371019) * invT2; + // reverse + phi_r = sc[2] * sc[3]; + Kc = exp(g_RT[0] - g_RT[2] - g_RT[3] + g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[0] + h_RT[5]) + (h_RT[2] + h_RT[3])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] -= q; // H2 + wdot[2] += q; // H2O + wdot[3] += q; // H + wdot[5] -= q; // OH + // d()/d[H2] + dqdci = +k_f * sc[5]; + J[0] -= dqdci; // dwdot[H2]/d[H2] + J[2] += dqdci; // dwdot[H2O]/d[H2] + J[3] += dqdci; // dwdot[H]/d[H2] + J[5] -= dqdci; // dwdot[OH]/d[H2] + // d()/d[H2O] + dqdci = -k_r * sc[3]; + J[24] -= dqdci; // dwdot[H2]/d[H2O] + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[27] += dqdci; // dwdot[H]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + // d()/d[H] + dqdci = -k_r * sc[2]; + J[36] -= dqdci; // dwdot[H2]/d[H] + J[38] += dqdci; // dwdot[H2O]/d[H] + J[39] += dqdci; // dwdot[H]/d[H] + J[41] -= dqdci; // dwdot[OH]/d[H] + // d()/d[OH] + dqdci = +k_f * sc[0]; + J[60] -= dqdci; // dwdot[H2]/d[OH] + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[63] += dqdci; // dwdot[H]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[132] -= dqdT; // dwdot[H2]/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[135] += dqdT; // dwdot[H]/dT + J[137] -= dqdT; // dwdot[OH]/dT + + // reaction 3: H2O + O <=> 2 OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[2] * sc[4]; + k_f = 2.97 * exp(2.02 * logT - (6743.10332178324) * invT); + dlnkfdT = 2.02 * invT + (6743.10332178324) * invT2; + // reverse + phi_r = (sc[5] * sc[5]); + Kc = exp(g_RT[2] + g_RT[4] - 2.000000 * g_RT[5]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[2] + h_RT[4]) + (2.000000 * h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] -= q; // H2O + wdot[4] -= q; // O + wdot[5] += 2 * q; // OH + // d()/d[H2O] + dqdci = +k_f * sc[4]; + J[26] -= dqdci; // dwdot[H2O]/d[H2O] + J[28] -= dqdci; // dwdot[O]/d[H2O] + J[29] += 2 * dqdci; // dwdot[OH]/d[H2O] + // d()/d[O] + dqdci = +k_f * sc[2]; + J[50] -= dqdci; // dwdot[H2O]/d[O] + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += 2 * dqdci; // dwdot[OH]/d[O] + // d()/d[OH] + dqdci = -k_r * 2.000000 * sc[5]; + J[62] -= dqdci; // dwdot[H2O]/d[OH] + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += 2 * dqdci; // dwdot[OH]/d[OH] + // d()/dT + J[134] -= dqdT; // dwdot[H2O]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += 2 * dqdT; // dwdot[OH]/dT + + // reaction 9: H + HO2 <=> H2 + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[6]; + k_f = 16600000 * exp(-(414.147315957284) * invT); + dlnkfdT = (414.147315957284) * invT2; + // reverse + phi_r = sc[0] * sc[1]; + Kc = exp(-g_RT[0] - g_RT[1] + g_RT[3] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[6]) + (h_RT[0] + h_RT[1])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] += q; // H2 + wdot[1] += q; // O2 + wdot[3] -= q; // H + wdot[6] -= q; // HO2 + // d()/d[H2] + dqdci = -k_r * sc[1]; + J[0] += dqdci; // dwdot[H2]/d[H2] + J[1] += dqdci; // dwdot[O2]/d[H2] + J[3] -= dqdci; // dwdot[H]/d[H2] + J[6] -= dqdci; // dwdot[HO2]/d[H2] + // d()/d[O2] + dqdci = -k_r * sc[0]; + J[12] += dqdci; // dwdot[H2]/d[O2] + J[13] += dqdci; // dwdot[O2]/d[O2] + J[15] -= dqdci; // dwdot[H]/d[O2] + J[18] -= dqdci; // dwdot[HO2]/d[O2] + // d()/d[H] + dqdci = +k_f * sc[6]; + J[36] += dqdci; // dwdot[H2]/d[H] + J[37] += dqdci; // dwdot[O2]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[42] -= dqdci; // dwdot[HO2]/d[H] + // d()/d[HO2] + dqdci = +k_f * sc[3]; + J[72] += dqdci; // dwdot[H2]/d[HO2] + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[75] -= dqdci; // dwdot[H]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[132] += dqdT; // dwdot[H2]/dT + J[133] += dqdT; // dwdot[O2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 10: H + HO2 <=> 2 OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[6]; + k_f = 70790000 * exp(-(148.448916412392) * invT); + dlnkfdT = (148.448916412392) * invT2; + // reverse + phi_r = (sc[5] * sc[5]); + Kc = exp(g_RT[3] - 2.000000 * g_RT[5] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[6]) + (2.000000 * h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[3] -= q; // H + wdot[5] += 2 * q; // OH + wdot[6] -= q; // HO2 + // d()/d[H] + dqdci = +k_f * sc[6]; + J[39] -= dqdci; // dwdot[H]/d[H] + J[41] += 2 * dqdci; // dwdot[OH]/d[H] + J[42] -= dqdci; // dwdot[HO2]/d[H] + // d()/d[OH] + dqdci = -k_r * 2.000000 * sc[5]; + J[63] -= dqdci; // dwdot[H]/d[OH] + J[65] += 2 * dqdci; // dwdot[OH]/d[OH] + J[66] -= dqdci; // dwdot[HO2]/d[OH] + // d()/d[HO2] + dqdci = +k_f * sc[3]; + J[75] -= dqdci; // dwdot[H]/d[HO2] + J[77] += 2 * dqdci; // dwdot[OH]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[135] -= dqdT; // dwdot[H]/dT + J[137] += 2 * dqdT; // dwdot[OH]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 11: HO2 + O <=> O2 + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[4] * sc[6]; + k_f = 32500000; + dlnkfdT = 0.0; + // reverse + phi_r = sc[1] * sc[5]; + Kc = exp(-g_RT[1] + g_RT[4] - g_RT[5] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[4] + h_RT[6]) + (h_RT[1] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[4] -= q; // O + wdot[5] += q; // OH + wdot[6] -= q; // HO2 + // d()/d[O2] + dqdci = -k_r * sc[5]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[16] -= dqdci; // dwdot[O]/d[O2] + J[17] += dqdci; // dwdot[OH]/d[O2] + J[18] -= dqdci; // dwdot[HO2]/d[O2] + // d()/d[O] + dqdci = +k_f * sc[6]; + J[49] += dqdci; // dwdot[O2]/d[O] + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + J[54] -= dqdci; // dwdot[HO2]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[1]; + J[61] += dqdci; // dwdot[O2]/d[OH] + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + J[66] -= dqdci; // dwdot[HO2]/d[OH] + // d()/d[HO2] + dqdci = +k_f * sc[4]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[76] -= dqdci; // dwdot[O]/d[HO2] + J[77] += dqdci; // dwdot[OH]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 12: HO2 + OH <=> H2O + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[5] * sc[6]; + k_f = 28900000 * exp(-(-250.098682904946) * invT); + dlnkfdT = (-250.098682904946) * invT2; + // reverse + phi_r = sc[1] * sc[2]; + Kc = exp(-g_RT[1] - g_RT[2] + g_RT[5] + g_RT[6]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[5] + h_RT[6]) + (h_RT[1] + h_RT[2])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[2] += q; // H2O + wdot[5] -= q; // OH + wdot[6] -= q; // HO2 + // d()/d[O2] + dqdci = -k_r * sc[2]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[14] += dqdci; // dwdot[H2O]/d[O2] + J[17] -= dqdci; // dwdot[OH]/d[O2] + J[18] -= dqdci; // dwdot[HO2]/d[O2] + // d()/d[H2O] + dqdci = -k_r * sc[1]; + J[25] += dqdci; // dwdot[O2]/d[H2O] + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + J[30] -= dqdci; // dwdot[HO2]/d[H2O] + // d()/d[OH] + dqdci = +k_f * sc[6]; + J[61] += dqdci; // dwdot[O2]/d[OH] + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + J[66] -= dqdci; // dwdot[HO2]/d[OH] + // d()/d[HO2] + dqdci = +k_f * sc[5]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[74] += dqdci; // dwdot[H2O]/d[HO2] + J[77] -= dqdci; // dwdot[OH]/d[HO2] + J[78] -= dqdci; // dwdot[HO2]/d[HO2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[137] -= dqdT; // dwdot[OH]/dT + J[138] -= dqdT; // dwdot[HO2]/dT + + // reaction 13: 2 HO2 <=> H2O2 + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = (sc[6] * sc[6]); + k_f = 420000000 * exp(-(6029.54208967215) * invT); + dlnkfdT = (6029.54208967215) * invT2; + // reverse + phi_r = sc[1] * sc[7]; + Kc = exp(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(2.000000 * h_RT[6]) + (h_RT[1] + h_RT[7])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[6] -= 2 * q; // HO2 + wdot[7] += q; // H2O2 + // d()/d[O2] + dqdci = -k_r * sc[7]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[18] += -2 * dqdci; // dwdot[HO2]/d[O2] + J[19] += dqdci; // dwdot[H2O2]/d[O2] + // d()/d[HO2] + dqdci = +k_f * 2.000000 * sc[6]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[78] += -2 * dqdci; // dwdot[HO2]/d[HO2] + J[79] += dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = -k_r * sc[1]; + J[85] += dqdci; // dwdot[O2]/d[H2O2] + J[90] += -2 * dqdci; // dwdot[HO2]/d[H2O2] + J[91] += dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[138] += -2 * dqdT; // dwdot[HO2]/dT + J[139] += dqdT; // dwdot[H2O2]/dT + + // reaction 14: 2 HO2 <=> H2O2 + O2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = (sc[6] * sc[6]); + k_f = 130000 * exp(-(-819.89091359563) * invT); + dlnkfdT = (-819.89091359563) * invT2; + // reverse + phi_r = sc[1] * sc[7]; + Kc = exp(-g_RT[1] + 2.000000 * g_RT[6] - g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(2.000000 * h_RT[6]) + (h_RT[1] + h_RT[7])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[1] += q; // O2 + wdot[6] -= 2 * q; // HO2 + wdot[7] += q; // H2O2 + // d()/d[O2] + dqdci = -k_r * sc[7]; + J[13] += dqdci; // dwdot[O2]/d[O2] + J[18] += -2 * dqdci; // dwdot[HO2]/d[O2] + J[19] += dqdci; // dwdot[H2O2]/d[O2] + // d()/d[HO2] + dqdci = +k_f * 2.000000 * sc[6]; + J[73] += dqdci; // dwdot[O2]/d[HO2] + J[78] += -2 * dqdci; // dwdot[HO2]/d[HO2] + J[79] += dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = -k_r * sc[1]; + J[85] += dqdci; // dwdot[O2]/d[H2O2] + J[90] += -2 * dqdci; // dwdot[HO2]/d[H2O2] + J[91] += dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[133] += dqdT; // dwdot[O2]/dT + J[138] += -2 * dqdT; // dwdot[HO2]/dT + J[139] += dqdT; // dwdot[H2O2]/dT + + // reaction 16: H + H2O2 <=> H2O + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[7]; + k_f = 24100000 * exp(-(1997.77016324474) * invT); + dlnkfdT = (1997.77016324474) * invT2; + // reverse + phi_r = sc[2] * sc[5]; + Kc = exp(-g_RT[2] + g_RT[3] - g_RT[5] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[7]) + (h_RT[2] + h_RT[5])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[3] -= q; // H + wdot[5] += q; // OH + wdot[7] -= q; // H2O2 + // d()/d[H2O] + dqdci = -k_r * sc[5]; + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[27] -= dqdci; // dwdot[H]/d[H2O] + J[29] += dqdci; // dwdot[OH]/d[H2O] + J[31] -= dqdci; // dwdot[H2O2]/d[H2O] + // d()/d[H] + dqdci = +k_f * sc[7]; + J[38] += dqdci; // dwdot[H2O]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[41] += dqdci; // dwdot[OH]/d[H] + J[43] -= dqdci; // dwdot[H2O2]/d[H] + // d()/d[OH] + dqdci = -k_r * sc[2]; + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[63] -= dqdci; // dwdot[H]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[H2O2] + dqdci = +k_f * sc[3]; + J[86] += dqdci; // dwdot[H2O]/d[H2O2] + J[87] -= dqdci; // dwdot[H]/d[H2O2] + J[89] += dqdci; // dwdot[OH]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[137] += dqdT; // dwdot[OH]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 17: H + H2O2 <=> H2 + HO2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[3] * sc[7]; + k_f = 48200000 * exp(-(4000.57249314752) * invT); + dlnkfdT = (4000.57249314752) * invT2; + // reverse + phi_r = sc[0] * sc[6]; + Kc = exp(-g_RT[0] + g_RT[3] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[3] + h_RT[7]) + (h_RT[0] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[0] += q; // H2 + wdot[3] -= q; // H + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[H2] + dqdci = -k_r * sc[6]; + J[0] += dqdci; // dwdot[H2]/d[H2] + J[3] -= dqdci; // dwdot[H]/d[H2] + J[6] += dqdci; // dwdot[HO2]/d[H2] + J[7] -= dqdci; // dwdot[H2O2]/d[H2] + // d()/d[H] + dqdci = +k_f * sc[7]; + J[36] += dqdci; // dwdot[H2]/d[H] + J[39] -= dqdci; // dwdot[H]/d[H] + J[42] += dqdci; // dwdot[HO2]/d[H] + J[43] -= dqdci; // dwdot[H2O2]/d[H] + // d()/d[HO2] + dqdci = -k_r * sc[0]; + J[72] += dqdci; // dwdot[H2]/d[HO2] + J[75] -= dqdci; // dwdot[H]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[3]; + J[84] += dqdci; // dwdot[H2]/d[H2O2] + J[87] -= dqdci; // dwdot[H]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[132] += dqdT; // dwdot[H2]/dT + J[135] -= dqdT; // dwdot[H]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 18: H2O2 + O <=> HO2 + OH + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[4] * sc[7]; + k_f = 9.55 * exp(2 * logT - (1997.77016324474) * invT); + dlnkfdT = 2 * invT + (1997.77016324474) * invT2; + // reverse + phi_r = sc[5] * sc[6]; + Kc = exp(g_RT[4] - g_RT[5] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[4] + h_RT[7]) + (h_RT[5] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[4] -= q; // O + wdot[5] += q; // OH + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[O] + dqdci = +k_f * sc[7]; + J[52] -= dqdci; // dwdot[O]/d[O] + J[53] += dqdci; // dwdot[OH]/d[O] + J[54] += dqdci; // dwdot[HO2]/d[O] + J[55] -= dqdci; // dwdot[H2O2]/d[O] + // d()/d[OH] + dqdci = -k_r * sc[6]; + J[64] -= dqdci; // dwdot[O]/d[OH] + J[65] += dqdci; // dwdot[OH]/d[OH] + J[66] += dqdci; // dwdot[HO2]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[HO2] + dqdci = -k_r * sc[5]; + J[76] -= dqdci; // dwdot[O]/d[HO2] + J[77] += dqdci; // dwdot[OH]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[4]; + J[88] -= dqdci; // dwdot[O]/d[H2O2] + J[89] += dqdci; // dwdot[OH]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[136] -= dqdT; // dwdot[O]/dT + J[137] += dqdT; // dwdot[OH]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 19: H2O2 + OH <=> H2O + HO2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[5] * sc[7]; + k_f = 1000000; + dlnkfdT = 0.0; + // reverse + phi_r = sc[2] * sc[6]; + Kc = exp(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[5] + h_RT[7]) + (h_RT[2] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[5] -= q; // OH + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[H2O] + dqdci = -k_r * sc[6]; + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + J[30] += dqdci; // dwdot[HO2]/d[H2O] + J[31] -= dqdci; // dwdot[H2O2]/d[H2O] + // d()/d[OH] + dqdci = +k_f * sc[7]; + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + J[66] += dqdci; // dwdot[HO2]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[HO2] + dqdci = -k_r * sc[2]; + J[74] += dqdci; // dwdot[H2O]/d[HO2] + J[77] -= dqdci; // dwdot[OH]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[5]; + J[86] += dqdci; // dwdot[H2O]/d[H2O2] + J[89] -= dqdci; // dwdot[OH]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[137] -= dqdT; // dwdot[OH]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + // reaction 20: H2O2 + OH <=> H2O + HO2 + // a non-third-body and non-pressure-fall-off reaction + // forward + phi_f = sc[5] * sc[7]; + k_f = 580000000 * exp(-(4809.24167509571) * invT); + dlnkfdT = (4809.24167509571) * invT2; + // reverse + phi_r = sc[2] * sc[6]; + Kc = exp(-g_RT[2] + g_RT[5] - g_RT[6] + g_RT[7]); + k_r = k_f / Kc; + dlnKcdT = invT * (-(h_RT[5] + h_RT[7]) + (h_RT[2] + h_RT[6])); + dkrdT = (dlnkfdT - dlnKcdT) * k_r; + // rate of progress + q = k_f * phi_f - k_r * phi_r; + dqdT = (dlnkfdT * k_f * phi_f - dkrdT * phi_r); + // update wdot + wdot[2] += q; // H2O + wdot[5] -= q; // OH + wdot[6] += q; // HO2 + wdot[7] -= q; // H2O2 + // d()/d[H2O] + dqdci = -k_r * sc[6]; + J[26] += dqdci; // dwdot[H2O]/d[H2O] + J[29] -= dqdci; // dwdot[OH]/d[H2O] + J[30] += dqdci; // dwdot[HO2]/d[H2O] + J[31] -= dqdci; // dwdot[H2O2]/d[H2O] + // d()/d[OH] + dqdci = +k_f * sc[7]; + J[62] += dqdci; // dwdot[H2O]/d[OH] + J[65] -= dqdci; // dwdot[OH]/d[OH] + J[66] += dqdci; // dwdot[HO2]/d[OH] + J[67] -= dqdci; // dwdot[H2O2]/d[OH] + // d()/d[HO2] + dqdci = -k_r * sc[2]; + J[74] += dqdci; // dwdot[H2O]/d[HO2] + J[77] -= dqdci; // dwdot[OH]/d[HO2] + J[78] += dqdci; // dwdot[HO2]/d[HO2] + J[79] -= dqdci; // dwdot[H2O2]/d[HO2] + // d()/d[H2O2] + dqdci = +k_f * sc[5]; + J[86] += dqdci; // dwdot[H2O]/d[H2O2] + J[89] -= dqdci; // dwdot[OH]/d[H2O2] + J[90] += dqdci; // dwdot[HO2]/d[H2O2] + J[91] -= dqdci; // dwdot[H2O2]/d[H2O2] + // d()/dT + J[134] += dqdT; // dwdot[H2O]/dT + J[137] -= dqdT; // dwdot[OH]/dT + J[138] += dqdT; // dwdot[HO2]/dT + J[139] -= dqdT; // dwdot[H2O2]/dT + + amrex::Real c_R[11], dcRdT[11], e_RT[11]; + amrex::Real* eh_RT; + if (consP == 1) { + cp_R(c_R, T); + dcvpRdT(dcRdT, T); + eh_RT = &h_RT[0]; + } else { + cv_R(c_R, T); + dcvpRdT(dcRdT, T); + speciesInternalEnergy(e_RT, T); + eh_RT = &e_RT[0]; + } + + amrex::Real cmix = 0.0, ehmix = 0.0, dcmixdT = 0.0, dehmixdT = 0.0; + for (int k = 0; k < 11; ++k) { + cmix += c_R[k] * sc[k]; + dcmixdT += dcRdT[k] * sc[k]; + ehmix += eh_RT[k] * wdot[k]; + dehmixdT += invT * (c_R[k] - eh_RT[k]) * wdot[k] + eh_RT[k] * J[132 + k]; + } + + amrex::Real cmixinv = 1.0 / cmix; + amrex::Real tmp1 = ehmix * cmixinv; + amrex::Real tmp3 = cmixinv * T; + amrex::Real tmp2 = tmp1 * tmp3; + amrex::Real dehmixdc; + // dTdot/d[X] + for (int k = 0; k < 11; ++k) { + dehmixdc = 0.0; + for (int m = 0; m < 11; ++m) { + dehmixdc += eh_RT[m] * J[k * 12 + m]; + } + J[k * 12 + 11] = tmp2 * c_R[k] - tmp3 * dehmixdc; + } + // dTdot/dT + J[143] = -tmp1 + tmp2 * dcmixdT - tmp3 * dehmixdT; +#else + amrex::Abort(); +#endif +} + +// compute the reaction Jacobian +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +DWDOT( + amrex::Real* J, + const amrex::Real* sc, + const amrex::Real* Tp, + const int* consP) +{ + amrex::Real c[11]; + + for (int k = 0; k < 11; k++) { + c[k] = 1.e6 * sc[k]; + } + + aJacobian(J, c, *Tp, *consP); + + // dwdot[k]/dT + // dTdot/d[X] + for (int k = 0; k < 11; k++) { + J[132 + k] *= 1.e-6; + J[k * 12 + 11] *= 1.e6; + } +} + +// Transport function declarations + +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetLENIMC(int* LENIMC) +{ + *LENIMC = 47; +} + +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetLENRMC(int* LENRMC) +{ + *LENRMC = 2728; +} + +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetNO(int* NO) +{ + *NO = 4; +} + +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetKK(int* KK) +{ + *KK = 11; +} + +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetNLITE(int* NLITE) +{ + *NLITE = 3; +} + +// Patm in ergs/cm3 +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetPATM(amrex::Real* PATM) +{ + *PATM = 0.1013250000000000E+07; +} + +// the molecular weights in g/mol +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetWT(amrex::Real* WT) +{ + WT[0] = 2.01600000E+00; + WT[1] = 3.19980000E+01; + WT[2] = 1.80150000E+01; + WT[3] = 1.00800000E+00; + WT[4] = 1.59990000E+01; + WT[5] = 1.70070000E+01; + WT[6] = 3.30060000E+01; + WT[7] = 3.40140000E+01; + WT[8] = 2.80140000E+01; + WT[9] = 4.00260200E+00; + WT[10] = 4.40090000E+01; +} + +// the lennard-jones potential well depth eps/kb in K +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetEPS(amrex::Real* EPS) +{ + EPS[0] = 3.80000000E+01; + EPS[1] = 1.07400000E+02; + EPS[2] = 5.72400000E+02; + EPS[3] = 1.45000000E+02; + EPS[4] = 8.00000000E+01; + EPS[5] = 8.00000000E+01; + EPS[6] = 1.07400000E+02; + EPS[7] = 1.07400000E+02; + EPS[8] = 9.75300000E+01; + EPS[9] = 1.02000000E+01; + EPS[10] = 2.44000000E+02; +} + +// the lennard-jones collision diameter in Angstroms +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetSIG(amrex::Real* SIG) +{ + SIG[0] = 2.92000000E+00; + SIG[1] = 3.45800000E+00; + SIG[2] = 2.60500000E+00; + SIG[3] = 2.05000000E+00; + SIG[4] = 2.75000000E+00; + SIG[5] = 2.75000000E+00; + SIG[6] = 3.45800000E+00; + SIG[7] = 3.45800000E+00; + SIG[8] = 3.62100000E+00; + SIG[9] = 2.57600000E+00; + SIG[10] = 3.76300000E+00; +} + +// the dipole moment in Debye +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetDIP(amrex::Real* DIP) +{ + DIP[0] = 0.00000000E+00; + DIP[1] = 0.00000000E+00; + DIP[2] = 1.84400000E+00; + DIP[3] = 0.00000000E+00; + DIP[4] = 0.00000000E+00; + DIP[5] = 0.00000000E+00; + DIP[6] = 0.00000000E+00; + DIP[7] = 0.00000000E+00; + DIP[8] = 0.00000000E+00; + DIP[9] = 0.00000000E+00; + DIP[10] = 0.00000000E+00; +} + +// the polarizability in cubic Angstroms +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetPOL(amrex::Real* POL) +{ + POL[0] = 7.90000000E-01; + POL[1] = 1.60000000E+00; + POL[2] = 0.00000000E+00; + POL[3] = 0.00000000E+00; + POL[4] = 0.00000000E+00; + POL[5] = 0.00000000E+00; + POL[6] = 0.00000000E+00; + POL[7] = 0.00000000E+00; + POL[8] = 1.76000000E+00; + POL[9] = 0.00000000E+00; + POL[10] = 2.65000000E+00; +} + +// the rotational relaxation collision number at 298 K +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetZROT(amrex::Real* ZROT) +{ + ZROT[0] = 2.80000000E+02; + ZROT[1] = 3.80000000E+00; + ZROT[2] = 4.00000000E+00; + ZROT[3] = 0.00000000E+00; + ZROT[4] = 0.00000000E+00; + ZROT[5] = 0.00000000E+00; + ZROT[6] = 1.00000000E+00; + ZROT[7] = 3.80000000E+00; + ZROT[8] = 4.00000000E+00; + ZROT[9] = 0.00000000E+00; + ZROT[10] = 2.10000000E+00; +} + +// 0: monoatomic, 1: linear, 2: nonlinear +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetNLIN(int* NLIN) +{ + NLIN[0] = 1; + NLIN[1] = 1; + NLIN[2] = 2; + NLIN[3] = 0; + NLIN[4] = 0; + NLIN[5] = 1; + NLIN[6] = 2; + NLIN[7] = 2; + NLIN[8] = 1; + NLIN[9] = 0; + NLIN[10] = 1; +} + +// Poly fits for the viscosities, dim NO*KK +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetCOFETA(amrex::Real* COFETA) +{ + COFETA[0] = -1.37549291E+01; + COFETA[1] = 9.65530587E-01; + COFETA[2] = -4.45720114E-02; + COFETA[3] = 2.05871810E-03; + COFETA[4] = -1.68118998E+01; + COFETA[5] = 2.52362554E+00; + COFETA[6] = -2.49309128E-01; + COFETA[7] = 1.10211025E-02; + COFETA[8] = -1.17770995E+01; + COFETA[9] = -8.26744826E-01; + COFETA[10] = 3.39009392E-01; + COFETA[11] = -2.00674472E-02; + COFETA[12] = -1.98744352E+01; + COFETA[13] = 3.41660514E+00; + COFETA[14] = -3.63206306E-01; + COFETA[15] = 1.58671021E-02; + COFETA[16] = -1.48001711E+01; + COFETA[17] = 1.79491990E+00; + COFETA[18] = -1.54008440E-01; + COFETA[19] = 6.86719439E-03; + COFETA[20] = -1.47696217E+01; + COFETA[21] = 1.79491990E+00; + COFETA[22] = -1.54008440E-01; + COFETA[23] = 6.86719439E-03; + COFETA[24] = -1.67963918E+01; + COFETA[25] = 2.52362554E+00; + COFETA[26] = -2.49309128E-01; + COFETA[27] = 1.10211025E-02; + COFETA[28] = -1.67813504E+01; + COFETA[29] = 2.52362554E+00; + COFETA[30] = -2.49309128E-01; + COFETA[31] = 1.10211025E-02; + COFETA[32] = -1.62526676E+01; + COFETA[33] = 2.24839597E+00; + COFETA[34] = -2.13428438E-01; + COFETA[35] = 9.46192413E-03; + COFETA[36] = -1.11555215E+01; + COFETA[37] = 2.18772782E-01; + COFETA[38] = 5.60263799E-02; + COFETA[39] = -2.36018246E-03; + COFETA[40] = -2.36749638E+01; + COFETA[41] = 4.99775518E+00; + COFETA[42] = -5.52687718E-01; + COFETA[43] = 2.34353338E-02; +} + +// Poly fits for the conductivities, dim NO*KK +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetCOFLAM(amrex::Real* COFLAM) +{ + COFLAM[0] = 1.11035349E+01; + COFLAM[1] = -1.31883900E+00; + COFLAM[2] = 2.44042484E-01; + COFLAM[3] = -8.99836592E-03; + COFLAM[4] = -2.51298007E+00; + COFLAM[5] = 3.15166804E+00; + COFLAM[6] = -3.10009299E-01; + COFLAM[7] = 1.34523108E-02; + COFLAM[8] = 2.21730107E+01; + COFLAM[9] = -8.46933438E+00; + COFLAM[10] = 1.46153488E+00; + COFLAM[11] = -7.29500808E-02; + COFLAM[12] = -3.24554543E-01; + COFLAM[13] = 3.41660514E+00; + COFLAM[14] = -3.63206306E-01; + COFLAM[15] = 1.58671021E-02; + COFLAM[16] = 1.98515155E+00; + COFLAM[17] = 1.79491990E+00; + COFLAM[18] = -1.54008440E-01; + COFLAM[19] = 6.86719439E-03; + COFLAM[20] = 1.60618776E+01; + COFLAM[21] = -4.10626624E+00; + COFLAM[22] = 6.63570999E-01; + COFLAM[23] = -2.97906170E-02; + COFLAM[24] = 5.56033781E-01; + COFLAM[25] = 1.59073629E+00; + COFLAM[26] = -5.28054537E-02; + COFLAM[27] = 4.07605156E-04; + COFLAM[28] = 1.48802838E+00; + COFLAM[29] = 1.06175929E+00; + COFLAM[30] = 5.72199654E-02; + COFLAM[31] = -6.38393154E-03; + COFLAM[32] = 1.15507226E+01; + COFLAM[33] = -2.91453572E+00; + COFLAM[34] = 5.55045264E-01; + COFLAM[35] = -2.75173246E-02; + COFLAM[36] = 7.01538268E+00; + COFLAM[37] = 2.18772782E-01; + COFLAM[38] = 5.60263799E-02; + COFLAM[39] = -2.36018246E-03; + COFLAM[40] = -1.21375517E+01; + COFLAM[41] = 6.23624372E+00; + COFLAM[42] = -6.22471355E-01; + COFLAM[43] = 2.30613270E-02; +} + +// Poly fits for the diffusion coefficients, dim NO*KK*KK +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetCOFD(amrex::Real* COFD) +{ + COFD[0] = -1.02395385E+01; + COFD[1] = 2.15403244E+00; + COFD[2] = -6.97480266E-02; + COFD[3] = 3.23666871E-03; + COFD[4] = -1.15797897E+01; + COFD[5] = 2.43235504E+00; + COFD[6] = -1.02890179E-01; + COFD[7] = 4.52903603E-03; + COFD[8] = -1.53110597E+01; + COFD[9] = 3.37317428E+00; + COFD[10] = -2.24900439E-01; + COFD[11] = 9.81228151E-03; + COFD[12] = -1.68759075E+01; + COFD[13] = 4.49460341E+00; + COFD[14] = -3.64766179E-01; + COFD[15] = 1.56457173E-02; + COFD[16] = -2.10639926E+01; + COFD[17] = 5.50980703E+00; + COFD[18] = -4.78335492E-01; + COFD[19] = 1.98515434E-02; + COFD[20] = -1.31492509E+01; + COFD[21] = 1.48004045E+00; + COFD[22] = 1.60499956E-01; + COFD[23] = -1.19765871E-02; + COFD[24] = -1.11808845E+01; + COFD[25] = 2.66936727E+00; + COFD[26] = -1.34411514E-01; + COFD[27] = 5.92957488E-03; + COFD[28] = -1.43713019E+01; + COFD[29] = 3.70920439E+00; + COFD[30] = -2.67274113E-01; + COFD[31] = 1.15967481E-02; + COFD[32] = -1.93611201E+01; + COFD[33] = 5.51579726E+00; + COFD[34] = -4.76061961E-01; + COFD[35] = 1.96329391E-02; + COFD[36] = -1.43693219E+01; + COFD[37] = 4.03992999E+00; + COFD[38] = -3.08044800E-01; + COFD[39] = 1.32757775E-02; + COFD[40] = -1.06250314E+01; + COFD[41] = 2.15849701E+00; + COFD[42] = -6.53886401E-02; + COFD[43] = 2.81453370E-03; + COFD[44] = -1.40864784E+01; + COFD[45] = 3.07458927E+00; + COFD[46] = -1.86899591E-01; + COFD[47] = 8.19829781E-03; + COFD[48] = -1.91096700E+01; + COFD[49] = 5.02608697E+00; + COFD[50] = -4.26959993E-01; + COFD[51] = 1.80709910E-02; + COFD[52] = -1.31860264E+01; + COFD[53] = 3.38003453E+00; + COFD[54] = -2.25783856E-01; + COFD[55] = 9.85028660E-03; + COFD[56] = -1.29877255E+01; + COFD[57] = 2.80841511E+00; + COFD[58] = -1.52629888E-01; + COFD[59] = 6.72604927E-03; + COFD[60] = -1.06283588E+01; + COFD[61] = 2.15849701E+00; + COFD[62] = -6.53886401E-02; + COFD[63] = 2.81453370E-03; + COFD[64] = -1.41066358E+01; + COFD[65] = 3.07458927E+00; + COFD[66] = -1.86899591E-01; + COFD[67] = 8.19829781E-03; + COFD[68] = -1.91256173E+01; + COFD[69] = 5.02608697E+00; + COFD[70] = -4.26959993E-01; + COFD[71] = 1.80709910E-02; + COFD[72] = -1.31877859E+01; + COFD[73] = 3.38003453E+00; + COFD[74] = -2.25783856E-01; + COFD[75] = 9.85028660E-03; + COFD[76] = -1.30027669E+01; + COFD[77] = 2.80841511E+00; + COFD[78] = -1.52629888E-01; + COFD[79] = 6.72604927E-03; + COFD[80] = -1.30182749E+01; + COFD[81] = 2.80841511E+00; + COFD[82] = -1.52629888E-01; + COFD[83] = 6.72604927E-03; + COFD[84] = -1.15806955E+01; + COFD[85] = 2.43235504E+00; + COFD[86] = -1.02890179E-01; + COFD[87] = 4.52903603E-03; + COFD[88] = -1.53187536E+01; + COFD[89] = 3.37317428E+00; + COFD[90] = -2.24900439E-01; + COFD[91] = 9.81228151E-03; + COFD[92] = -2.04177394E+01; + COFD[93] = 5.31457079E+00; + COFD[94] = -4.58216496E-01; + COFD[95] = 1.91825910E-02; + COFD[96] = -1.43717684E+01; + COFD[97] = 3.70920439E+00; + COFD[98] = -2.67274113E-01; + COFD[99] = 1.15967481E-02; + COFD[100] = -1.40915944E+01; + COFD[101] = 3.07458927E+00; + COFD[102] = -1.86899591E-01; + COFD[103] = 8.19829781E-03; + COFD[104] = -1.41119635E+01; + COFD[105] = 3.07458927E+00; + COFD[106] = -1.86899591E-01; + COFD[107] = 8.19829781E-03; + COFD[108] = -1.53265677E+01; + COFD[109] = 3.37317428E+00; + COFD[110] = -2.24900439E-01; + COFD[111] = 9.81228151E-03; + COFD[112] = -1.15815492E+01; + COFD[113] = 2.43235504E+00; + COFD[114] = -1.02890179E-01; + COFD[115] = 4.52903603E-03; + COFD[116] = -1.53261011E+01; + COFD[117] = 3.37317428E+00; + COFD[118] = -2.24900439E-01; + COFD[119] = 9.81228151E-03; + COFD[120] = -2.04229988E+01; + COFD[121] = 5.31457079E+00; + COFD[122] = -4.58216496E-01; + COFD[123] = 1.91825910E-02; + COFD[124] = -1.43722077E+01; + COFD[125] = 3.70920439E+00; + COFD[126] = -2.67274113E-01; + COFD[127] = 1.15967481E-02; + COFD[128] = -1.40964555E+01; + COFD[129] = 3.07458927E+00; + COFD[130] = -1.86899591E-01; + COFD[131] = 8.19829781E-03; + COFD[132] = -1.41170278E+01; + COFD[133] = 3.07458927E+00; + COFD[134] = -1.86899591E-01; + COFD[135] = 8.19829781E-03; + COFD[136] = -1.53340319E+01; + COFD[137] = 3.37317428E+00; + COFD[138] = -2.24900439E-01; + COFD[139] = 9.81228151E-03; + COFD[140] = -1.53416091E+01; + COFD[141] = 3.37317428E+00; + COFD[142] = -2.24900439E-01; + COFD[143] = 9.81228151E-03; + COFD[144] = -1.13253618E+01; + COFD[145] = 2.31195095E+00; + COFD[146] = -8.63988037E-02; + COFD[147] = 3.77573452E-03; + COFD[148] = -1.50096252E+01; + COFD[149] = 3.25515933E+00; + COFD[150] = -2.09710110E-01; + COFD[151] = 9.15941830E-03; + COFD[152] = -2.08123331E+01; + COFD[153] = 5.42470175E+00; + COFD[154] = -4.69700438E-01; + COFD[155] = 1.95706912E-02; + COFD[156] = -1.40298991E+01; + COFD[157] = 3.55837688E+00; + COFD[158] = -2.47785790E-01; + COFD[159] = 1.07555332E-02; + COFD[160] = -1.38756380E+01; + COFD[161] = 2.98558426E+00; + COFD[162] = -1.75507216E-01; + COFD[163] = 7.71173691E-03; + COFD[164] = -1.38948654E+01; + COFD[165] = 2.98558426E+00; + COFD[166] = -1.75507216E-01; + COFD[167] = 7.71173691E-03; + COFD[168] = -1.50168047E+01; + COFD[169] = 3.25515933E+00; + COFD[170] = -2.09710110E-01; + COFD[171] = 9.15941830E-03; + COFD[172] = -1.50236540E+01; + COFD[173] = 3.25515933E+00; + COFD[174] = -2.09710110E-01; + COFD[175] = 9.15941830E-03; + COFD[176] = -1.47639411E+01; + COFD[177] = 3.15955654E+00; + COFD[178] = -1.97590757E-01; + COFD[179] = 8.64692156E-03; + COFD[180] = -9.86430173E+00; + COFD[181] = 2.05348746E+00; + COFD[182] = -5.90289007E-02; + COFD[183] = 2.89596157E-03; + COFD[184] = -1.03310320E+01; + COFD[185] = 1.90522472E+00; + COFD[186] = -3.44812795E-02; + COFD[187] = 1.57640018E-03; + COFD[188] = -1.21950641E+01; + COFD[189] = 2.72222246E+00; + COFD[190] = -1.41335602E-01; + COFD[191] = 6.23222872E-03; + COFD[192] = -9.71339666E+00; + COFD[193] = 2.17561180E+00; + COFD[194] = -7.28270090E-02; + COFD[195] = 3.38302182E-03; + COFD[196] = -9.70779235E+00; + COFD[197] = 1.77912272E+00; + COFD[198] = -1.67349571E-02; + COFD[199] = 7.45446845E-04; + COFD[200] = -9.71375815E+00; + COFD[201] = 1.77912272E+00; + COFD[202] = -1.67349571E-02; + COFD[203] = 7.45446845E-04; + COFD[204] = -1.03327327E+01; + COFD[205] = 1.90522472E+00; + COFD[206] = -3.44812795E-02; + COFD[207] = 1.57640018E-03; + COFD[208] = -1.03343378E+01; + COFD[209] = 1.90522472E+00; + COFD[210] = -3.44812795E-02; + COFD[211] = 1.57640018E-03; + COFD[212] = -1.01976439E+01; + COFD[213] = 1.83188320E+00; + COFD[214] = -2.40547456E-02; + COFD[215] = 1.08399898E-03; + COFD[216] = -7.72963456E+00; + COFD[217] = 1.13864728E+00; + COFD[218] = 7.22991035E-02; + COFD[219] = -3.32491895E-03; + COFD[220] = -1.35545391E+01; + COFD[221] = 3.13878730E+00; + COFD[222] = -1.94980335E-01; + COFD[223] = 8.53744486E-03; + COFD[224] = -1.81197250E+01; + COFD[225] = 4.33684042E+00; + COFD[226] = -3.44981265E-01; + COFD[227] = 1.48142449E-02; + COFD[228] = -2.12021420E+01; + COFD[229] = 5.20775027E+00; + COFD[230] = -4.07348285E-01; + COFD[231] = 1.55473262E-02; + COFD[232] = -1.72994129E+01; + COFD[233] = 4.71931868E+00; + COFD[234] = -3.91258152E-01; + COFD[235] = 1.66866639E-02; + COFD[236] = -1.67115471E+01; + COFD[237] = 3.98859394E+00; + COFD[238] = -3.02316219E-01; + COFD[239] = 1.30661099E-02; + COFD[240] = -1.67337674E+01; + COFD[241] = 3.98859394E+00; + COFD[242] = -3.02316219E-01; + COFD[243] = 1.30661099E-02; + COFD[244] = -1.81286456E+01; + COFD[245] = 4.33684042E+00; + COFD[246] = -3.44981265E-01; + COFD[247] = 1.48142449E-02; + COFD[248] = -1.81371853E+01; + COFD[249] = 4.33684042E+00; + COFD[250] = -3.44981265E-01; + COFD[251] = 1.48142449E-02; + COFD[252] = -1.77350630E+01; + COFD[253] = 4.19328271E+00; + COFD[254] = -3.26911461E-01; + COFD[255] = 1.40520357E-02; + COFD[256] = -1.09328513E+01; + COFD[257] = 2.05651569E+00; + COFD[258] = -5.19591463E-02; + COFD[259] = 2.22384771E-03; + COFD[260] = -2.10907633E+01; + COFD[261] = 5.29211327E+00; + COFD[262] = -4.56068366E-01; + COFD[263] = 1.91195062E-02; +} + +// List of specs with small weight, dim NLITE +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetKTDIF(int* KTDIF) +{ + KTDIF[0] = 0; + KTDIF[1] = 3; + KTDIF[2] = 9; +} + +// Poly fits for thermal diff ratios, dim NO*NLITE*KK +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +egtransetCOFTD(amrex::Real* COFTD) +{ + COFTD[0] = 0.00000000E+00; + COFTD[1] = 0.00000000E+00; + COFTD[2] = 0.00000000E+00; + COFTD[3] = 0.00000000E+00; + COFTD[4] = 4.42736017E-01; + COFTD[5] = 7.11765887E-05; + COFTD[6] = -3.84765396E-08; + COFTD[7] = 6.86318682E-12; + COFTD[8] = 6.02021050E-02; + COFTD[9] = 5.61555733E-04; + COFTD[10] = -2.55370065E-07; + COFTD[11] = 3.63385926E-11; + COFTD[12] = -1.52534742E-01; + COFTD[13] = -5.46404022E-05; + COFTD[14] = 2.93412470E-08; + COFTD[15] = -4.87091914E-12; + COFTD[16] = 4.15577509E-01; + COFTD[17] = 1.09736860E-05; + COFTD[18] = -3.96016410E-09; + COFTD[19] = 1.14412838E-12; + COFTD[20] = 4.21927217E-01; + COFTD[21] = 1.11413555E-05; + COFTD[22] = -4.02067239E-09; + COFTD[23] = 1.16160979E-12; + COFTD[24] = 4.44449675E-01; + COFTD[25] = 7.14520855E-05; + COFTD[26] = -3.86254673E-08; + COFTD[27] = 6.88975155E-12; + COFTD[28] = 4.46067449E-01; + COFTD[29] = 7.17121674E-05; + COFTD[30] = -3.87660620E-08; + COFTD[31] = 6.91482989E-12; + COFTD[32] = 4.45261429E-01; + COFTD[33] = 4.94696577E-05; + COFTD[34] = -2.63023124E-08; + COFTD[35] = 4.90305626E-12; + COFTD[36] = 1.61607281E-01; + COFTD[37] = 4.74136612E-05; + COFTD[38] = -1.67108646E-08; + COFTD[39] = -1.88974661E-12; + COFTD[40] = 3.25740914E-01; + COFTD[41] = 3.03631979E-04; + COFTD[42] = -1.55289598E-07; + COFTD[43] = 2.41465297E-11; + COFTD[44] = 1.52534742E-01; + COFTD[45] = 5.46404022E-05; + COFTD[46] = -2.93412470E-08; + COFTD[47] = 4.87091914E-12; + COFTD[48] = 2.20482081E-01; + COFTD[49] = 4.80162630E-04; + COFTD[50] = -2.32927140E-07; + COFTD[51] = 3.46469239E-11; + COFTD[52] = -1.41882969E-01; + COFTD[53] = 7.66554625E-04; + COFTD[54] = -3.06548330E-07; + COFTD[55] = 4.02957302E-11; + COFTD[56] = 0.00000000E+00; + COFTD[57] = 0.00000000E+00; + COFTD[58] = 0.00000000E+00; + COFTD[59] = 0.00000000E+00; + COFTD[60] = 2.70008280E-01; + COFTD[61] = 3.61552588E-04; + COFTD[62] = -1.80743499E-07; + COFTD[63] = 2.75319341E-11; + COFTD[64] = 2.72039997E-01; + COFTD[65] = 3.64273144E-04; + COFTD[66] = -1.82103531E-07; + COFTD[67] = 2.77391022E-11; + COFTD[68] = 2.20907136E-01; + COFTD[69] = 4.81088308E-04; + COFTD[70] = -2.33376187E-07; + COFTD[71] = 3.47137178E-11; + COFTD[72] = 2.21307723E-01; + COFTD[73] = 4.81960701E-04; + COFTD[74] = -2.33799385E-07; + COFTD[75] = 3.47766667E-11; + COFTD[76] = 2.40744276E-01; + COFTD[77] = 4.45343183E-04; + COFTD[78] = -2.18173742E-07; + COFTD[79] = 3.26958310E-11; + COFTD[80] = 3.40757071E-01; + COFTD[81] = -4.04051397E-05; + COFTD[82] = 3.27874373E-08; + COFTD[83] = -6.27083944E-12; + COFTD[84] = 2.44368810E-02; + COFTD[85] = 7.18240808E-04; + COFTD[86] = -3.19717751E-07; + COFTD[87] = 4.48827629E-11; + COFTD[88] = -1.61607281E-01; + COFTD[89] = -4.74136612E-05; + COFTD[90] = 1.67108646E-08; + COFTD[91] = 1.88974661E-12; + COFTD[92] = 4.40217977E-01; + COFTD[93] = -4.83714278E-05; + COFTD[94] = 4.66085877E-08; + COFTD[95] = -1.02767764E-11; + COFTD[96] = 2.84980924E-01; + COFTD[97] = 1.15458959E-04; + COFTD[98] = -6.17192280E-08; + COFTD[99] = 1.01503292E-11; + COFTD[100] = -3.40757071E-01; + COFTD[101] = 4.04051397E-05; + COFTD[102] = -3.27874373E-08; + COFTD[103] = 6.27083944E-12; + COFTD[104] = 3.31583426E-01; + COFTD[105] = -1.96385405E-05; + COFTD[106] = 3.02384712E-08; + COFTD[107] = -8.44986516E-12; + COFTD[108] = 3.42199332E-01; + COFTD[109] = -2.02672839E-05; + COFTD[110] = 3.12065798E-08; + COFTD[111] = -8.72039429E-12; + COFTD[112] = 4.43646534E-01; + COFTD[113] = -4.87481598E-05; + COFTD[114] = 4.69715901E-08; + COFTD[115] = -1.03568152E-11; + COFTD[116] = 4.46893277E-01; + COFTD[117] = -4.91049140E-05; + COFTD[118] = 4.73153427E-08; + COFTD[119] = -1.04326096E-11; + COFTD[120] = 4.22012509E-01; + COFTD[121] = -4.14044861E-05; + COFTD[122] = 4.38754291E-08; + COFTD[123] = -1.02860874E-11; + COFTD[124] = 0.00000000E+00; + COFTD[125] = 0.00000000E+00; + COFTD[126] = 0.00000000E+00; + COFTD[127] = 0.00000000E+00; + COFTD[128] = 4.59661412E-01; + COFTD[129] = -1.74770160E-05; + COFTD[130] = 1.42887540E-08; + COFTD[131] = -2.03609880E-12; +} + +// compute the critical parameters for each species +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +GET_CRITPARAMS( + amrex::Real* Tci, amrex::Real* ai, amrex::Real* bi, amrex::Real* acentric_i) +{ + + amrex::Real EPS[11]; + amrex::Real SIG[11]; + amrex::Real wt[11]; + amrex::Real Rcst = 83.144598; // in bar [CGS] ! + amrex::Real avogadro = 6.02214199e23; + amrex::Real boltzmann = 1.3806503e-16; // we work in CGS + + egtransetEPS(EPS); + egtransetSIG(SIG); + get_mw(wt); + + // species 0: H2 + // Imported from NIST + Tci[0] = 33.145000; + ai[0] = 1e6 * 0.42748 * Rcst * Rcst * Tci[0] * Tci[0] / + (2.015880 * 2.015880 * 12.964000); + bi[0] = 0.08664 * Rcst * Tci[0] / (2.015880 * 12.964000); + acentric_i[0] = -0.219000; + + // species 1: O2 + // Imported from NIST + Tci[1] = 154.581000; + ai[1] = 1e6 * 0.42748 * Rcst * Rcst * Tci[1] * Tci[1] / + (31.998800 * 31.998800 * 50.430466); + bi[1] = 0.08664 * Rcst * Tci[1] / (31.998800 * 50.430466); + acentric_i[1] = 0.022200; + + // species 2: H2O + // Imported from NIST + Tci[2] = 647.096000; + ai[2] = 1e6 * 0.42748 * Rcst * Rcst * Tci[2] * Tci[2] / + (18.015340 * 18.015340 * 220.640000); + bi[2] = 0.08664 * Rcst * Tci[2] / (18.015340 * 220.640000); + acentric_i[2] = 0.344300; + + // species 3: H + Tci[3] = 1.316 * EPS[3]; + ai[3] = (5.55 * avogadro * avogadro * EPS[3] * boltzmann * 1e-24 * SIG[3] * + SIG[3] * SIG[3]) / + (wt[3] * wt[3]); + bi[3] = 0.855 * avogadro * 1e-24 * SIG[3] * SIG[3] * SIG[3] / (wt[3]); + acentric_i[3] = 0.0; + + // species 4: O + Tci[4] = 1.316 * EPS[4]; + ai[4] = (5.55 * avogadro * avogadro * EPS[4] * boltzmann * 1e-24 * SIG[4] * + SIG[4] * SIG[4]) / + (wt[4] * wt[4]); + bi[4] = 0.855 * avogadro * 1e-24 * SIG[4] * SIG[4] * SIG[4] / (wt[4]); + acentric_i[4] = 0.0; + + // species 5: OH + Tci[5] = 1.316 * EPS[5]; + ai[5] = (5.55 * avogadro * avogadro * EPS[5] * boltzmann * 1e-24 * SIG[5] * + SIG[5] * SIG[5]) / + (wt[5] * wt[5]); + bi[5] = 0.855 * avogadro * 1e-24 * SIG[5] * SIG[5] * SIG[5] / (wt[5]); + acentric_i[5] = 0.0; + + // species 6: HO2 + Tci[6] = 1.316 * EPS[6]; + ai[6] = (5.55 * avogadro * avogadro * EPS[6] * boltzmann * 1e-24 * SIG[6] * + SIG[6] * SIG[6]) / + (wt[6] * wt[6]); + bi[6] = 0.855 * avogadro * 1e-24 * SIG[6] * SIG[6] * SIG[6] / (wt[6]); + acentric_i[6] = 0.0; + + // species 7: H2O2 + Tci[7] = 1.316 * EPS[7]; + ai[7] = (5.55 * avogadro * avogadro * EPS[7] * boltzmann * 1e-24 * SIG[7] * + SIG[7] * SIG[7]) / + (wt[7] * wt[7]); + bi[7] = 0.855 * avogadro * 1e-24 * SIG[7] * SIG[7] * SIG[7] / (wt[7]); + acentric_i[7] = 0.0; + + // species 8: N2 + // Imported from NIST + Tci[8] = 126.192000; + ai[8] = 1e6 * 0.42748 * Rcst * Rcst * Tci[8] * Tci[8] / + (28.013400 * 28.013400 * 33.958000); + bi[8] = 0.08664 * Rcst * Tci[8] / (28.013400 * 33.958000); + acentric_i[8] = 0.037200; + + // species 9: HE + Tci[9] = 1.316 * EPS[9]; + ai[9] = (5.55 * avogadro * avogadro * EPS[9] * boltzmann * 1e-24 * SIG[9] * + SIG[9] * SIG[9]) / + (wt[9] * wt[9]); + bi[9] = 0.855 * avogadro * 1e-24 * SIG[9] * SIG[9] * SIG[9] / (wt[9]); + acentric_i[9] = 0.0; + + // species 10: CO2 + // Imported from NIST + Tci[10] = 304.120000; + ai[10] = 1e6 * 0.42748 * Rcst * Rcst * Tci[10] * Tci[10] / + (44.009950 * 44.009950 * 73.740000); + bi[10] = 0.08664 * Rcst * Tci[10] / (44.009950 * 73.740000); + acentric_i[10] = 0.225000; +} + +// compute the critical parameter quantities for each species for SRK +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +GET_CRITPARAMS_SRK( + amrex::Real* sqrtOneOverTc, + amrex::Real* sqrtAsti, + amrex::Real* Bi, + amrex::Real* Fomega) +{ + + // species 0: H2 + // Imported from NIST + sqrtOneOverTc[0] = 1.7369646834812e-01; + sqrtAsti[0] = 2.4824229305911e+05; + Bi[0] = 9.1362254169923e+00; + Fomega[0] = 1.3798618890700e-01; + + // species 1: O2 + // Imported from NIST + sqrtOneOverTc[1] = 8.0430717653241e-02; + sqrtAsti[1] = 3.6980081924740e+04; + Bi[1] = 6.9005216444999e-01; + Fomega[1] = 5.1945301904908e-01; + + // species 2: H2O + // Imported from NIST + sqrtOneOverTc[2] = 3.9311140369715e-02; + sqrtAsti[2] = 1.3145468419592e+05; + Bi[2] = 1.1727204136223e+00; + Fomega[2] = 1.0013577274636e+00; + + // species 3: H + // Computed from Lennard-Jones + sqrtOneOverTc[3] = 7.2391579785311e-02; + sqrtAsti[3] = 5.8451221185793e+05; + Bi[3] = 4.4006634563410e+00; + Fomega[3] = 4.8508000000000e-01; + + // species 4: O + // Computed from Lennard-Jones + sqrtOneOverTc[4] = 9.7460146948181e-02; + sqrtAsti[4] = 4.2500156012386e+04; + Bi[4] = 6.6930234851885e-01; + Fomega[4] = 4.8508000000000e-01; + + // species 5: OH + // Computed from Lennard-Jones + sqrtOneOverTc[5] = 9.7460146948181e-02; + sqrtAsti[5] = 3.9981183985545e+04; + Bi[5] = 6.2963299076575e-01; + Fomega[5] = 4.8508000000000e-01; + + // species 6: HO2 + // Computed from Lennard-Jones + sqrtOneOverTc[6] = 8.4114315417892e-02; + sqrtAsti[6] = 3.3657825710980e+04; + Bi[6] = 6.4505861132042e-01; + Fomega[6] = 4.8508000000000e-01; + + // species 7: H2O2 + // Computed from Lennard-Jones + sqrtOneOverTc[7] = 8.4114315417892e-02; + sqrtAsti[7] = 3.2660380884830e+04; + Bi[7] = 6.2594239211036e-01; + Fomega[7] = 4.8508000000000e-01; + + // species 8: N2 + // Imported from NIST + sqrtOneOverTc[8] = 8.9019282240563e-02; + sqrtAsti[8] = 4.2022983929562e+04; + Bi[8] = 9.5560052221563e-01; + Fomega[8] = 5.4259343186608e-01; + + // species 9: HE + // Computed from Lennard-Jones + sqrtOneOverTc[9] = 2.7294300551596e-01; + sqrtAsti[9] = 5.4994061413731e+04; + Bi[9] = 2.1989344021800e+00; + Fomega[9] = 4.8508000000000e-01; + + // species 10: CO2 + // Imported from NIST + sqrtOneOverTc[10] = 5.7342616962522e-02; + sqrtAsti[10] = 4.3745610142919e+04; + Bi[10] = 6.7506167841745e-01; + Fomega[10] = 8.2653709187500e-01; +} + +// gauss-jordan solver external routine +// Replace this routine with the one generated by the Gauss Jordan solver of DW +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +sgjsolve(amrex::Real* /*A*/, amrex::Real* /*x*/, amrex::Real* /*b*/) +{ + amrex::Abort("sgjsolve not implemented, choose a different solver "); +} + +// Replace this routine with the one generated by the Gauss Jordan solver of DW +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void +sgjsolve_simplified(amrex::Real* /*A*/, amrex::Real* /*x*/, amrex::Real* /*b*/) +{ + amrex::Abort( + "sgjsolve_simplified not implemented, choose a different solver "); +} + +#endif diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.cpp b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.cpp new file mode 100644 index 000000000..9bbeb7228 --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.cpp @@ -0,0 +1,481 @@ +#include "mechanism.H" +const int rmap[NUM_REACTIONS] = {8, 15, 4, 5, 6, 7, 0, 1, 2, 3, 9, + 10, 11, 12, 13, 14, 16, 17, 18, 19, 20}; + +// Returns 0-based map of reaction order +void +GET_RMAP(int* _rmap) +{ + for (int j = 0; j < NUM_REACTIONS; ++j) { + _rmap[j] = rmap[j]; + } +} + +// Returns a count of gas species in a gas reaction, and their indices +// and stoichiometric coefficients. (Eq 50) +void +CKINU(const int i, int& nspec, int ki[], int nu[]) +{ + const int ns[NUM_GAS_REACTIONS] = {4, 4, 4, 3, 2, 2, 3, 3, 3, 4, 3, + 4, 4, 3, 3, 2, 4, 4, 4, 4, 4}; + const int kiv[NUM_GAS_REACTIONS * 4] = { + 3, 1, 4, 5, 0, 4, 3, 5, 0, 5, 3, 2, 2, 4, 5, 0, 0, 3, 0, 0, 4, + 1, 0, 0, 3, 4, 5, 0, 3, 5, 2, 0, 3, 1, 6, 0, 3, 6, 0, 1, 3, 6, + 5, 0, 6, 4, 1, 5, 6, 5, 2, 1, 6, 7, 1, 0, 6, 7, 1, 0, 7, 5, 0, + 0, 3, 7, 2, 5, 3, 7, 0, 6, 7, 4, 6, 5, 7, 5, 2, 6, 7, 5, 2, 6}; + const int nuv[NUM_GAS_REACTIONS * 4] = { + -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 2, 0, -1, + 2, 0, 0, -2, 1, 0, 0, -1, -1, 1, 0, -1, -1, 1, 0, -1, -1, + 1, 0, -1, -1, 1, 1, -1, -1, 2, 0, -1, -1, 1, 1, -1, -1, 1, + 1, -2, 1, 1, 0, -2, 1, 1, 0, -1, 2, 0, 0, -1, -1, 1, 1, + -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1}; + if (i < 1) { + // Return max num species per reaction + nspec = 4; + } else { + if (i > NUM_GAS_REACTIONS) { + nspec = -1; + } else { + nspec = ns[i - 1]; + for (int j = 0; j < nspec; ++j) { + ki[j] = kiv[(i - 1) * 4 + j] + 1; + nu[j] = nuv[(i - 1) * 4 + j]; + } + } + } +} + +// Returns the progress rates of each reactions +// Given P, T, and mole fractions +void +CKKFKR( + const amrex::Real P, + const amrex::Real T, + const amrex::Real x[], + amrex::Real q_f[], + amrex::Real q_r[]) +{ + amrex::Real c[11]; // temporary storage + amrex::Real PORT = + 1e6 * P / (8.31446261815324e+07 * T); // 1e6 * P/RT so c goes to SI units + + // Compute conversion, see Eq 10 + for (int id = 0; id < 11; ++id) { + c[id] = x[id] * PORT; + } + + // convert to chemkin units + progressRateFR(q_f, q_r, c, T); + + // convert to chemkin units + for (int id = 0; id < 21; ++id) { + q_f[id] *= 1.0e-6; + q_r[id] *= 1.0e-6; + } +} + +// compute the progress rate for each reaction +// USES progressRate : todo switch to GPU +void +progressRateFR( + amrex::Real* q_f, amrex::Real* q_r, amrex::Real* sc, amrex::Real T) +{ + const amrex::Real invT = 1.0 / T; + const amrex::Real logT = log(T); + // compute the Gibbs free energy + amrex::Real g_RT[11]; + gibbs(g_RT, T); + + amrex::Real sc_qss[1]; + comp_qfqr(q_f, q_r, sc, sc_qss, T, invT, logT); +} + +// save atomic weights into array +void +atomicWeight(amrex::Real* awt) +{ + awt[0] = 1.008000; // H + awt[1] = 15.999000; // O + awt[2] = 14.007000; // N + awt[3] = 12.011000; // C + awt[4] = 4.002602; // He +} + +// get atomic weight for all elements +void +CKAWT(amrex::Real* awt) +{ + atomicWeight(awt); +} + +// Returns the elemental composition +// of the speciesi (mdim is num of elements) +void +CKNCF(int* ncf) +{ + int kd = 5; + // Zero ncf + for (int id = 0; id < kd * 11; ++id) { + ncf[id] = 0; + } + + // H2 + ncf[0 * kd + 0] = 2; // H + + // O2 + ncf[1 * kd + 1] = 2; // O + + // H2O + ncf[2 * kd + 0] = 2; // H + ncf[2 * kd + 1] = 1; // O + + // H + ncf[3 * kd + 0] = 1; // H + + // O + ncf[4 * kd + 1] = 1; // O + + // OH + ncf[5 * kd + 0] = 1; // H + ncf[5 * kd + 1] = 1; // O + + // HO2 + ncf[6 * kd + 0] = 1; // H + ncf[6 * kd + 1] = 2; // O + + // H2O2 + ncf[7 * kd + 0] = 2; // H + ncf[7 * kd + 1] = 2; // O + + // N2 + ncf[8 * kd + 2] = 2; // N + + // HE + ncf[9 * kd + 4] = 1; // He + + // CO2 + ncf[10 * kd + 3] = 1; // C + ncf[10 * kd + 1] = 2; // O +} + +// Returns the vector of strings of element names +void +CKSYME_STR(amrex::Vector& ename) +{ + ename.resize(5); + ename[0] = "H"; + ename[1] = "O"; + ename[2] = "N"; + ename[3] = "C"; + ename[4] = "He"; +} + +// Returns the vector of strings of species names +void +CKSYMS_STR(amrex::Vector& kname) +{ + kname.resize(11); + kname[0] = "H2"; + kname[1] = "O2"; + kname[2] = "H2O"; + kname[3] = "H"; + kname[4] = "O"; + kname[5] = "OH"; + kname[6] = "HO2"; + kname[7] = "H2O2"; + kname[8] = "N2"; + kname[9] = "HE"; + kname[10] = "CO2"; +} + +// compute the sparsity pattern of the chemistry Jacobian +void +SPARSITY_INFO(int* nJdata, const int* consP, int NCELLS) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian(Jac.data(), conc.data(), 1500.0, *consP); + + int nJdata_tmp = 0; + for (int k = 0; k < 12; k++) { + for (int l = 0; l < 12; l++) { + if (Jac[12 * k + l] != 0.0) { + nJdata_tmp = nJdata_tmp + 1; + } + } + } + + *nJdata = NCELLS * nJdata_tmp; +} + +// compute the sparsity pattern of the system Jacobian +void +SPARSITY_INFO_SYST(int* nJdata, const int* consP, int NCELLS) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian(Jac.data(), conc.data(), 1500.0, *consP); + + int nJdata_tmp = 0; + for (int k = 0; k < 12; k++) { + for (int l = 0; l < 12; l++) { + if (k == l) { + nJdata_tmp = nJdata_tmp + 1; + } else { + if (Jac[12 * k + l] != 0.0) { + nJdata_tmp = nJdata_tmp + 1; + } + } + } + } + + *nJdata = NCELLS * nJdata_tmp; +} + +// compute the sparsity pattern of the simplified (for preconditioning) system +// Jacobian +void +SPARSITY_INFO_SYST_SIMPLIFIED(int* nJdata, const int* consP) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian_precond(Jac.data(), conc.data(), 1500.0, *consP); + + int nJdata_tmp = 0; + for (int k = 0; k < 12; k++) { + for (int l = 0; l < 12; l++) { + if (k == l) { + nJdata_tmp = nJdata_tmp + 1; + } else { + if (Jac[12 * k + l] != 0.0) { + nJdata_tmp = nJdata_tmp + 1; + } + } + } + } + + nJdata[0] = nJdata_tmp; +} + +// compute the sparsity pattern of the chemistry Jacobian in CSC format -- base +// 0 +void +SPARSITY_PREPROC_CSC(int* rowVals, int* colPtrs, const int* consP, int NCELLS) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian(Jac.data(), conc.data(), 1500.0, *consP); + + colPtrs[0] = 0; + int nJdata_tmp = 0; + for (int nc = 0; nc < NCELLS; nc++) { + int offset_row = nc * 12; + int offset_col = nc * 12; + for (int k = 0; k < 12; k++) { + for (int l = 0; l < 12; l++) { + if (Jac[12 * k + l] != 0.0) { + rowVals[nJdata_tmp] = l + offset_row; + nJdata_tmp = nJdata_tmp + 1; + } + } + colPtrs[offset_col + (k + 1)] = nJdata_tmp; + } + } +} + +// compute the sparsity pattern of the chemistry Jacobian in CSR format -- base +// 0 +void +SPARSITY_PREPROC_CSR( + int* colVals, int* rowPtrs, const int* consP, int NCELLS, int base) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian(Jac.data(), conc.data(), 1500.0, *consP); + + if (base == 1) { + rowPtrs[0] = 1; + int nJdata_tmp = 1; + for (int nc = 0; nc < NCELLS; nc++) { + int offset = nc * 12; + for (int l = 0; l < 12; l++) { + for (int k = 0; k < 12; k++) { + if (Jac[12 * k + l] != 0.0) { + colVals[nJdata_tmp - 1] = k + 1 + offset; + nJdata_tmp = nJdata_tmp + 1; + } + } + rowPtrs[offset + (l + 1)] = nJdata_tmp; + } + } + } else { + rowPtrs[0] = 0; + int nJdata_tmp = 0; + for (int nc = 0; nc < NCELLS; nc++) { + int offset = nc * 12; + for (int l = 0; l < 12; l++) { + for (int k = 0; k < 12; k++) { + if (Jac[12 * k + l] != 0.0) { + colVals[nJdata_tmp] = k + offset; + nJdata_tmp = nJdata_tmp + 1; + } + } + rowPtrs[offset + (l + 1)] = nJdata_tmp; + } + } + } +} + +// compute the sparsity pattern of the system Jacobian +// CSR format BASE is user choice +void +SPARSITY_PREPROC_SYST_CSR( + int* colVals, int* rowPtr, const int* consP, int NCELLS, int base) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian(Jac.data(), conc.data(), 1500.0, *consP); + + if (base == 1) { + rowPtr[0] = 1; + int nJdata_tmp = 1; + for (int nc = 0; nc < NCELLS; nc++) { + int offset = nc * 12; + for (int l = 0; l < 12; l++) { + for (int k = 0; k < 12; k++) { + if (k == l) { + colVals[nJdata_tmp - 1] = l + 1 + offset; + nJdata_tmp = nJdata_tmp + 1; + } else { + if (Jac[12 * k + l] != 0.0) { + colVals[nJdata_tmp - 1] = k + 1 + offset; + nJdata_tmp = nJdata_tmp + 1; + } + } + } + rowPtr[offset + (l + 1)] = nJdata_tmp; + } + } + } else { + rowPtr[0] = 0; + int nJdata_tmp = 0; + for (int nc = 0; nc < NCELLS; nc++) { + int offset = nc * 12; + for (int l = 0; l < 12; l++) { + for (int k = 0; k < 12; k++) { + if (k == l) { + colVals[nJdata_tmp] = l + offset; + nJdata_tmp = nJdata_tmp + 1; + } else { + if (Jac[12 * k + l] != 0.0) { + colVals[nJdata_tmp] = k + offset; + nJdata_tmp = nJdata_tmp + 1; + } + } + } + rowPtr[offset + (l + 1)] = nJdata_tmp; + } + } + } +} + +// compute the sparsity pattern of the simplified (for precond) system Jacobian +// on CPU BASE 0 +void +SPARSITY_PREPROC_SYST_SIMPLIFIED_CSC( + int* rowVals, int* colPtrs, int* indx, const int* consP) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian_precond(Jac.data(), conc.data(), 1500.0, *consP); + + colPtrs[0] = 0; + int nJdata_tmp = 0; + for (int k = 0; k < 12; k++) { + for (int l = 0; l < 12; l++) { + if (k == l) { + rowVals[nJdata_tmp] = l; + indx[nJdata_tmp] = 12 * k + l; + nJdata_tmp = nJdata_tmp + 1; + } else { + if (Jac[12 * k + l] != 0.0) { + rowVals[nJdata_tmp] = l; + indx[nJdata_tmp] = 12 * k + l; + nJdata_tmp = nJdata_tmp + 1; + } + } + } + colPtrs[k + 1] = nJdata_tmp; + } +} + +// compute the sparsity pattern of the simplified (for precond) system Jacobian +// CSR format BASE is under choice +void +SPARSITY_PREPROC_SYST_SIMPLIFIED_CSR( + int* colVals, int* rowPtr, const int* consP, int base) +{ + amrex::GpuArray Jac = {0.0}; + amrex::GpuArray conc = {0.0}; + for (int n = 0; n < 11; n++) { + conc[n] = 1.0 / 11.000000; + } + aJacobian_precond(Jac.data(), conc.data(), 1500.0, *consP); + + if (base == 1) { + rowPtr[0] = 1; + int nJdata_tmp = 1; + for (int l = 0; l < 12; l++) { + for (int k = 0; k < 12; k++) { + if (k == l) { + colVals[nJdata_tmp - 1] = l + 1; + nJdata_tmp = nJdata_tmp + 1; + } else { + if (Jac[12 * k + l] != 0.0) { + colVals[nJdata_tmp - 1] = k + 1; + nJdata_tmp = nJdata_tmp + 1; + } + } + } + rowPtr[l + 1] = nJdata_tmp; + } + } else { + rowPtr[0] = 0; + int nJdata_tmp = 0; + for (int l = 0; l < 12; l++) { + for (int k = 0; k < 12; k++) { + if (k == l) { + colVals[nJdata_tmp] = l; + nJdata_tmp = nJdata_tmp + 1; + } else { + if (Jac[12 * k + l] != 0.0) { + colVals[nJdata_tmp] = k; + nJdata_tmp = nJdata_tmp + 1; + } + } + } + rowPtr[l + 1] = nJdata_tmp; + } + } +} diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.inp b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.inp new file mode 100644 index 000000000..516664408 --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.inp @@ -0,0 +1,287 @@ +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +! +! H2/O2 oxidation reaction mechanism -- +! (c) Li, Zhao, Kazakov, and Dryer, Princeton University, 2003. +! +!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! +! HOW TO USE THIS MECHANISM: +! +! Due to +! (1) limitations of CHEMKIN-II format (specifically, an inability to implement +! temperature-dependent collision efficiencies in falloff reactions) +! and +! (2) lack of fundamental understanding of the mixing rules for the falloff +! reactions with the bath gases that have different broadening factors, +! +! the present implementation represents a compromise (approximate) formulation. +! +! As a consequence, PRIOR TO ITS USE IN THE CALCULATIONS, THIS FILE HAS TO BE +! MODIFIED. DEPENDING ON WHAT BATH GAS (DILUTANT) IS MOST ABUNDANT IN YOUR SYSTEM +! (THE PRESENT CHOICES ARE N2, AR, OR HE), YOU SHOULD UNCOMMENT THE CORRESPONDING +! BLOCK FOR THE REACTION H+O2(+M)=HO2(+M), AND COMMENT THE BLOCK FOR OTHER DILUTANT(S). +! AS GIVEN, THE MAIN DILUTANT IS SET TO BE N2. +! +! +! HOW TO REFERENCE THIS MECHANISM: +! +! Li, J., Zhao, Z., Kazakov, A., and Dryer, F.L. "An Updated Comprehensive Kinetic Model +! of Hydrogen Combustion", Int. J. Chem. Kinet. 2004 (in press). +! +! +! HOW TO CONTACT THE AUTHORS: +! +! Prof. Frederick L. Dryer +! D-329-D Engineering Quadrangle +! Mechanical and Aerospace Engineering +! Princeton University +! Princeton, NJ 08544-5263 +! Phone: 609-258-5206 +! Lab: 609-258-0316 +! FAX: 609-258-1939 +! Email: fldryer@Princeton.EDU +! +!********************************************************************************************** +! Development notes: +! +!The following H2/O2 mechanism is based on Mueller et al's (Int.J.Chem.Kinet.1999,31:113) +!Changes: +! +!1.update the standard heat of formation of OH at 0K to 8.85kcal/mol (Ruscic et al, +! J. Phys. Chem. A, 2002, 106:2727) +! +!2.update the rate constant of H+O2=O+OH as proposed by Hessler (J. Phys. Chem. A, 1998, +! 102:4517) +! +!3.update the low-pressure-limit rate constant of H+O2(+M)=HO2(+M) with bath gases: H2, +! O2, N2, AR, HE, H2O as proposed by Michael et al (J. Phys. Chem. A, 2002,106:5297). +! The third-body efficiency of H2, O2, and H2O are taken as the average value over +! the temperature range of 300-3000K. +! The Fc in Troe's form with N2 and AR/HE as bath gas are different, so the fall-off +! kinetics is expressed in two sets, for N2 and AR/HE, respectively. +! +!4.for all other recombination reactions, assume the third-body efficiency of HE is +! the same as AR. +! +!5.modify the A factor of the rate constant of H+OH+M=H2O+M to 3.8E+22. +! +! INCLUDES He and CO2 +! +!END OF NOTES +!********************************************************************************************** +ELEMENTS +H O N C HE +END +!C AR HE + +SPECIES +H2 O2 H2O H O OH HO2 H2O2 N2 HE CO2 +END +! AR HE CO CO2 + +THERMO ALL +300.0 1000.0 5000.0 +H 120186H 1 G 0300.00 5000.00 1000.00 1 + 2.50000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 + 2.54716270E+04-4.60117638E-01 2.50000000E+00 0.00000000E+00 0.00000000E+00 3 + 0.00000000E+00 0.00000000E+00 2.54716270E+04-4.60117608E-01 4 +O 120186O 1 G 0300.00 5000.00 1000.00 1 + 2.54205966E+00-2.75506191E-05-3.10280335E-09 4.55106742E-12-4.36805150E-16 2 + 2.92308027E+04 4.92030811E+00 2.94642878E+00-1.63816649E-03 2.42103170E-06 3 +-1.60284319E-09 3.89069636E-13 2.91476445E+04 2.96399498E+00 4 +OH S 9/01O 1H 1 0 0G 200.000 6000.000 1000. 1 + 2.86472886E+00 1.05650448E-03-2.59082758E-07 3.05218674E-11-1.33195876E-15 2 + 3.68362875E+03 5.70164073E+00 4.12530561E+00-3.22544939E-03 6.52764691E-06 3 +-5.79853643E-09 2.06237379E-12 3.34630913E+03-6.90432960E-01 4.51532273E+03 4 +H2 121286H 2 G 0300.00 5000.00 1000.00 1 + 2.99142337E+00 7.00064411E-04-5.63382869E-08-9.23157818E-12 1.58275179E-15 2 +-8.35033997E+02-1.35511017E+00 3.29812431E+00 8.24944174E-04-8.14301529E-07 3 +-9.47543433E-11 4.13487224E-13-1.01252087E+03-3.29409409E+00 4 +O2 121386O 2 G 0300.00 5000.00 1000.00 1 + 3.69757819E+00 6.13519689E-04-1.25884199E-07 1.77528148E-11-1.13643531E-15 2 +-1.23393018E+03 3.18916559E+00 3.21293640E+00 1.12748635E-03-5.75615047E-07 3 + 1.31387723E-09-8.76855392E-13-1.00524902E+03 6.03473759E+00 4 +H2O 20387H 2O 1 G 0300.00 5000.00 1000.00 1 + 2.67214561E+00 3.05629289E-03-8.73026011E-07 1.20099639E-10-6.39161787E-15 2 +-2.98992090E+04 6.86281681E+00 3.38684249E+00 3.47498246E-03-6.35469633E-06 3 + 6.96858127E-09-2.50658847E-12-3.02081133E+04 2.59023285E+00 4 +HO2 L 5/89H 1O 2 00 00G 200.000 3500.000 1000.000 1 + 4.01721090E+00 2.23982013E-03-6.33658150E-07 1.14246370E-10-1.07908535E-14 2 + 1.11856713E+02 3.78510215E+00 4.30179801E+00-4.74912051E-03 2.11582891E-05 3 +-2.42763894E-08 9.29225124E-12 2.94808040E+02 3.71666245E+00 1.00021620E+04 4 +H2O2 120186H 2O 2 G 0300.00 5000.00 1000.00 1 + 4.57316685E+00 4.33613639E-03-1.47468882E-06 2.34890357E-10-1.43165356E-14 2 +-1.80069609E+04 5.01136959E-01 3.38875365E+00 6.56922581E-03-1.48501258E-07 3 +-4.62580552E-09 2.47151475E-12-1.76631465E+04 6.78536320E+00 4 +N2 121286N 2 G 0300.00 5000.00 1000.00 1 + 0.02926640E+02 0.01487977E-01-0.05684761E-05 0.01009704E-08-0.06753351E-13 2 +-0.09227977E+04 0.05980528E+02 0.03298677E+02 0.01408240E-01-0.03963222E-04 3 + 0.05641515E-07-0.02444855E-10-0.01020900E+05 0.03950372E+02 4 +HE 120186HE 1 G 0300.00 5000.00 1000.00 1 + 0.02500000E+02 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 +-0.07453750E+04 0.09153489E+01 0.02500000E+02 0.00000000E+00 0.00000000E+00 3 + 0.00000000E+00 0.00000000E+00-0.07453750E+04 0.09153488E+01 4 +CO2 121286C 1O 2 G 0300.00 5000.00 1000.00 1 + 0.04453623E+02 0.03140169E-01-0.01278411E-04 0.02393997E-08-0.01669033E-12 2 +-0.04896696E+06-0.09553959E+01 0.02275725E+02 0.09922072E-01-0.01040911E-03 3 + 0.06866687E-07-0.02117280E-10-0.04837314E+06 0.01018849E+03 4 +!AR 120186AR 1 G 0300.00 5000.00 1000.00 1 +! 0.02500000E+02 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 +!-0.07453750E+04 0.04366001E+02 0.02500000E+02 0.00000000E+00 0.00000000E+00 3 +! 0.00000000E+00 0.00000000E+00-0.07453750E+04 0.04366001E+02 4 +END + +!AR 120186AR 1 G 0300.00 5000.00 1000.00 1 +! 0.02500000E+02 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 +!-0.07453750E+04 0.04366001E+02 0.02500000E+02 0.00000000E+00 0.00000000E+00 3 +! 0.00000000E+00 0.00000000E+00-0.07453750E+04 0.04366001E+02 4 +!HE 120186HE 1 G 0300.00 5000.00 1000.00 1 +! 0.02500000E+02 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 +!-0.07453750E+04 0.09153489E+01 0.02500000E+02 0.00000000E+00 0.00000000E+00 3 +! 0.00000000E+00 0.00000000E+00-0.07453750E+04 0.09153488E+01 4 +!CO 121286C 1O 1 G 0300.00 5000.00 1000.00 1 +! 0.03025078E+02 0.01442689E-01-0.05630828E-05 0.01018581E-08-0.06910952E-13 2 +!-0.01426835E+06 0.06108218E+02 0.03262452E+02 0.01511941E-01-0.03881755E-04 3 +! 0.05581944E-07-0.02474951E-10-0.01431054E+06 0.04848897E+02 4 +!CO2 121286C 1O 2 G 0300.00 5000.00 1000.00 1 +! 0.04453623E+02 0.03140169E-01-0.01278411E-04 0.02393997E-08-0.01669033E-12 2 +!-0.04896696E+06-0.09553959E+01 0.02275725E+02 0.09922072E-01-0.01040911E-03 3 +! 0.06866687E-07-0.02117280E-10-0.04837314E+06 0.01018849E+03 4 + +TRAN ALL +H2 1 38.000 2.920 0.000 0.790 280.000 +O2 1 107.400 3.458 0.000 1.600 3.800 +H2O 2 572.400 2.605 1.844 0.000 4.000 +H 0 145.000 2.050 0.000 0.000 0.000 +O 0 80.000 2.750 0.000 0.000 0.000 +OH 1 80.000 2.750 0.000 0.000 0.000 +HO2 2 107.400 3.458 0.000 0.000 1.000 +H2O2 2 107.400 3.458 0.000 0.000 3.800 +N2 1 97.530 3.621 0.000 1.760 4.000 +HE 0 10.200 2.576 0.000 0.000 0.000 ! * +CO2 1 244.000 3.763 0.000 2.650 2.100 +END + +REACTIONS + +!H2-O2 Chain Reactions + +! Hessler, J. Phys. Chem. A, 102:4517 (1998) +H+O2=O+OH 3.547e+15 -0.406 1.6599E+4 + +! Sutherland et al., 21st Symposium, p. 929 (1986) +O+H2=H+OH 0.508E+05 2.67 0.629E+04 + +! Michael and Sutherland, J. Phys. Chem. 92:3853 (1988) +H2+OH=H2O+H 0.216E+09 1.51 0.343E+04 + +! Sutherland et al., 23rd Symposium, p. 51 (1990) +O+H2O=OH+OH 2.97e+06 2.02 1.34e+4 + + +!H2-O2 Dissociation Reactions + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +H2+M=H+H+M 4.577E+19 -1.40 1.0438E+05 + H2/2.5/ H2O/12/ +! CO/1.9/ CO2/3.8/ +! AR/0.0/ HE/0.0/ + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +!H2+AR=H+H+AR 5.84e18 -1.1 1.0438E+05 + +!H2+HE=H+H+HE 5.84e18 -1.1 1.0438E+05 + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +O+O+M=O2+M 6.165E+15 -0.50 0.000E+00 + H2/2.5/ H2O/12/ +! AR/0.0/ HE/0.0/ +! CO/1.9/ CO2/3.8/ + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +!O+O+AR=O2+AR 1.886E+13 0.00 -1.788E+03 + +!O+O+HE=O2+HE 1.886E+13 0.00 -1.788E+03 + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +O+H+M=OH+M 4.714E+18 -1.00 0.000E+00 + H2/2.5/ H2O/12/ +! AR/0.75/ HE/0.75/ +! CO/1.9/ CO2/3.8/ + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +!H+OH+M=H2O+M 2.212E+22 -2.00 0.000E+00 +H+OH+M=H2O+M 3.800E+22 -2.00 0.000E+00 + H2/2.5/ H2O/12/ +! AR/0.38/ HE/0.38/ +! CO/1.9/ CO2/3.8/ + + +!Formation and Consumption of HO2 + +! Cobos et al., J. Phys. Chem. 89:342 (1985) for kinf +! Michael, et al., J. Phys. Chem. A, 106:5297 (2002) for k0 + +!****************************************************************************** +! MAIN BATH GAS IS N2 (comment this reaction otherwise) +! +H+O2(+M)=HO2(+M) 1.475E+12 0.60 0.00E+00 + LOW/6.366E+20 -1.72 5.248E+02/ + TROE/0.8 1E-30 1E+30/ + H2/2.0/ H2O/11./ O2/0.78/ +!CO/1.9/ CO2/3.8/ + +!****************************************************************************** +! MAIN BATH GAS IS AR OR HE (comment this reaction otherwise) +! +!H+O2(+M)=HO2(+M) 1.475E+12 0.60 0.00E+00 +! LOW/9.042E+19 -1.50 4.922E+02/ +! TROE/0.5 1E-30 1E+30/ +! H2/3.0/ H2O/16/ O2/1.1/ CO/2.7/ CO2/5.4/ HE/1.2/ + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) [modified] +HO2+H=H2+O2 1.66E+13 0.00 0.823E+03 + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) [modified] +HO2+H=OH+OH 7.079E+13 0.00 2.95E+02 + +! Baulch et al., J. Phys. Chem. Ref Data, 21:411 (1992) +HO2+O=O2+OH 0.325E+14 0.00 0.00E+00 + +! Keyser, J. Phys. Chem. 92:1193 (1988) +HO2+OH=H2O+O2 2.890E+13 0.00 -4.970E+02 + + +!Formation and Consumption of H2O2 + +! Hippler et al., J. Chem. Phys. 93:1755 (1990) +HO2+HO2=H2O2+O2 4.200e+14 0.00 1.1982e+04 + DUPLICATE +HO2+HO2=H2O2+O2 1.300e+11 0.00 -1.6293e+3 + DUPLICATE + +! Brouwer et al., J. Chem. Phys. 86:6171 (1987) for kinf +! Warnatz, J. in Combustion chemistry (1984) for k0 +H2O2(+M)=OH+OH(+M) 2.951e+14 0.00 4.843E+04 + LOW/1.202E+17 0.00 4.55E+04/ + TROE/0.5 1E-30 1E+30/ + H2/2.5/ H2O/12/ +! CO/1.9/ CO2/3.8/ +! AR/0.64/ HE/0.64/ + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +H2O2+H=H2O+OH 0.241E+14 0.00 0.397E+04 + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +H2O2+H=HO2+H2 0.482E+14 0.00 0.795E+04 + +! Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +H2O2+O=OH+HO2 9.550E+06 2.00 3.970E+03 + +! Hippler and Troe, J. Chem. Phys. Lett. 192:333 (1992) +H2O2+OH=HO2+H2O 1.000E+12 0.00 0.000 + DUPLICATE +H2O2+OH=HO2+H2O 5.800E+14 0.00 9.557E+03 + DUPLICATE + +END diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.yaml b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.yaml new file mode 100644 index 000000000..edf948e71 --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/mechanism.yaml @@ -0,0 +1,409 @@ +description: |- + <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> + + H2/O2 oxidation reaction mechanism -- + (c) Li, Zhao, Kazakov, and Dryer, Princeton University, 2003. + + !!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + HOW TO USE THIS MECHANISM: + + Due to + (1) limitations of CHEMKIN-II format (specifically, an inability to implement + temperature-dependent collision efficiencies in falloff reactions) + and + (2) lack of fundamental understanding of the mixing rules for the falloff + reactions with the bath gases that have different broadening factors, + + the present implementation represents a compromise (approximate) formulation. + + As a consequence, PRIOR TO ITS USE IN THE CALCULATIONS, THIS FILE HAS TO BE + MODIFIED. DEPENDING ON WHAT BATH GAS (DILUTANT) IS MOST ABUNDANT IN YOUR SYSTEM + (THE PRESENT CHOICES ARE N2, AR, OR HE), YOU SHOULD UNCOMMENT THE CORRESPONDING + BLOCK FOR THE REACTION H+O2(+M)=HO2(+M), AND COMMENT THE BLOCK FOR OTHER DILUTANT(S). + AS GIVEN, THE MAIN DILUTANT IS SET TO BE N2. + + + HOW TO REFERENCE THIS MECHANISM: + + Li, J., Zhao, Z., Kazakov, A., and Dryer, F.L. "An Updated Comprehensive Kinetic Model + of Hydrogen Combustion", Int. J. Chem. Kinet. 2004 (in press). + + + HOW TO CONTACT THE AUTHORS: + + Prof. Frederick L. Dryer + D-329-D Engineering Quadrangle + Mechanical and Aerospace Engineering + Princeton University + Princeton, NJ 08544-5263 + Phone: 609-258-5206 + Lab: 609-258-0316 + FAX: 609-258-1939 + Email: fldryer@Princeton.EDU + + ********************************************************************************************** + Development notes: + + The following H2/O2 mechanism is based on Mueller et al's (Int.J.Chem.Kinet.1999,31:113) + Changes: + + 1.update the standard heat of formation of OH at 0K to 8.85kcal/mol (Ruscic et al, + J. Phys. Chem. A, 2002, 106:2727) + + 2.update the rate constant of H+O2=O+OH as proposed by Hessler (J. Phys. Chem. A, 1998, + 102:4517) + + 3.update the low-pressure-limit rate constant of H+O2(+M)=HO2(+M) with bath gases: H2, + O2, N2, AR, HE, H2O as proposed by Michael et al (J. Phys. Chem. A, 2002,106:5297). + The third-body efficiency of H2, O2, and H2O are taken as the average value over + the temperature range of 300-3000K. + The Fc in Troe's form with N2 and AR/HE as bath gas are different, so the fall-off + kinetics is expressed in two sets, for N2 and AR/HE, respectively. + + 4.for all other recombination reactions, assume the third-body efficiency of HE is + the same as AR. + + 5.modify the A factor of the rate constant of H+OH+M=H2O+M to 3.8E+22. + + INCLUDES He and CO2 + + END OF NOTES + ********************************************************************************************** + +generator: ck2yaml +input-files: [mechanism.inp] +cantera-version: 3.2.0 +date: Tue, 06 Jan 2026 15:12:38 -0700 + +units: {length: cm, time: s, quantity: mol, activation-energy: cal/mol} + +phases: +- name: gas + thermo: ideal-gas + elements: [H, O, N, C, He] + species: [H2, O2, H2O, H, O, OH, HO2, H2O2, N2, HE, CO2] + kinetics: gas + transport: mixture-averaged + state: {T: 300.0, P: 1 atm} + +species: +- name: H2 + composition: {H: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.29812431, 8.24944174e-04, -8.14301529e-07, -9.47543433e-11, + 4.13487224e-13, -1012.52087, -3.29409409] + - [2.99142337, 7.00064411e-04, -5.63382869e-08, -9.23157818e-12, + 1.58275179e-15, -835.033997, -1.35511017] + note: '121286' + transport: + model: gas + geometry: linear + well-depth: 38.0 + diameter: 2.92 + polarizability: 0.79 + rotational-relaxation: 280.0 +- name: O2 + composition: {O: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.2129364, 1.12748635e-03, -5.75615047e-07, 1.31387723e-09, + -8.76855392e-13, -1005.24902, 6.03473759] + - [3.69757819, 6.13519689e-04, -1.25884199e-07, 1.77528148e-11, + -1.13643531e-15, -1233.93018, 3.18916559] + note: '121386' + transport: + model: gas + geometry: linear + well-depth: 107.4 + diameter: 3.458 + polarizability: 1.6 + rotational-relaxation: 3.8 +- name: H2O + composition: {H: 2, O: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.38684249, 3.47498246e-03, -6.35469633e-06, 6.96858127e-09, + -2.50658847e-12, -3.02081133e+04, 2.59023285] + - [2.67214561, 3.05629289e-03, -8.73026011e-07, 1.20099639e-10, + -6.39161787e-15, -2.9899209e+04, 6.86281681] + note: '20387' + transport: + model: gas + geometry: nonlinear + well-depth: 572.4 + diameter: 2.605 + dipole: 1.844 + rotational-relaxation: 4.0 +- name: H + composition: {H: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [2.5, 0.0, 0.0, 0.0, 0.0, 2.5471627e+04, -0.460117608] + - [2.5, 0.0, 0.0, 0.0, 0.0, 2.5471627e+04, -0.460117638] + note: '120186' + transport: + model: gas + geometry: atom + well-depth: 145.0 + diameter: 2.05 +- name: O + composition: {O: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [2.94642878, -1.63816649e-03, 2.4210317e-06, -1.60284319e-09, + 3.89069636e-13, 2.91476445e+04, 2.96399498] + - [2.54205966, -2.75506191e-05, -3.10280335e-09, 4.55106742e-12, + -4.3680515e-16, 2.92308027e+04, 4.92030811] + note: '120186' + transport: + model: gas + geometry: atom + well-depth: 80.0 + diameter: 2.75 +- name: OH + composition: {O: 1, H: 1} + thermo: + model: NASA7 + temperature-ranges: [200.0, 1000.0, 6000.0] + data: + - [4.12530561, -3.22544939e-03, 6.52764691e-06, -5.79853643e-09, + 2.06237379e-12, 3346.30913, -0.69043296] + - [2.86472886, 1.05650448e-03, -2.59082758e-07, 3.05218674e-11, + -1.33195876e-15, 3683.62875, 5.70164073] + note: S 9/01 + transport: + model: gas + geometry: linear + well-depth: 80.0 + diameter: 2.75 +- name: HO2 + composition: {H: 1, O: 2} + thermo: + model: NASA7 + temperature-ranges: [200.0, 1000.0, 3500.0] + data: + - [4.30179801, -4.74912051e-03, 2.11582891e-05, -2.42763894e-08, + 9.29225124e-12, 294.80804, 3.71666245] + - [4.0172109, 2.23982013e-03, -6.3365815e-07, 1.1424637e-10, + -1.07908535e-14, 111.856713, 3.78510215] + note: L 5/89 + transport: + model: gas + geometry: nonlinear + well-depth: 107.4 + diameter: 3.458 + rotational-relaxation: 1.0 +- name: H2O2 + composition: {H: 2, O: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.38875365, 6.56922581e-03, -1.48501258e-07, -4.62580552e-09, + 2.47151475e-12, -1.76631465e+04, 6.7853632] + - [4.57316685, 4.33613639e-03, -1.47468882e-06, 2.34890357e-10, + -1.43165356e-14, -1.80069609e+04, 0.501136959] + note: '120186' + transport: + model: gas + geometry: nonlinear + well-depth: 107.4 + diameter: 3.458 + rotational-relaxation: 3.8 +- name: N2 + composition: {N: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.298677, 1.40824e-03, -3.963222e-06, 5.641515e-09, + -2.444855e-12, -1020.9, 3.950372] + - [2.92664, 1.487977e-03, -5.684761e-07, 1.009704e-10, + -6.753351e-15, -922.7977, 5.980528] + note: '121286' + transport: + model: gas + geometry: linear + well-depth: 97.53 + diameter: 3.621 + polarizability: 1.76 + rotational-relaxation: 4.0 +- name: HE + composition: {He: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 0.9153488] + - [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 0.9153489] + note: '120186' + transport: + model: gas + geometry: atom + well-depth: 10.2 + diameter: 2.576 + note: '*' +- name: CO2 + composition: {C: 1, O: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [2.275725, 9.922072e-03, -1.040911e-05, 6.866687e-09, + -2.11728e-12, -4.837314e+04, 10.18849] + - [4.453623, 3.140169e-03, -1.278411e-06, 2.393997e-10, + -1.669033e-14, -4.896696e+04, -0.9553959] + note: '121286' + transport: + model: gas + geometry: linear + well-depth: 244.0 + diameter: 3.763 + polarizability: 2.65 + rotational-relaxation: 2.1 + +reactions: +- equation: H + O2 <=> O + OH # Reaction 1 + rate-constant: {A: 3.547e+15, b: -0.406, Ea: 1.6599e+04} + note: | + H2-O2 Chain Reactions + Hessler, J. Phys. Chem. A, 102:4517 (1998) +- equation: O + H2 <=> H + OH # Reaction 2 + rate-constant: {A: 5.08e+04, b: 2.67, Ea: 6290.0} + note: | + Sutherland et al., 21st Symposium, p. 929 (1986) +- equation: H2 + OH <=> H2O + H # Reaction 3 + rate-constant: {A: 2.16e+08, b: 1.51, Ea: 3430.0} + note: | + Michael and Sutherland, J. Phys. Chem. 92:3853 (1988) +- equation: O + H2O <=> OH + OH # Reaction 4 + rate-constant: {A: 2.97e+06, b: 2.02, Ea: 1.34e+04} + note: | + Sutherland et al., 23rd Symposium, p. 51 (1990) +- equation: H2 + M <=> H + H + M # Reaction 5 + type: three-body + rate-constant: {A: 4.577e+19, b: -1.4, Ea: 1.0438e+05} + efficiencies: {H2: 2.5, H2O: 12.0} + note: | + H2-O2 Dissociation Reactions + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +- equation: O + O + M <=> O2 + M # Reaction 6 + type: three-body + rate-constant: {A: 6.165e+15, b: -0.5, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} + note: |2 + CO/1.9/ CO2/3.8/ + AR/0.0/ HE/0.0/ + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) + H2+AR=H+H+AR 5.84e18 -1.1 1.0438E+05 + H2+HE=H+H+HE 5.84e18 -1.1 1.0438E+05 + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +- equation: O + H + M <=> OH + M # Reaction 7 + type: three-body + rate-constant: {A: 4.714e+18, b: -1.0, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} + note: |2 + AR/0.0/ HE/0.0/ + CO/1.9/ CO2/3.8/ + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) + O+O+AR=O2+AR 1.886E+13 0.00 -1.788E+03 + O+O+HE=O2+HE 1.886E+13 0.00 -1.788E+03 + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +- equation: H + OH + M <=> H2O + M # Reaction 8 + type: three-body + rate-constant: {A: 3.8e+22, b: -2.0, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} + note: |2 + AR/0.75/ HE/0.75/ + CO/1.9/ CO2/3.8/ + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) + H+OH+M=H2O+M 2.212E+22 -2.00 0.000E+00 +- equation: H + O2 (+M) <=> HO2 (+M) # Reaction 9 + type: falloff + low-P-rate-constant: {A: 6.366e+20, b: -1.72, Ea: 524.8} + high-P-rate-constant: {A: 1.475e+12, b: 0.6, Ea: 0.0} + Troe: {A: 0.8, T3: 1.0e-30, T1: 1.0e+30} + efficiencies: {H2: 2.0, H2O: 11.0, O2: 0.78} + note: |2 + AR/0.38/ HE/0.38/ + CO/1.9/ CO2/3.8/ + Formation and Consumption of HO2 + Cobos et al., J. Phys. Chem. 89:342 (1985) for kinf + Michael, et al., J. Phys. Chem. A, 106:5297 (2002) for k0 + ****************************************************************************** + MAIN BATH GAS IS N2 (comment this reaction otherwise) +- equation: HO2 + H <=> H2 + O2 # Reaction 10 + rate-constant: {A: 1.66e+13, b: 0.0, Ea: 823.0} + note: | + CO/1.9/ CO2/3.8/ + ****************************************************************************** + MAIN BATH GAS IS AR OR HE (comment this reaction otherwise) + H+O2(+M)=HO2(+M) 1.475E+12 0.60 0.00E+00 + LOW/9.042E+19 -1.50 4.922E+02/ + TROE/0.5 1E-30 1E+30/ + H2/3.0/ H2O/16/ O2/1.1/ CO/2.7/ CO2/5.4/ HE/1.2/ + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) [modified] +- equation: HO2 + H <=> OH + OH # Reaction 11 + rate-constant: {A: 7.079e+13, b: 0.0, Ea: 295.0} + note: | + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) [modified] +- equation: HO2 + O <=> O2 + OH # Reaction 12 + rate-constant: {A: 3.25e+13, b: 0.0, Ea: 0.0} + note: | + Baulch et al., J. Phys. Chem. Ref Data, 21:411 (1992) +- equation: HO2 + OH <=> H2O + O2 # Reaction 13 + rate-constant: {A: 2.89e+13, b: 0.0, Ea: -497.0} + note: | + Keyser, J. Phys. Chem. 92:1193 (1988) +- equation: HO2 + HO2 <=> H2O2 + O2 # Reaction 14 + duplicate: true + rate-constant: {A: 4.2e+14, b: 0.0, Ea: 1.1982e+04} + note: | + Formation and Consumption of H2O2 + Hippler et al., J. Chem. Phys. 93:1755 (1990) +- equation: HO2 + HO2 <=> H2O2 + O2 # Reaction 15 + duplicate: true + rate-constant: {A: 1.3e+11, b: 0.0, Ea: -1629.3} +- equation: H2O2 (+M) <=> OH + OH (+M) # Reaction 16 + type: falloff + low-P-rate-constant: {A: 1.202e+17, b: 0.0, Ea: 4.55e+04} + high-P-rate-constant: {A: 2.951e+14, b: 0.0, Ea: 4.843e+04} + Troe: {A: 0.5, T3: 1.0e-30, T1: 1.0e+30} + efficiencies: {H2: 2.5, H2O: 12.0} + note: | + Brouwer et al., J. Chem. Phys. 86:6171 (1987) for kinf + Warnatz, J. in Combustion chemistry (1984) for k0 +- equation: H2O2 + H <=> H2O + OH # Reaction 17 + rate-constant: {A: 2.41e+13, b: 0.0, Ea: 3970.0} + note: |2 + CO/1.9/ CO2/3.8/ + AR/0.64/ HE/0.64/ + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +- equation: H2O2 + H <=> HO2 + H2 # Reaction 18 + rate-constant: {A: 4.82e+13, b: 0.0, Ea: 7950.0} + note: | + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +- equation: H2O2 + O <=> OH + HO2 # Reaction 19 + rate-constant: {A: 9.55e+06, b: 2.0, Ea: 3970.0} + note: | + Tsang and Hampson, J. Phys. Chem. Ref. Data, 15:1087 (1986) +- equation: H2O2 + OH <=> HO2 + H2O # Reaction 20 + duplicate: true + rate-constant: {A: 1.0e+12, b: 0.0, Ea: 0.0} + note: | + Hippler and Troe, J. Chem. Phys. Lett. 192:333 (1992) +- equation: H2O2 + OH <=> HO2 + H2O # Reaction 21 + duplicate: true + rate-constant: {A: 5.8e+14, b: 0.0, Ea: 9557.0} diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/therm.dat b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/therm.dat new file mode 100644 index 000000000..24f82b9ed --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/therm.dat @@ -0,0 +1,39 @@ +THERMO ALL +300.0 1000.0 5000.0 +H 120186H 1 G 0300.00 5000.00 1000.00 1 + 2.50000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 2 + 2.54716270E+04-4.60117638E-01 2.50000000E+00 0.00000000E+00 0.00000000E+00 3 + 0.00000000E+00 0.00000000E+00 2.54716270E+04-4.60117608E-01 4 +O 120186O 1 G 0300.00 5000.00 1000.00 1 + 2.54205966E+00-2.75506191E-05-3.10280335E-09 4.55106742E-12-4.36805150E-16 2 + 2.92308027E+04 4.92030811E+00 2.94642878E+00-1.63816649E-03 2.42103170E-06 3 +-1.60284319E-09 3.89069636E-13 2.91476445E+04 2.96399498E+00 4 +OH S 9/01O 1H 1 0 0G 200.000 6000.000 1000. 1 + 2.86472886E+00 1.05650448E-03-2.59082758E-07 3.05218674E-11-1.33195876E-15 2 + 3.68362875E+03 5.70164073E+00 4.12530561E+00-3.22544939E-03 6.52764691E-06 3 +-5.79853643E-09 2.06237379E-12 3.34630913E+03-6.90432960E-01 4.51532273E+03 4 +H2 121286H 2 G 0300.00 5000.00 1000.00 1 + 2.99142337E+00 7.00064411E-04-5.63382869E-08-9.23157818E-12 1.58275179E-15 2 +-8.35033997E+02-1.35511017E+00 3.29812431E+00 8.24944174E-04-8.14301529E-07 3 +-9.47543433E-11 4.13487224E-13-1.01252087E+03-3.29409409E+00 4 +O2 121386O 2 G 0300.00 5000.00 1000.00 1 + 3.69757819E+00 6.13519689E-04-1.25884199E-07 1.77528148E-11-1.13643531E-15 2 +-1.23393018E+03 3.18916559E+00 3.21293640E+00 1.12748635E-03-5.75615047E-07 3 + 1.31387723E-09-8.76855392E-13-1.00524902E+03 6.03473759E+00 4 +H2O 20387H 2O 1 G 0300.00 5000.00 1000.00 1 + 2.67214561E+00 3.05629289E-03-8.73026011E-07 1.20099639E-10-6.39161787E-15 2 +-2.98992090E+04 6.86281681E+00 3.38684249E+00 3.47498246E-03-6.35469633E-06 3 + 6.96858127E-09-2.50658847E-12-3.02081133E+04 2.59023285E+00 4 +HO2 L 5/89H 1O 2 00 00G 200.000 3500.000 1000.000 1 + 4.01721090E+00 2.23982013E-03-6.33658150E-07 1.14246370E-10-1.07908535E-14 2 + 1.11856713E+02 3.78510215E+00 4.30179801E+00-4.74912051E-03 2.11582891E-05 3 +-2.42763894E-08 9.29225124E-12 2.94808040E+02 3.71666245E+00 1.00021620E+04 4 +H2O2 120186H 2O 2 G 0300.00 5000.00 1000.00 1 + 4.57316685E+00 4.33613639E-03-1.47468882E-06 2.34890357E-10-1.43165356E-14 2 +-1.80069609E+04 5.01136959E-01 3.38875365E+00 6.56922581E-03-1.48501258E-07 3 +-4.62580552E-09 2.47151475E-12-1.76631465E+04 6.78536320E+00 4 +N2 121286N 2 G 0300.00 5000.00 1000.00 1 + 0.02926640E+02 0.01487977E-01-0.05684761E-05 0.01009704E-08-0.06753351E-13 2 +-0.09227977E+04 0.05980528E+02 0.03298677E+02 0.01408240E-01-0.03963222E-04 3 + 0.05641515E-07-0.02444855E-10-0.01020900E+05 0.03950372E+02 4 +END diff --git a/Exec/Production/JetInCrossflow/LiDryer_CO2_He/tran.dat b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/tran.dat new file mode 100644 index 000000000..3adfde9d9 --- /dev/null +++ b/Exec/Production/JetInCrossflow/LiDryer_CO2_He/tran.dat @@ -0,0 +1,134 @@ + +AR 0 136.500 3.330 0.000 0.000 0.000 +C 0 71.400 3.298 0.000 0.000 0.000 ! * +CH 1 80.000 2.750 0.000 0.000 0.000 +CH2 1 144.000 3.800 0.000 0.000 0.000 +CH2* 1 144.000 3.800 0.000 0.000 0.000 +CH3 1 144.000 3.800 0.000 0.000 0.000 +CH4 2 141.400 3.746 0.000 2.600 13.000 +CO 1 98.100 3.650 0.000 1.950 1.800 +CO2 1 244.000 3.763 0.000 2.650 2.100 +HCO 2 498.000 3.590 0.000 0.000 0.000 +CH2O 2 498.000 3.590 0.000 0.000 2.000 +CH2OH 2 417.000 3.690 1.700 0.000 2.000 +CH3O 2 417.000 3.690 1.700 0.000 2.000 +CH3OH 2 481.800 3.626 0.000 0.000 1.000 ! SVE + +C2 1 97.530 3.621 0.000 1.760 4.000 +C2O 1 232.400 3.828 0.000 0.000 1.000 ! * +C2H 1 209.000 4.100 0.000 0.000 2.500 +C2H2 1 209.000 4.100 0.000 0.000 2.500 +H2CC 2 209.000 4.100 0.000 0.000 2.500 +C2H3 2 209.000 4.100 0.000 0.000 1.000 ! * +C2H4 2 280.800 3.971 0.000 0.000 1.500 +C2H5 2 252.300 4.302 0.000 0.000 1.500 +C2H6 2 252.300 4.302 0.000 0.000 1.500 +HCCO 2 150.000 2.500 0.000 0.000 1.000 ! * +HCCOH 2 436.000 3.970 0.000 0.000 2.000 +CH2CO 2 436.000 3.970 0.000 0.000 2.000 +CH2CHO 2 436.000 3.970 0.000 0.000 2.000 +C2H2OH 2 224.700 4.162 0.000 0.000 1.000 ! * + +C3H2 2 209.000 4.100 0.000 0.000 1.000 ! * +C3H3 2 252.000 4.760 0.000 0.000 1.000 ! JAM +aC3H4 1 252.000 4.760 0.000 0.000 1.000 +pC3H4 1 252.000 4.760 0.000 0.000 1.000 +cC3H4 1 252.000 4.760 0.000 0.000 1.000 + +C4H 1 357.000 5.180 0.000 0.000 1.000 +C4H2 1 357.000 5.180 0.000 0.000 1.000 +H2C4O 2 357.000 5.180 0.000 0.000 1.000 ! JAM +C4H2OH 2 224.700 4.162 0.000 0.000 1.000 ! * +i-C4H3 2 357.000 5.180 0.000 0.000 1.000 ! JAM +n-C4H3 2 357.000 5.180 0.000 0.000 1.000 ! JAM +C4H4 2 357.000 5.180 0.000 0.000 1.000 ! JAM +i-C4H5 2 357.000 5.180 0.000 0.000 1.000 ! JAM +n-C4H5 2 357.000 5.180 0.000 0.000 1.000 ! JAM +C4H6 2 357.000 5.180 0.000 0.000 1.000 +C4H612 2 357.000 5.180 0.000 0.000 1.000 + +C5H2 1 357.000 5.180 0.000 0.000 1.000 +C5H3 1 357.000 5.180 0.000 0.000 1.000 +C5H5 1 357.000 5.180 0.000 0.000 1.000 +C5H6 1 357.000 5.180 0.000 0.000 1.000 + +C6H 1 357.000 5.180 0.000 0.000 1.000 +C6H2 1 357.000 5.180 0.000 0.000 1.000 +C6H3 2 357.000 5.180 0.000 0.000 1.000 ! +l-C6H4 2 412.300 5.349 0.000 0.000 1.000 !(JAM) +n-C6H5 2 412.300 5.349 0.000 0.000 1.000 !(JAM) +i-C6H5 2 412.300 5.349 0.000 0.000 1.000 !(JAM) +l-C6H6 2 412.300 5.349 0.000 0.000 1.000 !(SVE) +n-C6H7 2 412.300 5.349 0.000 0.000 1.000 !(JAM) +i-C6H7 2 412.300 5.349 0.000 0.000 1.000 !(JAM) +C6H8 2 412.300 5.349 0.000 0.000 1.000 !(JAM) + +HE 0 10.200 2.576 0.000 0.000 0.000 ! * +H 0 145.000 2.050 0.000 0.000 0.000 +H2 1 38.000 2.920 0.000 0.790 280.000 +H2O 2 572.400 2.605 1.844 0.000 4.000 +H2O2 2 107.400 3.458 0.000 0.000 3.800 +HO2 2 107.400 3.458 0.000 0.000 1.000 ! * +N2 1 97.530 3.621 0.000 1.760 4.000 +O 0 80.000 2.750 0.000 0.000 0.000 +O2 1 107.400 3.458 0.000 1.600 3.800 +OH 1 80.000 2.750 0.000 0.000 0.000 + + +The Lennard-Jones parameters of polycyclic aromatic hydrocarbons were estimated +based on the critical temperature and pressure. See H. Wang and M. Frenklach, +"Transport Properties of Polycyclic Aromatic Hydrocarbons for Flame Modeling." +Combustion and Flame, 96:163-170 (1994) + +c-C6H4 2 464.8 5.29 0.00 10.32 0.000 ! benze +A1 2 464.8 5.29 0.00 10.32 0.000 ! benze +A1- 2 464.8 5.29 0.00 10.32 0.000 ! benze +c-C6H7 2 464.8 5.29 0.00 10.32 0.000 ! benze +C5H4O 2 464.8 5.29 0.00 10.32 0.000 ! benze +C5H5O 2 464.8 5.29 0.00 10.32 0.000 ! benze +C5H4OH 2 464.8 5.29 0.00 10.32 0.000 ! benze +C6H5O 2 464.8 5.29 0.00 10.32 0.000 ! benze +C6H5OH 2 464.8 5.29 0.00 10.32 0.000 ! benze + +aC3H5 2 266.800 4.982 0.000 0.000 1.000 +CH3CCH2 2 266.800 4.982 0.000 0.000 1.000 +CH3CHCH 2 266.800 4.982 0.000 0.000 1.000 +C3H6 2 266.800 4.982 0.000 0.000 1.000 +C3H7 2 266.800 4.982 0.000 0.000 1.000 +C4H6 2 357.000 5.180 0.000 0.000 1.000 +iC3H7 2 266.800 4.982 0.000 0.000 1.000 +nC3H7 2 266.800 4.982 0.000 0.000 1.000 +C3H8 2 266.800 4.982 0.000 0.000 1.000 +C4H 1 357.000 5.180 0.000 0.000 1.000 +C4H2 1 357.000 5.180 0.000 0.000 1.000 +C4H2OH 2 224.700 4.162 0.000 0.000 1.000 ! * +iC4H5 2 357.000 5.176 0.000 0.000 1.000 +C4H6 2 357.000 5.176 0.000 0.000 1.000 +C4H7 2 357.000 5.176 0.000 0.000 1.000 +iC4H7 2 357.000 5.176 0.000 0.000 1.000 +C4H81 2 357.000 5.176 0.000 0.000 1.000 +C4H82 2 357.000 5.176 0.000 0.000 1.000 +iC4H8 2 357.000 5.176 0.000 0.000 1.000 +tC4H9 2 357.000 5.176 0.000 0.000 1.000 +iC4H9 2 357.000 5.176 0.000 0.000 1.000 +pC4H9 2 357.000 5.176 0.000 0.000 1.000 +sC4H9 2 357.000 5.176 0.000 0.000 1.000 +C4H10 2 357.000 5.176 0.000 0.000 1.000 +iC4H10 2 357.000 5.176 0.000 0.000 1.000 +CH3COCH3 2 357.000 5.176 0.000 0.000 1.000 +C2H3CHO 2 357.000 5.176 0.000 0.000 1.000 +iC4H7O 2 450.000 5.500 0.000 0.000 1.000 ! JAM +CH3CHO 2 436.000 3.970 0.000 0.000 2.000 +CH3CO 2 436.000 3.970 0.000 0.000 2.000 +HE 0 10.200 2.576 0.000 0.000 0.000 ! * + + 1-15: Species name + 16-80: Molecular parameters + molecule index: 0 = atom, 1= linear molec. + 2 = nonlinear molec. + L-J potential well depth, e/kb (K) + L-J collision diameter, s,  + Dipole moment, f, Debye + Polarizability, `, 2 + Rotational relaxation number, Zrot at 298K + Comments diff --git a/Exec/Production/JetInCrossflow/README.txt b/Exec/Production/JetInCrossflow/README.txt new file mode 100644 index 000000000..c1b856395 --- /dev/null +++ b/Exec/Production/JetInCrossflow/README.txt @@ -0,0 +1,38 @@ +---------------- +Case Description +---------------- + +Perform a {DNS, **LES} of a {nonreacting, **reacting} jet in crossflow where the jet issues into a {ducted, *channel} flow of vitiated combustion products at [atmospheric pressure]. The jet has a mole-basis composition of [70% H2, 18% N2 and 12% HE] at [300 K], a bulk inlet velocity of [42.2 m/s] with a {uniform profile, **uniform mean profile with turbulent fluctuations at an intensity of 5%, ****fully-developed turbulent structure}, and a diameter (d_j) of [3.175 mm]. The domain has a cross section of [24d_j] in the spanwise direction by [40d_j] in the direction of the jet flow and we are interested in the region from [30d_j] upstream of the jet to [50d_j] downstream of the jet. The walls are assumed to be {adiabatic, ***isothermal}. The cross flow has a bulk velocity of {19.1 m/s} with a {uniform profile, **uniform mean profile with turbulent fluctuations at an intensity of 5%, ****fully-developed turbulent structure} and a mole-basis composition of [12.91% O2, 76.11% N2, 3.66% CO2, 7.32% H2O and 0.0019629% OH] at [1236 K]. + +[] - Numerical Parameters that can be directly changed in the input file. + Changing any of these should be the easiest level of change. +{} - Categorical options that may be changed with varying degress of difficulty. In all cases, the existing + setup is the first option, and * are used to indicate the difficulty of alternative options: + *: Easiest: simply change the value of an existing input parameters + **: Somewhat harder: must add several input parameters not included in the current input file + ***: Moderate difficulty: Slight changes needed to case source files + ****: Extreme difficulty: Requires setting up and running a precursor simulation + +Quantities of Interest: +- Jet trajectory (z(x) on the mean streamline eminating from the jet center) + +Sample additional prompt: +Adjust the momentum ratio of the default jet in-crossflow case from 5.08 to 25.32 by adjusting the jet velocity and run a simulation to determine the resulting jet trajectory. + +The input file `input.3d` corresponds to the default options above. Additional input files correspond to +certain of the options above: + +* Run with LES: input_les_additions.inp +* Run a reacting case: input_reacting_additions.inp +* Run with a turbulent crossflow (isotropic fluctuations): input_turbinflow_additions.inp +* Run with all above combinations: input_all.inp + + +--------------- +Case References +--------------- + +[1] Xu, C., Ameen, M., Pal, P. and Som, S., 2022. Direct Numerical Simulation of a Reacting Hydrogen Jet in Turbulent Vitiated Crossflow Using Spectral Element Method. In AIAA SCITECH 2022 Forum (p. 0823). + +[2] Wilde, B.R., 2014. Dynamics of variable density ratio reacting jets in unsteady, vitiated crossflows. Doctor of Philosophy. +input_turbinflow_additions.inp diff --git a/Exec/Production/JetInCrossflow/TurbInflow/DAT b/Exec/Production/JetInCrossflow/TurbInflow/DAT new file mode 100644 index 000000000..60cc16b85 Binary files /dev/null and b/Exec/Production/JetInCrossflow/TurbInflow/DAT differ diff --git a/Exec/Production/JetInCrossflow/TurbInflow/HDR b/Exec/Production/JetInCrossflow/TurbInflow/HDR new file mode 100644 index 000000000..d923e2c35 --- /dev/null +++ b/Exec/Production/JetInCrossflow/TurbInflow/HDR @@ -0,0 +1,195 @@ +67 67 64 +6.47953 6.47953 6.28319 +1 1 1 +0 +36000 +72000 +108000 +144000 +180000 +216000 +252000 +288000 +324000 +360000 +396002 +432004 +468006 +504008 +540010 +576012 +612014 +648016 +684018 +720020 +756022 +792024 +828026 +864028 +900030 +936032 +972034 +1008036 +1044038 +1080040 +1116042 +1152044 +1188046 +1224048 +1260050 +1296052 +1332054 +1368056 +1404058 +1440060 +1476062 +1512064 +1548066 +1584068 +1620070 +1656072 +1692074 +1728076 +1764078 +1800080 +1836082 +1872084 +1908086 +1944088 +1980090 +2016092 +2052094 +2088096 +2124098 +2160100 +2196102 +2232104 +2268106 +2304108 +2340108 +2376108 +2412108 +2448108 +2484108 +2520108 +2556108 +2592108 +2628108 +2664108 +2700110 +2736112 +2772114 +2808116 +2844118 +2880120 +2916122 +2952124 +2988126 +3024128 +3060130 +3096132 +3132134 +3168136 +3204138 +3240140 +3276142 +3312144 +3348146 +3384148 +3420150 +3456152 +3492154 +3528156 +3564158 +3600160 +3636162 +3672164 +3708166 +3744168 +3780170 +3816172 +3852174 +3888176 +3924178 +3960180 +3996182 +4032184 +4068186 +4104188 +4140190 +4176192 +4212194 +4248196 +4284198 +4320200 +4356202 +4392204 +4428206 +4464208 +4500210 +4536212 +4572214 +4608216 +4644216 +4680216 +4716216 +4752216 +4788216 +4824216 +4860216 +4896216 +4932216 +4968216 +5004218 +5040220 +5076222 +5112224 +5148226 +5184228 +5220230 +5256232 +5292234 +5328236 +5364238 +5400240 +5436242 +5472244 +5508246 +5544248 +5580250 +5616252 +5652254 +5688256 +5724258 +5760260 +5796262 +5832264 +5868266 +5904268 +5940270 +5976272 +6012274 +6048276 +6084278 +6120280 +6156282 +6192284 +6228286 +6264288 +6300290 +6336292 +6372294 +6408296 +6444298 +6480300 +6516302 +6552304 +6588306 +6624308 +6660310 +6696312 +6732314 +6768316 +6804318 +6840320 +6876322 diff --git a/Exec/Production/JetInCrossflow/input.3d b/Exec/Production/JetInCrossflow/input.3d index 8185fea85..80a12295c 100644 --- a/Exec/Production/JetInCrossflow/input.3d +++ b/Exec/Production/JetInCrossflow/input.3d @@ -1,60 +1,62 @@ #----------------------DOMAIN DEFINITION------------------------ geometry.is_periodic = 0 0 0 # For each dir, 0: non-perio, 1: periodic geometry.coord_sys = 0 # 0 => cart, 1 => RZ -geometry.prob_lo = 0.0 -0.0031 -0.0024 # x_lo y_lo (z_lo) -geometry.prob_hi = 0.0062 0.0031 0.0100 # x_hi y_hi (z_hi) +geometry.prob_lo = 0.0 -0.0381 -0.09525 # x_lo y_lo (z_lo) +geometry.prob_hi = 0.127 0.0381 0.15875 # x_hi y_hi (z_hi) # >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< # Interior, Inflow, Outflow, Symmetry, # SlipWallAdiab, NoSlipWallAdiab, SlipWallIsotherm, NoSlipWallIsotherm peleLM.lo_bc = Inflow NoSlipWallAdiab Inflow -peleLM.hi_bc = Inflow NoSlipWallAdiab Outflow - +peleLM.hi_bc = NoSlipWallAdiab NoSlipWallAdiab Outflow #-------------------------AMR CONTROL---------------------------- -amr.n_cell = 32 32 64 # Level 0 number of cells in each direction -amr.v = 1 # AMR verbose -amr.max_level = 2 # maximum level number allowed +amr.n_cell = 80 48 160 # Level 0 number of cells in each direction +amr.v = 2 # AMR verbose +amr.max_level = 4 # maximum level number allowed amr.ref_ratio = 2 2 2 2 # refinement ratio -amr.regrid_int = 2 # how often to regrid +amr.regrid_int = 6 # how often to regrid amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est -amr.grid_eff = 0.7 # what constitutes an efficient grid -amr.blocking_factor = 8 # block factor in grid generation (min box size) +amr.grid_eff = 0.85 # what constitutes an efficient grid +amr.blocking_factor = 16 # block factor in grid generation (min box size) amr.max_grid_size = 64 # max box size #--------------------------- Problem ------------------------------- -prob.P_mean = 2431800.0 -prob.V_in = 1.1e2 -prob.jet_rad = 2.5e-4 -prob.jet_temp = 5.5e2 -prob.global_eq_ratio = 3.5e-1 -prob.ox_temp = 7.5e2 -prob.XO2 = 2.1e-1 -prob.XN2 = 7.9e-1 -prob.init_time = -1 -prob.pertmag_cf = 0.0 -prob.pertmag_jet = 0.0 -prob.double_jet = 1 -prob.jet_dir = 0 +prob.P_mean = 101325.0 + +prob.cf_velocity = 19.1 +prob.cf_temp = 1236 +prob.cf_composition = O2:0.1291 N2:0.7611 CO2:0.0366 H2O:0.0732 OH:1.9629e-5 +prob.cf_composition_type = mole prob.cf_dir = 2 -prob.jet_purity = 0.995 -prob.bl_thickness = 2.0e-4 + +prob.jet_velocity = 42.2 +prob.jet_temp = 300 +prob.jet_composition = H2:0.7 N2:0.18 HE:0.12 +prob.jet_composition_type = mole +prob.jet_dir = 0 +prob.jet_rad = 0.0015875 +prob.jet_bl_thickness = -1.0 +prob.jet_init_time = 1.0e-6 +prob.jet_start_time = 0.0 +prob.double_jet = 0 #-------------------------PeleLM CONTROL---------------------------- -peleLM.v = 3 +peleLM.v = 2 peleLM.incompressible = 0 peleLM.rho = 1.17 peleLM.mu = 0.0 peleLM.use_wbar = 1 peleLM.sdc_iterMax = 1 peleLM.advection_scheme = "Godunov_BDS" +peleLM.deltaT_crashIfFailing = 0 -amr.plot_int = 10 -amr.check_int = 100 -amr.check_file = "chk_" -amr.plot_file = "plt_" -amr.max_step = 500 +amr.plot_int = 50 +amr.check_int = 200 +amr.check_file = chk +amr.plot_file = plt +amr.max_step = 50000 amr.dt_shrink = 1e-2 #amr.init_dt = 1e-1 amr.stop_time = 0.02 @@ -65,31 +67,68 @@ amr.derive_plot_vars = avg_pressure mag_vort mass_fractions # --------------- INPUTS TO CHEMISTRY REACTOR --------------- peleLM.chem_integrator = "ReactorNull" -peleLM.use_typ_vals_chem = 1 # Use species/temp typical values in CVODE +peleLM.use_typ_vals_chem = 1 # Use species/temp typical values in CVODE ode.rtol = 1.0e-6 # Relative tolerance of the chemical solve ode.atol = 1.0e-5 # Absolute tolerance factor applied on typical values -cvode.solve_type = denseAJ_direct # CVODE Linear solve type (for Newton direction) -cvode.max_order = 4 # CVODE max BDF order. +cvode.solve_type = denseAJ_direct # CVODE Linear solve type (for Newton direction) +cvode.max_order = 4 # CVODE max BDF order. #--------------------REFINEMENT CONTROL------------------------ -amr.refinement_indicators = overYH2 diffYH2 diffRho +amr.refinement_indicators = overYH2 diffYH2 diffRho diffT bottom_box -amr.overYH2.max_level = 3 -amr.overYH2.value_greater = 0.99 +amr.overYH2.max_level = 4 +amr.overYH2.value_greater = 0.1 amr.overYH2.field_name = Y(H2) -amr.diffYH2.max_level = 3 -amr.diffYH2.adjacent_difference_greater = 0.01 +amr.diffYH2.max_level = 5 +amr.diffYH2.adjacent_difference_greater = 0.005 amr.diffYH2.field_name = Y(H2) amr.diffRho.max_level = 1 amr.diffRho.adjacent_difference_greater = 0.8 amr.diffRho.field_name = density -#amr.diffXvel.max_level = 3 -#amr.diffXvel.adjacent_difference_greater = 100 -#amr.diffXvel.field_name = x_velocity +amr.diffT.max_level = 5 +amr.diffT.adjacent_difference_greater = 50 +amr.diffT.field_name = temp + +amr.bottom_box.max_level = 2 +amr.bottom_box.in_box_lo = 0.000 -0.04 -0.1 +amr.bottom_box.in_box_hi = 0.004 0.04 0.16 #amrex.fpe_trap_invalid = 1 #amrex.fpe_trap_zero = 1 #amrex.fpe_trap_overflow = 1 +amrex.the_arena_is_managed = 0 + +#-------------------DIAGNOSTIC CONTROL----------------------- +peleLM.diagnostics = ynormalplt znormalplt +peleLM.ynormalplt.type = DiagFramePlane +peleLM.ynormalplt.normal = 1 +peleLM.ynormalplt.center = 0.0 +peleLM.ynormalplt.int = 25 +peleLM.ynormalplt.interpolation = Linear +peleLM.ynormalplt.field_names = Y(H2) Y(H2O) Y(H) Y(OH) x_velocity y_velocity z_velocity temp HeatRelease + +peleLM.znormalplt.type = DiagFramePlane +peleLM.znormalplt.normal = 2 +peleLM.znormalplt.center = 0.008 +peleLM.znormalplt.int = 25 +peleLM.znormalplt.interpolation = Linear +peleLM.znormalplt.field_names = Y(H2) Y(H2O) Y(H) Y(OH) x_velocity y_velocity z_velocity temp HeatRelease + +peleLM.xnormalplt.type = DiagFramePlane +peleLM.xnormalplt.normal = 0 +peleLM.xnormalplt.center = 0.008 +peleLM.xnormalplt.int = 25 +peleLM.xnormalplt.interpolation = Linear +peleLM.xnormalplt.field_names = Y(H2) Y(H2O) Y(H) Y(OH) x_velocity y_velocity z_velocity temp HeatRelease + +peleLM.do_temporals = 1 # [OPT, DEF=0] Activate temporal diagnostics +peleLM.temporal_dir = temporals # [OPT, DEF="temporals"] Directory to store temporal diagnostics +peleLM.temporal_int = 10 # [OPT, DEF=5] Temporal freq. +peleLM.do_extremas = 1 # [OPT, DEF=0] Trigger extremas, if temporals activated +peleLM.do_mass_balance = 1 # [OPT, DEF=0] Compute mass balance, if temporals activated +peleLM.do_species_balance = 1 # [OPT, DEF=0] Compute species mass balance, if temporals activated + +peleLM.base_output_prefix = output_nonreacting/ \ No newline at end of file diff --git a/Exec/Production/JetInCrossflow/input.3d_reacting b/Exec/Production/JetInCrossflow/input.3d_reacting new file mode 100644 index 000000000..14d9709c5 --- /dev/null +++ b/Exec/Production/JetInCrossflow/input.3d_reacting @@ -0,0 +1,110 @@ +#----------------------DOMAIN DEFINITION------------------------ +geometry.is_periodic = 0 0 0 # For each dir, 0: non-perio, 1: periodic +geometry.coord_sys = 0 # 0 => cart, 1 => RZ +geometry.prob_lo = 0.0 -0.0381 -0.09525 # x_lo y_lo (z_lo) +geometry.prob_hi = 0.127 0.0381 0.15875 # x_hi y_hi (z_hi) + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# Interior, Inflow, Outflow, Symmetry, +# SlipWallAdiab, NoSlipWallAdiab, SlipWallIsotherm, NoSlipWallIsotherm +peleLM.lo_bc = Inflow NoSlipWallAdiab Inflow +peleLM.hi_bc = NoSlipWallAdiab NoSlipWallAdiab Outflow + +#-------------------------AMR CONTROL---------------------------- +amr.n_cell = 40 24 80 # Level 0 number of cells in each direction +amr.v = 2 # AMR verbose +amr.max_level = 5 # maximum level number allowed +amr.ref_ratio = 2 2 2 2 # refinement ratio +amr.regrid_int = 6 # how often to regrid +amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est +amr.grid_eff = 0.7 # what constitutes an efficient grid +amr.blocking_factor = 8 # block factor in grid generation (min box size) +amr.max_grid_size = 64 # max box size + + +#--------------------------- Problem ------------------------------- +prob.P_mean = 101325.0 + +prob.cf_velocity = 19.1 +prob.cf_temp = 1236 +prob.cf_composition = O2:0.1291 N2:0.7611 CO2:0.0366 H2O:0.0732 OH:1.9629e-5 +prob.cf_composition_type = mole +prob.cf_dir = 2 + +prob.jet_velocity = 42.2 +prob.jet_temp = 300 +prob.jet_composition = H2:0.7 N2:0.18 HE:0.12 +prob.jet_composition_type = mole +prob.jet_dir = 0 +prob.jet_rad = 0.0015875 +prob.jet_bl_thickness = -1.0 +prob.jet_init_time = 1.0e-6 +prob.double_jet = 0 + +#-------------------------PeleLM CONTROL---------------------------- +peleLM.v = 2 +peleLM.incompressible = 0 +peleLM.rho = 1.17 +peleLM.mu = 0.0 +peleLM.use_wbar = 1 +peleLM.sdc_iterMax = 1 +peleLM.advection_scheme = "Godunov_BDS" +peleLM.deltaT_crashIfFailing = 0 +peleLM.base_output_prefix = output_reacting/ + +amr.plot_int = 50 +amr.check_int = 200 +amr.check_file = chk +amr.plot_file = plt +amr.max_step = 50000 +amr.dt_shrink = 1e-2 +#amr.init_dt = 1e-1 +amr.stop_time = 0.02 +#amr.stop_time = 1.00 +amr.cfl = 0.7 +#amr.fixed_dt = 1e-3 +amr.derive_plot_vars = avg_pressure mag_vort mass_fractions + +# --------------- INPUTS TO CHEMISTRY REACTOR --------------- +peleLM.chem_integrator = "ReactorCvode" +peleLM.use_typ_vals_chem = 1 # Use species/temp typical values in CVODE +ode.rtol = 1.0e-8 # Relative tolerance of the chemical solve +ode.atol = 1.0e-7 # Absolute tolerance factor applied on typical values +cvode.solve_type = denseAJ_direct # CVODE Linear solve type (for Newton direction) +cvode.max_order = 4 # CVODE max BDF order. + +#--------------------REFINEMENT CONTROL------------------------ +amr.refinement_indicators = overYH2 diffYH2 diffRho diffT inlet_box + +amr.overYH2.max_level = 4 +amr.overYH2.value_greater = 0.15 +amr.overYH2.field_name = Y(H2) + +amr.diffYH2.max_level = 5 +amr.diffYH2.adjacent_difference_greater = 0.005 +amr.diffYH2.field_name = Y(H2) + +amr.diffRho.max_level = 1 +amr.diffRho.adjacent_difference_greater = 0.8 +amr.diffRho.field_name = density + +amr.diffT.max_level = 5 +amr.diffT.adjacent_difference_greater = 50 +amr.diffT.field_name = temp + +amr.inlet_box.max_level = 5 +amr.inlet_box.in_box_lo = 0.000 -0.002 -0.002 +amr.inlet_box.in_box_hi = 0.004 0.002 0.0002 + +#amrex.fpe_trap_invalid = 1 +#amrex.fpe_trap_zero = 1 +#amrex.fpe_trap_overflow = 1 + +#-------------------DIAGNOSTIC CONTROL----------------------- +peleLM.diagnostics = ynormal +peleLM.ynormal.type = DiagFramePlane +peleLM.ynormal.normal = 0 +peleLM.ynormal.center = 0.008 +peleLM.ynormal.int = 5 +peleLM.ynormal.interpolation = Linear +peleLM.ynormal.field_names = Y(H2) Y(H2O) Y(H) Y(OH) x_velocity y_velocity z_velocity temp HeatRelease diff --git a/Exec/Production/JetInCrossflow/input_all.inp b/Exec/Production/JetInCrossflow/input_all.inp new file mode 100644 index 000000000..8fb7aba95 --- /dev/null +++ b/Exec/Production/JetInCrossflow/input_all.inp @@ -0,0 +1,5 @@ +FILE = input.3d +FILE = input_turbinflow_additions.inp +FILE = input_reacting_additions.inp +FILE = input_les_additions.inp +peleLM.base_output_prefix = output_all/ \ No newline at end of file diff --git a/Exec/Production/JetInCrossflow/input_les_additions.inp b/Exec/Production/JetInCrossflow/input_les_additions.inp new file mode 100644 index 000000000..36f1be57d --- /dev/null +++ b/Exec/Production/JetInCrossflow/input_les_additions.inp @@ -0,0 +1,4 @@ +peleLM.les_model = WALE +peleLM.les_v = 1 +peleLM.plot_les = 1 +peleLM.base_output_prefix = output_les/ \ No newline at end of file diff --git a/Exec/Production/JetInCrossflow/input_reacting_additions.inp b/Exec/Production/JetInCrossflow/input_reacting_additions.inp new file mode 100644 index 000000000..500a53349 --- /dev/null +++ b/Exec/Production/JetInCrossflow/input_reacting_additions.inp @@ -0,0 +1,4 @@ +peleLM.chem_integrator = "ReactorCvode" +ode.rtol = 1.0e-8 +ode.atol = 1.0e-7 +peleLM.base_output_prefix = output_reacting/ diff --git a/Exec/Production/JetInCrossflow/input_turbinflow_additions.inp b/Exec/Production/JetInCrossflow/input_turbinflow_additions.inp new file mode 100644 index 000000000..3e2bbaee0 --- /dev/null +++ b/Exec/Production/JetInCrossflow/input_turbinflow_additions.inp @@ -0,0 +1,14 @@ +turbinflows = lowZ +turbinflow.lowZ.turb_file = TurbInflow +turbinflow.lowZ.dir = 2 +turbinflow.lowZ.side = low +turbinflow.lowZ.turb_scale_loc = 314.15927 +turbinflow.lowZ.turb_scale_vel = 2.0 +turbinflow.lowZ.turb_center = 0. 0. +turbinflow.lowZ.tile_periodic = 1 +turbinflow.lowZ.turb_conv_vel = 19.1 +turbinflow.lowZ.turb_nplane = 32 +prob.jet_start_time = 0.0075 +prob.jet_init_time = 1.0e-4 + +peleLM.base_output_prefix = output_turbinflow/ \ No newline at end of file diff --git a/Exec/Production/JetInCrossflow/pelelmex_prob.H b/Exec/Production/JetInCrossflow/pelelmex_prob.H index 2167192c2..d675d7082 100644 --- a/Exec/Production/JetInCrossflow/pelelmex_prob.H +++ b/Exec/Production/JetInCrossflow/pelelmex_prob.H @@ -13,22 +13,23 @@ struct MyProbParm : public ProbParmDefault { amrex::Real P_mean = 2431800.0; - amrex::Real V_in = 1.1e2; - amrex::Real jet_rad = 2.5e-4; + + // Cross-Flow Conditions + amrex::Real cf_velocity = 1.1e2; + amrex::Real cf_temp = 7.5e2; + amrex::Real cf_massfracs[NUM_SPECIES]{0.0}; + int cf_dir = 2; + + // Jet Conditions + amrex::Real jet_velocity = 1.1e2; amrex::Real jet_temp = 5.5e2; - amrex::Real global_eq_ratio = 3.5e-1; - amrex::Real ox_temp = 7.5e2; - amrex::Real X_O2 = 2.1e-1; - amrex::Real X_N2 = 7.9e-1; - amrex::Real pertmag_cf = 0.0; - amrex::Real pertmag_jet = 0.0; - amrex::Real jet_purity = 0.995; - amrex::Real bl_thickness = 1.0e-4; - - int init_time = -1; - int double_jet = 1; + amrex::Real jet_massfracs[NUM_SPECIES]{0.0}; + amrex::Real jet_bl_thickness = -1.0; + amrex::Real jet_rad = 2.5e-4; int jet_dir = 0; - int cf_dir = 2; + amrex::Real jet_init_time = -1; + amrex::Real jet_start_time = -1; + int double_jet = 0; }; struct MyProblemSpecificFunctions : public DefaultProblemSpecificFunctions @@ -46,80 +47,34 @@ struct MyProblemSpecificFunctions : public DefaultProblemSpecificFunctions MyProbParm const& prob_parm, pele::physics::PMF::PmfData::DataContainer const* /*pmf_data*/) { - const amrex::Real* prob_lo = geomdata.ProbLo(); - const amrex::Real* prob_hi = geomdata.ProbHi(); - const amrex::Real* dx = geomdata.CellSize(); - - AMREX_D_TERM( - const amrex::Real x = prob_lo[0] + (i + 0.5) * dx[0]; - , const amrex::Real y = prob_lo[1] + (j + 0.5) * dx[1]; - , const amrex::Real z = prob_lo[2] + (k + 0.5) * dx[2];); - - AMREX_D_TERM( - const amrex::Real Lx = prob_hi[0] - prob_lo[0]; - , const amrex::Real Ly = prob_hi[1] - prob_lo[1]; - , const amrex::Real Lz = prob_hi[2] - prob_lo[2]); - - constexpr amrex::Real Pi = 3.14159265358979323846264338327950288; - auto eos = pele::physics::PhysicsType::eos(); - amrex::Real molefrac[NUM_SPECIES] = {0.0}; - amrex::Real massfrac[NUM_SPECIES] = {0.0}; - molefrac[O2_ID] = prob_parm.X_O2; - molefrac[N2_ID] = prob_parm.X_N2; - eos.X2Y(molefrac, massfrac); - - state(i, j, k, TEMP) = prob_parm.ox_temp; + state(i, j, k, TEMP) = prob_parm.cf_temp; // Set the initial velocity field - amrex::Real x_velocity = 0.0; - amrex::Real y_velocity = 0.0; - amrex::Real z_velocity = 0.0; - amrex::Real V_in = prob_parm.V_in; - -#if (AMREX_SPACEDIM == 2) - x_velocity = 0.0; - y_velocity = 0.0; -#elif (AMREX_SPACEDIM == 3) - x_velocity = - V_in + prob_parm.pertmag_cf * V_in * - (sin(2 * Pi * 4 * x / Lx) * sin(2 * Pi * 5 * y / Ly) * - sin(2 * Pi * 3 * z / Lz) + - 1.017 * sin(2 * Pi * 3 * x / Lx) * sin(2 * Pi * 7 * y / Ly) * - sin(2 * Pi * 5 * z / Lz)); - y_velocity = prob_parm.pertmag_cf * V_in * - (sin(2 * Pi * 5 * x / Lx) * sin(2 * Pi * 3 * y / Ly) * - sin(2 * Pi * 7 * z / Lz) + - 1.017 * sin(2 * Pi * 9 * x / Lx) * sin(2 * Pi * 4 * y / Ly) * - sin(2 * Pi * 2 * z / Lz)); - z_velocity = prob_parm.pertmag_cf * V_in * - (sin(2 * Pi * 2 * x / Lx) * sin(2 * Pi * 6 * y / Ly) * - sin(2 * Pi * 5 * z / Lz) + - 1.017 * sin(2 * Pi * 7 * x / Lx) * sin(2 * Pi * 4 * y / Ly) * - sin(2 * Pi * 3 * z / Lz)); -#endif - - AMREX_D_TERM(state(i, j, k, VELX) = x_velocity; - , state(i, j, k, VELY) = y_velocity; - , state(i, j, k, VELZ) = z_velocity); + amrex::RealVect velocity{0.0}; + velocity[prob_parm.cf_dir] = prob_parm.cf_velocity; + state(i, j, k, VELX) = velocity[0]; + state(i, j, k, VELY) = velocity[1]; + state(i, j, k, VELZ) = velocity[2]; amrex::Real P_cgs = prob_parm.P_mean * 10.0; // Density amrex::Real rho_cgs = 0.0; - eos.PYT2R(P_cgs, massfrac, state(i, j, k, TEMP), rho_cgs); + eos.PYT2R(P_cgs, prob_parm.cf_massfracs, state(i, j, k, TEMP), rho_cgs); state(i, j, k, DENSITY) = rho_cgs * 1.0e3; // Enthalpy amrex::Real h_cgs = 0.0; - eos.TY2H(state(i, j, k, TEMP), massfrac, h_cgs); + eos.TY2H(state(i, j, k, TEMP), prob_parm.cf_massfracs, h_cgs); state(i, j, k, RHOH) = h_cgs * 1.0e-4 * state(i, j, k, DENSITY); // Species mass for (int n = 0; n < NUM_SPECIES; n++) { - state(i, j, k, FIRSTSPEC + n) = massfrac[n] * state(i, j, k, DENSITY); + state(i, j, k, FIRSTSPEC + n) = + prob_parm.cf_massfracs[n] * state(i, j, k, DENSITY); } } @@ -142,26 +97,22 @@ struct MyProblemSpecificFunctions : public DefaultProblemSpecificFunctions constexpr amrex::Real Pi = 3.14159265358979323846264338327950288; amrex::GpuArray pmf_vals = {0.0}; - amrex::Real molefrac[NUM_SPECIES] = {0.0}; amrex::Real massfrac[NUM_SPECIES] = {0.0}; - amrex::Real V_in = prob_parm.V_in; - amrex::Real jet_rad = prob_parm.jet_rad; - int cf_dir = prob_parm.cf_dir; - int jet_dir = prob_parm.jet_dir; + const amrex::Real cf_velocity = prob_parm.cf_velocity; + const amrex::Real jet_rad = prob_parm.jet_rad; + const int cf_dir = prob_parm.cf_dir; + const int jet_dir = prob_parm.jet_dir; - amrex::Real X_air[NUM_SPECIES] = {0.0}; - amrex::Real X_jet[NUM_SPECIES] = {0.0}; - amrex::Real Y_air[NUM_SPECIES] = {0.0}; - amrex::Real Y_jet[NUM_SPECIES] = {0.0}; amrex::Real U_air[AMREX_SPACEDIM] = {0.0}; amrex::Real U_jet[AMREX_SPACEDIM] = {0.0}; amrex::Real rho_air = 0.0; amrex::Real rho_jet = 0.0; amrex::Real radsq = 0.0; - amrex::Real factor = 0.0; + amrex::Real vel_factor = 0.0; + amrex::Real comp_factor = 0.0; amrex::Real area = 0.0; - amrex::Real jet_vel = 0.0; + const amrex::Real jet_vel = prob_parm.jet_velocity; auto eos = pele::physics::PhysicsType::eos(); @@ -177,39 +128,16 @@ struct MyProblemSpecificFunctions : public DefaultProblemSpecificFunctions } } - // Initialize the jet and air molefracs - X_air[O2_ID] = prob_parm.X_O2; - X_air[N2_ID] = prob_parm.X_N2; - X_jet[H2_ID] = prob_parm.jet_purity; - X_jet[N2_ID] = 1.0 - prob_parm.jet_purity; - - // Get air/jet mass fraction and densities - // Mass fraction - eos.X2Y(X_air, Y_air); - eos.X2Y(X_jet, Y_jet); - // Density - eos.PYT2R(prob_parm.P_mean * 10.0, Y_air, prob_parm.ox_temp, rho_air); - eos.PYT2R(prob_parm.P_mean * 10.0, Y_jet, prob_parm.jet_temp, rho_jet); - rho_air *= 1.0e3; - rho_jet *= 1.0e3; - // Initialize jet velocity BCs -#if (AMREX_SPACEDIM == 2) - amrex::Abort("JIC not implemented in 2D"); -#elif (AMREX_SPACEDIM == 3) - area = (prob_hi[other_dir] - prob_lo[other_dir]) * - (prob_hi[jet_dir] - prob_lo[jet_dir]); - - jet_vel = - (prob_parm.global_eq_ratio * rho_air * area * V_in * Y_air[O2_ID]) / - (8 * Pi * jet_rad * jet_rad * rho_jet * Y_jet[H2_ID]); - +#if (AMREX_SPACEDIM < 3) + amrex::Abort("JICF only implemented in 3D"); +#endif if (cf_dir == 0) { - U_air[0] = V_in; + U_air[0] = cf_velocity; } else if (cf_dir == 1) { - U_air[1] = V_in; + U_air[1] = cf_velocity; } else { - U_air[2] = V_in; + U_air[2] = cf_velocity; } if (jet_dir == 0) { @@ -219,25 +147,61 @@ struct MyProblemSpecificFunctions : public DefaultProblemSpecificFunctions } else { U_jet[2] = jet_vel; } -#endif if (idir == jet_dir and (prob_parm.double_jet == 1 or sgn == 1)) { - radsq = x[other_dir] * x[other_dir] + x[cf_dir] * x[cf_dir]; - factor = - 0.5 * - (1.0 - tanh((sqrt(radsq) - jet_rad) / (prob_parm.bl_thickness / 4.0))); + if (prob_parm.jet_bl_thickness > 0.0) { + // specified BL thickness - use tanh profile at jet boundary + radsq = x[other_dir] * x[other_dir] + x[cf_dir] * x[cf_dir]; + vel_factor = + 0.5 * + (1.0 - + tanh((sqrt(radsq) - jet_rad) / (prob_parm.jet_bl_thickness / 4.0))); + comp_factor = vel_factor; + } else { + // scale inlet conditions by how much of cell is covered by the jet + radsq = x[other_dir] * x[other_dir] + x[cf_dir] * x[cf_dir]; + if ( + radsq < + jet_rad + geomdata.CellSize(cf_dir) + geomdata.CellSize(other_dir)) { + amrex::Real area = + pele::physics::utilities::rectangle_circle_intersection_area( + x[other_dir] - 0.5 * geomdata.CellSize(other_dir), + x[other_dir] + 0.5 * geomdata.CellSize(other_dir), + x[cf_dir] - 0.5 * geomdata.CellSize(cf_dir), + x[cf_dir] + 0.5 * geomdata.CellSize(cf_dir), 0.0, 0.0, jet_rad); + vel_factor = + area / (geomdata.CellSize(cf_dir) * geomdata.CellSize(other_dir)); + vel_factor = (vel_factor > 1e-9) ? vel_factor : 0.0; + comp_factor = (vel_factor > 0.5e-9) ? 1.0 : 0.0; + } else { + vel_factor = 0.0; + comp_factor = 0.0; + } + } + + amrex::Real time_factor = 0.0; + if (time < prob_parm.jet_start_time) { + time_factor = 0.0; + } else if (time < prob_parm.jet_start_time + prob_parm.jet_init_time) { + time_factor = + (time - prob_parm.jet_start_time) / prob_parm.jet_init_time; + } else { + time_factor = 1.0; + } + vel_factor *= time_factor; + comp_factor *= time_factor; for (int n = 0; n < NUM_SPECIES; n++) { - molefrac[n] = factor * X_jet[n] + (1.0 - factor) * X_air[n]; + massfrac[n] = comp_factor * prob_parm.jet_massfracs[n] + + (1.0 - comp_factor) * prob_parm.cf_massfracs[n]; } - eos.X2Y(molefrac, massfrac); amrex::Real rho_cgs, P_cgs, RhoH_temp; P_cgs = prob_parm.P_mean * 10.0; - s_ext[TEMP] = - factor * prob_parm.jet_temp + (1.0 - factor) * prob_parm.ox_temp; + s_ext[TEMP] = comp_factor * prob_parm.jet_temp + + (1.0 - comp_factor) * prob_parm.cf_temp; eos.PYT2R(P_cgs, massfrac, s_ext[TEMP], rho_cgs); s_ext[DENSITY] = rho_cgs * 1.0e3; @@ -251,38 +215,65 @@ struct MyProblemSpecificFunctions : public DefaultProblemSpecificFunctions } // Velocity - amrex::Real time_factor = 0.0; - if (time < prob_parm.init_time) { - time_factor = - (time / prob_parm.init_time) * (time / prob_parm.init_time); - } else { - time_factor = 1.0; - } - s_ext[VELX] = (1 - 0.5 * prob_parm.double_jet) * sgn * time_factor * - factor * U_jet[0]; - s_ext[VELY] = (1 - 0.5 * prob_parm.double_jet) * sgn * time_factor * - factor * U_jet[1]; - s_ext[VELZ] = (1 - 0.5 * prob_parm.double_jet) * sgn * time_factor * - factor * U_jet[2]; + s_ext[VELX] = + (1 - 0.5 * prob_parm.double_jet) * sgn * vel_factor * U_jet[0]; + s_ext[VELY] = + (1 - 0.5 * prob_parm.double_jet) * sgn * vel_factor * U_jet[1]; + s_ext[VELZ] = + (1 - 0.5 * prob_parm.double_jet) * sgn * vel_factor * U_jet[2]; } if ((idir == cf_dir) and (sgn == 1)) { // Density + eos.PYT2R( + prob_parm.P_mean * 10.0, prob_parm.cf_massfracs, prob_parm.cf_temp, + rho_air); + rho_air *= 1.0e3; s_ext[DENSITY] = rho_air; // Mass fraction for (int n = 0; n < NUM_SPECIES; n++) { - s_ext[FIRSTSPEC + n] = Y_air[n] * s_ext[DENSITY]; + s_ext[FIRSTSPEC + n] = prob_parm.cf_massfracs[n] * s_ext[DENSITY]; } // Temperature - s_ext[TEMP] = prob_parm.ox_temp; + s_ext[TEMP] = prob_parm.cf_temp; amrex::Real RhoH_temp; // Enthalpy - eos.TY2H(s_ext[TEMP], Y_air, RhoH_temp); + eos.TY2H(s_ext[TEMP], prob_parm.cf_massfracs, RhoH_temp); s_ext[RHOH] = RhoH_temp * 1.0e-4 * s_ext[DENSITY]; // Velocity - s_ext[VELX] = U_air[0]; - s_ext[VELY] = U_air[1]; - s_ext[VELZ] = U_air[2]; + s_ext[VELX] += U_air[0]; + s_ext[VELY] += U_air[1]; + s_ext[VELZ] += U_air[2]; + } + } + + // Zero diffusion coefficients for walls on inflow face so we don't get + // diffusion through them + AMREX_GPU_DEVICE + AMREX_FORCE_INLINE + static void zero_visc( + int i, + int j, + int k, + amrex::Array4 const& beta, + amrex::GeometryData const& /*geomdata*/, + amrex::Box const& domainBox, + const int dir, + const int beta_comp, + const int nComp, + MyProbParm const& prob_parm) + { + // We treat species when beta_comp == 0 and nComp == NUM_SPECIES + // otherwise this routine could be called for other face diffusivity (Temp, + // velocity, ...) + if (beta_comp == 0 && nComp == NUM_SPECIES) { + amrex::IntVect idx{i, j, k}; + if (dir == prob_parm.jet_dir && idx[dir] <= domainBox.smallEnd(dir)) { + // Just over whole inlet + for (int n = 0; n < nComp; n++) { + beta(i, j, k, n) = 0.0; + } + } } } }; diff --git a/Exec/Production/JetInCrossflow/pelelmex_prob.cpp b/Exec/Production/JetInCrossflow/pelelmex_prob.cpp index 3fa5e0f1f..e03694a23 100644 --- a/Exec/Production/JetInCrossflow/pelelmex_prob.cpp +++ b/Exec/Production/JetInCrossflow/pelelmex_prob.cpp @@ -6,22 +6,41 @@ PeleLM::readProbParm() amrex::ParmParse pp("prob"); std::string type; - pp.query("P_mean", PeleLM::prob_parm->P_mean); - pp.query("V_in", PeleLM::prob_parm->V_in); - pp.query("jet_rad", PeleLM::prob_parm->jet_rad); - pp.query("jet_temp", PeleLM::prob_parm->jet_temp); - pp.query("global_eq_ratio", PeleLM::prob_parm->global_eq_ratio); - pp.query("ox_temp", PeleLM::prob_parm->ox_temp); - pp.query("X_O2", PeleLM::prob_parm->X_O2); - pp.query("X_N2", PeleLM::prob_parm->X_N2); - pp.query("pertmag_cf", PeleLM::prob_parm->pertmag_cf); - pp.query("pertmag_jet", PeleLM::prob_parm->pertmag_jet); - pp.query("jet_purity", PeleLM::prob_parm->jet_purity); - pp.query("bl_thickness", PeleLM::prob_parm->bl_thickness); - pp.query("init_time", PeleLM::prob_parm->init_time); - pp.query("double_jet", PeleLM::prob_parm->double_jet); - pp.query("jet_dir", PeleLM::prob_parm->jet_dir); + pp.get("P_mean", PeleLM::prob_parm->P_mean); + + // Crossflow Conditions + pp.get("cf_velocity", PeleLM::prob_parm->cf_velocity); + pp.get("cf_temp", PeleLM::prob_parm->cf_temp); + { + amrex::Vector compositionIn; + std::string comp_type = "mass"; + int entryCount = pp.countval("cf_composition"); + compositionIn.resize(entryCount); + pp.getarr("cf_composition", compositionIn, 0, entryCount); + pp.query("cf_composition_type", comp_type); + parseComposition(compositionIn, comp_type, PeleLM::prob_parm->cf_massfracs); + } pp.query("cf_dir", PeleLM::prob_parm->cf_dir); + + // Jet Conditions + pp.get("jet_velocity", PeleLM::prob_parm->jet_velocity); + pp.get("jet_temp", PeleLM::prob_parm->jet_temp); + { + amrex::Vector compositionIn; + std::string comp_type = "mass"; + int entryCount = pp.countval("jet_composition"); + compositionIn.resize(entryCount); + pp.getarr("jet_composition", compositionIn, 0, entryCount); + pp.query("jet_composition_type", comp_type); + parseComposition( + compositionIn, comp_type, PeleLM::prob_parm->jet_massfracs); + } + pp.query("jet_dir", PeleLM::prob_parm->jet_dir); + pp.get("jet_rad", PeleLM::prob_parm->jet_rad); + pp.get("jet_bl_thickness", PeleLM::prob_parm->jet_bl_thickness); + pp.query("jet_init_time", PeleLM::prob_parm->jet_init_time); + pp.query("jet_start_time", PeleLM::prob_parm->jet_start_time); + pp.query("double_jet", PeleLM::prob_parm->double_jet); } void