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 SimulatorUpdate simulatorUpdate;
36 simulatorUpdate.tran_update = false;
37 simulatorUpdate.well_structure_changed = false;
38 simulatorUpdate.affected_wells = {"test"};
39 return simulatorUpdate;
40 }
41
42 template<class Serializer>
43 void serializeOp(Serializer& serializer)
44 {
45 serializer(affected_wells);
46 serializer(tran_update);
47 serializer(well_structure_changed);
48 }
49
50 // Wells affected by ACTIONX and for which the simulator needs to
51 // reapply rates and state from the newly updated Schedule object.
52 std::unordered_set<std::string> affected_wells;
53
54 // If one of the transmissibility multiplier keywords has been invoked
55 // as an ACTIONX keyword the simulator needs to recalculate the
56 // transmissibility.
57 bool tran_update{false};
58
63
64 void append(SimulatorUpdate& otherSimUpdate) {
65 this->tran_update = otherSimUpdate.tran_update or this->tran_update;
67 affected_wells.insert(otherSimUpdate.affected_wells.begin(), otherSimUpdate.affected_wells.end());
68 }
69
70 void reset() {
71 tran_update = false;
73 affected_wells.clear();
74 }
75
76 bool operator==(const SimulatorUpdate& data) const {
77 return tran_update == data.tran_update &&
78 well_structure_changed == data.well_structure_changed &&
79 affected_wells == data.affected_wells;
80 }
81};
82
83} // namespace Opm
84
85#endif // SIMULATOR_UPDATE_HPP
Class for (de-)serializing.
Definition Serializer.hpp:84
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 well_structure_changed
Whether or not well structure changed in processing an ACTIONX block.
Definition SimulatorUpdate.hpp:62