15 using NonPolarTerms = std::variant<saft::pcsaft::PCSAFTMixture, SAFTVRMie::SAFTVRMieNonpolarMixture, saft::softsaft::SoftSAFT, TwoCLJ>;
21 std::string kind = j.at(
"kind");
22 if (kind ==
"PCSAFT" || kind ==
"PC-SAFT"){
25 else if (kind ==
"SAFTVRMie" || kind ==
"SAFT-VR-Mie"){
28 else if (kind ==
"Johnson+Johnson" || kind ==
"softSAFT"){
31 else if (kind ==
"2CLJF" || kind ==
"2CLJ"){
32 const auto& model = j.at(
"model");
36 throw std::invalid_argument(
"Not valid nonpolar kind:" + kind);
40 std::string kind = j.at(
"kind");
41 if (kind ==
"canonical" || kind ==
"Dufal"){
45 throw std::invalid_argument(
"Not valid association kind:" + kind);
51 if (j.contains(
"association")){
52 association.emplace(make_association(j.at(
"association")));
56 template<
class VecType>
57 auto R(
const VecType& molefrac)
const {
65 template <
typename TType,
typename RhoType,
typename MoleFractions>
66 auto alphar(
const TType& T,
const RhoType& rho,
const MoleFractions& molefrac)
const {
67 auto contrib = std::visit([&](
auto& t) {
return t.alphar(T, rho, molefrac); },
nonpolar);
70 contrib += std::visit([&](
auto& t) {
return t.alphar(T, rho, molefrac); }, at);
static Association factory(const nlohmann::json &j)
auto SAFTVRMieNonpolarfactory(const nlohmann::json &spec)
auto PCSAFTfactory(const nlohmann::json &spec)
A JSON-based factory function for the PC-SAFT model.
auto build_two_center_model(const std::string &model_version, const double &L=0.0)
auto get_R_gas()
< Gas constant, according to CODATA 2019, in the given number type
auto R(const VecType &molefrac) const
std::variant< association::Association > AssociationTerms
std::variant< saft::pcsaft::PCSAFTMixture, SAFTVRMie::SAFTVRMieNonpolarMixture, saft::softsaft::SoftSAFT, TwoCLJ > NonPolarTerms
std::optional< AssociationTerms > association
GenericSAFT(const nlohmann::json &j)
auto alphar(const TType &T, const RhoType &rho, const MoleFractions &molefrac) const