8
8
9
9
import java .util .ArrayList ;
10
10
import org .apache .logging .log4j .LogManager ;
11
+ import org .apache .logging .log4j .Logger ;
11
12
import neqsim .physicalProperties .PhysicalPropertyHandler ;
12
13
import neqsim .thermo .ThermodynamicConstantsInterface ;
13
14
import neqsim .thermo .ThermodynamicModelSettings ;
14
15
import neqsim .thermo .component .ComponentInterface ;
15
16
import neqsim .thermo .system .SystemInterface ;
16
17
import neqsim .util .exception .InvalidInputException ;
17
- import org .apache .logging .log4j .Logger ;
18
18
19
19
/**
20
20
* Phase class.
@@ -122,7 +122,8 @@ public void addComponent(String name, double moles, int compNumber) {
122
122
}
123
123
124
124
if (this .hasComponent (name )) {
125
- // shall use addMoles/addMolesChemreac to adding/subtracting moles for component.
125
+ // shall use addMoles/addMolesChemreac to adding/subtracting moles for
126
+ // component.
126
127
throw new RuntimeException (new InvalidInputException (this , "addComponent" , "name" ,
127
128
"component with same name already exists in phase. Use addMoles or addMolesChemreac." ));
128
129
}
@@ -616,6 +617,9 @@ public double getMolarVolume(String unit) {
616
617
case "litre/mol" :
617
618
conversionFactor = 1000.0 ;
618
619
break ;
620
+ case "ft3/lbmole" :
621
+ conversionFactor = 16018.463373960138 ;
622
+ break ;
619
623
default :
620
624
throw new RuntimeException ("unit not supported " + unit );
621
625
}
@@ -1000,6 +1004,9 @@ public double getCp(String unit) {
1000
1004
case "kJ/kgK" :
1001
1005
conversionFactor = 1.0 / getNumberOfMolesInPhase () / getMolarMass () / 1000.0 ;
1002
1006
break ;
1007
+ case "btu/lbmole-F" :
1008
+ conversionFactor = 1.0 / getNumberOfMolesInPhase () / getMolarMass () / 1000.0 * 0.2388 ;
1009
+ break ;
1003
1010
default :
1004
1011
break ;
1005
1012
}
@@ -1030,6 +1037,9 @@ public double getCv(String unit) {
1030
1037
case "kJ/kgK" :
1031
1038
conversionFactor = 1.0 / getNumberOfMolesInPhase () / getMolarMass () / 1000.0 ;
1032
1039
break ;
1040
+ case "btu/lbmole-F" :
1041
+ conversionFactor = 1.0 / getNumberOfMolesInPhase () / getMolarMass () / 1000.0 * 0.2388 ;
1042
+ break ;
1033
1043
default :
1034
1044
break ;
1035
1045
}
@@ -1165,6 +1175,9 @@ public double getEntropy(String unit) {
1165
1175
case "kJ/kgK" :
1166
1176
conversionFactor = 1.0 / getNumberOfMolesInPhase () / getMolarMass () / 1000.0 ;
1167
1177
break ;
1178
+ case "btu/lb-F" :
1179
+ conversionFactor = 1.0 / getNumberOfMolesInPhase () / getMolarMass () / 1000.0 * 0.2388 ;
1180
+ break ;
1168
1181
default :
1169
1182
throw new RuntimeException ("unit not supported " + unit );
1170
1183
}
@@ -1226,6 +1239,9 @@ public double getThermalConductivity(String unit) {
1226
1239
case "W/cmK" :
1227
1240
conversionFactor = 0.01 ;
1228
1241
break ;
1242
+ case "Btu/hr-ft-F" :
1243
+ conversionFactor = 0.5781759824 ;
1244
+ break ;
1229
1245
default :
1230
1246
throw new RuntimeException ("unit not supported " + unit );
1231
1247
}
@@ -1559,6 +1575,27 @@ public final double getMolarMass() {
1559
1575
return tempVar ;
1560
1576
}
1561
1577
1578
+ /** {@inheritDoc} */
1579
+ @ Override
1580
+ public double getMolarMass (String unit ) {
1581
+ double refMolarMass = getMolarMass ();
1582
+ double conversionFactor = 1.0 ;
1583
+ switch (unit ) {
1584
+ case "kg/mol" :
1585
+ conversionFactor = 1.0 ;
1586
+ break ;
1587
+ case "gr/mol" :
1588
+ conversionFactor = 1000.0 ;
1589
+ break ;
1590
+ case "lbm/lbmol" :
1591
+ conversionFactor = 1000.0 ;
1592
+ break ;
1593
+ default :
1594
+ throw new RuntimeException ("unit not supported " + unit );
1595
+ }
1596
+ return refMolarMass * conversionFactor ;
1597
+ }
1598
+
1562
1599
/** {@inheritDoc} */
1563
1600
@ Override
1564
1601
public double getJouleThomsonCoefficient (String unit ) {
@@ -1571,6 +1608,12 @@ public double getJouleThomsonCoefficient(String unit) {
1571
1608
case "C/bar" :
1572
1609
conversionFactor = 1.0 ;
1573
1610
break ;
1611
+ case "K/Pa" :
1612
+ conversionFactor = 1.0e-5 ;
1613
+ break ;
1614
+ case "F/psi" :
1615
+ conversionFactor = 1.8 * 1.0 / 14.503773773 ;
1616
+ break ;
1574
1617
default :
1575
1618
throw new RuntimeException ("unit not supported " + unit );
1576
1619
}
@@ -2093,6 +2136,27 @@ public double getSoundSpeed() {
2093
2136
throw new UnsupportedOperationException ("Unimplemented method 'getSoundSpeed'" );
2094
2137
}
2095
2138
2139
+ /** {@inheritDoc} */
2140
+ @ Override
2141
+ public double getSoundSpeed (String unit ) {
2142
+ double refVel = getSoundSpeed ();
2143
+ double conversionFactor = 1.0 ;
2144
+ switch (unit ) {
2145
+ case "m/s" :
2146
+ conversionFactor = 1.0 ;
2147
+ break ;
2148
+ case "km/hr" :
2149
+ conversionFactor = 3.6 ;
2150
+ break ;
2151
+ case "ft/sec" :
2152
+ conversionFactor = 3.280839895 ;
2153
+ break ;
2154
+ default :
2155
+ break ;
2156
+ }
2157
+ return refVel * conversionFactor ;
2158
+ }
2159
+
2096
2160
/** {@inheritDoc} */
2097
2161
@ Override
2098
2162
public ComponentInterface getComponentWithIndex (int index ) {
0 commit comments