1 #ifndef ABLATELIBRARY_STATEVECTORSOOT_HPP
2 #define ABLATELIBRARY_STATEVECTORSOOT_HPP
3 #include "TChem_Util.hpp"
4 #include "sootConstants.hpp"
13 template <
typename RealType1DView>
16 const ::TChem::ordinal_type _nSpec;
17 const RealType1DView _v;
20 using real_value_type =
typename RealType1DView::non_const_value_type;
21 using range_type = Kokkos::pair<::TChem::ordinal_type, ::TChem::ordinal_type>;
23 KOKKOS_INLINE_FUNCTION
StateVectorSoot(const ::TChem::ordinal_type nGasSpec,
const RealType1DView &v) : _nSpec(nGasSpec), _v(v) {}
26 KOKKOS_INLINE_FUNCTION
bool isValid()
const {
27 const bool is_valid_rank = (RealType1DView::Rank == 1);
28 const bool is_extent_valid = (_v.extent(0) <= (3 + _nSpec + 1 ));
29 return (is_valid_rank && is_extent_valid);
33 KOKKOS_INLINE_FUNCTION ::TChem::ordinal_type
size()
const {
return _nSpec + 3 + 1; }
34 KOKKOS_INLINE_FUNCTION
void assign_data(real_value_type *ptr) { _v.assign_data(ptr); }
37 KOKKOS_INLINE_FUNCTION RealType1DView
KokkosView()
const {
return _v; }
38 KOKKOS_INLINE_FUNCTION ::TChem::ordinal_type NumGasSpecies()
const {
return _nSpec; }
39 KOKKOS_INLINE_FUNCTION ::TChem::ordinal_type NumSpecies()
const {
return _nSpec + 1; }
42 KOKKOS_INLINE_FUNCTION real_value_type &
Density()
const {
return _v(0); }
43 KOKKOS_INLINE_FUNCTION real_value_type &
Pressure()
const {
return _v(1); }
44 KOKKOS_INLINE_FUNCTION real_value_type &Temperature()
const {
return _v(2); }
45 KOKKOS_INLINE_FUNCTION
auto MassFractions() const -> decltype(Kokkos::subview(_v, range_type(3, 3 + _nSpec + 1))) {
return Kokkos::subview(_v, range_type(3, 3 + _nSpec + 1)); }
46 KOKKOS_INLINE_FUNCTION real_value_type &MassFractionCarbon()
const {
return _v(3 + _nSpec); }
47 KOKKOS_INLINE_FUNCTION real_value_type &SootNumberDensity()
const {
return _v(3 + _nSpec + 1); }
49 KOKKOS_INLINE_FUNCTION real_value_type *DensityPtr()
const {
return &_v(0); }
50 KOKKOS_INLINE_FUNCTION real_value_type *PressurePtr()
const {
return &_v(1); }
51 KOKKOS_INLINE_FUNCTION real_value_type *TemperaturePtr()
const {
return &_v(2); }
52 KOKKOS_INLINE_FUNCTION real_value_type *MassFractionsPtr()
const {
return &_v(3); }
56 template <
typename real_1d_viewType>
57 inline void SplitYiState(Impl::StateVector<real_1d_viewType> &gaseousState)
const {
58 double Yc = MassFractionCarbon();
61 gaseousState.Temperature() = Temperature();
62 gaseousState.Pressure() = Pressure();
63 auto yiGaseousState = gaseousState.MassFractions();
64 auto yi = MassFractions();
66 for (
auto ns = 0; ns < _nSpec; ns++) {
67 yiGaseousState(ns) = yi(ns) / (1.0 - Yc);
70 gaseousState.Density() = (1 - Yc) / (1 /
Density() - Yc / ablate::eos::tChemSoot::solidCarbonDensity);
74 static KOKKOS_INLINE_FUNCTION ordinal_type getStateVectorSootSize(
const ordinal_type nGasSpec) {
return nGasSpec + 3 + 2 ; }
Definition: densityFcn.hpp:11
Definition: pressure.hpp:10
Definition: stateVectorSoot.hpp:14
KOKKOS_INLINE_FUNCTION real_value_type & Density() const
interface to state vector
Definition: stateVectorSoot.hpp:42
KOKKOS_INLINE_FUNCTION bool isValid() const
validate input vector
Definition: stateVectorSoot.hpp:26
KOKKOS_INLINE_FUNCTION RealType1DView KokkosView() const
copy access to private members
Definition: stateVectorSoot.hpp:37
KOKKOS_INLINE_FUNCTION ::TChem::ordinal_type size() const
assign a pointer to update the vector in a batch fashion
Definition: stateVectorSoot.hpp:33