CoolProp  6.6.0
An open-source fluid property and humid air property database
TTSEBackend.h
Go to the documentation of this file.
1 #ifndef TTSEBACKEND_H
2 #define TTSEBACKEND_H
3 
4 #include "TabularBackends.h"
5 #include "DataStructures.h"
6 
7 namespace CoolProp {
8 
9 class TTSEBackend : public TabularBackend
10 {
11  public:
12  std::string backend_name(void) {
14  }
16  TTSEBackend(shared_ptr<CoolProp::AbstractState> AS) : TabularBackend(AS) {
18  // If a pure fluid or a predefined mixture, don't need to set fractions, go ahead and build
19  if (!this->AS->get_mole_fractions().empty()) {
20  check_tables();
23  dataset->build_coeffs(single_phase_logph, dataset->coeffs_ph);
24  dataset->build_coeffs(single_phase_logpT, dataset->coeffs_pT);
25  is_mixture = (this->AS->get_mole_fractions().size() > 1);
26  }
27  }
28  double evaluate_single_phase(SinglePhaseGriddedTableData& table, parameters output, double x, double y, std::size_t i, std::size_t j);
29  double evaluate_single_phase_transport(SinglePhaseGriddedTableData& table, parameters output, double x, double y, std::size_t i, std::size_t j);
30  double evaluate_single_phase_phmolar(parameters output, std::size_t i, std::size_t j) {
32  return evaluate_single_phase(single_phase_logph, output, _hmolar, _p, i, j);
33  }
34  double evaluate_single_phase_pT(parameters output, std::size_t i, std::size_t j) {
36  return evaluate_single_phase(single_phase_logpT, output, _T, _p, i, j);
37  }
38  double evaluate_single_phase_phmolar_transport(parameters output, std::size_t i, std::size_t j) {
40  return evaluate_single_phase_transport(single_phase_logph, output, _hmolar, _p, i, j);
41  }
42  double evaluate_single_phase_pT_transport(parameters output, std::size_t i, std::size_t j) {
44  return evaluate_single_phase_transport(single_phase_logpT, output, _T, _p, i, j);
45  }
46  void invert_single_phase_x(const SinglePhaseGriddedTableData& table, const std::vector<std::vector<CellCoeffs>>& coeffs, parameters output,
47  double x, double y, std::size_t i, std::size_t j);
48  void invert_single_phase_y(const SinglePhaseGriddedTableData& table, const std::vector<std::vector<CellCoeffs>>& coeffs, parameters output,
49  double y, double x, std::size_t i, std::size_t j);
50 
52  virtual void find_native_nearest_good_indices(SinglePhaseGriddedTableData& table, const std::vector<std::vector<CellCoeffs>>& coeffs, double x,
53  double y, std::size_t& i, std::size_t& j) {
54  return table.find_native_nearest_good_neighbor(x, y, i, j);
55  };
57  virtual void find_nearest_neighbor(SinglePhaseGriddedTableData& table, const std::vector<std::vector<CellCoeffs>>& coeffs,
58  const parameters variable1, const double value1, const parameters otherkey, const double otherval,
59  std::size_t& i, std::size_t& j) {
60  table.find_nearest_neighbor(variable1, value1, otherkey, otherval, cached_single_phase_i, cached_single_phase_j);
61  };
62 
75  double evaluate_single_phase_derivative(SinglePhaseGriddedTableData& table, parameters output, double x, double y, std::size_t i, std::size_t j,
76  std::size_t Nx, std::size_t Ny);
77  double evaluate_single_phase_phmolar_derivative(parameters output, std::size_t i, std::size_t j, std::size_t Nx, std::size_t Ny) {
79  return evaluate_single_phase_derivative(single_phase_logph, output, _hmolar, _p, i, j, Nx, Ny);
80  };
81  double evaluate_single_phase_pT_derivative(parameters output, std::size_t i, std::size_t j, std::size_t Nx, std::size_t Ny) {
83  return evaluate_single_phase_derivative(single_phase_logpT, output, _T, _p, i, j, Nx, Ny);
84  };
85 };
86 
87 } // namespace CoolProp
88 
89 #endif // TTSEBACKEND_H