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
32
33#include <map>
34#include <optional>
35#include <string>
36
37namespace Opm {
38 class Schedule;
39 class UnitSystem;
40 template<class Scalar, class IndexTraits> class BlackoilWellModelGeneric;
41 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
42 template<typename Scalar> class VFPProdProperties;
43}
44
45namespace Opm {
46
48template<typename Scalar, typename IndexTraits>
50{
51public:
53
55
57 bool active() const
58 { return active_; }
59
60 const std::map<std::string, Scalar>&
61 nodePressures() const { return node_pressures_; }
62
63 // do not use, only needed for serialization testing
64 void setNodePressures(const std::map<std::string, Scalar>& values)
65 { node_pressures_ = values; }
66
67 void setFromRestart(const std::optional<std::map<std::string, double>>& restart_pressures);
68
70 void initialize(const int report_step);
71
74
76 void updateActiveState(const int report_step);
77
81 bool needPreStepRebalance(const int report_step) const;
82
85 bool shouldBalance(const int reportStepIndex) const;
87 bool willBalanceOnNextIteration(const int reportStepIndex) const;
88
89 Scalar updatePressures(const int reportStepIdx,
90 const Scalar damping_factor,
91 const Scalar update_upper_bound);
92
93 void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues,
94 const int reportStepIdx) const;
95
98
101
102 template<class Serializer>
103 void serializeOp(Serializer& serializer)
104 {
105 serializer(node_pressures_);
106 serializer(last_valid_node_pressures_);
107 }
108
110
111protected:
112 std::map<std::string, Scalar>
113 computePressures(const Network::ExtNetwork& network,
114 const VFPProdProperties<Scalar>& vfp_prod_props,
115 const UnitSystem& unit_system,
116 const int reportStepIdx,
117 const Parallel::Communication& comm) const;
118
119
120 bool active_{false};
122
123 // Network pressures for output and initialization
124 std::map<std::string, Scalar> node_pressures_;
125 // Valid network pressures for output and initialization for safe restart after failed iterations
126 std::map<std::string, Scalar> last_valid_node_pressures_;
127};
128
129} // namespace Opm
130
131#endif
Class for handling the blackoil well network model.
Definition: BlackoilWellModelNetworkGeneric.hpp:50
std::map< std::string, Scalar > node_pressures_
Definition: BlackoilWellModelNetworkGeneric.hpp:124
bool shouldBalance(const int reportStepIndex) const
virtual ~BlackoilWellModelNetworkGeneric()=default
bool willBalanceOnNextIteration(const int reportStepIndex) const
Checks if we will perform a network re-balance on the next Newton iteration.
void commitState()
Definition: BlackoilWellModelNetworkGeneric.hpp:96
bool active_
Definition: BlackoilWellModelNetworkGeneric.hpp:120
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:64
void initialize(const int report_step)
Initialize wells according to network configuration.
BlackoilWellModelGeneric< Scalar, IndexTraits > & well_model_
Definition: BlackoilWellModelNetworkGeneric.hpp:121
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:126
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:103
bool active() const
return true if network is active (at least one network well in prediction mode)
Definition: BlackoilWellModelNetworkGeneric.hpp:57
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:99
const std::map< std::string, Scalar > & nodePressures() const
Definition: BlackoilWellModelNetworkGeneric.hpp:61
Definition: VFPProdProperties.hpp:38
Definition: WellInterfaceGeneric.hpp:53
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: blackoilbioeffectsmodules.hh:45