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 template<class Scalar, class IndexTraits> class BlackoilWellModelGeneric;
39 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
40 template<typename Scalar> class VFPProdProperties;
41}
42
43namespace Opm {
44
46template<typename Scalar, typename IndexTraits>
48{
49public:
51
53
55 bool active() const
56 { return active_; }
57
58 const std::map<std::string, Scalar>&
59 nodePressures() const { return node_pressures_; }
60
61 // do not use, only needed for serialization testing
62 void setNodePressures(const std::map<std::string, Scalar>& values)
63 { node_pressures_ = values; }
64
65 void setFromRestart(const std::optional<std::map<std::string, double>>& restart_pressures);
66
68 void initialize(const int report_step);
69
72
74 void updateActiveState(const int report_step);
75
79 bool needPreStepRebalance(const int report_step) const;
80
81 bool shouldBalance(const int reportStepIndex,
82 const int iterationIdx) const;
83
84 Scalar updatePressures(const int reportStepIdx,
85 const Scalar damping_factor,
86 const Scalar update_upper_bound);
87
88 void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues,
89 const int reportStepIdx) const;
90
93
96
97 template<class Serializer>
98 void serializeOp(Serializer& serializer)
99 {
100 serializer(node_pressures_);
101 serializer(last_valid_node_pressures_);
102 }
103
105
106protected:
107 std::map<std::string, Scalar>
108 computePressures(const Network::ExtNetwork& network,
109 const VFPProdProperties<Scalar>& vfp_prod_props,
110 const int reportStepIdx,
111 const Parallel::Communication& comm) const;
112
113
114 bool active_{false};
116
117 // Network pressures for output and initialization
118 std::map<std::string, Scalar> node_pressures_;
119 // Valid network pressures for output and initialization for safe restart after failed iterations
120 std::map<std::string, Scalar> last_valid_node_pressures_;
121};
122
123} // namespace Opm
124
125#endif
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:96
Class for handling the blackoil well network model.
Definition: BlackoilWellModelNetworkGeneric.hpp:48
std::map< std::string, Scalar > node_pressures_
Definition: BlackoilWellModelNetworkGeneric.hpp:118
virtual ~BlackoilWellModelNetworkGeneric()=default
void commitState()
Definition: BlackoilWellModelNetworkGeneric.hpp:91
bool active_
Definition: BlackoilWellModelNetworkGeneric.hpp:114
void setNodePressures(const std::map< std::string, Scalar > &values)
Definition: BlackoilWellModelNetworkGeneric.hpp:62
void initialize(const int report_step)
Initialize wells according to network configuration.
BlackoilWellModelGeneric< Scalar, IndexTraits > & well_model_
Definition: BlackoilWellModelNetworkGeneric.hpp:115
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:120
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)
std::map< std::string, Scalar > computePressures(const Network::ExtNetwork &network, const VFPProdProperties< Scalar > &vfp_prod_props, const int reportStepIdx, const Parallel::Communication &comm) const
void serializeOp(Serializer &serializer)
Definition: BlackoilWellModelNetworkGeneric.hpp:98
bool active() const
return true if network is active (at least one network well in prediction mode)
Definition: BlackoilWellModelNetworkGeneric.hpp:55
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:94
const std::map< std::string, Scalar > & nodePressures() const
Definition: BlackoilWellModelNetworkGeneric.hpp:59
Definition: VFPProdProperties.hpp:38
Definition: WellInterfaceGeneric.hpp:53
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: blackoilbioeffectsmodules.hh:43