mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move output of restart FIP values into FIPContainer
This commit is contained in:
parent
9ae656fd58
commit
57ef2b63e8
@ -29,6 +29,8 @@
|
||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||
#include <opm/material/fluidsystems/GenericOilGasFluidSystem.hpp>
|
||||
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class FluidSystem>
|
||||
@ -36,8 +38,28 @@ bool
|
||||
FIPContainer<FluidSystem>::
|
||||
allocate(const std::size_t bufferSize,
|
||||
const SummaryConfig& summaryConfig,
|
||||
const bool forceAlloc)
|
||||
const bool forceAlloc,
|
||||
std::map<std::string, int>& rstKeywords)
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
|
||||
const auto fipctrl = std::array {
|
||||
std::pair { "FIP"s , &OutputRestart::noPrefix },
|
||||
std::pair { "SFIP"s, &OutputRestart::surface },
|
||||
std::pair { "RFIP"s, &OutputRestart::reservoir },
|
||||
};
|
||||
|
||||
this->outputRestart_.clearBits();
|
||||
|
||||
for (const auto& [mnemonic, kind] : fipctrl) {
|
||||
if (auto fipPos = rstKeywords.find(mnemonic);
|
||||
fipPos != rstKeywords.end())
|
||||
{
|
||||
fipPos->second = 0;
|
||||
this->outputRestart_.*kind = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool computeFip = false;
|
||||
bufferSize_ = bufferSize;
|
||||
for (const auto& phase : Inplace::phases()) {
|
||||
@ -297,6 +319,62 @@ assignOilGasDistribution(const unsigned globalDofIdx,
|
||||
}
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void
|
||||
FIPContainer<FluidSystem>::
|
||||
outputRestart(data::Solution& sol)
|
||||
{
|
||||
if (!this->outputRestart_) {
|
||||
return;
|
||||
}
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
using M = UnitSystem::measure;
|
||||
using FIPEntry = std::tuple<std::string, M, Inplace::Phase>;
|
||||
|
||||
auto fipArrays = std::vector<FIPEntry> {};
|
||||
if (this->outputRestart_.surface) {
|
||||
fipArrays.insert(fipArrays.end(), {
|
||||
FIPEntry {"SFIPOIL"s, M::liquid_surface_volume, Inplace::Phase::OIL },
|
||||
FIPEntry {"SFIPWAT"s, M::liquid_surface_volume, Inplace::Phase::WATER },
|
||||
FIPEntry {"SFIPGAS"s, M::gas_surface_volume, Inplace::Phase::GAS },
|
||||
});
|
||||
}
|
||||
|
||||
if (this->outputRestart_.reservoir) {
|
||||
fipArrays.insert(fipArrays.end(), {
|
||||
FIPEntry {"RFIPOIL"s, M::volume, Inplace::Phase::OilResVolume },
|
||||
FIPEntry {"RFIPWAT"s, M::volume, Inplace::Phase::WaterResVolume },
|
||||
FIPEntry {"RFIPGAS"s, M::volume, Inplace::Phase::GasResVolume },
|
||||
});
|
||||
}
|
||||
|
||||
if (this->outputRestart_.noPrefix && !this->outputRestart_.surface) {
|
||||
fipArrays.insert(fipArrays.end(), {
|
||||
FIPEntry { "FIPOIL"s, M::liquid_surface_volume, Inplace::Phase::OIL },
|
||||
FIPEntry { "FIPWAT"s, M::liquid_surface_volume, Inplace::Phase::WATER },
|
||||
FIPEntry { "FIPGAS"s, M::gas_surface_volume, Inplace::Phase::GAS },
|
||||
});
|
||||
}
|
||||
|
||||
for (const auto& [mnemonic, unit, phase] : fipArrays) {
|
||||
if (! this->fip_[phase].empty()) {
|
||||
sol.insert(mnemonic, unit, std::move(this->fip_[phase]),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& phase : Inplace::mixingPhases()) {
|
||||
if (! this->fip_[phase].empty()) {
|
||||
sol.insert(Inplace::EclString(phase),
|
||||
UnitSystem::measure::volume,
|
||||
this->fip_[phase],
|
||||
data::TargetType::SUMMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void
|
||||
FIPContainer<FluidSystem>::
|
||||
|
@ -30,9 +30,15 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm::data {
|
||||
class Solution;
|
||||
}
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class SummaryConfig;
|
||||
@ -54,7 +60,8 @@ public:
|
||||
|
||||
bool allocate(const std::size_t bufferSize,
|
||||
const SummaryConfig& summaryConfig,
|
||||
const bool forceAlloc);
|
||||
const bool forceAlloc,
|
||||
std::map<std::string, int>& rstKeywords);
|
||||
|
||||
void add(const Inplace::Phase phase);
|
||||
|
||||
@ -96,9 +103,36 @@ public:
|
||||
const Scalar saltConcentration,
|
||||
const std::array<Scalar, numPhases>& fipr);
|
||||
|
||||
void outputRestart(data::Solution& sol);
|
||||
|
||||
private:
|
||||
FIPMap& fip_;
|
||||
std::size_t bufferSize_ = 0;
|
||||
|
||||
struct OutputRestart
|
||||
{
|
||||
/// Whether or not run requests (surface condition) fluid-in-place
|
||||
/// restart file output using the 'FIP' mnemonic.
|
||||
bool noPrefix {false};
|
||||
|
||||
/// Whether or not run requests surface condition fluid-in-place
|
||||
/// restart file output using the 'SFIP' mnemonic.
|
||||
bool surface {false};
|
||||
|
||||
/// Whether or not run requests reservoir condition fluid-in-place
|
||||
/// restart file output using the 'RFIP' mnemonic.
|
||||
bool reservoir {false};
|
||||
|
||||
void clearBits()
|
||||
{
|
||||
this->noPrefix = this->surface = this->reservoir = false;
|
||||
}
|
||||
|
||||
explicit operator bool() const
|
||||
{
|
||||
return this->noPrefix || this->surface || this->reservoir;
|
||||
}
|
||||
} outputRestart_{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -697,53 +697,7 @@ assignToSolution(data::Solution& sol)
|
||||
}
|
||||
|
||||
// Fluid in place
|
||||
if (this->outputFipRestart_) {
|
||||
using namespace std::string_literals;
|
||||
|
||||
using M = UnitSystem::measure;
|
||||
using FIPEntry = std::tuple<std::string, M, Inplace::Phase>;
|
||||
|
||||
auto fipArrays = std::vector<FIPEntry> {};
|
||||
if (this->outputFipRestart_.surface) {
|
||||
fipArrays.insert(fipArrays.end(), {
|
||||
FIPEntry {"SFIPOIL"s, M::liquid_surface_volume, Inplace::Phase::OIL },
|
||||
FIPEntry {"SFIPWAT"s, M::liquid_surface_volume, Inplace::Phase::WATER },
|
||||
FIPEntry {"SFIPGAS"s, M::gas_surface_volume, Inplace::Phase::GAS },
|
||||
});
|
||||
}
|
||||
|
||||
if (this->outputFipRestart_.reservoir) {
|
||||
fipArrays.insert(fipArrays.end(), {
|
||||
FIPEntry {"RFIPOIL"s, M::volume, Inplace::Phase::OilResVolume },
|
||||
FIPEntry {"RFIPWAT"s, M::volume, Inplace::Phase::WaterResVolume },
|
||||
FIPEntry {"RFIPGAS"s, M::volume, Inplace::Phase::GasResVolume },
|
||||
});
|
||||
}
|
||||
|
||||
if (this->outputFipRestart_.noPrefix && !this->outputFipRestart_.surface) {
|
||||
fipArrays.insert(fipArrays.end(), {
|
||||
FIPEntry { "FIPOIL"s, M::liquid_surface_volume, Inplace::Phase::OIL },
|
||||
FIPEntry { "FIPWAT"s, M::liquid_surface_volume, Inplace::Phase::WATER },
|
||||
FIPEntry { "FIPGAS"s, M::gas_surface_volume, Inplace::Phase::GAS },
|
||||
});
|
||||
}
|
||||
|
||||
for (const auto& [mnemonic, unit, phase] : fipArrays) {
|
||||
if (! this->fip_[phase].empty()) {
|
||||
sol.insert(mnemonic, unit, std::move(this->fip_[phase]),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& phase : Inplace::mixingPhases()) {
|
||||
if (! this->fip_[phase].empty()) {
|
||||
sol.insert(Inplace::EclString(phase),
|
||||
UnitSystem::measure::volume,
|
||||
this->fip_[phase],
|
||||
data::TargetType::SUMMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
this->fipC_.outputRestart(sol);
|
||||
|
||||
// Tracers
|
||||
if (! this->freeTracerConcentrations_.empty()) {
|
||||
@ -926,31 +880,10 @@ doAllocBuffers(const unsigned bufferSize,
|
||||
}
|
||||
|
||||
// Fluid in place
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
|
||||
const auto fipctrl = std::array {
|
||||
std::pair { "FIP"s , &OutputFIPRestart::noPrefix },
|
||||
std::pair { "SFIP"s, &OutputFIPRestart::surface },
|
||||
std::pair { "RFIP"s, &OutputFIPRestart::reservoir },
|
||||
};
|
||||
|
||||
this->outputFipRestart_.clearBits();
|
||||
this->computeFip_ = false;
|
||||
|
||||
for (const auto& [mnemonic, kind] : fipctrl) {
|
||||
if (auto fipPos = rstKeywords.find(mnemonic);
|
||||
fipPos != rstKeywords.end())
|
||||
{
|
||||
fipPos->second = 0;
|
||||
this->outputFipRestart_.*kind = true;
|
||||
}
|
||||
}
|
||||
|
||||
this->computeFip_ = this->fipC_.allocate(bufferSize,
|
||||
summaryConfig_,
|
||||
!substep);
|
||||
}
|
||||
this->computeFip_ = this->fipC_.allocate(bufferSize,
|
||||
summaryConfig_,
|
||||
!substep,
|
||||
rstKeywords);
|
||||
|
||||
const auto needAvgPress = !substep ||
|
||||
!this->RPRNodes_.empty() ||
|
||||
|
@ -430,30 +430,6 @@ protected:
|
||||
bool forceDisableFipresvOutput_{false};
|
||||
bool computeFip_{false};
|
||||
|
||||
struct OutputFIPRestart {
|
||||
/// Whether or not run requests (surface condition) fluid-in-place
|
||||
/// restart file output using the 'FIP' mnemonic.
|
||||
bool noPrefix {false};
|
||||
|
||||
/// Whether or not run requests surface condition fluid-in-place
|
||||
/// restart file output using the 'SFIP' mnemonic.
|
||||
bool surface {false};
|
||||
|
||||
/// Whether or not run requests reservoir condition fluid-in-place
|
||||
/// restart file output using the 'RFIP' mnemonic.
|
||||
bool reservoir {false};
|
||||
|
||||
void clearBits()
|
||||
{
|
||||
this->noPrefix = this->surface = this->reservoir = false;
|
||||
}
|
||||
|
||||
explicit operator bool() const
|
||||
{
|
||||
return this->noPrefix || this->surface || this->reservoir;
|
||||
}
|
||||
} outputFipRestart_{};
|
||||
|
||||
bool anyFlows_{false};
|
||||
bool anyFlores_{false};
|
||||
bool blockFlows_{false};
|
||||
|
Loading…
Reference in New Issue
Block a user