teqp
0.22.0
Loading...
Searching...
No Matches
include
teqp
models
multifluid_gas_constant.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
teqp/constants.hpp
"
4
5
namespace
teqp
{
6
namespace
multifluid{
7
namespace
gasconstant{
8
9
class
MoleFractionWeighted
{
10
const
std::vector<double> Rvals;
11
public
:
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
27
class
CODATA
{
28
public
:
29
template
<
typename
MoleFractions>
30
auto
get_R
(
const
MoleFractions& molefracs)
const
{
31
return
get_R_gas<decltype(molefracs[0])>
();
32
}
33
};
34
35
using
GasConstantCalculator
= std::variant<MoleFractionWeighted, CODATA>;
36
37
}
38
}
39
}
teqp::multifluid::gasconstant::CODATA
Definition
multifluid_gas_constant.hpp:27
teqp::multifluid::gasconstant::CODATA::get_R
auto get_R(const MoleFractions &molefracs) const
Definition
multifluid_gas_constant.hpp:30
teqp::multifluid::gasconstant::MoleFractionWeighted
Definition
multifluid_gas_constant.hpp:9
teqp::multifluid::gasconstant::MoleFractionWeighted::MoleFractionWeighted
MoleFractionWeighted(const std::vector< double > &Rvals)
Definition
multifluid_gas_constant.hpp:13
teqp::multifluid::gasconstant::MoleFractionWeighted::get_R
auto get_R(const MoleFractions &molefracs) const
Definition
multifluid_gas_constant.hpp:16
constants.hpp
teqp::multifluid::gasconstant::GasConstantCalculator
std::variant< MoleFractionWeighted, CODATA > GasConstantCalculator
Definition
multifluid_gas_constant.hpp:35
teqp
Definition
ancillary_builder.hpp:8
teqp::forceeval
auto forceeval(T &&expr)
Definition
types.hpp:52
teqp::get_R_gas
auto get_R_gas()
< Gas constant, according to CODATA 2019, in the given number type
Definition
constants.hpp:22
Generated by
1.11.0