TofReorder.hpp
Go to the documentation of this file.
1/*
2 Copyright 2012 SINTEF ICT, Applied Mathematics.
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_TOFREORDER_HEADER_INCLUDED
21#define OPM_TOFREORDER_HEADER_INCLUDED
22
24#include <vector>
25#include <map>
26#include <ostream>
27
28struct UnstructuredGrid;
29
30namespace Opm
31{
32
33 class IncompPropertiesInterface;
34 template <typename T> class SparseTable;
35
44 {
45 public:
49 TofReorder(const UnstructuredGrid& grid,
50 const bool use_multidim_upwind = false);
51
59 void solveTof(const double* darcyflux,
60 const double* porevolume,
61 const double* source,
62 std::vector<double>& tof);
63
75 void solveTofTracer(const double* darcyflux,
76 const double* porevolume,
77 const double* source,
78 const SparseTable<int>& tracerheads,
79 std::vector<double>& tof,
80 std::vector<double>& tracer);
81
82 private:
83 void executeSolve();
84 virtual void solveSingleCell(const int cell);
85 void solveSingleCellMultidimUpwind(const int cell);
86 void assembleSingleCell(const int cell,
87 std::vector<int>& local_column,
88 std::vector<double>& local_coefficient,
89 double& rhs);
90 virtual void solveMultiCell(const int num_cells, const int* cells);
91
92 void multidimUpwindTerms(const int face, const int upwind_cell,
93 double& face_term, double& cell_term_factor) const;
94 void localMultidimUpwindTerms(const int face, const int upwind_cell, const int node_pos,
95 double& face_term, double& cell_term_factor) const;
96
97 private:
98 const UnstructuredGrid& grid_;
99 const double* darcyflux_; // one flux per grid face
100 const double* porevolume_; // one volume per cell
101 const double* source_; // one volumetric source term per cell
102 double* tof_;
103 bool compute_tracer_;
104 enum { NoTracerHead = -1 };
105 std::vector<int> tracerhead_by_cell_;
106 // For solveMultiCell():
107 double gauss_seidel_tol_;
108 int num_multicell_;
109 int max_size_multicell_;
110 int max_iter_multicell_;
111 // For multidim upwinding:
112 bool use_multidim_upwind_;
113 std::vector<double> face_tof_; // For multidim upwind face tofs.
114 std::vector<double> face_part_tof_; // For multidim upwind face tofs.
115 };
116
117} // namespace Opm
118
119#endif // OPM_TRANSPORTMODELTRACERTOF_HEADER_INCLUDED
Definition: ReorderSolverInterface.hpp:39
Definition: TofDiscGalReorder.hpp:38
Definition: TofReorder.hpp:44
void solveTofTracer(const double *darcyflux, const double *porevolume, const double *source, const SparseTable< int > &tracerheads, std::vector< double > &tof, std::vector< double > &tracer)
TofReorder(const UnstructuredGrid &grid, const bool use_multidim_upwind=false)
void solveTof(const double *darcyflux, const double *porevolume, const double *source, std::vector< double > &tof)
Definition: AnisotropicEikonal.hpp:44