ABLATE Source Documentation  0.12.33
sourceCalculatorSoot.hpp
1 #ifndef ABLATELIBRARY_TCHEM_SOURCECALCULATORSOOT_HPP
2 #define ABLATELIBRARY_TCHEM_SOURCECALCULATORSOOT_HPP
3 #include <Kokkos_Macros.hpp>
4 #ifndef KOKKOS_ENABLE_CUDA
5 
6 #include <TChem_KineticModelGasConstData.hpp>
7 #include "eos/chemistryModel.hpp"
8 #include "eos/tChem/sourceCalculator.hpp"
9 
10 namespace tChemLib = TChem;
11 
12 namespace ablate::eos {
13 class TChemSoot;
14 }
15 
16 namespace ablate::eos::tChemSoot {
17 
21 class SourceCalculatorSoot : public ChemistryModel::SourceCalculator, private utilities::Loggable<SourceCalculatorSoot> {
22  public:
29  SourceCalculatorSoot(const std::vector<domain::Field>& fields, const std::shared_ptr<TChemSoot>& tChemEos, ablate::eos::tChem::SourceCalculator::ChemistryConstraints constraints,
30  const ablate::domain::Range& cellRange);
31 
35  void ComputeSource(const ablate::domain::Range& cellRange, PetscReal time, PetscReal dt, Vec globalSolution) override;
36 
40  void AddSource(const ablate::domain::Range& cellRange, Vec localXVec, Vec localFVec) override;
41 
42  private:
45 
49  std::shared_ptr<eos::TChemSoot> eos;
50  const size_t numberSpecies;
51 
53  PetscInt eulerId;
54 
56  PetscInt densityYiId;
57 
59  PetscInt densityProgressId;
60  PetscInt sootNumberDensityIndex;
61 
62  // tchem memory storage on host/device. These will be sized for the number of active nodes in the domain
63  real_type_2d_view stateDevice;
64  real_type_2d_view_host stateHost;
65 
66  // store the end state for the device/host
67  real_type_2d_view endStateDevice;
68 
69  // the time advance information
70  time_advance_type_1d_view timeAdvanceDevice;
71  time_advance_type timeAdvanceDefault{};
72 
73  // store host/device memory for computing state
74  real_type_1d_view internalEnergyRefDevice;
75  real_type_1d_view_host internalEnergyRefHost;
76  real_type_1d_view totInternalEnergyRefDevice;
77  real_type_1d_view_host totInternalEnergyRefHost;
78  real_type_2d_view perSpeciesScratchDevice;
79  real_type_2d_view perGasSpeciesScratchDevice;
80 
81  // store the source terms (density* energy + density*species)
82  real_type_2d_view_host sourceTermsHost;
83  real_type_2d_view sourceTermsDevice;
84 
85  // tolerance constraints
86  real_type_2d_view tolTimeDevice;
87  real_type_1d_view tolNewtonDevice;
88  real_type_2d_view facDevice;
89 
90  // store the time and delta for the ode solver
91  real_type_1d_view timeViewDevice;
92  real_type_1d_view dtViewDevice;
93 
94  // store device specific kineticModelGasConstants
95  tChemLib::KineticModelConstData<typename Tines::UseThisDevice<exec_space>::type> kineticModelGasConstDataDevice;
96  kmd_type_1d_view_host kineticModelDataClone;
97  Kokkos::View<KineticModelGasConstData<typename Tines::UseThisDevice<exec_space>::type>*, typename Tines::UseThisDevice<exec_space>::type> kineticModelGasConstDataDevices;
98 };
99 
100 } // namespace ablate::eos::tChemSoot
101 
102 #endif // ABLATELIBRARY_BATCHSOURCE_HPP
103 #endif
Definition: chemistryModel.hpp:30
Definition: sourceCalculatorSoot.hpp:21
SourceCalculatorSoot(const std::vector< domain::Field > &fields, const std::shared_ptr< TChemSoot > &tChemEos, ablate::eos::tChem::SourceCalculator::ChemistryConstraints constraints, const ablate::domain::Range &cellRange)
Definition: sourceCalculatorSoot.cpp:11
void AddSource(const ablate::domain::Range &cellRange, Vec localXVec, Vec localFVec) override
Definition: sourceCalculatorSoot.cpp:341
void ComputeSource(const ablate::domain::Range &cellRange, PetscReal time, PetscReal dt, Vec globalSolution) override
Definition: sourceCalculatorSoot.cpp:113
Definition: loggable.hpp:9
Definition: densityFcn.hpp:11
Definition: range.hpp:11
hold a struct that can be used for chemistry constraints
Definition: sourceCalculator.hpp:26