Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
radiation.h
Go to the documentation of this file.
1
14#ifndef CHEMISTRY_RADIATION_H
15#define CHEMISTRY_RADIATION_H
16
17#include <Kokkos_Core.hpp>
18
19#include "mechanism.h"
20
21namespace chemistry {
22
23enum class RadiatingSpecies { H2O = 0, CO2 = 1, CO = 2, CH4 = 3 };
24constexpr int N_RADIATING_SPECIES = 4;
25
28double planck_mean_absorption(const RadiatingSpecies s, const double T) {
29 switch (s) {
31 const double z = 1000.0 / T;
32 return -0.23093 + z * (-1.12390 + z * (9.41530 + z * (-2.99880 + z * (0.51382 + z * -1.86840e-5))));
33 }
35 const double z = 1000.0 / T;
36 return 18.741 + z * (-121.310 + z * (273.500 + z * (-194.050 + z * (56.310 + z * -5.8169))));
37 }
39 if (T <= 750.0) return 4.7869 + T * (-0.06953 + T * (2.95775e-4 + T * (-4.25732e-7 + T * 2.02894e-10)));
40 return 10.09 + T * (-0.01183 + T * (4.7753e-6 + T * (-5.87209e-10 + T * -2.5334e-14)));
42 return 6.6334 + T * (-0.0035686 + T * (1.6682e-8 + T * (2.5611e-10 + T * -2.6558e-14)));
43 }
44 return 0.0;
45}
46
47constexpr double STEFAN_BOLTZMANN = 5.670374419e-8; // W/(m^2 K^4), CODATA 2018 (Cantera's value)
48
54 Kokkos::Array<int32_t, N_RADIATING_SPECIES> index{-1, -1, -1, -1}; // in the mechanism, -1 if not radiating
55 Kokkos::Array<double, N_RADIATING_SPECIES> inv_W{}; // kmol/kg
56 double T_ambient4 = 0.0;
57
59 template <typename F_rho>
60 KOKKOS_INLINE_FUNCTION double loss(const double T, const F_rho & rho_k) const {
61 const double RT_atm = GAS_CONSTANT * T / ONE_ATM;
62 double kappa = 0.0; // 1/m
63 for (uint32_t s = 0; s < N_RADIATING_SPECIES; s++) {
64 if (index[s] < 0) continue;
65 kappa += rho_k(static_cast<uint32_t>(index[s])) * inv_W[s] * RT_atm * planck_mean_absorption(static_cast<RadiatingSpecies>(s), T);
66 }
67 const double T2 = T * T;
68 return 4.0 * STEFAN_BOLTZMANN * kappa * (T2 * T2 - T_ambient4);
69 }
70};
71
72} // namespace chemistry
73
74#endif // CHEMISTRY_RADIATION_H
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
Gas-phase mechanisms read from Cantera YAML files.
Definition kinetics.h:25
constexpr double ONE_ATM
Definition mechanism.h:28
RadiatingSpecies
Definition radiation.h:23
constexpr double GAS_CONSTANT
Definition mechanism.h:26
constexpr int N_RADIATING_SPECIES
Definition radiation.h:24
constexpr double STEFAN_BOLTZMANN
Definition radiation.h:47
KOKKOS_INLINE_FUNCTION double planck_mean_absorption(const RadiatingSpecies s, const double T)
Planck-mean absorption coefficient, 1 / (m atm), of species s at T (fits valid over 300-2500 K).
Definition radiation.h:28
Optically thin radiative loss q = 4 sigma sum_i p_i a_i(T) (T^4 - T_amb^4), p_i the partial pressures...
Definition radiation.h:53
Kokkos::Array< double, N_RADIATING_SPECIES > inv_W
Definition radiation.h:55
KOKKOS_INLINE_FUNCTION double loss(const double T, const F_rho &rho_k) const
Power lost per unit volume [W/m^3] at T, rho_k(k) the partial densities [kg/m^3].
Definition radiation.h:60
double T_ambient4
Definition radiation.h:56
Kokkos::Array< int32_t, N_RADIATING_SPECIES > index
Definition radiation.h:54