mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-24 22:57:42 -05:00
Merge pull request #6137 from GitPaean/optional_initial_inplace
using std::optional for function initialInplace()
This commit is contained in:
6 files changed
+59
-65
No files matched your search
@@ -144,7 +144,7 @@ protected:
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& regionData,
|
||||
const Inplace& inplace,
|
||||
const Inplace& initialInPlace,
|
||||
const std::optional<Inplace>& initialInPlace,
|
||||
const InterRegFlowMap& interRegFlows,
|
||||
SummaryState& summaryState,
|
||||
UDQState& udqState);
|
||||
|
||||
@@ -633,7 +633,7 @@ evalSummary(const int reportStepNum,
|
||||
const std::map<std::string, double>& miscSummaryData,
|
||||
const std::map<std::string, std::vector<double>>& regionData,
|
||||
const Inplace& inplace,
|
||||
const Inplace& initialInPlace,
|
||||
const std::optional<Inplace>& initialInPlace,
|
||||
const InterRegFlowMap& interRegFlows,
|
||||
SummaryState& summaryState,
|
||||
UDQState& udqState)
|
||||
|
||||
@@ -380,8 +380,7 @@ public:
|
||||
boost::posix_time::from_time_t(simulator_.vanguard().schedule().getStartTime());
|
||||
|
||||
if (this->collectOnIORank_.isIORank()) {
|
||||
inplace_ = outputModule_->initialInplace();
|
||||
|
||||
inplace_ = outputModule_->initialInplace().value();
|
||||
outputModule_->outputFipAndResvLog(inplace_, 0, 0.0, start_time,
|
||||
false, simulator_.gridView().comm());
|
||||
}
|
||||
@@ -686,7 +685,9 @@ public:
|
||||
this->outputModule_->calc_initial_inplace(this->simulator_.gridView().comm());
|
||||
|
||||
if (this->collectOnIORank_.isIORank()) {
|
||||
this->inplace_ = this->outputModule_->initialInplace();
|
||||
if (this->outputModule_->initialInplace().has_value()) {
|
||||
this->inplace_ = this->outputModule_->initialInplace().value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -263,57 +263,6 @@ calc_inplace(std::map<std::string, double>& miscSummaryData,
|
||||
return inplace;
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void GenericOutputBlackoilModule<FluidSystem>::
|
||||
outputFipAndResvLog(const Inplace& inplace,
|
||||
const std::size_t reportStepNum,
|
||||
double elapsed,
|
||||
boost::posix_time::ptime currentDate,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm)
|
||||
{
|
||||
if (comm.rank() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For report step 0 we use the RPTSOL config, else derive from RPTSCHED
|
||||
std::unique_ptr<FIPConfig> fipSched;
|
||||
if (reportStepNum > 0) {
|
||||
const auto& rpt = this->schedule_[reportStepNum-1].rpt_config.get();
|
||||
fipSched = std::make_unique<FIPConfig>(rpt);
|
||||
}
|
||||
const FIPConfig& fipc = reportStepNum == 0 ? this->eclState_.getEclipseConfig().fip()
|
||||
: *fipSched;
|
||||
|
||||
if (!substep && !forceDisableFipOutput_ && fipc.output(FIPConfig::OutputField::FIELD)) {
|
||||
|
||||
logOutput_.timeStamp("BALANCE", elapsed, reportStepNum, currentDate);
|
||||
|
||||
logOutput_.fip(inplace, this->initialInplace(), "");
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::FIPNUM)) {
|
||||
logOutput_.fip(inplace, this->initialInplace(), "FIPNUM");
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::RESV))
|
||||
logOutput_.fipResv(inplace, "FIPNUM");
|
||||
}
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::FIP)) {
|
||||
for (const auto& reg : this->regions_) {
|
||||
if (reg.first != "FIPNUM") {
|
||||
std::ostringstream ss;
|
||||
ss << "BAL" << reg.first.substr(3);
|
||||
logOutput_.timeStamp(ss.str(), elapsed, reportStepNum, currentDate);
|
||||
logOutput_.fip(inplace, this->initialInplace(), reg.first);
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::RESV))
|
||||
logOutput_.fipResv(inplace, reg.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void GenericOutputBlackoilModule<FluidSystem>::
|
||||
assignToSolution(data::Solution& sol)
|
||||
|
||||
@@ -121,13 +121,6 @@ public:
|
||||
std::map<std::string, std::vector<double>>& regionData,
|
||||
const Parallel::Communication& comm);
|
||||
|
||||
void outputFipAndResvLog(const Inplace& inplace,
|
||||
const std::size_t reportStepNum,
|
||||
double elapsed,
|
||||
boost::posix_time::ptime currentDate,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm);
|
||||
|
||||
void outputErrorLog(const Parallel::Communication& comm) const;
|
||||
|
||||
void addRftDataToWells(data::Wells& wellDatas,
|
||||
@@ -224,9 +217,9 @@ public:
|
||||
return extraBlockData_;
|
||||
}
|
||||
|
||||
const Inplace& initialInplace() const
|
||||
const std::optional<Inplace>& initialInplace() const
|
||||
{
|
||||
return this->initialInplace_.value();
|
||||
return this->initialInplace_;
|
||||
}
|
||||
|
||||
bool localDataValid() const{
|
||||
|
||||
@@ -320,6 +320,57 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void outputFipAndResvLog(const Inplace& inplace,
|
||||
const std::size_t reportStepNum,
|
||||
double elapsed,
|
||||
boost::posix_time::ptime currentDate,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm)
|
||||
{
|
||||
|
||||
if (comm.rank() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For report step 0 we use the RPTSOL config, else derive from RPTSCHED
|
||||
std::unique_ptr<FIPConfig> fipSched;
|
||||
if (reportStepNum > 0) {
|
||||
const auto& rpt = this->schedule_[reportStepNum-1].rpt_config.get();
|
||||
fipSched = std::make_unique<FIPConfig>(rpt);
|
||||
}
|
||||
const FIPConfig& fipc = reportStepNum == 0 ? this->eclState_.getEclipseConfig().fip()
|
||||
: *fipSched;
|
||||
|
||||
if (!substep && !this->forceDisableFipOutput_ && fipc.output(FIPConfig::OutputField::FIELD)) {
|
||||
|
||||
this->logOutput_.timeStamp("BALANCE", elapsed, reportStepNum, currentDate);
|
||||
|
||||
const auto& initial_inplace = this->initialInplace().value();
|
||||
this->logOutput_.fip(inplace, initial_inplace, "");
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::FIPNUM)) {
|
||||
this->logOutput_.fip(inplace, initial_inplace, "FIPNUM");
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::RESV))
|
||||
this->logOutput_.fipResv(inplace, "FIPNUM");
|
||||
}
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::FIP)) {
|
||||
for (const auto& reg : this->regions_) {
|
||||
if (reg.first != "FIPNUM") {
|
||||
std::ostringstream ss;
|
||||
ss << "BAL" << reg.first.substr(3);
|
||||
this->logOutput_.timeStamp(ss.str(), elapsed, reportStepNum, currentDate);
|
||||
this->logOutput_.fip(inplace, initial_inplace, reg.first);
|
||||
|
||||
if (fipc.output(FIPConfig::OutputField::RESV))
|
||||
this->logOutput_.fipResv(inplace, reg.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Capture connection fluxes, particularly to account for inter-region flows.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user