teqp 0.22.0
Loading...
Searching...
No Matches
multifluid_gas_constant.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "teqp/constants.hpp"
4
5namespace teqp{
6namespace multifluid{
7namespace gasconstant{
8
10 const std::vector<double> Rvals;
11public:
12
13 MoleFractionWeighted(const std::vector<double>& Rvals) : Rvals(Rvals) {};
14
15 template<typename MoleFractions>
16 auto get_R(const MoleFractions& molefracs) const {
17 using resulttype = std::common_type_t<decltype(molefracs[0])>; // Type promotion, without the const-ness
18 resulttype out = 0.0;
19 auto N = molefracs.size();
20 for (auto i = 0; i < N; ++i) {
21 out += molefracs[i] * Rvals[i];
22 }
23 return forceeval(out);
24 }
25};
26
27class CODATA{
28public:
29 template<typename MoleFractions>
30 auto get_R(const MoleFractions& molefracs) const {
32 }
33};
34
35using GasConstantCalculator = std::variant<MoleFractionWeighted, CODATA>;
36
37}
38}
39}
auto get_R(const MoleFractions &molefracs) const
auto get_R(const MoleFractions &molefracs) const
std::variant< MoleFractionWeighted, CODATA > GasConstantCalculator
auto forceeval(T &&expr)
Definition types.hpp:52
auto get_R_gas()
< Gas constant, according to CODATA 2019, in the given number type
Definition constants.hpp:22