using different forms of flash equations have better convergence

it is the fugacity coefficient equations. It begins with bigger
residual, while converges faster.

origionally,
 newton residual is 24.7536
 newton residual is 11.0045
 newton residual is 5.2655
 newton residual is 2.4048
 newton residual is 0.995777
 newton residual is 0.331732
 newton residual is 0.0663179
 newton residual is 0.00393044
 newton residual is 1.84752e-05
 newton residual is 1.55499e-08
 newton residual is 1.67839e-11

new form,
 newton residual is 694053
 newton residual is 5950.39
 newton residual is 52.1553
 newton residual is 0.470124
 newton residual is 0.00430846
 newton residual is 3.91461e-05
 newton residual is 3.55269e-07
 newton residual is 4.00957e-09
This commit is contained in:
Kai Bao 2022-03-22 14:26:47 +01:00 committed by Trine Mykkeltvedt
parent 55145f8eaf
commit 76ad99e458
2 changed files with 7 additions and 2 deletions

View File

@ -931,8 +931,11 @@ protected:
{
// (f_liquid/f_vapor) - 1 = 0
auto local_res = (fluid_state.fugacity(oilPhaseIdx, compIdx) /
fluid_state.fugacity(gasPhaseIdx, compIdx)) - 1.0;
/* auto local_res = (fluid_state.fugacity(oilPhaseIdx, compIdx) /
fluid_state.fugacity(gasPhaseIdx, compIdx)) - 1.0; */
// TODO: it looks this formulation converges quicker while begin with bigger residual
auto local_res = (fluid_state.fugacity(oilPhaseIdx, compIdx) -
fluid_state.fugacity(gasPhaseIdx, compIdx));
res[compIdx + numComponents] = Opm::getValue(local_res);
for (unsigned i = 0; i < num_equation; ++i) {
jac[compIdx + numComponents][i] = local_res.derivative(i);

View File

@ -158,6 +158,8 @@ namespace Opm {
assert(0 <= phaseIdx && phaseIdx < numPhases);
assert(0 <= compIdx && compIdx < numComponents);
// TODO: here the derivatives for the phi are dropped. Should we keep the derivatives against the pressure
// and temperature?
Scalar phi = Opm::getValue(
PengRobinsonMixture::computeFugacityCoefficient(fluidState, paramCache, phaseIdx, compIdx));
return phi;