Merge pull request #2452 from blattms/use-region-temperature-cleaned

Use correct region temperature when calculating RS/RV
This commit is contained in:
Bård Skaflestad
2020-04-02 15:08:53 +02:00
committed by GitHub
2 changed files with 19 additions and 5 deletions

View File

@@ -535,8 +535,8 @@ if(MPI_FOUND)
add_test_compare_parallel_simulation(CASENAME spe1_thermal
FILENAME SPE1CASE2_THERMAL
SIMULATOR flow
ABS_TOL ${abs_tol_parallel}
REL_TOL 1e-1
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
DIR spe1
TEST_ARGS --linear-solver-reduction=1e-7 --tolerance-cnv=5e-6 --tolerance-mb=1e-8)

View File

@@ -1070,7 +1070,7 @@ private:
void updateInitialTemperature_(const Opm::EclipseState& eclState)
{
// Get the initial temperature data
std::vector<double> tempiData = eclState.fieldProps().get_global_double("TEMPI");
std::vector<double> tempiData = eclState.fieldProps().get_double("TEMPI");
temperature_ = tempiData;
}
@@ -1137,8 +1137,10 @@ private:
if (oil && gas) {
const int oilpos = FluidSystem::oilPhaseIdx;
const int gaspos = FluidSystem::gasPhaseIdx;
const Vec rsVals = computeRs(grid, cells, pressures[oilpos], temperature_, *(rsFunc_[r]), sat[gaspos]);
const Vec rvVals = computeRs(grid, cells, pressures[gaspos], temperature_, *(rvFunc_[r]), sat[oilpos]);
std::vector<double> regionTemperature(cells.size());
copyToRegion(temperature_, cells, regionTemperature);
const Vec rsVals = computeRs(grid, cells, pressures[oilpos], regionTemperature, *(rsFunc_[r]), sat[gaspos]);
const Vec rvVals = computeRs(grid, cells, pressures[gaspos], regionTemperature, *(rvFunc_[r]), sat[oilpos]);
copyFromRegion(rsVals, cells, rs_);
copyFromRegion(rvVals, cells, rv_);
}
@@ -1158,6 +1160,18 @@ private:
}
}
template <class CellRangeType>
void copyToRegion(const Vec& source,
const CellRangeType& cells,
Vec& destination)
{
auto d = destination.begin();
auto c = cells.begin();
const auto e = cells.end();
for (; c != e; ++c, ++d) {
*d = source[*c];
}
}
};
} // namespace DeckDependent
} // namespace EQUIL