My Project
Loading...
Searching...
No Matches
SimulatorUpdate.hpp
1/*
2 Copyright 2021 Equinor ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef SIMULATOR_UPDATE_HPP
21#define SIMULATOR_UPDATE_HPP
22
23#include <string>
24#include <unordered_set>
25
26namespace Opm {
27
31
33{
34 static SimulatorUpdate serializationTestObject()
35 {
36 SimulatorUpdate simulatorUpdate;
37 simulatorUpdate.tran_update = true;
38 simulatorUpdate.well_structure_changed = true;
39 simulatorUpdate.affected_wells = {"test"};
40 simulatorUpdate.welpi_wells.insert("I-45");
41 return simulatorUpdate;
42 }
43
44 template<class Serializer>
45 void serializeOp(Serializer& serializer)
46 {
47 serializer(affected_wells);
48 serializer(welpi_wells);
49 serializer(tran_update);
50 serializer(well_structure_changed);
51 }
52
55 std::unordered_set<std::string> affected_wells{};
56
59 std::unordered_set<std::string> welpi_wells{};
60
65 bool tran_update{false};
66
73
74 void append(const SimulatorUpdate& otherSimUpdate)
75 {
76 this->tran_update = this->tran_update || otherSimUpdate.tran_update;
77
79 || otherSimUpdate.well_structure_changed;
80
81 this->affected_wells.insert(otherSimUpdate.affected_wells.begin(),
82 otherSimUpdate.affected_wells.end());
83
84 this->welpi_wells.insert(otherSimUpdate.welpi_wells.begin(),
85 otherSimUpdate.welpi_wells.end());
86 }
87
88 void reset()
89 {
90 this->tran_update = false;
91 this->well_structure_changed = false;
92 this->affected_wells.clear();
93 this->welpi_wells.clear();
94 }
95
96 bool operator==(const SimulatorUpdate& that) const
97 {
98 return (this->tran_update == that.tran_update)
99 && (this->well_structure_changed == that.well_structure_changed)
100 && (this->affected_wells == that.affected_wells)
101 && (this->welpi_wells == that.welpi_wells)
102 ;
103 }
104};
105
106} // namespace Opm
107
108#endif // SIMULATOR_UPDATE_HPP
Class for (de-)serializing.
Definition Serializer.hpp:91
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
This struct is used to communicate back from the Schedule::applyAction() what needs to be updated in ...
Definition SimulatorUpdate.hpp:33
bool tran_update
Whether or not a transmissibility multiplier keyword was invoked in an ACTIONX block.
Definition SimulatorUpdate.hpp:65
std::unordered_set< std::string > welpi_wells
Wells affected only by WELPI for which the simulator needs to update its internal notion of the conne...
Definition SimulatorUpdate.hpp:59
bool well_structure_changed
Whether or not well structure changed in processing an ACTIONX block.
Definition SimulatorUpdate.hpp:72
std::unordered_set< std::string > affected_wells
Wells affected by ACTIONX and for which the simulator needs to reapply rates and state from the newly...
Definition SimulatorUpdate.hpp:55