User:RichardTowers: Difference between revisions
Added code snippet |
Updated RNG grammar |
||
| Line 23: | Line 23: | ||
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==== | ||
( | (Some of the names could be made more descriptive) | ||
<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"> | ||
< | <attribute name="name"><text /></attribute> | ||
<element name="idealData"> | |||
<element name="molarMass"> | |||
<attribute name="value"><data type="double" /></attribute> | |||
< | |||
</element> | </element> | ||
</oneOrMore> | <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="one"><data type="double" /></attribute> | |||
<attribute name="two"><data type="double" /></attribute> | |||
</element> | |||
</oneOrMore> | |||
</element> | |||
<element name="exponentialTerms"> | |||
<oneOrMore> | |||
<element name="exponentialTerm"> | |||
<attribute name="one"><data type="double" /></attribute> | |||
<attribute name="two"><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="one"><data type="double" /></attribute> | |||
<attribute name="two"><data type="double" /></attribute> | |||
<attribute name="three"><data type="double" /></attribute> | |||
<attribute name="four"><data type="double" /></attribute> | |||
</element> | |||
</oneOrMore> | |||
</element> | |||
<element name="criticalTermsFirstKind"> | |||
<oneOrMore> | |||
<element name="criticalTerm"> | |||
<attribute name="one"><data type="double" /></attribute> | |||
<attribute name="two"><data type="double" /></attribute> | |||
<attribute name="three"><data type="double" /></attribute> | |||
<attribute name="four"><data type="double" /></attribute> | |||
<attribute name="five"><data type="double" /></attribute> | |||
<attribute name="six"><data type="double" /></attribute> | |||
<attribute name="seven"><data type="double" /></attribute> | |||
</element> | |||
</oneOrMore> | |||
</element> | |||
<element name="criticalTermsSecondKind"> | |||
<zeroOrMore> | |||
<element name="criticalTerm"> | |||
<attribute name="one"><data type="double" /></attribute> | |||
<attribute name="two"><data type="double" /></attribute> | |||
<attribute name="three"><data type="double" /></attribute> | |||
<attribute name="four"><data type="double" /></attribute> | |||
<attribute name="five"><data type="double" /></attribute> | |||
<attribute name="six"><data type="double" /></attribute> | |||
<attribute name="seven"><data type="double" /></attribute> | |||
</element> | |||
</zeroOrMore> | |||
</element> | |||
</element> | |||
</element> | </element> | ||
</source> | |||
====Example XML Fluid File==== | |||
<source lang="xml"> | |||
<?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> | |||
</source> | </source> | ||
Revision as of 12:19, 23 May 2011
Richard Towers is a GSOC2011 student 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. I feel that the documentation is useful and well written, but the formatting is far from professional. Having just finished a dissertation written in LyX and LaTeX/pgf/tikz I feel I could be a big help in this regard. Clearly any work I do here would be additional to the main body of the project.
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
(Some of the names could be made more descriptive)
<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="one"><data type="double" /></attribute> <attribute name="two"><data type="double" /></attribute> </element> </oneOrMore> </element> <element name="exponentialTerms"> <oneOrMore> <element name="exponentialTerm"> <attribute name="one"><data type="double" /></attribute> <attribute name="two"><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="one"><data type="double" /></attribute> <attribute name="two"><data type="double" /></attribute> <attribute name="three"><data type="double" /></attribute> <attribute name="four"><data type="double" /></attribute> </element> </oneOrMore> </element> <element name="criticalTermsFirstKind"> <oneOrMore> <element name="criticalTerm"> <attribute name="one"><data type="double" /></attribute> <attribute name="two"><data type="double" /></attribute> <attribute name="three"><data type="double" /></attribute> <attribute name="four"><data type="double" /></attribute> <attribute name="five"><data type="double" /></attribute> <attribute name="six"><data type="double" /></attribute> <attribute name="seven"><data type="double" /></attribute> </element> </oneOrMore> </element> <element name="criticalTermsSecondKind"> <zeroOrMore> <element name="criticalTerm"> <attribute name="one"><data type="double" /></attribute> <attribute name="two"><data type="double" /></attribute> <attribute name="three"><data type="double" /></attribute> <attribute name="four"><data type="double" /></attribute> <attribute name="five"><data type="double" /></attribute> <attribute name="six"><data type="double" /></attribute> <attribute name="seven"><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.