Merge pull request #906 from totto82/livegas

Complete undersaturated PVTG tables by extrapolating from existing data
This commit is contained in:
Atgeirr Flø Rasmussen 2015-10-20 20:38:04 +02:00
commit d6a90c990d

View File

@ -11,6 +11,7 @@
//=========================================================================== //===========================================================================
/* /*
Copyright 2010 SINTEF ICT, Applied Mathematics. Copyright 2010 SINTEF ICT, Applied Mathematics.
Copyright 2015 IRIS AS
This file is part of the Open Porous Media project (OPM). This file is part of the Open Porous Media project (OPM).
@ -92,6 +93,51 @@ namespace Opm
undersat_gas_tables_[pvtTableIdx][i][1][j] = 1.0 / undersat_gas_tables_[pvtTableIdx][i][1][j]; undersat_gas_tables_[pvtTableIdx][i][1][j] = 1.0 / undersat_gas_tables_[pvtTableIdx][i][1][j];
} }
} }
// Complete undersaturated tables by extrapolating from existing data
int iNext = -1;
for (int i = 0; i < sz; ++i) {
// Skip records already containing undersaturated data
if (undersat_gas_tables_[pvtTableIdx][i][0].size() > 1) {
continue;
}
// Look ahead for next record containing undersaturated data
if (iNext < i) {
iNext = i+1;
while (iNext < sz && undersat_gas_tables_[pvtTableIdx][iNext][0].size() < 2) {
++iNext;
}
if (iNext == sz) {
OPM_THROW(std::runtime_error,"Unable to complete undersaturated table.");
}
}
// Undersaturated data is added to the current record in the same way as for liveoil.
// It is unclear whether this expantion maintains the compressibility and viscosibility,
// but it seems like it reproduces eclipse results for spe3.
typedef std::vector<std::vector<std::vector<double> > >::size_type sz_t;
auto& from_table = undersat_gas_tables_[pvtTableIdx][iNext];
auto& to_table = undersat_gas_tables_[pvtTableIdx][i];
enum {RV = 0, BG = 1, MUG = 2, BGMUG = 3};
for (sz_t j = 1; j < from_table[0].size(); ++j) {
double diffSolubility = from_table[RV][j] - from_table[RV][j-1];
double solubility = to_table[RV].back() + diffSolubility;
to_table[RV].push_back(solubility);
double compr = (1.0/from_table[BG][j] - 1.0/from_table[BG][j-1])
/ (0.5*(1.0/from_table[BG][j] + 1.0/from_table[BG][j-1]));
double B_var = (1.0/to_table[BG].back()) * (1.0+0.5*compr) / (1.0-0.5*compr);
to_table[BG].push_back(1.0/B_var);
double visc = (from_table[MUG][j] - from_table[MUG][j-1])
/ (0.5*(from_table[MUG][j] + from_table[MUG][j-1]));
double mu_var = (to_table[MUG].back()) * (1.0+0.5*visc) / (1.0-0.5*visc);
to_table[MUG].push_back(mu_var);
// A try to expolate the 1/BMu with the expolated mu and B
double inverseBMu = 1.0 / (B_var*mu_var);
to_table[BGMUG].push_back(inverseBMu);
}
}
} }
} }