MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / eval_state

Function eval_state

src/Tests/CoolProp-Tests-TermCacheProfile.cpp:218–231  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
218bool 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

Calls 6

logFunction · 0.85
resetMethod · 0.80
factoryFunction · 0.50
updateMethod · 0.45
tauMethod · 0.45
deltaMethod · 0.45

Tested by

no test coverage detected