Skip to content

Commit

Permalink
[thermo] Improve solveCubic exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and speth committed Nov 29, 2024
1 parent 1b48991 commit f9ac078
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/thermo/MixtureFugacityTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,9 @@ int MixtureFugacityTP::solveCubic(double T, double pres, double a, double b,
if (fabs(tmp) > 1.0E-4) {
for (int j = 0; j < 3; j++) {
if (j != i && fabs(Vroot[i] - Vroot[j]) < 1.0E-4 * (fabs(Vroot[i]) + fabs(Vroot[j]))) {
writelog("MixtureFugacityTP::solveCubic(T ={}, p ={}):"
" WARNING roots have merged: {}, {}\n",
T, pres, Vroot[i], Vroot[j]);
warn_user("MixtureFugacityTP::solveCubic",
"roots have merged for T = {}, p = {}: {}, {}",
T, pres, Vroot[i], Vroot[j]);
}
}
}
Expand Down Expand Up @@ -954,9 +954,9 @@ int MixtureFugacityTP::solveCubic(double T, double pres, double a, double b,
}
}
if ((fabs(res) > 1.0E-14) && (fabs(res) > 1.0E-14 * fabs(dresdV) * fabs(Vroot[i]))) {
writelog("MixtureFugacityTP::solveCubic(T = {}, p = {}): "
"WARNING root didn't converge V = {}", T, pres, Vroot[i]);
writelogendl();
throw CanteraError("MixtureFugacityTP::solveCubic",
"root failed to converge for T = {}, p = {} with "
"V = {}", T, pres, Vroot[i]);
}
}

Expand Down

0 comments on commit f9ac078

Please sign in to comment.