My Project
Loading...
Searching...
No Matches
UpscalerBase.hpp
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/input/eclipse/Deck/Deck.hpp>
39
40#include <opm/common/utility/parameters/ParameterGroup.hpp>
41
42#include <opm/grid/CpGrid.hpp>
43
44#include <opm/porsol/common/GridInterfaceEuler.hpp>
45#include <opm/porsol/common/BoundaryConditions.hpp>
46
47
48namespace Opm
49{
54 template <class Traits>
56 {
57 protected:
58 public:
59 // ------- Typedefs -------
60 typedef Dune::CpGrid GridType;
61 enum { Dimension = GridType::dimension };
63 typedef typename Traits::template ResProp<Dimension>::Type ResProp;
64
66 typedef typename ResProp::MutablePermTensor permtensor_t;
67
68 enum BoundaryConditionType { Fixed = 0, Linear = 1, Periodic = 2 };
69
70 // ------- Methods -------
71
74
75 virtual ~UpscalerBase() {;} ;
76
78 void init(const Opm::ParameterGroup& param);
79
81 void init(const Opm::Deck& deck,
82 BoundaryConditionType bctype,
83 double perm_threshold,
84 double residual_tolerance = 1e-8,
85 int linsolver_verbosity = 0,
86 int linsolver_type = 3,
87 bool twodim_hack = false,
88 int linsolver_maxit = 0,
89 double linsolver_prolongate_factor = 1.0,
90 int linsolver_smooth_steps = 1,
91 const double gravity = 0.0);
92
94 const GridType& grid() const;
95
99 void setBoundaryConditionType(BoundaryConditionType type);
100
103 void setPermeability(const int cell_index, const permtensor_t& k);
104
108
111 double upscalePorosity() const;
112
115 double upscaleNetPorosity() const;
116
119 double upscaleNTG() const;
120
123 double upscaleSWCR(const bool NTG) const;
124
127 double upscaleSOWCR(const bool NTG) const;
128
129 protected:
130 // ------- Typedefs and enums -------
131 typedef GridInterface::CellIterator CellIter;
132 typedef CellIter::FaceIterator FaceIter;
133 typedef BasicBoundaryConditions<true, true> BCs;
134 typedef typename Traits::template FlowSolver<GridInterface, BCs>::Type FlowSolver;
135
136 // ------- Methods -------
137 template <class FlowSol>
138 double computeAverageVelocity(const FlowSol& flow_solution,
139 const int flow_dir,
140 const int pdrop_dir) const;
141
142 double computeDelta(const int flow_dir) const;
143
144 template <class FluidInterface>
145 permtensor_t upscaleEffectivePerm(const FluidInterface& fluid);
146
147 virtual void initImpl(const Opm::ParameterGroup& param);
148
149 virtual void initFinal(const Opm::ParameterGroup& param);
150
151 // ------- Data members -------
152 BoundaryConditionType bctype_;
153 bool twodim_hack_;
154 double residual_tolerance_;
155 int linsolver_maxit_;
156 double linsolver_prolongate_factor_;
157 int linsolver_verbosity_;
158 int linsolver_type_;
159 int linsolver_smooth_steps_;
160 double gravity_;
161
162 GridType grid_;
163 GridInterface ginterf_;
164 ResProp res_prop_;
165 BCs bcond_;
166 FlowSolver flow_solver_;
167 };
168
169} // namespace Opm
170
171#include "UpscalerBase_impl.hpp"
172
173
174
175
176#endif // OPM_UPSCALERBASE_HEADER
Definition GridInterfaceEuler.hpp:403
A base class for upscaling.
Definition UpscalerBase.hpp:56
permtensor_t upscaleSinglePhase()
Does a single-phase upscaling.
Definition UpscalerBase_impl.hpp:219
void setPermeability(const int cell_index, const permtensor_t &k)
Set the permeability of a cell directly.
Definition UpscalerBase_impl.hpp:209
double upscalePorosity() const
Compute upscaled porosity.
Definition UpscalerBase_impl.hpp:374
ResProp::MutablePermTensor permtensor_t
A type for the upscaled permeability.
Definition UpscalerBase.hpp:66
const GridType & grid() const
Access the grid.
Definition UpscalerBase_impl.hpp:178
double upscaleNTG() const
Compute upscaled NTG.
Definition UpscalerBase_impl.hpp:400
double upscaleSOWCR(const bool NTG) const
Compute upscaled SOWCR.
Definition UpscalerBase_impl.hpp:432
void init(const Opm::ParameterGroup &param)
Initializes the upscaler from parameters.
Definition UpscalerBase_impl.hpp:65
void setBoundaryConditionType(BoundaryConditionType type)
Set boundary condition type.
Definition UpscalerBase_impl.hpp:188
double upscaleNetPorosity() const
Compute upscaled net porosity.
Definition UpscalerBase_impl.hpp:387
double upscaleSWCR(const bool NTG) const
Compute upscaled SWCR.
Definition UpscalerBase_impl.hpp:412
UpscalerBase()
Default constructor.
Definition UpscalerBase_impl.hpp:48
Inverting small matrices.
Definition ImplicitAssembly.hpp:43