opm-simulators
Toggle main menu visibility
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
37
namespace
Opm
{
38
39
template
<
typename
Scalar,
typename
IndexTraits>
40
class
BlackoilWellModelNlddGeneric
41
{
42
public
:
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
52
protected
:
53
BlackoilWellModelNlddGeneric(
BlackoilWellModelGeneric<Scalar, IndexTraits>
& model)
54
: genWellModel_(model)
55
{}
56
57
void
calcDomains(
const
std::vector<const SubDomainIndices*>& domains);
58
59
private
:
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
66
BlackoilWellModelGeneric<Scalar, IndexTraits>
& genWellModel_;
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
76
template
<
typename
TypeTag>
77
class
BlackoilWellModelNldd :
78
public
BlackoilWellModelNlddGeneric<GetPropType<TypeTag, Properties::Scalar>,
79
typename GetPropType<TypeTag, Properties::FluidSystem>::IndexTraitsType>
80
{
81
public
:
82
// --------- Types ---------
83
using
Grid =
GetPropType<TypeTag, Properties::Grid>
;
84
using
Scalar =
GetPropType<TypeTag, Properties::Scalar>
;
85
using
PressureMatrix =
typename
BlackoilWellModel<TypeTag>::PressureMatrix;
86
using
BVector =
typename
BlackoilWellModel<TypeTag>::BVector;
87
using
FluidSystem =
GetPropType<TypeTag, Properties::FluidSystem>
;
88
using
IndexTraits =
typename
FluidSystem::IndexTraitsType;
89
using
Indices =
GetPropType<TypeTag, Properties::Indices>
;
90
91
using
Domain =
SubDomain<Grid>
;
92
93
BlackoilWellModelNldd(
BlackoilWellModel<TypeTag>
& model)
94
: BlackoilWellModelNlddGeneric<Scalar, IndexTraits>(model)
95
, wellModel_(model)
96
{}
97
98
void
addWellPressureEquations(PressureMatrix& jacobian,
99
const
BVector& weights,
100
const
bool
use_well_weights,
101
const
int
domainIndex)
const
;
102
103
// prototype for assemble function for ASPIN solveLocal()
104
// will try to merge back to assemble() when done prototyping
105
void
assemble(
const
int
iterationIdx,
106
const
double
dt,
107
const
Domain& domain);
108
109
void
updateWellControls(
DeferredLogger
& deferred_logger,
110
const
Domain& domain);
111
112
void
setupDomains(
const
std::vector<Domain>& domains);
113
114
// Check if well equations are converged locally.
115
ConvergenceReport
getWellConvergence(
const
Domain& domain,
116
const
std::vector<Scalar>& B_avg,
117
DeferredLogger
& local_deferredLogger)
const
;
118
119
// using the solution x to recover the solution xw for wells and applying
120
// xw to update Well State
121
void
recoverWellSolutionAndUpdateWellState(
const
BVector& x,
122
const
int
domainIdx);
123
124
// Get number of wells on this rank
125
int
numLocalWells()
const
126
{
127
return
wellModel_.numLocalWells();
128
}
129
130
// Get number of wells on this rank
131
int
numLocalWellsEnd()
const
132
{
133
return
wellModel_.numLocalWellsEnd();
134
}
135
136
private
:
137
BlackoilWellModel<TypeTag>
& wellModel_;
138
139
void
assembleWellEq(
const
double
dt,
140
const
Domain& domain,
141
DeferredLogger
& deferred_logger);
142
143
// These members are used to avoid reallocation in specific functions
144
// instead of using local variables.
145
// Their state is not relevant between function calls, so they can
146
// (and must) be mutable, as the functions using them are const.
147
mutable
BVector x_local_;
148
149
};
150
151
}
// namespace Opm
152
153
#include "BlackoilWellModelNldd_impl.hpp"
154
155
#endif
Opm::BlackoilWellModelGeneric
Class for handling the blackoil well model.
Definition
BlackoilWellModelGeneric.hpp:95
Opm::BlackoilWellModel
Class for handling the blackoil well model.
Definition
BlackoilWellModel.hpp:102
Opm::ConvergenceReport
Represents the convergence status of the whole simulator, to make it possible to query and store the ...
Definition
ConvergenceReport.hpp:38
Opm::DeferredLogger
Definition
DeferredLogger.hpp:57
Opm::SparseTable
Definition
BlackoilWellModel.hpp:91
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition
blackoilbioeffectsmodules.hh:43
Opm::GetPropType
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:233
Opm::SubDomain
Representing a part of a grid, in a way suitable for performing local solves.
Definition
SubDomain.hpp:85
opm
simulators
wells
BlackoilWellModelNldd.hpp
Generated by
1.17.0