Pick a representative single-phase (T, p) state for each benchmark fluid, run the AbstractState through update so tau/delta are well-defined, then return log(tau) and log(delta). Returns false if the state can't be reached.
| 216 | // AbstractState through update so tau/delta are well-defined, then return log(tau) |
| 217 | // and log(delta). Returns false if the state can't be reached. |
| 218 | bool eval_state(const std::string& name, double T, double p, double& log_tau, double& log_delta) { |
| 219 | std::shared_ptr<CoolProp::AbstractState> AS; |
| 220 | try { |
| 221 | AS.reset(CoolProp::AbstractState::factory("HEOS", name)); |
| 222 | AS->update(CoolProp::PT_INPUTS, p, T); |
| 223 | } catch (...) { |
| 224 | return false; |
| 225 | } |
| 226 | const double tau = AS->tau(), delta = AS->delta(); |
| 227 | if (!(tau > 0) || !(delta > 0)) return false; |
| 228 | log_tau = std::log(tau); |
| 229 | log_delta = std::log(delta); |
| 230 | return true; |
| 231 | } |
| 232 | |
| 233 | } // anonymous namespace |
| 234 |