TracerTofSolver.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 SINTEF ICT, Applied Mathematics.
3 Copyright 2016 Statoil ASA.
4
5 This file is part of the Open Porous Media project (OPM).
6
7 OPM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 OPM is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with OPM. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef OPM_TRACERTOFSOLVER_HEADER_INCLUDED
22#define OPM_TRACERTOFSOLVER_HEADER_INCLUDED
23
27#include <vector>
28
29namespace Opm
30{
31namespace FlowDiagnostics
32{
33
34
48 {
49 public:
57 const AssembledConnections& reverse_graph,
58 const std::vector<double>& pore_volumes,
59 const CellSetValues& source_inflow);
60
64 std::vector<double> solveGlobal();
65
70 };
71
79
80 private:
81
82 // -------------- Private data members --------------
83
84 const AssembledConnections& g_;
85 const AssembledConnections& g_reverse_;
86 const std::vector<double>& pv_;
87 const std::vector<double> influx_;
88 const std::vector<double> outflux_;
89 std::vector<double> source_term_;
90 std::vector<double> local_source_term_;
91 std::vector<char> is_start_; // char to avoid the nasty vector<bool> specialization
92 std::vector<int> sequence_;
93 std::vector<int> component_starts_;
94 std::vector<double> tof_;
95 std::vector<double> tracer_;
96 int num_multicell_ = 0;
97 int max_size_multicell_ = 0;
98 int max_iter_multicell_ = 0;
99 const double max_tof_ = 200.0 * 365.0 * 24.0 * 60.0 * 60.0; // 200 years.
100 const double gauss_seidel_tof_tol_ = max_tof_ / 1e12;
101 const double gauss_seidel_tracer_tol_ = 1e-9;
102
103 // -------------- Private helper class --------------
104
105 struct InOutFluxComputer;
106
107 // -------------- Private methods --------------
108
110 const AssembledConnections& reverse_graph,
111 const std::vector<double>& pore_volumes,
112 const CellSetValues& source_inflow,
113 InOutFluxComputer&& inout);
114
115 void prepareForSolve();
116
117 void setupStartArray(const CellSetValues& startset);
118
119 void setupStartArrayFromSource();
120
121 void computeOrdering();
122
123 void computeLocalOrdering(const CellSetValues& startset);
124
125 void setupLocalSource(const CellSetValues& startset);
126
127 void cleanupLocalSource(const CellSetValues& startset);
128
129 void solve();
130
131 void solveSingleCell(const int cell);
132
133 void solveMultiCell(const int num_cells, const int* cells);
134 };
135
136} // namespace FlowDiagnostics
137} // namespace Opm
138
139#endif // OPM_TRACERTOFSOLVER_HEADER_INCLUDED
Definition: AssembledConnections.hpp:42
Definition: TracerTofSolver.hpp:48
TracerTofSolver(const AssembledConnections &graph, const AssembledConnections &reverse_graph, const std::vector< double > &pore_volumes, const CellSetValues &source_inflow)
std::vector< double > solveGlobal()
LocalSolution solveLocal(const CellSetValues &startset)
std::map< int, double > CellSetValues
Definition: CellSetValues.hpp:29
Definition: A.hpp:4
static const double e
Definition: exprtk.hpp:758
Output data struct for solveLocal().
Definition: TracerTofSolver.hpp:67
CellSetValues concentration
Definition: TracerTofSolver.hpp:69
CellSetValues tof
Definition: TracerTofSolver.hpp:68