BlackoilWellModelNetworkGeneric.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 SINTEF ICT, Applied Mathematics.
3 Copyright 2016 - 2017 Statoil ASA.
4 Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
5 Copyright 2016 - 2018 IRIS AS
6
7 This file is part of the Open Porous Media project (OPM).
8
9 OPM is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OPM is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OPM. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#ifndef OPM_BLACKOILWELLMODEL_NETWORK_GENERIC_HEADER_INCLUDED
24#define OPM_BLACKOILWELLMODEL_NETWORK_GENERIC_HEADER_INCLUDED
25
26#include <opm/input/eclipse/Schedule/Network/ExtNetwork.hpp>
27
28#include <opm/output/data/Groups.hpp>
29
31
32#include <map>
33#include <optional>
34#include <string>
35
36namespace Opm {
37 class Schedule;
38 class UnitSystem;
39 template<class Scalar, class IndexTraits> class BlackoilWellModelGeneric;
40 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
41 template<typename Scalar> class VFPProdProperties;
42}
43
44namespace Opm {
45
47template<typename Scalar, typename IndexTraits>
49{
50public:
52
54
56 bool active() const
57 { return active_; }
58
59 const std::map<std::string, Scalar>&
60 nodePressures() const { return node_pressures_; }
61
62 // do not use, only needed for serialization testing
63 void setNodePressures(const std::map<std::string, Scalar>& values)
64 { node_pressures_ = values; }
65
66 void setFromRestart(const std::optional<std::map<std::string, double>>& restart_pressures);
67
69 void initialize(const int report_step);
70
73
75 void updateActiveState(const int report_step);
76
80 bool needPreStepRebalance(const int report_step) const;
81
82 bool shouldBalance(const int reportStepIndex,
83 const int iterationIdx) const;
84
85 Scalar updatePressures(const int reportStepIdx,
86 const Scalar damping_factor,
87 const Scalar update_upper_bound);
88
89 void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues,
90 const int reportStepIdx) const;
91
94
97
98 template<class Serializer>
99 void serializeOp(Serializer& serializer)
100 {
101 serializer(node_pressures_);
102 serializer(last_valid_node_pressures_);
103 }
104
106
107protected:
108 std::map<std::string, Scalar>
109 computePressures(const Network::ExtNetwork& network,
110 const VFPProdProperties<Scalar>& vfp_prod_props,
111 const UnitSystem& unit_system,
112 const int reportStepIdx,
113 const Parallel::Communication& comm) const;
114
115
116 bool active_{false};
118
119 // Network pressures for output and initialization
120 std::map<std::string, Scalar> node_pressures_;
121 // Valid network pressures for output and initialization for safe restart after failed iterations
122 std::map<std::string, Scalar> last_valid_node_pressures_;
123};
124
125} // namespace Opm
126
127#endif
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:96
Class for handling the blackoil well network model.
Definition: BlackoilWellModelNetworkGeneric.hpp:49
std::map< std::string, Scalar > node_pressures_
Definition: BlackoilWellModelNetworkGeneric.hpp:120
virtual ~BlackoilWellModelNetworkGeneric()=default
void commitState()
Definition: BlackoilWellModelNetworkGeneric.hpp:92
bool active_
Definition: BlackoilWellModelNetworkGeneric.hpp:116
std::map< std::string, Scalar > computePressures(const Network::ExtNetwork &network, const VFPProdProperties< Scalar > &vfp_prod_props, const UnitSystem &unit_system, const int reportStepIdx, const Parallel::Communication &comm) const
void setNodePressures(const std::map< std::string, Scalar > &values)
Definition: BlackoilWellModelNetworkGeneric.hpp:63
void initialize(const int report_step)
Initialize wells according to network configuration.
BlackoilWellModelGeneric< Scalar, IndexTraits > & well_model_
Definition: BlackoilWellModelNetworkGeneric.hpp:117
bool shouldBalance(const int reportStepIndex, const int iterationIdx) const
Scalar updatePressures(const int reportStepIdx, const Scalar damping_factor, const Scalar update_upper_bound)
std::map< std::string, Scalar > last_valid_node_pressures_
Definition: BlackoilWellModelNetworkGeneric.hpp:122
bool needPreStepRebalance(const int report_step) const
bool operator==(const BlackoilWellModelNetworkGeneric< Scalar, IndexTraits > &rhs) const
void updateActiveState(const int report_step)
Checks if network is active (at least one network well on prediction).
BlackoilWellModelNetworkGeneric(BlackoilWellModelGeneric< Scalar, IndexTraits > &well_model)
void serializeOp(Serializer &serializer)
Definition: BlackoilWellModelNetworkGeneric.hpp:99
bool active() const
return true if network is active (at least one network well in prediction mode)
Definition: BlackoilWellModelNetworkGeneric.hpp:56
void setFromRestart(const std::optional< std::map< std::string, double > > &restart_pressures)
void initializeWell(WellInterfaceGeneric< Scalar, IndexTraits > &well)
Initialize a single well according to network configuration.
void assignNodeValues(std::map< std::string, data::NodeData > &nodevalues, const int reportStepIdx) const
void resetState()
Definition: BlackoilWellModelNetworkGeneric.hpp:95
const std::map< std::string, Scalar > & nodePressures() const
Definition: BlackoilWellModelNetworkGeneric.hpp:60
Definition: VFPProdProperties.hpp:38
Definition: WellInterfaceGeneric.hpp:53
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: blackoilbioeffectsmodules.hh:43