Loading...
Searching...
No Matches
UpscalerBase.hpp
//===========================================================================
//
// File: UpscalerBase.hpp
//
// Created: Thu Apr 29 10:20:22 2010
//
// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
//
// $Date$
//
// $Revision$
//
//===========================================================================
/*
Copyright 2010 SINTEF ICT, Applied Mathematics.
Copyright 2010 Statoil ASA.
This file is part of The Open Reservoir Simulator Project (OpenRS).
OpenRS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenRS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenRS. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_UPSCALERBASE_HEADER
#define OPM_UPSCALERBASE_HEADER
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/common/utility/parameters/ParameterGroup.hpp>
#include <opm/grid/CpGrid.hpp>
#include <opm/porsol/common/GridInterfaceEuler.hpp>
#include <opm/porsol/common/BoundaryConditions.hpp>
namespace Opm
{
template <class Traits>
class UpscalerBase
{
protected:
public:
// ------- Typedefs -------
typedef Dune::CpGrid GridType;
enum { Dimension = GridType::dimension };
typedef GridInterfaceEuler<GridType> GridInterface;
typedef typename Traits::template ResProp<Dimension>::Type ResProp;
typedef typename ResProp::MutablePermTensor permtensor_t;
enum BoundaryConditionType { Fixed = 0, Linear = 1, Periodic = 2 };
// ------- Methods -------
UpscalerBase();
virtual ~UpscalerBase() {;} ;
void init(const Opm::ParameterGroup& param);
void init(const Opm::Deck& deck,
BoundaryConditionType bctype,
double perm_threshold,
double residual_tolerance = 1e-8,
int linsolver_verbosity = 0,
int linsolver_type = 3,
bool twodim_hack = false,
int linsolver_maxit = 0,
double linsolver_prolongate_factor = 1.0,
int linsolver_smooth_steps = 1,
const double gravity = 0.0);
const GridType& grid() const;
void setBoundaryConditionType(BoundaryConditionType type);
void setPermeability(const int cell_index, const permtensor_t& k);
permtensor_t upscaleSinglePhase();
double upscalePorosity() const;
double upscaleNetPorosity() const;
double upscaleNTG() const;
double upscaleSWCR(const bool NTG) const;
double upscaleSOWCR(const bool NTG) const;
protected:
// ------- Typedefs and enums -------
typedef GridInterface::CellIterator CellIter;
typedef CellIter::FaceIterator FaceIter;
typedef BasicBoundaryConditions<true, true> BCs;
typedef typename Traits::template FlowSolver<GridInterface, BCs>::Type FlowSolver;
// ------- Methods -------
template <class FlowSol>
double computeAverageVelocity(const FlowSol& flow_solution,
const int flow_dir,
const int pdrop_dir) const;
double computeDelta(const int flow_dir) const;
template <class FluidInterface>
permtensor_t upscaleEffectivePerm(const FluidInterface& fluid);
virtual void initImpl(const Opm::ParameterGroup& param);
virtual void initFinal(const Opm::ParameterGroup& param);
// ------- Data members -------
BoundaryConditionType bctype_;
bool twodim_hack_;
double residual_tolerance_;
int linsolver_maxit_;
double linsolver_prolongate_factor_;
int linsolver_verbosity_;
int linsolver_type_;
int linsolver_smooth_steps_;
double gravity_;
GridType grid_;
GridInterface ginterf_;
ResProp res_prop_;
BCs bcond_;
FlowSolver flow_solver_;
};
} // namespace Opm
#include "UpscalerBase_impl.hpp"
#endif // OPM_UPSCALERBASE_HEADER
Opm::BasicBoundaryConditions
Definition BoundaryConditions.hpp:346
Opm::GridInterfaceEuler
Definition GridInterfaceEuler.hpp:403
Opm::UpscalerBase::upscaleSinglePhase
permtensor_t upscaleSinglePhase()
Does a single-phase upscaling.
Definition UpscalerBase_impl.hpp:222
Opm::UpscalerBase::setPermeability
void setPermeability(const int cell_index, const permtensor_t &k)
Set the permeability of a cell directly.
Definition UpscalerBase_impl.hpp:212
Opm::UpscalerBase::upscalePorosity
double upscalePorosity() const
Compute upscaled porosity.
Definition UpscalerBase_impl.hpp:377
Opm::GridInterface::permtensor_t
ResProp::MutablePermTensor permtensor_t
Definition UpscalerBase.hpp:66
Opm::UpscalerBase::grid
const GridType & grid() const
Access the grid.
Definition UpscalerBase_impl.hpp:181
Opm::UpscalerBase::init
void init(const Opm::Deck &deck, BoundaryConditionType bctype, double perm_threshold, double residual_tolerance=1e-8, int linsolver_verbosity=0, int linsolver_type=3, bool twodim_hack=false, int linsolver_maxit=0, double linsolver_prolongate_factor=1.0, int linsolver_smooth_steps=1, const double gravity=0.0)
Initializes the upscaler from given arguments.
Definition UpscalerBase_impl.hpp:139
Opm::UpscalerBase::upscaleNTG
double upscaleNTG() const
Compute upscaled NTG.
Definition UpscalerBase_impl.hpp:403
Opm::UpscalerBase::upscaleSOWCR
double upscaleSOWCR(const bool NTG) const
Compute upscaled SOWCR.
Definition UpscalerBase_impl.hpp:435
Opm::UpscalerBase::init
void init(const Opm::ParameterGroup &param)
Initializes the upscaler from parameters.
Definition UpscalerBase_impl.hpp:68
Opm::UpscalerBase::setBoundaryConditionType
void setBoundaryConditionType(BoundaryConditionType type)
Set boundary condition type.
Definition UpscalerBase_impl.hpp:191
Opm::UpscalerBase::upscaleNetPorosity
double upscaleNetPorosity() const
Compute upscaled net porosity.
Definition UpscalerBase_impl.hpp:390
Opm::UpscalerBase::upscaleSWCR
double upscaleSWCR(const bool NTG) const
Compute upscaled SWCR.
Definition UpscalerBase_impl.hpp:415
Opm::UpscalerBase::UpscalerBase
UpscalerBase()
Default constructor.
Definition UpscalerBase_impl.hpp:48
Opm
Inverting small matrices.
Definition ImplicitAssembly.hpp:43