mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-14 20:23:26 -06:00
Add Procedure for Calculating Basic FIP Region Statistics
This commit implements the parallel version of EclipseState::computeFipRegionStatistics() which computes a FIPRegionStatistics object for the current run's fluid-in-place regions. The object construction uses an MPI-aware reduction process to compute the maximum region IDs across all MPI ranks. While here, also unconditionally form the statistics object as part of the EclWriter's constructor to ensure that all ranks participate in the process. The initial approach of constructing the object on first use is not robust in parallel. We may however wish to compute these statistics only when needed. If so, that will be the subject of follow-up work.
This commit is contained in:
parent
c2184219fa
commit
10d2f52cd2
@ -170,6 +170,8 @@ public:
|
||||
}
|
||||
|
||||
this->rank_ = this->simulator_.vanguard().grid().comm().rank();
|
||||
|
||||
this->simulator_.vanguard().eclState().computeFipRegionStatistics();
|
||||
}
|
||||
|
||||
~EclWriter()
|
||||
|
@ -20,13 +20,18 @@
|
||||
#include <config.h>
|
||||
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
||||
|
||||
#include <opm/input/eclipse/EclipseState/Grid/FIPRegionStatistics.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Grid/FieldData.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <regex>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
bool is_FIP(const std::string& keyword)
|
||||
@ -280,6 +285,20 @@ const FieldPropsManager& ParallelEclipseState::globalFieldProps() const
|
||||
}
|
||||
|
||||
|
||||
void ParallelEclipseState::computeFipRegionStatistics()
|
||||
{
|
||||
if (! this->fipRegionStatistics_.has_value()) {
|
||||
this->fipRegionStatistics_
|
||||
.emplace(declaredMaxRegionID(this->runspec()),
|
||||
this->fieldProps(),
|
||||
[this](std::vector<int>& maxRegionID)
|
||||
{
|
||||
this->m_comm.max(maxRegionID.data(), maxRegionID.size());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const EclipseGrid& ParallelEclipseState::getInputGrid() const
|
||||
{
|
||||
if (m_comm.rank() != 0)
|
||||
|
@ -179,6 +179,12 @@ public:
|
||||
//! \details Can only be called on root process.
|
||||
const FieldPropsManager& globalFieldProps() const override;
|
||||
|
||||
//! \brief Compute basic descriptive statistics about all FIP region sets
|
||||
//!
|
||||
//! MPI-aware version which knows how to compute statistics across all
|
||||
//! ranks.
|
||||
void computeFipRegionStatistics() override;
|
||||
|
||||
//! \brief Returns a const ref to the eclipse grid.
|
||||
//! \details Can only be called on root process.
|
||||
const EclipseGrid& getInputGrid() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user