add a container for FLOWS

start by taking ownership of related variables and putting
initialization code in its ctor
This commit is contained in:
Arne Morten Kvarving committed 2025-02-18 09:53:36 +01:00
1 parent e53d384446
commit ab9cbb6704
8 files changed
+299 -196

No files matched your search

+2
View File
@@ -99,6 +99,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/FlowGenericProblem.cpp
opm/simulators/flow/FlowGenericVanguard.cpp
opm/simulators/flow/FlowProblemParameters.cpp
opm/simulators/flow/FlowsContainer.cpp
opm/simulators/flow/FlowUtils.cpp
opm/simulators/flow/GenericCpGridVanguard.cpp
opm/simulators/flow/GenericOutputBlackoilModule.cpp
@@ -850,6 +851,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/FlowProblemComp.hpp
opm/simulators/flow/FlowProblemCompProperties.hpp
opm/simulators/flow/FlowProblemParameters.hpp
opm/simulators/flow/FlowsContainer.hpp
opm/simulators/flow/FlowUtils.hpp
opm/simulators/flow/FlowsData.hpp
opm/simulators/flow/FlowThresholdPressure.hpp
@@ -539,8 +539,8 @@ private:
// If FLOWS/FLORES is set in any RPTRST in the schedule, then we initializate the sparse tables
// For now, do the same also if any block flows are requested (TODO: only save requested cells...)
// If DISPERC is in the deck, we initialize the sparse table here as well.
const bool anyFlows = simulator_().problem().eclWriter()->outputModule().anyFlows();
const bool anyFlores = simulator_().problem().eclWriter()->outputModule().anyFlores();
const bool anyFlows = simulator_().problem().eclWriter()->outputModule().getFlows().anyFlows();
const bool anyFlores = simulator_().problem().eclWriter()->outputModule().getFlows().anyFlores();
const bool enableDispersion = simulator_().vanguard().eclState().getSimulationConfig().rock_config().dispersion();
if (((!anyFlows || !flowsInfo_.empty()) && (!anyFlores || !floresInfo_.empty())) && !enableDispersion) {
return;
@@ -641,9 +641,9 @@ public:
void updateFlowsInfo() {
OPM_TIMEBLOCK(updateFlows);
const bool& enableFlows = simulator_().problem().eclWriter()->outputModule().hasFlows() ||
simulator_().problem().eclWriter()->outputModule().hasBlockFlows();
const bool& enableFlores = simulator_().problem().eclWriter()->outputModule().hasFlores();
const bool enableFlows = simulator_().problem().eclWriter()->outputModule().getFlows().hasFlows() ||
simulator_().problem().eclWriter()->outputModule().getFlows().hasBlockFlows();
const bool enableFlores = simulator_().problem().eclWriter()->outputModule().getFlows().hasFlores();
if (!enableFlows && !enableFlores) {
return;
}
+4 -4
View File
@@ -423,11 +423,11 @@ public:
auto localAquiferData = simulator_.problem().aquiferModel().aquiferData();
auto localWellTestState = simulator_.problem().wellModel().wellTestState();
const bool isFlowsn = this->outputModule_->hasFlowsn();
auto flowsn = this->outputModule_->getFlowsn();
const bool isFlowsn = this->outputModule_->getFlows().hasFlowsn();
auto flowsn = this->outputModule_->getFlows().getFlowsn();
const bool isFloresn = this->outputModule_->hasFloresn();
auto floresn = this->outputModule_->getFloresn();
const bool isFloresn = this->outputModule_->getFlows().hasFloresn();
auto floresn = this->outputModule_->getFlows().getFloresn();
if (! isSubStep || Parameters::Get<Parameters::EnableWriteAllSolutions>()) {
+95
View File
@@ -0,0 +1,95 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#include <config.h>
#include <opm/simulators/flow/FlowsContainer.hpp>
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/material/fluidsystems/BlackOilDefaultIndexTraits.hpp>
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
#include <opm/material/fluidsystems/GenericOilGasWaterFluidSystem.hpp>
#include <algorithm>
namespace Opm {
template<class FluidSystem>
FlowsContainer<FluidSystem>::
FlowsContainer(const Schedule& schedule,
const SummaryConfig& summaryConfig)
{
// Check for any BFLOW[I|J|K] summary keys
blockFlows_ = summaryConfig.keywords("BFLOW*").size() > 0;
// Check if FLORES/FLOWS is set in any RPTRST in the schedule
enableFlores_ = false; // Used for the output of i+, j+, k+
enableFloresn_ = false; // Used for the special case of nnc
enableFlows_ = false;
enableFlowsn_ = false;
anyFlores_ = std::any_of(schedule.begin(), schedule.end(),
[](const auto& block)
{
const auto& rstkw = block.rst_config().keywords;
return rstkw.find("FLORES") != rstkw.end();
});
anyFlows_ = std::any_of(schedule.begin(), schedule.end(),
[](const auto& block)
{
const auto& rstkw = block.rst_config().keywords;
return rstkw.find("FLOWS") != rstkw.end();
});
}
template<class T> using FS = BlackOilFluidSystem<T,BlackOilDefaultIndexTraits>;
#define INSTANTIATE_TYPE(T) \
template class FlowsContainer<FS<T>>;
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
#define INSTANTIATE_COMP_THREEPHASE(NUM) \
template<class T> using FS##NUM = GenericOilGasWaterFluidSystem<T, NUM, true>; \
template class FlowsContainer<FS##NUM<double>>;
#define INSTANTIATE_COMP_TWOPHASE(NUM) \
template<class T> using GFS##NUM = GenericOilGasWaterFluidSystem<T, NUM, false>; \
template class FlowsContainer<GFS##NUM<double>>;
#define INSTANTIATE_COMP(NUM) \
INSTANTIATE_COMP_THREEPHASE(NUM) \
INSTANTIATE_COMP_TWOPHASE(NUM)
INSTANTIATE_COMP_THREEPHASE(0) // \Note: to register the parameter ForceDisableFluidInPlaceOutput
INSTANTIATE_COMP(2)
INSTANTIATE_COMP(3)
INSTANTIATE_COMP(4)
INSTANTIATE_COMP(5)
INSTANTIATE_COMP(6)
INSTANTIATE_COMP(7)
} // namespace Opm
+91
View File
@@ -0,0 +1,91 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_FLOWS_CONTAINER_HPP
#define OPM_FLOWS_CONTAINER_HPP
#include <opm/simulators/flow/FlowsData.hpp>
#include <array>
#include <vector>
namespace Opm {
class Schedule;
class SummaryConfig;
template<class FluidSystem>
class FlowsContainer
{
using Scalar = typename FluidSystem::Scalar;
using ScalarBuffer = std::vector<Scalar>;
static constexpr auto numPhases = FluidSystem::numPhases;
public:
FlowsContainer(const Schedule& schedule,
const SummaryConfig& summaryConfig);
const std::array<FlowsData<double>, 3>& getFlowsn() const
{ return this->flowsn_; }
bool hasFlowsn() const
{ return enableFlowsn_; }
bool hasFlows() const
{ return enableFlows_; }
bool hasBlockFlows() const
{ return blockFlows_; }
bool anyFlows() const
{ return anyFlows_; }
const std::array<FlowsData<double>, 3>& getFloresn() const
{ return this->floresn_; }
bool hasFloresn() const
{ return enableFloresn_; }
bool hasFlores() const
{ return enableFlores_; }
bool anyFlores() const
{ return anyFlores_; }
bool anyFlows_{false};
bool anyFlores_{false};
bool blockFlows_{false};
bool enableFlows_{false};
bool enableFlores_{false};
bool enableFlowsn_{false};
bool enableFloresn_{false};
std::array<std::array<ScalarBuffer, numPhases>, 6> flows_;
std::array<std::array<ScalarBuffer, numPhases>, 6> flores_;
std::array<FlowsData<double>, 3> floresn_;
std::array<FlowsData<double>, 3> flowsn_;
};
} // namespace Opm
#endif // OPM_FLOWS_CONTAINER_HPP
@@ -124,6 +124,7 @@ GenericOutputBlackoilModule(const EclipseState& eclState,
, enableExtbo_(enableExtbo)
, enableMICP_(enableMICP)
, tracerC_(eclState_)
, flowsC_(schedule, summaryConfig)
, rftC_(eclState_, schedule_,
[this](const std::string& wname)
{ return !isDefunctParallelWell(wname); })
@@ -144,36 +145,6 @@ GenericOutputBlackoilModule(const EclipseState& eclState,
this->regionNodes_[phase] = summaryConfig_.keywords(key_pattern);
}
// Check for any BFLOW[I|J|K] summary keys
blockFlows_ = summaryConfig_.keywords("BFLOW*").size() > 0;
// Check if FLORES/FLOWS is set in any RPTRST in the schedule
anyFlores_ = false; // Used for the initialization of the sparse table
anyFlows_ = blockFlows_;
enableFlores_ = false; // Used for the output of i+, j+, k+
enableFloresn_ = false; // Used for the special case of nnc
enableFlows_ = false;
enableFlowsn_ = false;
for (const auto& block : this->schedule_) {
const auto& rstkw = block.rst_config().keywords;
if (! anyFlores_) {
anyFlores_ = rstkw.find("FLORES") != rstkw.end();
}
if (! anyFlows_) {
anyFlows_ = rstkw.find("FLOWS") != rstkw.end();
}
if (anyFlores_ && anyFlows_) {
// Terminate report step loop early if both FLORES and FLOWS
// have been set at some point as there's no need to search
// any further in that case.
break;
}
}
forceDisableFipOutput_ =
Parameters::Get<Parameters::ForceDisableFluidInPlaceOutput>();
forceDisableFipresvOutput_ =
@@ -358,15 +329,15 @@ assignToSolution(data::Solution& sol)
addEntry(baseSolutionVector, "1OVERBG", UnitSystem::measure::gas_inverse_formation_volume_factor, invB_[gasPhaseIdx], gasPhaseIdx);
addEntry(baseSolutionVector, "1OVERBO", UnitSystem::measure::oil_inverse_formation_volume_factor, invB_[oilPhaseIdx], oilPhaseIdx);
addEntry(baseSolutionVector, "1OVERBW", UnitSystem::measure::water_inverse_formation_volume_factor, invB_[waterPhaseIdx], waterPhaseIdx);
addEntry(baseSolutionVector, "FLRGASI+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][gasCompIdx], gasCompIdx);
addEntry(baseSolutionVector, "FLRGASJ+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][gasCompIdx], gasCompIdx);
addEntry(baseSolutionVector, "FLRGASK+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][gasCompIdx], gasCompIdx);
addEntry(baseSolutionVector, "FLROILI+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][oilCompIdx], oilCompIdx);
addEntry(baseSolutionVector, "FLROILJ+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][oilCompIdx], oilCompIdx);
addEntry(baseSolutionVector, "FLROILK+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][oilCompIdx], oilCompIdx);
addEntry(baseSolutionVector, "FLRWATI+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][waterCompIdx], waterCompIdx);
addEntry(baseSolutionVector, "FLRWATJ+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][waterCompIdx], waterCompIdx);
addEntry(baseSolutionVector, "FLRWATK+", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][waterCompIdx], waterCompIdx);
addEntry(baseSolutionVector, "FLRGASI+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][gasCompIdx], gasCompIdx);
addEntry(baseSolutionVector, "FLRGASJ+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][gasCompIdx], gasCompIdx);
addEntry(baseSolutionVector, "FLRGASK+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][gasCompIdx], gasCompIdx);
addEntry(baseSolutionVector, "FLROILI+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][oilCompIdx], oilCompIdx);
addEntry(baseSolutionVector, "FLROILJ+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][oilCompIdx], oilCompIdx);
addEntry(baseSolutionVector, "FLROILK+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][oilCompIdx], oilCompIdx);
addEntry(baseSolutionVector, "FLRWATI+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][waterCompIdx], waterCompIdx);
addEntry(baseSolutionVector, "FLRWATJ+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][waterCompIdx], waterCompIdx);
addEntry(baseSolutionVector, "FLRWATK+", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][waterCompIdx], waterCompIdx);
addEntry(baseSolutionVector, "FOAM", UnitSystem::measure::identity, cFoam_);
addEntry(baseSolutionVector, "GASKR", UnitSystem::measure::identity, relativePermeability_[gasPhaseIdx], gasPhaseIdx);
addEntry(baseSolutionVector, "GAS_DEN", UnitSystem::measure::density, density_[gasPhaseIdx], gasPhaseIdx);
@@ -403,33 +374,33 @@ assignToSolution(data::Solution& sol)
// Separate these as flows*_ may be defined due to BFLOW[I|J|K] even without FLOWS in RPTRST
std::vector<DataEntry> flowsSolutionVector;
addEntry(flowsSolutionVector, "FLOGASI+", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASJ+", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASK+", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOOILI+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILJ+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILK+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOWATI+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATJ+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATK+", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOGASI-", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASJ-", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASK-", UnitSystem::measure::gas_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOOILI-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILJ-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILK-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOWATI-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATJ-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATK-", UnitSystem::measure::liquid_surface_rate, flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLRGASI-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLRGASJ-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLRGASK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLROILI-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLROILJ-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLROILK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLRWATI-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLRWATJ-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLRWATK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOGASI+", UnitSystem::measure::gas_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASJ+", UnitSystem::measure::gas_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASK+", UnitSystem::measure::gas_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOOILI+", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILJ+", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILK+", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOWATI+", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATJ+", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATK+", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOGASI-", UnitSystem::measure::gas_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASJ-", UnitSystem::measure::gas_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOGASK-", UnitSystem::measure::gas_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLOOILI-", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILJ-", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOOILK-", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLOWATI-", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATJ-", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLOWATK-", UnitSystem::measure::liquid_surface_rate, flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLRGASI-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLRGASJ-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLRGASK-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][gasCompIdx], gasCompIdx);
addEntry(flowsSolutionVector, "FLROILI-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLROILJ-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLROILK-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][oilCompIdx], oilCompIdx);
addEntry(flowsSolutionVector, "FLRWATI-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLRWATJ-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][waterCompIdx], waterCompIdx);
addEntry(flowsSolutionVector, "FLRWATK-", UnitSystem::measure::rate, flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx], waterCompIdx);
auto extendedSolutionArrays = std::array {
DataEntry{"DRSDTCON", UnitSystem::measure::gas_oil_ratio_rate, drsdtcon_},
@@ -449,7 +420,7 @@ assignToSolution(data::Solution& sol)
doInsert(array, data::TargetType::RESTART_SOLUTION);
}
if (this->enableFlows_) {
if (this->flowsC_.enableFlows_) {
for (auto& array : flowsSolutionVector) {
doInsert(array, data::TargetType::RESTART_SOLUTION);
}
@@ -737,15 +708,15 @@ doAllocBuffers(const unsigned bufferSize,
}
// Flows may need to be allocated even when there is no restart due to BFLOW* summary keywords
if (blockFlows_ ) {
if (flowsC_.blockFlows_ ) {
const std::array<int, 3> phaseIdxs = { gasPhaseIdx, oilPhaseIdx, waterPhaseIdx };
const std::array<int, 3> compIdxs = { gasCompIdx, oilCompIdx, waterCompIdx };
for (unsigned ii = 0; ii < phaseIdxs.size(); ++ii) {
if (FluidSystem::phaseIsActive(phaseIdxs[ii])) {
flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
}
}
}
@@ -992,12 +963,10 @@ doAllocBuffers(const unsigned bufferSize,
this->micpC_.allocate(bufferSize);
}
enableFlows_ = false;
enableFlowsn_ = false;
const bool rstFlows = (rstKeywords["FLOWS"] > 0);
if (rstFlows) {
rstKeywords["FLOWS"] = 0;
enableFlows_ = true;
flowsC_. enableFlows_ = true;
const std::array<int, 3> phaseIdxs = { gasPhaseIdx, oilPhaseIdx, waterPhaseIdx };
const std::array<int, 3> compIdxs = { gasCompIdx, oilCompIdx, waterCompIdx };
@@ -1005,24 +974,24 @@ doAllocBuffers(const unsigned bufferSize,
for (unsigned ii = 0; ii < phaseIdxs.size(); ++ii) {
if (FluidSystem::phaseIsActive(phaseIdxs[ii])) {
if (!blockFlows_) { // Already allocated if summary vectors requested
flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
if (!flowsC_.blockFlows_) { // Already allocated if summary vectors requested
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
}
if (rstKeywords["FLOWS-"] > 0) {
flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::XMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::YMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flows_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
}
if (numOutputNnc > 0) {
enableFlowsn_ = true;
flowsC_.enableFlowsn_ = true;
flowsn_[compIdxs[ii]].name = rstName[ii];
flowsn_[compIdxs[ii]].indices.resize(numOutputNnc, -1);
flowsn_[compIdxs[ii]].values.resize(numOutputNnc, 0.0);
flowsC_.flowsn_[compIdxs[ii]].name = rstName[ii];
flowsC_.flowsn_[compIdxs[ii]].indices.resize(numOutputNnc, -1);
flowsC_.flowsn_[compIdxs[ii]].values.resize(numOutputNnc, 0.0);
}
}
}
@@ -1031,11 +1000,11 @@ doAllocBuffers(const unsigned bufferSize,
}
}
enableFlores_ = false;
enableFloresn_ = false;
flowsC_.enableFlores_ = false;
flowsC_.enableFloresn_ = false;
if (rstKeywords["FLORES"] > 0) {
rstKeywords["FLORES"] = 0;
enableFlores_ = true;
flowsC_.enableFlores_ = true;
const std::array<int, 3> phaseIdxs = { gasPhaseIdx, oilPhaseIdx, waterPhaseIdx };
const std::array<int, 3> compIdxs = { gasCompIdx, oilCompIdx, waterCompIdx };
@@ -1043,22 +1012,22 @@ doAllocBuffers(const unsigned bufferSize,
for (unsigned ii = 0; ii < phaseIdxs.size(); ++ii) {
if (FluidSystem::phaseIsActive(phaseIdxs[ii])) {
flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZPlus)][compIdxs[ii]].resize(bufferSize, 0.0);
if (rstKeywords["FLORES-"] > 0) {
flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::XMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::YMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
flowsC_.flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][compIdxs[ii]].resize(bufferSize, 0.0);
}
if (numOutputNnc > 0) {
enableFloresn_ = true;
flowsC_.enableFloresn_ = true;
floresn_[compIdxs[ii]].name = rstName[ii];
floresn_[compIdxs[ii]].indices.resize(numOutputNnc, -1);
floresn_[compIdxs[ii]].values.resize(numOutputNnc, 0.0);
flowsC_.floresn_[compIdxs[ii]].name = rstName[ii];
flowsC_.floresn_[compIdxs[ii]].indices.resize(numOutputNnc, -1);
flowsC_.floresn_[compIdxs[ii]].values.resize(numOutputNnc, 0.0);
}
}
}
@@ -34,7 +34,7 @@
#include <opm/simulators/flow/ExtboContainer.hpp>
#include <opm/simulators/flow/FIPContainer.hpp>
#include <opm/simulators/flow/FlowsData.hpp>
#include <opm/simulators/flow/FlowsContainer.hpp>
#include <opm/simulators/flow/InterRegFlows.hpp>
#include <opm/simulators/flow/LogOutputHelper.hpp>
#include <opm/simulators/flow/MechContainer.hpp>
@@ -199,50 +199,8 @@ public:
const MICPContainer<Scalar>& getMICP() const
{ return this->micpC_; }
const std::array<FlowsData<double>, 3>& getFlowsn() const
{
return this->flowsn_;
}
bool hasFlowsn() const
{
return enableFlowsn_;
}
bool hasFlows() const
{
return enableFlows_;
}
bool hasBlockFlows() const
{
return blockFlows_;
}
bool anyFlows() const
{
return anyFlows_;
}
const std::array<FlowsData<double>, 3>& getFloresn() const
{
return this->floresn_;
}
bool hasFloresn() const
{
return enableFloresn_;
}
bool hasFlores() const
{
return enableFlores_;
}
bool anyFlores() const
{
return anyFlores_;
}
const FlowsContainer<FluidSystem>& getFlows() const
{ return this->flowsC_; }
bool needInterfaceFluxes([[maybe_unused]] const bool isSubStep) const
{
@@ -384,14 +342,6 @@ protected:
bool forceDisableFipresvOutput_{false};
bool computeFip_{false};
bool anyFlows_{false};
bool anyFlores_{false};
bool blockFlows_{false};
bool enableFlows_{false};
bool enableFlores_{false};
bool enableFlowsn_{false};
bool enableFloresn_{false};
FIPContainer<FluidSystem> fipC_;
std::unordered_map<std::string, std::vector<int>> regions_;
std::unordered_map<Inplace::Phase, std::vector<SummaryConfigNode>> regionNodes_;
@@ -460,11 +410,7 @@ protected:
std::array<ScalarBuffer, numPhases> residual_;
std::array<std::array<ScalarBuffer, numPhases>, 6> flows_;
std::array<std::array<ScalarBuffer, numPhases>, 6> flores_;
std::array<FlowsData<double>, 3> floresn_;
std::array<FlowsData<double>, 3> flowsn_;
FlowsContainer<FluidSystem> flowsC_;
RFTContainer<FluidSystem> rftC_;
std::map<std::pair<std::string, int>, double> blockData_;
+31 -31
View File
@@ -678,38 +678,38 @@ public:
for (const auto& flowsInfo : flowsInfos) {
if (flowsInfo.faceId >= 0) {
if constexpr (gas_idx >= 0) {
if (!this->flows_[flowsInfo.faceId][gasCompIdx].empty()) {
this->flows_[flowsInfo.faceId][gasCompIdx][globalDofIdx]
if (!this->flowsC_.flows_[flowsInfo.faceId][gasCompIdx].empty()) {
this->flowsC_.flows_[flowsInfo.faceId][gasCompIdx][globalDofIdx]
= flowsInfo.flow[gas_idx];
}
}
if constexpr (oil_idx >= 0) {
if (!this->flows_[flowsInfo.faceId][oilCompIdx].empty()) {
this->flows_[flowsInfo.faceId][oilCompIdx][globalDofIdx]
if (!this->flowsC_.flows_[flowsInfo.faceId][oilCompIdx].empty()) {
this->flowsC_.flows_[flowsInfo.faceId][oilCompIdx][globalDofIdx]
= flowsInfo.flow[oil_idx];
}
}
if constexpr (water_idx >= 0) {
if (!this->flows_[flowsInfo.faceId][waterCompIdx].empty()) {
this->flows_[flowsInfo.faceId][waterCompIdx][globalDofIdx]
if (!this->flowsC_.flows_[flowsInfo.faceId][waterCompIdx].empty()) {
this->flowsC_.flows_[flowsInfo.faceId][waterCompIdx][globalDofIdx]
= flowsInfo.flow[water_idx];
}
}
}
if (flowsInfo.faceId == -2) {
if (!this->flowsn_[gasCompIdx].indices.empty()) {
this->flowsn_[gasCompIdx].indices[flowsInfo.nncId] = flowsInfo.nncId;
this->flowsn_[gasCompIdx].values[flowsInfo.nncId]
if (!this->flowsC_.flowsn_[gasCompIdx].indices.empty()) {
this->flowsC_.flowsn_[gasCompIdx].indices[flowsInfo.nncId] = flowsInfo.nncId;
this->flowsC_.flowsn_[gasCompIdx].values[flowsInfo.nncId]
= flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)];
}
if (!this->flowsn_[oilCompIdx].indices.empty()) {
this->flowsn_[oilCompIdx].indices[flowsInfo.nncId] = flowsInfo.nncId;
this->flowsn_[oilCompIdx].values[flowsInfo.nncId]
if (!this->flowsC_.flowsn_[oilCompIdx].indices.empty()) {
this->flowsC_.flowsn_[oilCompIdx].indices[flowsInfo.nncId] = flowsInfo.nncId;
this->flowsC_.flowsn_[oilCompIdx].values[flowsInfo.nncId]
= flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)];
}
if (!this->flowsn_[waterCompIdx].indices.empty()) {
this->flowsn_[waterCompIdx].indices[flowsInfo.nncId] = flowsInfo.nncId;
this->flowsn_[waterCompIdx].values[flowsInfo.nncId]
if (!this->flowsC_.flowsn_[waterCompIdx].indices.empty()) {
this->flowsC_.flowsn_[waterCompIdx].indices[flowsInfo.nncId] = flowsInfo.nncId;
this->flowsC_.flowsn_[waterCompIdx].values[flowsInfo.nncId]
= flowsInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)];
}
}
@@ -723,39 +723,39 @@ public:
for (const auto& floresInfo : floresInfos) {
if (floresInfo.faceId >= 0) {
if constexpr (gas_idx >= 0) {
if (!this->flores_[floresInfo.faceId][gasCompIdx].empty()) {
this->flores_[floresInfo.faceId][gasCompIdx][globalDofIdx]
if (!this->flowsC_.flores_[floresInfo.faceId][gasCompIdx].empty()) {
this->flowsC_.flores_[floresInfo.faceId][gasCompIdx][globalDofIdx]
= floresInfo.flow[gas_idx];
}
}
if constexpr (oil_idx >= 0) {
if (!this->flores_[floresInfo.faceId][oilCompIdx].empty()) {
this->flores_[floresInfo.faceId][oilCompIdx][globalDofIdx]
if (!this->flowsC_.flores_[floresInfo.faceId][oilCompIdx].empty()) {
this->flowsC_.flores_[floresInfo.faceId][oilCompIdx][globalDofIdx]
= floresInfo.flow[oil_idx];
}
}
if constexpr (water_idx >= 0) {
if (!this->flores_[floresInfo.faceId][waterCompIdx].empty()) {
this->flores_[floresInfo.faceId][waterCompIdx][globalDofIdx]
if (!this->flowsC_.flores_[floresInfo.faceId][waterCompIdx].empty()) {
this->flowsC_.flores_[floresInfo.faceId][waterCompIdx][globalDofIdx]
= floresInfo.flow[water_idx];
}
}
}
if (floresInfo.faceId == -2) {
if (!this->floresn_[gasCompIdx].indices.empty()) {
this->floresn_[gasCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->floresn_[gasCompIdx].values[floresInfo.nncId]
if (!this->flowsC_.floresn_[gasCompIdx].indices.empty()) {
this->flowsC_.floresn_[gasCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->flowsC_.floresn_[gasCompIdx].values[floresInfo.nncId]
= floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(gasCompIdx)];
}
if (!this->floresn_[oilCompIdx].indices.empty()) {
this->floresn_[oilCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->floresn_[oilCompIdx].values[floresInfo.nncId]
if (!this->flowsC_.floresn_[oilCompIdx].indices.empty()) {
this->flowsC_.floresn_[oilCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->flowsC_.floresn_[oilCompIdx].values[floresInfo.nncId]
= floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(oilCompIdx)];
}
if (!this->floresn_[waterCompIdx].indices.empty()) {
this->floresn_[waterCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->floresn_[waterCompIdx].values[floresInfo.nncId]
if (!this->flowsC_.floresn_[waterCompIdx].indices.empty()) {
this->flowsC_.floresn_[waterCompIdx].indices[floresInfo.nncId] = floresInfo.nncId;
this->flowsC_.floresn_[waterCompIdx].values[floresInfo.nncId]
= floresInfo.flow[conti0EqIdx + Indices::canonicalToActiveComponentIndex(waterCompIdx)];
}
}
@@ -1000,7 +1000,7 @@ public:
dir = FaceDir::ToIntersectionIndex(Dir::ZPlus);
}
val.second = this->flows_[dir][waterCompIdx][globalDofIdx];
val.second = this->flowsC_.flows_[dir][waterCompIdx][globalDofIdx];
}
else {
std::string logstring = "Keyword '";