While working on FFI bindings for REFPROP 10.0, I noticed a slight discrepancy in the ALLPROPS1dll subroutine between the documentation and the actual behavior. In the documentation, ALLPROPS1dll is described as the function for one property calculation. However, in the parameter description, there are some indications of array output.
-
c parameter
The documentation describes the output c as an array:
c [double ,out] :: Output value (array of size 200 dimensioned as double precision). The number -9999970 will be returned when errors occur or no input was requested.
-
hOut parameter
The description for hOut includes examples that suggest array outputs:
For example, a proper string would be hOut=’T,P,D,H,E,S’, whereas an improperly defined string would be hOut=’T,P;D H|E,S’. Use of lower or upper case is not important. Some properties will return multiple values, for example, hOut=’F,Fc,XMOLE’ will return 12 properties for a four component system, these being F(1), F(2), F(3), F(4), Fc(1), Fc(2), etc. To retrieve the property of a single component, use, for example, hOut=’XMOLE(2),XMOLE(3)’
The actual Fortran function seems to call ALLPROPS to calculate all the properties and return only the first element.
call ALLPROPS (hOut,iUnits,0,0,T,D,z,OutputArray,hUnitsArray,iUCodeArray,ierr,herr)
c=OutputArray(1)
This could lead to a few potential issues:
- A user following the hOut example might request multiple properties. The internal engine will compute them, but all except the first value will be silently discarded.
- If a 200-element array is allocated for
c, the subroutine writes a value only at the first element. The other elements might be uninitialized.
I wanted to bring this to your attention as it might cause confusion for some users/developers.
Thanks!
While working on FFI bindings for REFPROP 10.0, I noticed a slight discrepancy in the ALLPROPS1dll subroutine between the documentation and the actual behavior. In the documentation, ALLPROPS1dll is described as the function for one property calculation. However, in the parameter description, there are some indications of array output.
cparameterThe documentation describes the output c as an array:
c [double ,out] :: Output value (array of size 200 dimensioned as double precision). The number -9999970 will be returned when errors occur or no input was requested.
hOutparameterThe description for hOut includes examples that suggest array outputs:
For example, a proper string would be hOut=’T,P,D,H,E,S’, whereas an improperly defined string would be hOut=’T,P;D H|E,S’. Use of lower or upper case is not important. Some properties will return multiple values, for example, hOut=’F,Fc,XMOLE’ will return 12 properties for a four component system, these being F(1), F(2), F(3), F(4), Fc(1), Fc(2), etc. To retrieve the property of a single component, use, for example, hOut=’XMOLE(2),XMOLE(3)’
The actual Fortran function seems to call ALLPROPS to calculate all the properties and return only the first element.
This could lead to a few potential issues:
c, the subroutine writes a value only at the first element. The other elements might be uninitialized.I wanted to bring this to your attention as it might cause confusion for some users/developers.
Thanks!