mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-30 11:06:55 -06:00
Correctly compute the global number of cells and pore volume.
This commit is contained in:
parent
70d5d18560
commit
11cb82e815
@ -1901,11 +1901,19 @@ namespace {
|
||||
int nc) const
|
||||
{
|
||||
// Do the global reductions
|
||||
#if HAVE_MPI
|
||||
#if HAVE_MPI
|
||||
if(linsolver_.parallelInformation().type()==typeid(ParallelISTLInformation))
|
||||
{
|
||||
const ParallelISTLInformation& info =
|
||||
boost::any_cast<const ParallelISTLInformation&>(linsolver_.parallelInformation());
|
||||
// Compute the global number of cells and porevolume
|
||||
std::vector<int> v(nc, 1);
|
||||
auto nc_and_pv = std::tuple<int, double>(0,.0);
|
||||
auto nc_and_pv_operators = std::make_tuple(Opm::Reduction::makeGlobalSumFunctor<int>(),
|
||||
Opm::Reduction::makeGlobalSumFunctor<double>());
|
||||
auto nc_and_pv_containers = std::make_tuple(v, geo_.poreVolume());
|
||||
info.computeReduction(nc_and_pv_containers, nc_and_pv_operators, nc_and_pv);
|
||||
|
||||
for ( int idx=0; idx<MaxNumPhases; ++idx )
|
||||
{
|
||||
if (active_[idx]) {
|
||||
@ -1916,9 +1924,8 @@ namespace {
|
||||
auto operators = std::make_tuple(Opm::Reduction::makeGlobalSumFunctor<double>(),
|
||||
Opm::Reduction::makeGlobalMaxFunctor<double>(),
|
||||
Opm::Reduction::makeGlobalSumFunctor<double>());
|
||||
nc=info.communicator().sum(nc);
|
||||
info.computeReduction(containers,operators,values);
|
||||
B_avg[idx] = std::get<0>(values)/nc;
|
||||
B_avg[idx] = std::get<0>(values)/std::get<0>(nc_and_pv);
|
||||
maxCoeff[idx] = std::get<1>(values);
|
||||
R_sum[idx] = std::get<2>(values);
|
||||
}
|
||||
@ -1927,6 +1934,8 @@ namespace {
|
||||
R_sum[idx] = B_avg[idx] = maxCoeff[idx] = 0.;
|
||||
}
|
||||
}
|
||||
// Compute pore volume
|
||||
return std::get<1>(nc_and_pv);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -1943,9 +1952,9 @@ namespace {
|
||||
R_sum[idx] = B_avg[idx] = maxCoeff[idx] =0.;
|
||||
}
|
||||
}
|
||||
// Compute total pore volume
|
||||
return geo_.poreVolume().sum();
|
||||
}
|
||||
// Compute total pore volume
|
||||
return geo_.poreVolume().sum();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
Loading…
Reference in New Issue
Block a user