Skip to content

Commit

Permalink
Adding a test getPressure in PengRobinsonMFTP_Test.cpp file
Browse files Browse the repository at this point in the history
  • Loading branch information
Gandhali Kogekar committed Jul 8, 2019
1 parent 48537aa commit 777a0d6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/thermo/PengRobinsonMFTP_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,34 @@ TEST_F(PengRobinsonMFTP_Test, setTP)
}
}

TEST_F(PengRobinsonMFTP_Test, getPressure)
{
// Check to make sure that the P-R equation is accurately reproduced for a few selected values

double a_coeff = 3.958134E+5;
double b_coeff = 26.6275/1000;
double acc_factor = 0.228;
double pres_theoretical, kappa, alpha, mv;
const double Tcrit = test_phase->critTemperature();

//Calculate kappa value
if (acc_factor <= 0.491) {
kappa = 0.37464 + 1.54226*acc_factor - 0.26992*acc_factor*acc_factor;
}
else {
kappa = 0.379642 + 1.487503*acc_factor - 0.164423*acc_factor*acc_factor + 0.016666*pow(acc_factor,3);
}

for (int i = 0; i<10; ++i)
{
const double temp = 294 + i * 2;
set_r(0.99);
test_phase->setState_TR(temp, 1.0737);
mv = 1 / 1.0737 * test_phase->meanMolecularWeight();
//Calculate pressure using Peng-Robinson EoS
alpha = pow(1 + kappa*(1 - sqrt(temp / Tcrit)), 2);
pres_theoretical = GasConstant*temp / (mv - b_coeff) - a_coeff*alpha / (mv*mv + 2*b_coeff*mv - b_coeff*b_coeff);
EXPECT_NEAR(test_phase->pressure(), pres_theoretical, 10);
}
}
};

0 comments on commit 777a0d6

Please sign in to comment.