opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
NNC.hpp
1
/*
2
Copyright 2015 IRIS
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_PARSER_NNC_HPP
21
#define OPM_PARSER_NNC_HPP
22
23
#include <cstddef>
24
#include <optional>
25
#include <tuple>
26
#include <vector>
27
28
#include <opm/common/OpmLog/KeywordLocation.hpp>
29
30
namespace
Opm
31
{
32
33
class
GridDims
;
34
35
struct
NNCdata {
36
NNCdata(
size_t
c1,
size_t
c2,
double
t)
37
: cell1(c1), cell2(c2), trans(t)
38
{}
39
NNCdata() =
default
;
40
41
bool
operator==(
const
NNCdata& data)
const
42
{
43
return
cell1 == data.cell1 &&
44
cell2 == data.cell2 &&
45
trans == data.trans;
46
}
47
48
template
<
class
Serializer>
49
void
serializeOp(
Serializer
& serializer)
50
{
51
serializer(cell1);
52
serializer(cell2);
53
serializer(trans);
54
}
55
56
// Observe that the operator< is only for cell ordering and does not consider the
57
// trans member
58
bool
operator<(
const
NNCdata& other)
const
59
{
60
return
std::tie(this->cell1, this->cell2) < std::tie(other.cell1, other.cell2);
61
}
62
63
size_t
cell1{};
64
size_t
cell2{};
65
double
trans{};
66
};
67
68
69
70
class
Deck
;
71
class
EclipseGrid
;
72
73
/*
74
This class is an internalization of the NNC and EDITNNC keywords. Because the
75
opm-common codebase does not itself manage the simulation grid the purpose of
76
the NNC class is mainly to hold on to the NNC/EDITNNC input and pass it on to
77
the grid construction proper.
78
79
The EDITNNC keywords can operate on two different types of NNCs.
80
81
1. NNCs which have been explicitly entered using the NNC keyword.
82
2. NNCs which are inderectly inferred from the grid - e.g. due to faults.
83
84
When processing the EDITNNC keyword the class will search through the NNCs
85
configured explicitly with the NNC keyword and apply the edit transformation
86
on those NNCs, EDITNNCs which affect NNCs which are not configured explicitly
87
are stored for later use by the simulator.
88
89
The class guarantees the following ordering:
90
91
1. For all NNC / EDITNNC records we will have cell1 <= cell2
92
2. The vectors NNC::input() and NNC::edit() will be ordered in ascending
93
order.
94
95
While constructing from a deck NNCs connected to inactive cells will be
96
silently ignored. Do observe though that the addNNC() function does not check
97
the arguments and alas there is no guarantee that only active cells are
98
involved.
99
*/
100
101
class
NNC
102
{
103
public
:
104
NNC() =
default
;
106
NNC(
const
EclipseGrid
& grid,
const
Deck
& deck);
107
108
static
NNC serializationTestObject();
109
110
bool
addNNC(
const
size_t
cell1,
const
size_t
cell2,
const
double
trans);
111
113
void
merge
(
const
std::vector<NNCdata>& nncs);
115
const
std::vector<NNCdata>&
input
()
const
{
return
m_input; }
117
const
std::vector<NNCdata>&
edit
()
const
{
return
m_edit; }
119
const
std::vector<NNCdata>&
editr
()
const
{
return
m_editr; }
120
KeywordLocation
input_location(
const
NNCdata
& nnc)
const
;
121
KeywordLocation
edit_location(
const
NNCdata
& nnc)
const
;
122
KeywordLocation
editr_location(
const
NNCdata
& nnc)
const
;
123
124
125
bool
operator==(
const
NNC
& data)
const
;
126
127
template
<
class
Serializer>
128
void
serializeOp(
Serializer
& serializer)
129
{
130
serializer(m_input);
131
serializer(m_edit);
132
serializer(m_editr);
133
serializer(m_nnc_location);
134
serializer(m_edit_location);
135
serializer(m_editr_location);
136
}
137
138
private
:
139
140
void
load_input(
const
EclipseGrid& grid,
const
Deck& deck);
141
void
load_edit(
const
EclipseGrid& grid,
const
Deck& deck);
142
void
load_editr(
const
EclipseGrid& grid,
const
Deck& deck);
143
void
add_edit(
const
NNCdata& edit_node);
144
146
std::vector<NNCdata> m_input;
148
std::vector<NNCdata> m_edit;
150
std::vector<NNCdata> m_editr;
151
std::optional<KeywordLocation> m_nnc_location;
152
std::optional<KeywordLocation> m_edit_location;
153
std::optional<KeywordLocation> m_editr_location;
154
};
155
156
157
}
// namespace Opm
158
159
160
#endif
// OPM_PARSER_NNC_HPP
Opm::Deck
Definition
Deck.hpp:46
Opm::EclipseGrid
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition
EclipseGrid.hpp:61
Opm::GridDims
Definition
GridDims.hpp:31
Opm::KeywordLocation
Definition
KeywordLocation.hpp:27
Opm::NNC
Definition
NNC.hpp:102
Opm::NNC::input
const std::vector< NNCdata > & input() const
Get the combined information from NNC.
Definition
NNC.hpp:115
Opm::NNC::merge
void merge(const std::vector< NNCdata > &nncs)
Merge additional NNCs into sorted NNCs.
Definition
NNC.cpp:278
Opm::NNC::editr
const std::vector< NNCdata > & editr() const
Get the information from EDITNNCR keyword.
Definition
NNC.hpp:119
Opm::NNC::edit
const std::vector< NNCdata > & edit() const
Get the information from EDITNNC keyword.
Definition
NNC.hpp:117
Opm::Serializer
Class for (de-)serializing.
Definition
Serializer.hpp:94
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
Opm::NNCdata
Definition
NNC.hpp:35
opm
input
eclipse
EclipseState
Grid
NNC.hpp
Generated by
1.17.0