usnistgov / REFPROP-issues

A repository solely used for reporting issues with NIST REFPROP
26 stars 13 forks source link

HEATFRMdll #363

Closed Jonshagen closed 3 years ago

Jonshagen commented 3 years ago

I am trying to set up a simple but flexible combustion process using heat of formation. The input substances will be defined by the user.

the HeatFrmDll returns "662 Not all heating values available" for very common substances. I get it for pure H2O and for a air like mixture of N2, O2 mixture (of course I expect 0 HFRM). Are those substances not available?

code: // get pointers into the dll to the actual functions. SETUPdll = (fp_SETUPdllTYPE)GetProcAddress(RefpropdllInstance, "SETUPdll"); SETREFdll = (fp_SETREFdllTYPE)GetProcAddress(RefpropdllInstance, "SETREFdll"); HEATFRMdll = (fp_HEATFRMdllTYPE)GetProcAddress(RefpropdllInstance, "HEATFRMdll");

// SETREFdll(hrf, &ixflag, x, &h0, &s0, &t0, &p0, &ierr, herr, lengthofreference, errormessagelength); I have tested with this on and off but I dont think it should be needed for the heat of formation SETUPdll(&i, hf, hfmix, hrf, &ierr, herr, refpropcharlength*ncmax, refpropcharlength, lengthofreference, errormessagelength);

// Reference temperature t = T + 273.15;
// Calculate enthalpy HEATFRMdll(&t, &d, x, &hFrm, &ierr, herr, errormessagelength);

ianhbell commented 3 years ago

Can you please post a runnable (copy-pastable) example? Also, are you aware of these headers: https://github.com/CoolProp/REFPROP-headers ?

Jonshagen commented 3 years ago

Hmm, maybe my headers are outdated?

include

include

include "stdafx.h"

include "refprop2.h"

include

include // to write steps of calculation in file to check for errors

include // to write steps of calculation in file to check for errors

include

include

include

using namespace std; //OK as long as no other namespaces are used

define EXTERN_FUNCTION __declspec(dllexport) _stdcall

ianhbell commented 3 years ago

Yes, please switch over to the REFPROP_headers ones and try again. No more function pointer management!

EricLemmon commented 3 years ago

There's a bug in the heat of formation routine that may return incorrect values under some circumstances. If you would like a patch, please send me a personal email (eric.lemmon@nist.gov).