1 #ifndef ABLATELIBRARY_SOOT_HPP
2 #define ABLATELIBRARY_SOOT_HPP
4 #include "eos/tChem.hpp"
6 #include "utilities/constants.hpp"
8 namespace ablate::finiteVolume::processes {
18 [[maybe_unused]]
inline static double surfPreExponential = 700;
22 DM sourceDm =
nullptr;
24 Vec sourceVec =
nullptr;
27 PetscOptions petscOptions =
nullptr;
30 std::shared_ptr<eos::ChemistryModel> eos;
33 inline const static PetscReal dtInitDefault = 1E-6;
36 PetscReal dtInit = dtInitDefault;
39 double thresholdTemperature = 0.0;
42 enum OdeSpecies { C_s = 0, H, H2, C2H2, O, O2, OH, CO, TOTAL_ODE_SPECIES };
45 inline static const char OdeSpeciesNames[TOTAL_ODE_SPECIES][5] = {
"C(S)",
"H",
"H2",
"C2H2",
"O",
"O2",
"OH",
"CO"};
48 inline static const PetscInt ODE_NDD = TOTAL_ODE_SPECIES;
51 inline static const PetscInt ODE_T = TOTAL_ODE_SPECIES + 1;
54 inline static const PetscInt TotalEquations = TOTAL_ODE_SPECIES + 2;
58 Vec pointData =
nullptr;
59 Mat pointJacobian =
nullptr;
62 struct OdePointInformation {
64 PetscReal currentDensity;
66 std::vector<PetscReal> yiScratch;
69 std::vector<PetscReal> speciesSensibleEnthalpyScratch;
78 std::array<PetscInt, TotalEquations> speciesOffset;
81 std::array<PetscInt, TOTAL_ODE_SPECIES> speciesIndex;
84 std::array<PetscReal, TOTAL_ODE_SPECIES> enthalpyOfFormation;
87 std::array<PetscReal, TOTAL_ODE_SPECIES> mw;
89 OdePointInformation pointInformation;
99 static PetscErrorCode SinglePointSootChemistryRHS(TS ts, PetscReal t, Vec X, Vec F,
void *ptr);
111 static PetscErrorCode AddSootChemistrySourceToFlow(
const FiniteVolumeSolver &solver, DM dm, PetscReal time, Vec locX, Vec fVec,
void *ctx);
114 static constexpr
double Ca = 3.;
115 static constexpr
double Cmin = 700;
116 static constexpr
double OxidationCollisionEfficiency = .2;
117 static constexpr
double NdNuclationConversionTerm = 2. / Cmin * 6.02214076e26;
128 static PetscErrorCode ComputeSootChemistryPreStep(FiniteVolumeSolver &, TS ts, PetscReal time,
bool initialStage, Vec locX,
void *ctx);
136 template <
typename real>
137 static inline double calculateSootDiameter(real YCarbon, real Nd) {
148 template <
typename real>
149 static inline real calculateSurfaceArea_V(real YCarbon, real Nd, real totalDensity) {
150 real dp = calculateSootDiameter(YCarbon, Nd);
154 template <
typename real>
155 static inline real calculateNucleationReactionRate(real T, real C2H2Conc, real fv) {
159 template <
typename real>
160 static inline real calculateSurfaceGrowthReactionRate(real T, real C2H2Conc, real SA_V) {
161 return surfPreExponential * std::exp(-10064. / T) * C2H2Conc * std::sqrt(SA_V);
164 template <
typename real>
165 static inline double calculateAgglomerationRate(real YCarbon, real Nd, real T, real totalDensity) {
166 real dp = calculateSootDiameter(YCarbon, Nd);
167 return 2 * Ca * std::sqrt(dp) * std::sqrt(6 * (1.380649e-23) * T /
solidCarbonDensity) * (totalDensity * totalDensity * Nd * Nd);
170 template <
typename real>
171 static inline real calculateO2OxidationRate(real YCarbon, real Nd, real O2Conc, real totalDensity, real T, real SA_V) {
172 real ka = 200. * std::exp(-15098. / T);
173 real kz = 21.3 * std::exp(2063. / T);
174 real kb = 4.46e-2 * std::exp(-7650. / T);
175 real kT = 1.51e6 * std::exp(-48817. / T);
176 real PO2 = O2Conc * (8314.4626) * T / (101325.);
177 real xA = 1. / (1. + kT / (kb * PO2));
178 return (ka * PO2 * xA / (1 + kz * PO2) + kb * PO2 * (1 - xA)) * SA_V;
181 template <
typename real>
182 static inline double calculateOOxidationRate(real OConc, real T, real SA_V, real fv) {
183 return 0.001094 * OxidationCollisionEfficiency * std::sqrt(T) * (8314.4626) * OConc * SA_V * (1 - fv);
186 template <
typename real>
187 static inline double calculateOHOxidationRate(real OHConc, real T, real SA_V, real fv) {
188 return .001044 * OxidationCollisionEfficiency * std::sqrt(T) * (8314.4626) * OHConc * SA_V * (1 - fv);
192 explicit Soot(
const std::shared_ptr<eos::EOS> &eos,
const std::shared_ptr<parameters::Parameters> &options = {},
double thresholdTemperature = {},
double surfaceGrowthPreExp = {},
193 double nucleationPreExp = {});
Definition: finiteVolumeSolver.hpp:28
Definition: process.hpp:7
void Initialize(ablate::finiteVolume::FiniteVolumeSolver &flow) override
Definition: soot.cpp:73
void Setup(ablate::finiteVolume::FiniteVolumeSolver &flow) override
Definition: soot.hpp:207
static double nucPreExponential
Parameters for Nucleation and Surface Growth Pre Exponentials.
Definition: soot.hpp:17
static double NddScaling
Scaling term for Ndd going into the Tines ODE Solver.
Definition: soot.hpp:15
static const double solidCarbonDensity
SolidCarbonDensity.
Definition: soot.hpp:13
constexpr static PetscReal pi
Pi.
Definition: constants.hpp:22
constexpr static PetscReal tiny
A very tiny number.
Definition: constants.hpp:25
Definition: chemistryModel.hpp:66