opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
SubDomain.hpp
1
/*
2
Copyright 2021 Total SE
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 OPM_SUBDOMAIN_HEADER_INCLUDED
21
#define OPM_SUBDOMAIN_HEADER_INCLUDED
22
23
#include <opm/grid/common/SubGridPart.hpp>
24
25
#include <fmt/format.h>
26
27
#include <utility>
28
#include <vector>
29
30
namespace
Opm
31
{
33
enum class
DomainSolveApproach
{
34
Jacobi,
35
GaussSeidel
36
};
37
39
enum class
DomainOrderingMeasure
{
40
AveragePressure,
41
MaxPressure,
42
Residual
43
};
44
45
inline
DomainOrderingMeasure
domainOrderingMeasureFromString(
const
std::string_view measure)
46
{
47
if
(measure ==
"residual"
) {
48
return
DomainOrderingMeasure::Residual;
49
}
else
if
(measure ==
"maxpressure"
) {
50
return
DomainOrderingMeasure::MaxPressure;
51
}
else
if
(measure ==
"averagepressure"
) {
52
return
DomainOrderingMeasure::AveragePressure;
53
}
else
{
54
throw
std::runtime_error(fmt::format(
"Invalid domain ordering '{}' specified"
, measure));
55
}
56
}
57
60
struct
SubDomainIndices
61
{
62
// The index of a subdomain is arbitrary, but can be used by the
63
// solvers to keep track of well locations etc.
64
int
index;
65
// The set of cells that make up a SubDomain, stored as cell indices
66
// in the local numbering of the current MPI rank.
67
std::vector<int> cells;
68
// Flag for each cell of the current MPI rank, true if the cell is part
69
// of the subdomain. If empty, assumed to be all true. Not required for
70
// all nonlinear solver algorithms.
71
std::vector<bool> interior;
72
// Flag indicating if this domain should be skipped during solves
73
bool
skip;
74
// Enables subdomain solves and linearization using the generic linearization
75
// approach (i.e. FvBaseLinearizer as opposed to TpfaLinearizer).
76
SubDomainIndices(
const
int
i, std::vector<int>&& c, std::vector<bool>&& in,
bool
s)
77
: index(i), cells(std::move(c)), interior(std::move(in)), skip(s)
78
{}
79
};
80
83
template
<
class
Gr
id
>
84
struct
SubDomain :
public
SubDomainIndices
85
{
86
Dune::SubGridPart<Grid> view;
87
// Constructor that moves from its argument.
88
SubDomain(
const
int
i, std::vector<int>&& c, std::vector<bool>&& in, Dune::SubGridPart<Grid>&& v,
bool
s)
89
: SubDomainIndices(i, std::move(c), std::move(in), s)
90
, view(std::move(v))
91
{}
92
};
93
94
}
// namespace Opm
95
96
97
#endif
// OPM_SUBDOMAIN_HEADER_INCLUDED
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition
blackoilbioeffectsmodules.hh:43
Opm::DomainOrderingMeasure
DomainOrderingMeasure
Measure to use for domain ordering.
Definition
SubDomain.hpp:39
Opm::DomainSolveApproach
DomainSolveApproach
Solver approach for NLDD.
Definition
SubDomain.hpp:33
opm
simulators
flow
SubDomain.hpp
Generated by
1.17.0