mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-11 17:35:34 -06:00
replace the blackoil PVT classes by the ones of opm-material
the opm-material classes are the ones which are now used by opm-autodiff and this patch makes it much easier to keep the opm-core and opm-autodiff results consistent. Also, the opm-material classes seem to be a bit faster than the opm-core ones (see https://github.com/OPM/opm-autodiff/pull/576) I ran the usual array of tests with `flow`: SPE1, SPE3, SPE9 and Norne all produce the same results at the identical runtime (modulo noise) and also "Model 2" seems to work.
This commit is contained in:
parent
5bb705fda8
commit
1f1dfbfc65
@ -128,8 +128,6 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate the initial fluid densities for the gravity correction.
|
// calculate the initial fluid densities for the gravity correction.
|
||||||
std::vector<double> b(numCells);
|
|
||||||
|
|
||||||
std::vector<std::vector<double>> rho(numPhases);
|
std::vector<std::vector<double>> rho(numPhases);
|
||||||
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
rho[phaseIdx].resize(numCells);
|
rho[phaseIdx].resize(numCells);
|
||||||
@ -176,69 +174,55 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the inverse formation volume factors for the active phases and each cell
|
// calculate the densities of the active phases for each cell
|
||||||
if (pu.phase_used[BlackoilPhases::Aqua]) {
|
if (pu.phase_used[BlackoilPhases::Aqua]) {
|
||||||
std::vector<double> dummy(numCells*BlackoilPhases::MaxNumPhases);
|
|
||||||
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
|
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
|
||||||
const PvtInterface& pvtw = props.pvt(wpos);
|
const auto& pvtw = props.waterPvt();
|
||||||
pvtw.b(numCells,
|
|
||||||
pvtRegion.data(),
|
|
||||||
phasePressure[wpos].data(),
|
|
||||||
initialState.temperature().data(),
|
|
||||||
initialState.gasoilratio().data(),
|
|
||||||
cond.data(),
|
|
||||||
b.data(),
|
|
||||||
dummy.data(),
|
|
||||||
dummy.data());
|
|
||||||
for (int cellIdx = 0; cellIdx < numCells; ++ cellIdx) {
|
for (int cellIdx = 0; cellIdx < numCells; ++ cellIdx) {
|
||||||
rho[wpos][cellIdx] = surfaceDensity[pvtRegion[cellIdx]][wpos]*b[cellIdx];
|
int pvtRegionIdx = pvtRegion[cellIdx];
|
||||||
|
|
||||||
|
double T = initialState.temperature()[cellIdx];
|
||||||
|
double p = initialState.pressure()[cellIdx];
|
||||||
|
double b = pvtw.inverseFormationVolumeFactor(pvtRegionIdx, T, p);
|
||||||
|
|
||||||
|
rho[wpos][cellIdx] = surfaceDensity[pvtRegionIdx][wpos]*b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pu.phase_used[BlackoilPhases::Liquid]) {
|
if (pu.phase_used[BlackoilPhases::Liquid]) {
|
||||||
std::vector<double> dummy(numCells*BlackoilPhases::MaxNumPhases);
|
|
||||||
const int opos = pu.phase_pos[BlackoilPhases::Liquid];
|
const int opos = pu.phase_pos[BlackoilPhases::Liquid];
|
||||||
const PvtInterface& pvto = props.pvt(opos);
|
const auto& pvto = props.oilPvt();
|
||||||
pvto.b(numCells,
|
|
||||||
pvtRegion.data(),
|
|
||||||
phasePressure[opos].data(),
|
|
||||||
initialState.temperature().data(),
|
|
||||||
initialState.gasoilratio().data(),
|
|
||||||
cond.data(),
|
|
||||||
b.data(),
|
|
||||||
dummy.data(),
|
|
||||||
dummy.data());
|
|
||||||
for (int cellIdx = 0; cellIdx < numCells; ++ cellIdx) {
|
for (int cellIdx = 0; cellIdx < numCells; ++ cellIdx) {
|
||||||
rho[opos][cellIdx] = surfaceDensity[pvtRegion[cellIdx]][opos]*b[cellIdx];
|
int pvtRegionIdx = pvtRegion[cellIdx];
|
||||||
|
|
||||||
|
double T = initialState.temperature()[cellIdx];
|
||||||
|
double p = initialState.pressure()[cellIdx];
|
||||||
|
double Rs = initialState.gasoilratio()[cellIdx];
|
||||||
|
double b = pvto.inverseFormationVolumeFactor(pvtRegionIdx, T, p, Rs);
|
||||||
|
|
||||||
|
rho[opos][cellIdx] = surfaceDensity[pvtRegionIdx][opos]*b;
|
||||||
if (pu.phase_used[BlackoilPhases::Vapour]) {
|
if (pu.phase_used[BlackoilPhases::Vapour]) {
|
||||||
int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
||||||
rho[opos][cellIdx] +=
|
rho[opos][cellIdx] += surfaceDensity[pvtRegionIdx][gpos]*Rs*b;
|
||||||
surfaceDensity[pvtRegion[cellIdx]][gpos]*initialState.gasoilratio()[cellIdx]*b[cellIdx];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pu.phase_used[BlackoilPhases::Vapour]) {
|
if (pu.phase_used[BlackoilPhases::Vapour]) {
|
||||||
std::vector<double> dummy(numCells*BlackoilPhases::MaxNumPhases);
|
const int gpos = pu.phase_pos[BlackoilPhases::Liquid];
|
||||||
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
const auto& pvtg = props.gasPvt();
|
||||||
const PvtInterface& pvtg = props.pvt(gpos);
|
|
||||||
pvtg.b(numCells,
|
|
||||||
pvtRegion.data(),
|
|
||||||
phasePressure[gpos].data(),
|
|
||||||
initialState.temperature().data(),
|
|
||||||
initialState.rv().data(),
|
|
||||||
cond.data(),
|
|
||||||
b.data(),
|
|
||||||
dummy.data(),
|
|
||||||
dummy.data());
|
|
||||||
for (int cellIdx = 0; cellIdx < numCells; ++ cellIdx) {
|
for (int cellIdx = 0; cellIdx < numCells; ++ cellIdx) {
|
||||||
rho[gpos][cellIdx] = surfaceDensity[pvtRegion[cellIdx]][gpos]*b[cellIdx];
|
int pvtRegionIdx = pvtRegion[cellIdx];
|
||||||
|
|
||||||
|
double T = initialState.temperature()[cellIdx];
|
||||||
|
double p = initialState.pressure()[cellIdx];
|
||||||
|
double Rv = initialState.rv()[cellIdx];
|
||||||
|
double b = pvtg.inverseFormationVolumeFactor(pvtRegionIdx, T, p, Rv);
|
||||||
|
|
||||||
|
rho[gpos][cellIdx] = surfaceDensity[pvtRegionIdx][gpos]*b;
|
||||||
if (pu.phase_used[BlackoilPhases::Liquid]) {
|
if (pu.phase_used[BlackoilPhases::Liquid]) {
|
||||||
const int opos = pu.phase_pos[BlackoilPhases::Liquid];
|
int opos = pu.phase_pos[BlackoilPhases::Liquid];
|
||||||
rho[gpos][cellIdx] +=
|
rho[gpos][cellIdx] += surfaceDensity[pvtRegionIdx][opos]*Rv*b;
|
||||||
surfaceDensity[pvtRegion[cellIdx]][opos]*initialState.rv()[cellIdx]*b[cellIdx];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user