EulerUpstream.hpp
Go to the documentation of this file.
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 /*
17 Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
18 Copyright 2009, 2010 Statoil ASA.
19 
20 This file is part of The Open Reservoir Simulator Project (OpenRS).
21 
22 OpenRS is free software: you can redistribute it and/or modify
23 it under the terms of the GNU General Public License as published by
24 the Free Software Foundation, either version 3 of the License, or
25 (at your option) any later version.
26 
27 OpenRS is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31 
32 You should have received a copy of the GNU General Public License
33 along with OpenRS. If not, see <http://www.gnu.org/licenses/>.
34 */
35 
36 #ifndef OPENRS_EULERUPSTREAM_HEADER
37 #define OPENRS_EULERUPSTREAM_HEADER
38 
40 
41 #include <boost/unordered_map.hpp>
42 
43 #include <opm/core/utility/parameters/ParameterGroup.hpp>
44 #include <opm/core/utility/SparseVector.hpp>
45 
46 
47 namespace Opm {
48 
51  template <class GridInterface, class ReservoirProperties, class BoundaryConditions>
53  {
54  public:
57  EulerUpstream();
61  EulerUpstream(const GridInterface& grid,
62  const ReservoirProperties& resprop,
63  const BoundaryConditions& boundary);
67  void init(const Opm::parameter::ParameterGroup& param);
71  void init(const Opm::parameter::ParameterGroup& param,
72  const GridInterface& grid,
73  const ReservoirProperties& resprop,
74  const BoundaryConditions& boundary);
78  void initObj(const GridInterface& grid,
79  const ReservoirProperties& resprop,
80  const BoundaryConditions& boundary);
84  void display();
85 
89  void setCourantNumber(double cn);
90 
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 
126  EulerUpstreamResidual<GridInterface,
127  ReservoirProperties,
128  BoundaryConditions> residual_computer_;
129 
136  // The courant_number is the multiplied with the cfl time to get the time step.
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
Definition: EulerUpstream.hpp:52
double courant_number_
Definition: EulerUpstream.hpp:137
bool use_cfl_gravity_
Definition: EulerUpstream.hpp:134
Definition: BlackoilFluid.hpp:31
bool method_gravity_
Definition: EulerUpstream.hpp:131
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, evolving.
void init(const Opm::parameter::ParameterGroup &param)
Definition: EulerUpstream_impl.hpp:95
void display()
Definition: EulerUpstream_impl.hpp:132
Definition: EulerUpstreamResidual.hpp:59
bool clamp_sat_
Definition: EulerUpstream.hpp:141
bool method_capillary_
Definition: EulerUpstream.hpp:132
std::vector< double > porevol_
Definition: EulerUpstream.hpp:142
EulerUpstream()
Definition: EulerUpstream_impl.hpp:60
bool use_cfl_capillary_
Definition: EulerUpstream.hpp:135
FIt::Vector Vector
Definition: EulerUpstream.hpp:107
CIt::FaceIterator FIt
Definition: EulerUpstream.hpp:106
void smallTimeStep(std::vector< double > &saturation, const double time, const typename GridInterface::Vector &gravity, const PressureSolution &pressure_sol, const Opm::SparseVector< double > &injection_rates) const
double computeCflTime(const std::vector< double > &saturation, const double time, const typename GridInterface::Vector &gravity, const PressureSolution &pressure_sol) const
bool method_viscous_
Definition: EulerUpstream.hpp:130
EulerUpstreamResidual< GridInterface, ReservoirProperties, BoundaryConditions > residual_computer_
Definition: EulerUpstream.hpp:128
bool check_sat_
Definition: EulerUpstream.hpp:140
void setCourantNumber(double cn)
Set the Courant number. That is dt = dt_cfl*courant_number. For this explicit method it should be < 1...
Definition: EulerUpstream_impl.hpp:144
GridInterface::CellIterator CIt
Definition: EulerUpstream.hpp:105
std::vector< double > residual_
Definition: EulerUpstream.hpp:145
void checkAndPossiblyClampSat(std::vector< double > &s) const
Definition: EulerUpstream_impl.hpp:337
int maximum_small_steps_
Definition: EulerUpstream.hpp:139
bool use_cfl_viscous_
Definition: EulerUpstream.hpp:133
int minimum_small_steps_
Definition: EulerUpstream.hpp:138
void initObj(const GridInterface &grid, const ReservoirProperties &resprop, const BoundaryConditions &boundary)
Definition: EulerUpstream_impl.hpp:120