My Project
Loading...
Searching...
No Matches
BlackoilWellModelNldd.hpp
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#ifndef OPM_BLACKOILWELLMODEL_NLDD_HEADER_INCLUDED
23#define OPM_BLACKOILWELLMODEL_NLDD_HEADER_INCLUDED
24
25#include <opm/grid/utility/SparseTable.hpp>
26
27#include <opm/simulators/timestepping/ConvergenceReport.hpp>
28
29#include <opm/simulators/utils/DeferredLogger.hpp>
30
31#include <opm/simulators/wells/BlackoilWellModel.hpp>
32
33#include <map>
34#include <string>
35#include <vector>
36
37namespace Opm {
38
39template<class Scalar>
41{
42public:
43 std::vector<Scalar> getPrimaryVarsDomain(const int domainIdx) const;
44 void setPrimaryVarsDomain(const int domainIdx, const std::vector<Scalar>& vars);
45
46 const SparseTable<int>& well_local_cells() const
47 { return well_local_cells_; }
48
49 const std::map<std::string, int>& well_domain() const
50 { return well_domain_; }
51
52protected:
54 : genWellModel_(model)
55 {}
56
57 void calcDomains(const std::vector<const SubDomainIndices*>& domains);
58
59private:
60 void logDomains() const;
61
62 void findWellDomains(const std::vector<const SubDomainIndices*>& domains);
63
64 void calcLocalIndices(const std::vector<const SubDomainIndices*>& domains);
65
67
68 // Keep track of the domain of each well
69 std::map<std::string, int> well_domain_{};
70
71 // Store the local index of the wells perforated cells in the domain
72 SparseTable<int> well_local_cells_{};
73};
74
76template<typename TypeTag>
78 public BlackoilWellModelNlddGeneric<GetPropType<TypeTag, Properties::Scalar>>
79{
80public:
81 // --------- Types ---------
84 using PressureMatrix = typename BlackoilWellModel<TypeTag>::PressureMatrix;
85 using BVector = typename BlackoilWellModel<TypeTag>::BVector;
86
87 using Domain = SubDomain<Grid>;
88
91 , wellModel_(model)
92 {}
93
94 void addWellPressureEquations(PressureMatrix& jacobian,
95 const BVector& weights,
96 const bool use_well_weights,
97 const int domainIndex) const;
98
99 // prototype for assemble function for ASPIN solveLocal()
100 // will try to merge back to assemble() when done prototyping
101 void assemble(const int iterationIdx,
102 const double dt,
103 const Domain& domain);
104
105 void updateWellControls(DeferredLogger& deferred_logger,
106 const Domain& domain);
107
108 void setupDomains(const std::vector<Domain>& domains);
109
110 // Check if well equations are converged locally.
111 ConvergenceReport getWellConvergence(const Domain& domain,
112 const std::vector<Scalar>& B_avg,
114
115 // using the solution x to recover the solution xw for wells and applying
116 // xw to update Well State
117 void recoverWellSolutionAndUpdateWellState(const BVector& x,
118 const int domainIdx);
119
120private:
121 BlackoilWellModel<TypeTag>& wellModel_;
122
123 void assembleWellEq(const double dt,
124 const Domain& domain,
126
127 // These members are used to avoid reallocation in specific functions
128 // instead of using local variables.
129 // Their state is not relevant between function calls, so they can
130 // (and must) be mutable, as the functions using them are const.
131 mutable BVector x_local_;
132
133};
134
135} // namespace Opm
136
137#include "BlackoilWellModelNldd_impl.hpp"
138
139#endif
Class for handling the blackoil well model.
Definition BlackoilWellModelGeneric.hpp:92
Definition BlackoilWellModelNldd.hpp:41
Class for handling the blackoil well model in a NLDD solver.
Definition BlackoilWellModelNldd.hpp:79
Class for handling the blackoil well model.
Definition BlackoilWellModel.hpp:94
Represents the convergence status of the whole simulator, to make it possible to query and store the ...
Definition ConvergenceReport.hpp:38
Definition DeferredLogger.hpp:57
Definition BlackoilWellModel.hpp:83
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:235
Representing a part of a grid, in a way suitable for performing local solves.
Definition SubDomain.hpp:85