mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Implement parallel fip total computation.
Up to now parallel runs aborted due to an exception with the message "FIP not yet implemented for MPI". With this commit we do the computation in parallel, too. And flow_ebos runs a bit longer...
This commit is contained in:
@@ -636,21 +636,45 @@ protected:
|
||||
double pv_hydrocarbon_sum = 0.0;
|
||||
double p_pv_hydrocarbon_sum = 0.0;
|
||||
|
||||
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
||||
const auto& intQuants = *ebosSimulator_.model().cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
if ( ! is_parallel_run_ )
|
||||
{
|
||||
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
||||
const auto& intQuants = *ebosSimulator_.model().cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
const double& p = fs.pressure(FluidSystem::oilPhaseIdx).value();
|
||||
const double hydrocarbon = fs.saturation(FluidSystem::oilPhaseIdx).value() + fs.saturation(FluidSystem::gasPhaseIdx).value();
|
||||
|
||||
const double& p = fs.pressure(FluidSystem::oilPhaseIdx).value();
|
||||
const double hydrocarbon = fs.saturation(FluidSystem::oilPhaseIdx).value() + fs.saturation(FluidSystem::gasPhaseIdx).value();
|
||||
if ( ! is_parallel_run_ )
|
||||
{
|
||||
totals[5] += pv[cellIdx];
|
||||
pv_hydrocarbon_sum += pv[cellIdx] * hydrocarbon;
|
||||
p_pv_hydrocarbon_sum += p * pv[cellIdx] * hydrocarbon;
|
||||
}
|
||||
else {
|
||||
OPM_THROW(std::logic_error, "FIP not yet implemented for MPI");
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_MPI
|
||||
const auto & pinfo =
|
||||
boost::any_cast<const ParallelISTLInformation&>(solver_.parallelInformation());
|
||||
// Mask with 1 for owned cell and 0 otherwise
|
||||
const auto& mask = pinfo.updateOwnerMask(pv);
|
||||
|
||||
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
||||
const auto& intQuants = *ebosSimulator_.model().cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
const double& p = fs.pressure(FluidSystem::oilPhaseIdx).value();
|
||||
const double hydrocarbon = fs.saturation(FluidSystem::oilPhaseIdx).value() + fs.saturation(FluidSystem::gasPhaseIdx).value();
|
||||
|
||||
if( mask[cellIdx] )
|
||||
{
|
||||
totals[5] += pv[cellIdx];
|
||||
pv_hydrocarbon_sum += pv[cellIdx] * hydrocarbon;
|
||||
p_pv_hydrocarbon_sum += p * pv[cellIdx] * hydrocarbon;
|
||||
}
|
||||
}
|
||||
#else
|
||||
OPM_THROW(std::logic_error, "Requested a parallel run with MPI available!");
|
||||
#endif
|
||||
}
|
||||
totals[6] = (p_pv_hydrocarbon_sum / pv_hydrocarbon_sum);
|
||||
return totals;
|
||||
|
||||
Reference in New Issue
Block a user