mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: refactor LogOutputHelper::fip
only do one output per call. allow passing the name of the regions to process
This commit is contained in:
@@ -277,7 +277,8 @@ outputFipLog(std::map<std::string, double>& miscSummaryData,
|
|||||||
regionData);
|
regionData);
|
||||||
|
|
||||||
if (!substep && !forceDisableFipOutput_) {
|
if (!substep && !forceDisableFipOutput_) {
|
||||||
logOutput_.fip(inplace, this->initialInplace());
|
logOutput_.fip(inplace, this->initialInplace(), "");
|
||||||
|
logOutput_.fip(inplace, this->initialInplace(), "FIPNUM");
|
||||||
}
|
}
|
||||||
|
|
||||||
return inplace;
|
return inplace;
|
||||||
|
|||||||
@@ -259,61 +259,47 @@ error(const std::vector<int>& failedCellsPbub,
|
|||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
void LogOutputHelper<Scalar>::
|
void LogOutputHelper<Scalar>::
|
||||||
fip(const Inplace& inplace,
|
fip(const Inplace& inplace,
|
||||||
const Inplace& initialInplace) const
|
const Inplace& initialInplace,
|
||||||
|
const std::string& name) const
|
||||||
{
|
{
|
||||||
|
auto iget = [&name](const Inplace& ip,
|
||||||
|
Inplace::Phase phase,
|
||||||
|
std::size_t idx)
|
||||||
{
|
{
|
||||||
Scalar fieldHydroCarbonPoreVolumeAveragedPressure =
|
if (name.empty()) {
|
||||||
detail::pressureAverage(inplace.get(Inplace::Phase::PressureHydroCarbonPV),
|
return ip.get(phase);
|
||||||
inplace.get(Inplace::Phase::HydroCarbonPV),
|
}
|
||||||
inplace.get(Inplace::Phase::PressurePV),
|
|
||||||
inplace.get(Inplace::Phase::DynamicPoreVolume),
|
|
||||||
true);
|
|
||||||
|
|
||||||
|
return ip.get(name, phase, idx);
|
||||||
|
};
|
||||||
|
|
||||||
|
for (std::size_t reg = 1; reg <= (name.empty() ? 1 : inplace.max_region(name)); ++reg) {
|
||||||
std::unordered_map<Inplace::Phase, Scalar> initial_values;
|
std::unordered_map<Inplace::Phase, Scalar> initial_values;
|
||||||
std::unordered_map<Inplace::Phase, Scalar> current_values;
|
std::unordered_map<Inplace::Phase, Scalar> current_values;
|
||||||
|
|
||||||
for (const auto& phase : Inplace::phases()) {
|
for (const auto& phase : Inplace::phases()) {
|
||||||
initial_values[phase] = initialInplace.get(phase);
|
initial_values[phase] = iget(initialInplace, phase, reg);
|
||||||
current_values[phase] = inplace.get(phase);
|
current_values[phase] = iget(inplace, phase, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_values[Inplace::Phase::DynamicPoreVolume] =
|
current_values[Inplace::Phase::DynamicPoreVolume] =
|
||||||
inplace.get(Inplace::Phase::DynamicPoreVolume);
|
iget(inplace, Inplace::Phase::DynamicPoreVolume, reg);
|
||||||
|
|
||||||
this->fipUnitConvert_(initial_values);
|
|
||||||
this->fipUnitConvert_(current_values);
|
|
||||||
|
|
||||||
this->pressureUnitConvert_(fieldHydroCarbonPoreVolumeAveragedPressure);
|
|
||||||
this->outputRegionFluidInPlace_(std::move(initial_values),
|
|
||||||
std::move(current_values),
|
|
||||||
fieldHydroCarbonPoreVolumeAveragedPressure, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (std::size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) {
|
|
||||||
std::unordered_map<Inplace::Phase, Scalar> initial_values;
|
|
||||||
std::unordered_map<Inplace::Phase, Scalar> current_values;
|
|
||||||
|
|
||||||
for (const auto& phase : Inplace::phases()) {
|
|
||||||
initial_values[phase] = initialInplace.get("FIPNUM", phase, reg);
|
|
||||||
current_values[phase] = inplace.get("FIPNUM", phase, reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
current_values[Inplace::Phase::DynamicPoreVolume] =
|
|
||||||
inplace.get("FIPNUM", Inplace::Phase::DynamicPoreVolume, reg);
|
|
||||||
|
|
||||||
this->fipUnitConvert_(initial_values);
|
this->fipUnitConvert_(initial_values);
|
||||||
this->fipUnitConvert_(current_values);
|
this->fipUnitConvert_(current_values);
|
||||||
|
|
||||||
Scalar regHydroCarbonPoreVolumeAveragedPressure =
|
Scalar regHydroCarbonPoreVolumeAveragedPressure =
|
||||||
detail::pressureAverage(inplace.get("FIPNUM", Inplace::Phase::PressureHydroCarbonPV, reg),
|
detail::pressureAverage(iget(inplace, Inplace::Phase::PressureHydroCarbonPV, reg),
|
||||||
inplace.get("FIPNUM", Inplace::Phase::HydroCarbonPV, reg),
|
iget(inplace, Inplace::Phase::HydroCarbonPV, reg),
|
||||||
inplace.get("FIPNUM", Inplace::Phase::PressurePV, reg),
|
iget(inplace, Inplace::Phase::PressurePV, reg),
|
||||||
inplace.get("FIPNUM", Inplace::Phase::DynamicPoreVolume, reg),
|
iget(inplace, Inplace::Phase::DynamicPoreVolume, reg),
|
||||||
true);
|
true);
|
||||||
this->pressureUnitConvert_(regHydroCarbonPoreVolumeAveragedPressure);
|
this->pressureUnitConvert_(regHydroCarbonPoreVolumeAveragedPressure);
|
||||||
this->outputRegionFluidInPlace_(std::move(initial_values),
|
this->outputRegionFluidInPlace_(std::move(initial_values),
|
||||||
std::move(current_values),
|
std::move(current_values),
|
||||||
regHydroCarbonPoreVolumeAveragedPressure, reg);
|
regHydroCarbonPoreVolumeAveragedPressure,
|
||||||
|
name,
|
||||||
|
name.empty() ? 0 : reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,6 +740,7 @@ void LogOutputHelper<Scalar>::
|
|||||||
outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
|
outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
|
||||||
std::unordered_map<Inplace::Phase, Scalar> cip,
|
std::unordered_map<Inplace::Phase, Scalar> cip,
|
||||||
const Scalar pav,
|
const Scalar pav,
|
||||||
|
const std::string& name,
|
||||||
const int reg) const
|
const int reg) const
|
||||||
{
|
{
|
||||||
// don't output FIPNUM report if the region has no porv.
|
// don't output FIPNUM report if the region has no porv.
|
||||||
@@ -768,7 +755,7 @@ outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
|
|||||||
if (reg == 0) {
|
if (reg == 0) {
|
||||||
ss << "Field total";
|
ss << "Field total";
|
||||||
} else {
|
} else {
|
||||||
ss << "FIPNUM report region " << reg;
|
ss << name << " report region " << reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
ss << " pressure dependent pore volume = "
|
ss << " pressure dependent pore volume = "
|
||||||
@@ -782,8 +769,8 @@ outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ss << " ===================================================\n"
|
ss << " ===================================================\n"
|
||||||
<< " : FIPNUM report region "
|
<< " : " << name << " report region "
|
||||||
<< std::setw(2) << reg << " :\n";
|
<< std::setw(8 - name.size()) << reg << " :\n";
|
||||||
}
|
}
|
||||||
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
|
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
|
||||||
ss << " : PAV =" << std::setw(14) << pav << " BARSA :\n"
|
ss << " : PAV =" << std::setw(14) << pav << " BARSA :\n"
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ public:
|
|||||||
|
|
||||||
//! \brief Write fluid-in-place reports to output.
|
//! \brief Write fluid-in-place reports to output.
|
||||||
void fip(const Inplace& inplace,
|
void fip(const Inplace& inplace,
|
||||||
const Inplace& initialInplace) const;
|
const Inplace& initialInplace,
|
||||||
|
const std::string& name) const;
|
||||||
|
|
||||||
//! \brief Write fluid-in-place reservoir reports to output.
|
//! \brief Write fluid-in-place reservoir reports to output.
|
||||||
void fipResv(const Inplace& inplace) const;
|
void fipResv(const Inplace& inplace) const;
|
||||||
@@ -74,6 +75,7 @@ private:
|
|||||||
void outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
|
void outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
|
||||||
std::unordered_map<Inplace::Phase, Scalar> cip,
|
std::unordered_map<Inplace::Phase, Scalar> cip,
|
||||||
const Scalar pav,
|
const Scalar pav,
|
||||||
|
const std::string& name,
|
||||||
const int reg) const;
|
const int reg) const;
|
||||||
|
|
||||||
void outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
|
void outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
|
||||||
|
|||||||
@@ -269,7 +269,8 @@ FIPNUM report region 1 pressure dependent pore volume = 50 RB
|
|||||||
current.add("FIPNUM", Opm::Inplace::Phase::PressurePV, 1, 6.0);
|
current.add("FIPNUM", Opm::Inplace::Phase::PressurePV, 1, 6.0);
|
||||||
current.add("FIPNUM", Opm::Inplace::Phase::DynamicPoreVolume, 1, 8.0);
|
current.add("FIPNUM", Opm::Inplace::Phase::DynamicPoreVolume, 1, 8.0);
|
||||||
|
|
||||||
helper.fip(current, initial);
|
helper.fip(current, initial, "");
|
||||||
|
helper.fip(current, initial, "FIPNUM");
|
||||||
std::string data = trimStream(str);
|
std::string data = trimStream(str);
|
||||||
BOOST_CHECK_EQUAL(data, reference);
|
BOOST_CHECK_EQUAL(data, reference);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user