Skip to content

Commit 43fe9ac

Browse files
authored
KTA (#1290)
* Added new viscosity model for PURE HELIUM * Modified KTA-viscosity model with lower uncertainty
1 parent d413dea commit 43fe9ac

File tree

5 files changed

+136
-0
lines changed

5 files changed

+136
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity;
2+
3+
import neqsim.physicalproperties.system.PhysicalProperties;
4+
5+
/**
6+
* <p>
7+
* KTAViscosityMethod class.
8+
* </p>
9+
*/
10+
11+
public class KTAViscosityMethod extends Viscosity {
12+
/**
13+
* <p>
14+
* Constructor for KTAViscosityMethod.
15+
* </p>
16+
*
17+
* @param phase a {@link neqsim.physicalproperties.system.PhysicalProperties} object
18+
*/
19+
public KTAViscosityMethod(PhysicalProperties phase) {
20+
super(phase);
21+
}
22+
23+
/** {@inheritDoc} */
24+
@Override
25+
public double calcViscosity() {
26+
// Check if there are other components than helium
27+
if (phase.getPhase().getNumberOfComponents() > 1
28+
|| !phase.getPhase().getComponent(0).getName().equalsIgnoreCase("helium")) {
29+
throw new Error("This method only supports PURE HELIUM.");
30+
}
31+
32+
double T = phase.getPhase().getTemperature();
33+
//Source of KTA-model https://www.sciencedirect.com/science/article/pii/S0149197024004670#bib28
34+
double visc = 3.674 * Math.pow(10, -7) * Math.pow(T, 0.7); //[Pa*s]
35+
return visc;
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity;
2+
3+
import neqsim.physicalproperties.system.PhysicalProperties;
4+
5+
/**
6+
* <p>
7+
* KTAViscosityMethodMod class.
8+
* </p>
9+
*/
10+
public class KTAViscosityMethodMod extends Viscosity {
11+
/**
12+
* <p>
13+
* Constructor for KTAViscosityMethodMod.
14+
* </p>
15+
*
16+
* @param phase a {@link neqsim.physicalproperties.system.PhysicalProperties} object
17+
*/
18+
public KTAViscosityMethodMod(PhysicalProperties phase) {
19+
super(phase);
20+
}
21+
22+
/** {@inheritDoc} */
23+
@Override
24+
public double calcViscosity() {
25+
// Check if there are other components than helium
26+
if (phase.getPhase().getNumberOfComponents() > 1
27+
|| !phase.getPhase().getComponent(0).getName().equalsIgnoreCase("helium")) {
28+
throw new Error("This method only supports PURE HELIUM.");
29+
}
30+
31+
double T = phase.getPhase().getTemperature();
32+
double P = phase.getPhase().getPressure();
33+
double P_crit = 0.22832; // [MPa] (Source: NIST)
34+
double A = Math.pow((2 - T / 300), 5.05);
35+
double B = Math.pow((2 - 300 / T), 2) - 1;
36+
double viscosity = 1e-7 * (3.817 * Math.pow(T, 0.6938)
37+
+ Math.pow(P, A) / (T * P_crit)
38+
+ Math.exp(-Math.pow(T - 325, 2) / 1000)
39+
* (Math.pow(P / 25, 2.7) - Math.pow(T, B)));
40+
return viscosity; // [Pa*s]
41+
}
42+
}

src/main/java/neqsim/physicalproperties/system/PhysicalProperties.java

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import neqsim.physicalproperties.methods.commonphasephysicalproperties.conductivity.PFCTConductivityMethodMod86;
1313
import neqsim.physicalproperties.methods.commonphasephysicalproperties.diffusivity.CorrespondingStatesDiffusivity;
1414
import neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity.FrictionTheoryViscosityMethod;
15+
import neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity.KTAViscosityMethod;
16+
import neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity.KTAViscosityMethodMod;
1517
import neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity.LBCViscosityMethod;
1618
import neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity.PFCTViscosityMethodHeavyOil;
1719
import neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity.PFCTViscosityMethodMod86;
@@ -219,6 +221,10 @@ public void setViscosityModel(String model) {
219221
viscosityCalc = new PFCTViscosityMethodMod86(this);
220222
} else if ("PFCT-Heavy-Oil".equals(model)) {
221223
viscosityCalc = new PFCTViscosityMethodHeavyOil(this);
224+
} else if ("KTA".equals(model)) {
225+
viscosityCalc = new KTAViscosityMethod(this);
226+
} else if ("KTA_mod".equals(model)) {
227+
viscosityCalc = new KTAViscosityMethodMod(this);
222228
}
223229
}
224230

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
import neqsim.thermodynamicoperations.ThermodynamicOperations;
6+
7+
public class KTAViscosityMethodModTest {
8+
static neqsim.thermo.system.SystemInterface testSystem = null;
9+
@Test
10+
void testCalcViscosity() {
11+
double T = 273.15;
12+
double P = 20.265; //Pressure in MPa
13+
testSystem = new neqsim.thermo.system.SystemSrkEos(T, P);
14+
testSystem.addComponent("helium", 1.0);
15+
//testSystem.addComponent("hydrogen", 0.6);
16+
testSystem.setMixingRule(2);
17+
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
18+
testOps.TPflash();
19+
testSystem.getPhase("gas").getPhysicalProperties().setViscosityModel("KTA_mod");
20+
testSystem.initProperties();
21+
assertEquals(18.878e-6, testSystem.getPhase(0).getPhysicalProperties().getViscosity(), 1e-9);
22+
//double viscosity = testSystem.getPhase(0).getPhysicalProperties().getViscosity() * Math.pow(10, 6);
23+
//System.out.println("Viscosity: " + viscosity);
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package neqsim.physicalproperties.methods.commonphasephysicalproperties.viscosity;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
import neqsim.thermodynamicoperations.ThermodynamicOperations;
6+
7+
public class KTAViscosityMethodTest {
8+
static neqsim.thermo.system.SystemInterface testSystem = null;
9+
10+
@Test
11+
void testCalcViscosity() {
12+
double T = 273.15;
13+
double P = 20.265; //Pressure in MPa
14+
testSystem = new neqsim.thermo.system.SystemSrkEos(T, P);
15+
testSystem.addComponent("helium", 1.0);
16+
//testSystem.addComponent("hydrogen", 0.6);
17+
testSystem.setMixingRule(2);
18+
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
19+
testOps.TPflash();
20+
testSystem.getPhase("gas").getPhysicalProperties().setViscosityModel("KTA");
21+
testSystem.initProperties();
22+
assertEquals(18.647e-6, testSystem.getPhase(0).getPhysicalProperties().getViscosity(), 1e-9);
23+
//double viscosity = testSystem.getPhase(0).getPhysicalProperties().getViscosity() * Math.pow(10, 6);
24+
//System.out.println("Viscosity: " + viscosity);
25+
}
26+
}

0 commit comments

Comments
 (0)