UpscalerBase.hpp
Go to the documentation of this file.
1 //===========================================================================
2 //
3 // File: UpscalerBase.hpp
4 //
5 // Created: Thu Apr 29 10:20:22 2010
6 //
7 // Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
8 //
9 // $Date$
10 //
11 // $Revision$
12 //
13 //===========================================================================
14 
15 /*
16  Copyright 2010 SINTEF ICT, Applied Mathematics.
17  Copyright 2010 Statoil ASA.
18 
19  This file is part of The Open Reservoir Simulator Project (OpenRS).
20 
21  OpenRS is free software: you can redistribute it and/or modify
22  it under the terms of the GNU General Public License as published by
23  the Free Software Foundation, either version 3 of the License, or
24  (at your option) any later version.
25 
26  OpenRS is distributed in the hope that it will be useful,
27  but WITHOUT ANY WARRANTY; without even the implied warranty of
28  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29  GNU General Public License for more details.
30 
31  You should have received a copy of the GNU General Public License
32  along with OpenRS. If not, see <http://www.gnu.org/licenses/>.
33 */
34 
35 #ifndef OPM_UPSCALERBASE_HEADER
36 #define OPM_UPSCALERBASE_HEADER
37 
38 #include <opm/core/utility/parameters/ParameterGroup.hpp>
39 #include <dune/grid/CpGrid.hpp>
40 #include <opm/porsol/common/GridInterfaceEuler.hpp>
41 #include <opm/porsol/common/BoundaryConditions.hpp>
42 #include <opm/parser/eclipse/Deck/Deck.hpp>
43 
44 
45 namespace Opm
46 {
51  template <class Traits>
53  {
54  protected:
55  public:
56  // ------- Typedefs -------
57  typedef Dune::CpGrid GridType;
58  enum { Dimension = GridType::dimension };
59  typedef GridInterfaceEuler<GridType> GridInterface;
60  typedef typename Traits::template ResProp<Dimension>::Type ResProp;
61 
63  typedef typename ResProp::MutablePermTensor permtensor_t;
64 
65  enum BoundaryConditionType { Fixed = 0, Linear = 1, Periodic = 2 };
66 
67  // ------- Methods -------
68 
70  UpscalerBase();
71 
72  virtual ~UpscalerBase() {;} ;
73 
75  void init(const Opm::parameter::ParameterGroup& param);
76 
78  void init(Opm::DeckConstPtr deck,
79  BoundaryConditionType bctype,
80  double perm_threshold,
81  double residual_tolerance = 1e-8,
82  int linsolver_verbosity = 0,
83  int linsolver_type = 3,
84  bool twodim_hack = false,
85  int linsolver_maxit = 0,
86  double linsolver_prolongate_factor = 1.0,
87  int linsolver_smooth_steps = 1);
88 
90  const GridType& grid() const;
91 
96 
99  void setPermeability(const int cell_index, const permtensor_t& k);
100 
103  permtensor_t upscaleSinglePhase();
104 
107  double upscalePorosity() const;
108 
111  double upscaleNetPorosity() const;
112 
115  double upscaleNTG() const;
116 
119  double upscaleSWCR(const bool NTG) const;
120 
123  double upscaleSOWCR(const bool NTG) const;
124 
125  protected:
126  // ------- Typedefs and enums -------
127  typedef GridInterface::CellIterator CellIter;
128  typedef CellIter::FaceIterator FaceIter;
129  typedef BasicBoundaryConditions<true, true> BCs;
130  typedef typename Traits::template FlowSolver<GridInterface, BCs>::Type FlowSolver;
131 
132  // ------- Methods -------
133  template <class FlowSol>
134  double computeAverageVelocity(const FlowSol& flow_solution,
135  const int flow_dir,
136  const int pdrop_dir) const;
137 
138  double computeDelta(const int flow_dir) const;
139 
140  template <class FluidInterface>
141  permtensor_t upscaleEffectivePerm(const FluidInterface& fluid);
142 
143  virtual void initImpl(const Opm::parameter::ParameterGroup& param);
144 
145  virtual void initFinal(const Opm::parameter::ParameterGroup& param);
146 
147  // ------- Data members -------
156 
157  GridType grid_;
158  GridInterface ginterf_;
159  ResProp res_prop_;
160  BCs bcond_;
161  FlowSolver flow_solver_;
162  };
163 
164 } // namespace Opm
165 
166 #include "UpscalerBase_impl.hpp"
167 
168 
169 
170 
171 #endif // OPM_UPSCALERBASE_HEADER
GridType grid_
Definition: UpscalerBase.hpp:157
FlowSolver flow_solver_
Definition: UpscalerBase.hpp:161
GridInterface ginterf_
Definition: UpscalerBase.hpp:158
double residual_tolerance_
Definition: UpscalerBase.hpp:150
Dune::CpGrid GridType
Definition: UpscalerBase.hpp:57
Definition: applier.hpp:18
virtual void initFinal(const Opm::parameter::ParameterGroup &param)
Definition: UpscalerBase_impl.hpp:119
const GridType & grid() const
Access the grid.
Definition: UpscalerBase_impl.hpp:170
BCs bcond_
Definition: UpscalerBase.hpp:160
bool twodim_hack_
Definition: UpscalerBase.hpp:149
virtual ~UpscalerBase()
Definition: UpscalerBase.hpp:72
ResProp::MutablePermTensor permtensor_t
A type for the upscaled permeability.
Definition: UpscalerBase.hpp:63
double upscaleNetPorosity() const
Definition: UpscalerBase_impl.hpp:390
ResProp res_prop_
Definition: UpscalerBase.hpp:159
A base class for upscaling.
Definition: UpscalerBase.hpp:52
void setBoundaryConditionType(BoundaryConditionType type)
Definition: UpscalerBase_impl.hpp:180
double computeDelta(const int flow_dir) const
Definition: UpscalerBase_impl.hpp:345
int linsolver_type_
Definition: UpscalerBase.hpp:154
CellIter::FaceIterator FaceIter
Definition: UpscalerBase.hpp:128
UpscalingTraitsBasic::template ResProp< Dimension >::Type ResProp
Definition: UpscalerBase.hpp:60
Definition: UpscalerBase.hpp:58
BoundaryConditionType bctype_
Definition: UpscalerBase.hpp:148
int linsolver_smooth_steps_
Definition: UpscalerBase.hpp:155
GridInterfaceEuler< GridType > GridInterface
Definition: UpscalerBase.hpp:59
permtensor_t upscaleEffectivePerm(const FluidInterface &fluid)
Definition: UpscalerBase_impl.hpp:223
virtual void initImpl(const Opm::parameter::ParameterGroup &param)
Definition: UpscalerBase_impl.hpp:74
double upscaleNTG() const
Definition: UpscalerBase_impl.hpp:403
double upscalePorosity() const
Definition: UpscalerBase_impl.hpp:377
Definition: UpscalerBase.hpp:65
Definition: UpscalerBase.hpp:65
Opm::DeckConstPtr deck(parser->parseFile(file, parseMode))
int linsolver_verbosity_
Definition: UpscalerBase.hpp:153
UpscalerBase()
Default constructor.
Definition: UpscalerBase_impl.hpp:48
double linsolver_prolongate_factor_
Definition: UpscalerBase.hpp:152
double computeAverageVelocity(const FlowSol &flow_solution, const int flow_dir, const int pdrop_dir) const
Definition: UpscalerBase_impl.hpp:282
int linsolver_maxit_
Definition: UpscalerBase.hpp:151
BoundaryConditionType
Definition: UpscalerBase.hpp:65
void init(const Opm::parameter::ParameterGroup &param)
Initializes the upscaler from parameters.
Definition: UpscalerBase_impl.hpp:64
GridInterface::CellIterator CellIter
Definition: UpscalerBase.hpp:127
permtensor_t upscaleSinglePhase()
Definition: UpscalerBase_impl.hpp:211
double upscaleSWCR(const bool NTG) const
Definition: UpscalerBase_impl.hpp:415
BasicBoundaryConditions< true, true > BCs
Definition: UpscalerBase.hpp:129
double upscaleSOWCR(const bool NTG) const
Definition: UpscalerBase_impl.hpp:435
void setPermeability(const int cell_index, const permtensor_t &k)
Definition: UpscalerBase_impl.hpp:201
Definition: UpscalerBase.hpp:65
UpscalingTraitsBasic::template FlowSolver< GridInterface, BCs >::Type FlowSolver
Definition: UpscalerBase.hpp:130