opm-upscaling
Loading...
Searching...
No Matches
EulerUpstream.hpp
1//===========================================================================
2//
3// File: EulerUpstream.hpp
4//
5// Created: Tue Jun 16 14:07:53 2009
6//
7// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
8// Bård Skaflestad <bard.skaflestad@sintef.no>
9//
10// $Date$
11//
12// $Revision$
13//
14//===========================================================================
15
16/*
17Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
18Copyright 2009, 2010 Statoil ASA.
19
20This file is part of The Open Reservoir Simulator Project (OpenRS).
21
22OpenRS is free software: you can redistribute it and/or modify
23it under the terms of the GNU General Public License as published by
24the Free Software Foundation, either version 3 of the License, or
25(at your option) any later version.
26
27OpenRS is distributed in the hope that it will be useful,
28but WITHOUT ANY WARRANTY; without even the implied warranty of
29MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30GNU General Public License for more details.
31
32You should have received a copy of the GNU General Public License
33along with OpenRS. If not, see <http://www.gnu.org/licenses/>.
34*/
35
36#ifndef OPENRS_EULERUPSTREAM_HEADER
37#define OPENRS_EULERUPSTREAM_HEADER
38
39#include <opm/porsol/euler/EulerUpstreamResidual.hpp>
40
41#include <opm/common/utility/parameters/ParameterGroup.hpp>
42#include <opm/common/utility/numeric/SparseVector.hpp>
43
44
45namespace Opm {
46
49 template <class GridInterface, class ReservoirProperties, class BoundaryConditions>
51 {
52 public:
60 const ReservoirProperties& resprop,
61 const BoundaryConditions& boundary);
65 void init(const Opm::ParameterGroup& param);
69 void init(const Opm::ParameterGroup& param,
70 const GridInterface& grid,
71 const ReservoirProperties& resprop,
72 const BoundaryConditions& boundary);
76 void initObj(const GridInterface& grid,
77 const ReservoirProperties& resprop,
78 const BoundaryConditions& boundary);
82 void display();
83
87 void setCourantNumber(double cn);
88
97 template <class PressureSolution>
98 void transportSolve(std::vector<double>& saturation,
99 const double time,
100 const typename GridInterface::Vector& gravity,
101 const PressureSolution& pressure_sol,
102 const Opm::SparseVector<double>& injection_rates) const;
103
104 protected:
105 typedef typename GridInterface::CellIterator CIt;
106 typedef typename CIt::FaceIterator FIt;
107 typedef typename FIt::Vector Vector;
108
109
110 template <class PressureSolution>
111 double computeCflTime(const std::vector<double>& saturation,
112 const double time,
113 const typename GridInterface::Vector& gravity,
114 const PressureSolution& pressure_sol) const;
115
116 template <class PressureSolution>
117 void smallTimeStep(std::vector<double>& saturation,
118 const double time,
119 const typename GridInterface::Vector& gravity,
120 const PressureSolution& pressure_sol,
121 const Opm::SparseVector<double>& injection_rates) const;
122
123 void checkAndPossiblyClampSat(std::vector<double>& s) const;
124
125
127 ReservoirProperties,
128 BoundaryConditions> residual_computer_;
129
130 bool method_viscous_;
131 bool method_gravity_;
132 bool method_capillary_;
133 bool use_cfl_viscous_;
134 bool use_cfl_gravity_;
135 bool use_cfl_capillary_;
136 // The courant_number is the multiplied with the cfl time to get the time step.
137 double courant_number_;
138 int minimum_small_steps_;
139 int maximum_small_steps_;
140 bool check_sat_;
141 bool clamp_sat_;
142 std::vector<double> porevol_;
143
144 // Storing residual so that we won't have to reallocate it for every step.
145 mutable std::vector<double> residual_;
146 };
147
148} // namespace Opm
149
150#include "EulerUpstream_impl.hpp"
151
152#endif // OPENRS_EULERUPSTREAM_HEADER
Class for doing simple transport by explicit Euler upstream method for general grid.
Definition EulerUpstreamResidual.hpp:58
void transportSolve(std::vector< double > &saturation, const double time, const typename GridInterface::Vector &gravity, const PressureSolution &pressure_sol, const Opm::SparseVector< double > &injection_rates) const
Solve transport equation.
void setCourantNumber(double cn)
Set the Courant number.
Definition EulerUpstream_impl.hpp:144
void initObj(const GridInterface &grid, const ReservoirProperties &resprop, const BoundaryConditions &boundary)
Definition EulerUpstream_impl.hpp:120
EulerUpstream()
Definition EulerUpstream_impl.hpp:60
EulerUpstream(const GridInterface &grid, const ReservoirProperties &resprop, const BoundaryConditions &boundary)
void display()
Definition EulerUpstream_impl.hpp:132
void init(const Opm::ParameterGroup &param)
Definition EulerUpstream_impl.hpp:95
void init(const Opm::ParameterGroup &param, const GridInterface &grid, const ReservoirProperties &resprop, const BoundaryConditions &boundary)
Inverting small matrices.
Definition ImplicitAssembly.hpp:43