User:RichardTowers: Difference between revisions
| Line 30: | Line 30: | ||
Coefficients should be stored in human readable files, not as C source. The plan is to create an XML structure for these files and a function to parse the files, loading fluid information at runtime. John suggests using RelaxNG as the schema, I'm not sure whether or not ASCEND already has a preferred cross platform XML parser, to begin with I'll use GNOME's libxml. | Coefficients should be stored in human readable files, not as C source. The plan is to create an XML structure for these files and a function to parse the files, loading fluid information at runtime. John suggests using RelaxNG as the schema, I'm not sure whether or not ASCEND already has a preferred cross platform XML parser, to begin with I'll use GNOME's libxml. | ||
====Relax NG Grammar==== | ====Relax NG Grammar==== | ||
( | Element names identify the property in question and attributes identify values. The advantage of using attributes instead of node text is that we can specify different attributes (for the same property) that are treated differently, for example: it is sometimes useful to specify the constant ideal term as a multiple of the specific gas constant instead of as an absolute value. | ||
<source lang="xml"> | <source lang="xml"> | ||
<element name="fluid" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> | <element name="fluid" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> | ||
Revision as of 14:26, 31 May 2011
Richard Towers is a GSOC2011 student (Masters of Engineering, Mechanical) from The University of Durham (UK), working on improvements to FPROPS.
Initial Thoughts
A brief summary of what I hope to achieve over the summer. These points largely follow my GSOC application, feel free to ridicule my youthful ambition.
- All current fluids tested and all discrepancies discovered
- Squashed some bugs!
- Improvements to documentation
- Separated correlation coefficients from program code, load at run-time
- Added support for one other eqn. of state and tested successfully
- Increased confirmed fluid support to 50 fluids
- Added support for a0 (p, h) where p < pt
- Added support for two more eqns. of state, tested successfully
- Added support for pseudo-pure fluids
- Increased confirmed fluid support to 70 fluids
- Added support for at least one mixture
Testing
Need to find correct data for comparison. Working version of REFPROP? Literature? Inconsistencies need to be investigated and hopefully fixed.
Improvements to documentation
As part of the build up to starting work I've been reading through the LyX generated help file that comes with ASCEND, Having just finished a dissertation written in LyX and LaTeX/pgf/tikz I could probably help significantly with the general appearance of this document, for example:
![]() |
![]() |
Separating Correlation Coefficients
Coefficients should be stored in human readable files, not as C source. The plan is to create an XML structure for these files and a function to parse the files, loading fluid information at runtime. John suggests using RelaxNG as the schema, I'm not sure whether or not ASCEND already has a preferred cross platform XML parser, to begin with I'll use GNOME's libxml.
Relax NG Grammar
Element names identify the property in question and attributes identify values. The advantage of using attributes instead of node text is that we can specify different attributes (for the same property) that are treated differently, for example: it is sometimes useful to specify the constant ideal term as a multiple of the specific gas constant instead of as an absolute value.
<element name="fluid" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <attribute name="name"><text /></attribute> <element name="idealData"> <element name="molarMass"> <attribute name="value"><data type="double" /></attribute> </element> <element name="specificGasConstant"> <attribute name="value"><data type="double" /></attribute> </element> <element name="normalizationTemperature"> <attribute name="value"><data type="double" /></attribute> </element> <element name="constantTerm"> <choice> <attribute name="absoluteValue"><data type="double" /></attribute> <attribute name="multipleOfR"><data type="double" /></attribute> </choice> </element> <element name="linearTerm"> <choice> <attribute name="absoluteValue"><data type="double" /></attribute> <attribute name="multipleOfR"><data type="double" /></attribute> <attribute name="multipleOfRAndTstar"><data type="double" /></attribute> </choice> </element> <element name="idealPowerTerms"> <oneOrMore> <element name="idealPowerTerm"> <attribute name="c"><data type="double" /></attribute> <attribute name="t"><data type="double" /></attribute> </element> </oneOrMore> </element> <element name="exponentialTerms"> <oneOrMore> <element name="exponentialTerm"> <attribute name="b"><data type="double" /></attribute> <attribute name="beta"><data type="double" /></attribute> </element> </oneOrMore> </element> </element> <element name="helmholtzData"> <element name="rhoStar"> <choice> <attribute name="value"><data type="double" /></attribute> <attribute name="valueOverM"><data type="double" /></attribute> </choice> </element> <element name="rhoC"> <choice> <attribute name="value"><data type="double" /></attribute> <attribute name="valueOverM"><data type="double" /></attribute> </choice> </element> <element name="triplePointTemp"> <attribute name="value"><data type="double" /></attribute> </element> <element name="acentricFactor"> <attribute name="value"><data type="double" /></attribute> </element> <element name="helmholtzPowerTerms"> <oneOrMore> <element name="powerTerm"> <attribute name="a"><data type="double" /></attribute> <attribute name="t"><data type="double" /></attribute> <attribute name="d"><data type="double" /></attribute> <attribute name="l"><data type="double" /></attribute> </element> </oneOrMore> </element> <element name="criticalTermsFirstKind"> <oneOrMore> <element name="criticalTerm"> <attribute name="n"><data type="double" /></attribute> <attribute name="t"><data type="double" /></attribute> <attribute name="d"><data type="double" /></attribute> <attribute name="alpha"><data type="double" /></attribute> <attribute name="beta"><data type="double" /></attribute> <attribute name="gamma"><data type="double" /></attribute> <attribute name="epsilon"><data type="double" /></attribute> </element> </oneOrMore> </element> <element name="criticalTermsSecondKind"> <zeroOrMore> <element name="criticalTerm"> <attribute name="n"><data type="double" /></attribute> <attribute name="a"><data type="double" /></attribute> <attribute name="b"><data type="double" /></attribute> <attribute name="beta"><data type="double" /></attribute> <attribute name="A"><data type="double" /></attribute> <attribute name="B"><data type="double" /></attribute> <attribute name="C"><data type="double" /></attribute> <attribute name="D"><data type="double" /></attribute> </element> </zeroOrMore> </element> </element> </element>
Example XML Fluid File
<?xml version="1.0" encoding="UTF-8"?> <fluid name="Hydrogen"> <idealData> <molarMass value="2.01594" /> <specificGasConstant value="4124.36481" /> <normalizationTemperature value="33.145" /> <constantTerm multipleOfR="-6.0132647014e+03" /> <linearTerm multipleOfRAndTstar="2.5810400764e+05" /> <idealPowerTerms> <idealPowerTerm one="2.5" two="0.0" /> </idealPowerTerms> <exponentialTerms> <exponentialTerm one="1.616" two="531" /> <exponentialTerm one="-0.4117" two="751" /> <exponentialTerm one="-0.792" two="1989" /> <exponentialTerm one="0.758" two="2484" /> <exponentialTerm one="1.217" two="6859" /> </exponentialTerms> </idealData> <helmholtzData> <rhoStar valueOverM="15.508" /> <rhoC valueOverM="15.508" /> <triplePointTemp value="13.957" /> <acentricFactor value=".088" /> <helmholtzPowerTerms> <powerTerm one="-0.693643e1" two="0.6844" three="1" four="0" /> <powerTerm one="0.01" two="1.0" three="0" four="0" /> <powerTerm one="2.1101" two="0.989" three="1" four="0" /> <powerTerm one="4.52059" two="0.489" three="1" four="0" /> <powerTerm one="0.732564" two="0.803" three="2" four="0" /> <powerTerm one="1.34086" two="1.1444" three="2" four="0" /> <powerTerm one="0.130985" two="1.409" three="3" four="0" /> <powerTerm one="-0.777414" two="1.754" three="1" four="1" /> <powerTerm one="0.351944" two="1.311" three="1" four="1" /> </helmholtzPowerTerms> <criticalTermsFirstKind> <criticalTerm one="-0.211716e-1" two="4.187" three="2" four="1.685" five="0.1710" six="0.7164" seven="1.506" /> <criticalTerm one="0.226312e-1" two="5.646" three="1" four="0.489" five="0.2245" six="1.3444" seven="0.156" /> <criticalTerm one="0.321870e-1" two="0.791" three="3" four="0.103" five="0.1304" six="1.4517" seven="1.736" /> <criticalTerm one="-0.231752e-1" two="7.249" three="1" four="2.506" five="0.2785" six="0.7204" seven="0.670" /> <criticalTerm one="0.557346e-1" two="2.986" three="1" four="1.607" five="0.3967" six="1.5445" seven="1.662" /> </criticalTermsFirstKind> <criticalTermsSecondKind> </criticalTermsSecondKind> </helmholtzData> </fluid>
Equations of State
To start with I'll expand upon Ankit's work on the Peng-Robinson, later adding MBWR if this is seen as a priority.

