SubDomain.hpp
Go to the documentation of this file.
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
30namespace Opm
31{
34 Jacobi,
36 };
37
43 };
44
45 inline DomainOrderingMeasure domainOrderingMeasureFromString(const std::string_view measure)
46 {
47 if (measure == "residual") {
49 } else if (measure == "maxpressure") {
51 } else if (measure == "averagepressure") {
53 } else {
54 throw std::runtime_error(fmt::format("Invalid domain ordering '{}' specified", measure));
55 }
56 }
57
60 template <class Grid>
61 struct SubDomain
62 {
63 // The index of a subdomain is arbitrary, but can be used by the
64 // solvers to keep track of well locations etc.
65 int index;
66 // The set of cells that make up a SubDomain, stored as cell indices
67 // in the local numbering of the current MPI rank.
68 std::vector<int> cells;
69 // Flag for each cell of the current MPI rank, true if the cell is part
70 // of the subdomain. If empty, assumed to be all true. Not required for
71 // all nonlinear solver algorithms.
72 std::vector<bool> interior;
73 // Enables subdomain solves and linearization using the generic linearization
74 // approach (i.e. FvBaseLinearizer as opposed to TpfaLinearizer).
75 Dune::SubGridPart<Grid> view;
76 // Constructor that moves from its argument.
77 SubDomain(const int i, std::vector<int>&& c, std::vector<bool>&& in, Dune::SubGridPart<Grid>&& v)
78 : index(i), cells(std::move(c)), interior(std::move(in)), view(std::move(v))
79 {}
80 };
81
82} // namespace Opm
83
84
85#endif // OPM_SUBDOMAIN_HEADER_INCLUDED
Definition: BlackoilPhases.hpp:27
DomainOrderingMeasure
Measure to use for domain ordering.
Definition: SubDomain.hpp:39
DomainOrderingMeasure domainOrderingMeasureFromString(const std::string_view measure)
Definition: SubDomain.hpp:45
DomainSolveApproach
Solver approach for NLDD.
Definition: SubDomain.hpp:33
Definition: SubDomain.hpp:62
SubDomain(const int i, std::vector< int > &&c, std::vector< bool > &&in, Dune::SubGridPart< Grid > &&v)
Definition: SubDomain.hpp:77
Dune::SubGridPart< Grid > view
Definition: SubDomain.hpp:75
int index
Definition: SubDomain.hpp:65
std::vector< int > cells
Definition: SubDomain.hpp:68
std::vector< bool > interior
Definition: SubDomain.hpp:72