Tony fixed problem with Peng Robinson SO2 (Marc Parmentier).

Added test case peng_SO2, which should test for fix.


git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@9345 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2015-03-11 14:59:02 +00:00
parent eafa16d0f1
commit 544db5a230
2 changed files with 11 additions and 5 deletions

View File

@ -474,7 +474,7 @@ calc_PR(void)
it = 0;
halved = false;
ddp = 1e-9;
v1 = vinit = 0.429;
v1 = vinit = 0.729;
dp_dv = f_Vm(v1, this);
while (fabs(dp_dv) > 1e-11 && it < 40)
{
@ -483,7 +483,10 @@ calc_PR(void)
v1 -= (dp_dv * ddp / (dp_dv - dp_dv2));
if (!halved && (v1 > vinit || v1 < 0.03))
{
vinit -= 0.05;
if (vinit > 0.329)
vinit -= 0.1;
else
vinit -=0.05;
if (vinit < 0.03)
{
vinit = halve(f_Vm, 0.03, 1.0, 1e-3);

View File

@ -44,7 +44,7 @@ prep(void)
{
error_msg("Solution needed for calculation not found, stopping.",
STOP);
exit(4);
return ERROR;
}
description_x = (char *) free_check_null(description_x);
description_x = string_duplicate(solution_ptr->Get_description().c_str());
@ -4008,7 +4008,7 @@ calc_PR(std::vector<struct phase *> phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m)
it = 0;
halved = false;
ddp = 1e-9;
v1 = vinit = 0.429;
v1 = vinit = 0.729;
dp_dv = f_Vm(v1, this);
while (fabs(dp_dv) > 1e-11 && it < 40)
{
@ -4017,7 +4017,10 @@ calc_PR(std::vector<struct phase *> phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m)
v1 -= (dp_dv * ddp / (dp_dv - dp_dv2));
if (!halved && (v1 > vinit || v1 < 0.03))
{
vinit -= 0.05;
if (vinit > 0.329)
vinit -= 0.1;
else
vinit -=0.05;
if (vinit < 0.03)
{
vinit = halve(f_Vm, 0.03, 1.0, 1e-3);