Loading...
Searching...
No Matches
ReservoirPropertyCommon.hpp
//===========================================================================
//
// File: ReservoirPropertyCommon.hpp
//
// Created: Mon Oct 26 08:23:31 2009
//
// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
// B�rd Skaflestad <bard.skaflestad@sintef.no>
//
// $Date$
//
// $Revision$
//
//===========================================================================
/*
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
Copyright 2009, 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 OPENRS_RESERVOIRPROPERTYCOMMON_HEADER
#define OPENRS_RESERVOIRPROPERTYCOMMON_HEADER
#include <opm/input/eclipse/Units/Units.hpp>
#include <opm/porsol/common/Matrix.hpp>
#include <opm/input/eclipse/Deck/Deck.hpp>
namespace Opm
{
enum PermeabilityKind { ScalarPerm, DiagonalPerm, TensorPerm, None, Invalid };
template <int dim, class RPImpl, class RockType>
class ReservoirPropertyCommon
{
public:
typedef ImmutableCMatrix PermTensor;
typedef OwnCMatrix MutablePermTensor;
typedef SharedCMatrix SharedPermTensor;
enum { NumberOfPhases = 2 };
ReservoirPropertyCommon();
void init(const Opm::Deck&,
const std::vector<int>& global_cell,
const double perm_threshold = 0.0,
const std::string* rock_list_filename = 0,
const bool use_jfunction_scaling = true,
const double sigma = 1.0,
const double theta = 0.0);
void init(const int num_cells,
const double uniform_poro = 0.2,
const double uniform_perm = 100.0*Opm::prefix::milli*Opm::unit::darcy);
void setViscosities(double v1, double v2);
void setDensities(double d1, double d2);
double viscosityFirstPhase() const;
double viscositySecondPhase() const;
double densityFirstPhase() const;
double densitySecondPhase() const;
double porosity(int cell_index) const;
double ntg(int cell_index) const;
double swcr(int cell_index) const;
double sowcr(int cell_index) const;
PermTensor permeability(int cell_index) const;
SharedPermTensor permeabilityModifiable(int cell_index);
template<class Vector>
void phaseDensities(int /*cell_index*/, Vector& density) const;
double densityDifference() const;
double cflFactor() const;
double cflFactorGravity() const;
double cflFactorCapillary() const;
double capillaryPressure(int cell_index, double saturation) const;
double capillaryPressureDeriv(int c, double s) const;
// @brief Minimum of saturation in rock table.
double s_min(int c) const;
// @brief Maximum of saturation in rock table.
double s_max(int c) const;
double saturationFromCapillaryPressure(int cell_index, double cap_press) const;
void writeSintefLegacyFormat(const std::string& grid_prefix) const;
protected:
// Methods
void assignPorosity(const Opm::Deck& deck,
const std::vector<int>& global_cell);
void assignNTG(const Opm::Deck& deck,
const std::vector<int>& global_cell);
void assignSWCR(const Opm::Deck& deck,
const std::vector<int>& global_cell);
void assignSOWCR(const Opm::Deck& deck,
const std::vector<int>& global_cell);
void assignPermeability(const Opm::Deck& deck,
const std::vector<int>& global_cell,
const double perm_threshold);
void assignRockTable(const Opm::Deck& deck,
const std::vector<int>& global_cell);
void readRocks(const std::string& rock_list_file);
// Supporting Barton/Nackman trick (also known as the curiously recurring template pattern).
RPImpl& asImpl();
// Data members.
std::vector<double> porosity_;
std::vector<double> ntg_;
std::vector<double> swcr_;
std::vector<double> sowcr_;
std::vector<double> permeability_;
std::vector<unsigned char> permfield_valid_;
double density1_;
double density2_;
double viscosity1_;
double viscosity2_;
double cfl_factor_;
double cfl_factor_gravity_;
double cfl_factor_capillary_;
std::vector<RockType> rock_;
std::vector<int> cell_to_rock_;
PermeabilityKind permeability_kind_;
};
} // namespace Opm
#include "ReservoirPropertyCommon_impl.hpp"
#endif // OPENRS_RESERVOIRPROPERTYCOMMON_HEADER
Opm::ReservoirPropertyCommon::porosity
double porosity(int cell_index) const
Read-access to porosity.
Definition ReservoirPropertyCommon_impl.hpp:380
Opm::ReservoirPropertyCommon::ReservoirPropertyCommon
ReservoirPropertyCommon()
Default constructor.
Definition ReservoirPropertyCommon_impl.hpp:258
Opm::ReservoirPropertyCommon::densitySecondPhase
double densitySecondPhase() const
Density of second (oil) phase.
Definition ReservoirPropertyCommon_impl.hpp:373
Opm::ReservoirPropertyCommon::cflFactorCapillary
double cflFactorCapillary() const
A factor useful in gravity cfl computations.
Definition ReservoirPropertyCommon_impl.hpp:461
Opm::ReservoirPropertyCommon::setViscosities
void setViscosities(double v1, double v2)
Set viscosities of both faces.
Definition ReservoirPropertyCommon_impl.hpp:338
Opm::ReservoirPropertyCommon::viscosityFirstPhase
double viscosityFirstPhase() const
Viscosity of first (water) phase.
Definition ReservoirPropertyCommon_impl.hpp:352
Opm::ReservoirPropertyCommon::viscositySecondPhase
double viscositySecondPhase() const
Viscosity of second (oil) phase.
Definition ReservoirPropertyCommon_impl.hpp:359
Opm::ReservoirPropertyCommon::saturationFromCapillaryPressure
double saturationFromCapillaryPressure(int cell_index, double cap_press) const
Inverse of the capillary pressure function.
Definition ReservoirPropertyCommon_impl.hpp:519
Opm::ReservoirPropertyCommon::densityDifference
double densityDifference() const
Difference of densities.
Definition ReservoirPropertyCommon_impl.hpp:440
Opm::ReservoirPropertyCommon::permeability
PermTensor permeability(int cell_index) const
Read-access to permeability.
Definition ReservoirPropertyCommon_impl.hpp:406
Opm::ReservoirPropertyCommon::densityFirstPhase
double densityFirstPhase() const
Density of first (water) phase.
Definition ReservoirPropertyCommon_impl.hpp:366
Opm::ReservoirPropertyCommon::capillaryPressure
double capillaryPressure(int cell_index, double saturation) const
Capillary pressure.
Definition ReservoirPropertyCommon_impl.hpp:467
Opm::ReservoirPropertyCommon::capillaryPressureDeriv
double capillaryPressureDeriv(int c, double s) const
Derivative of Capillary pressure.
Definition ReservoirPropertyCommon_impl.hpp:480
Opm::ReservoirPropertyCommon< dim, ReservoirPropertyCapillary< dim >, RockJfunc >::PermTensor
ImmutableCMatrix PermTensor
Definition ReservoirPropertyCommon.hpp:62
Opm::ReservoirPropertyCommon::swcr
double swcr(int cell_index) const
Read-access to swcr.
Definition ReservoirPropertyCommon_impl.hpp:392
Opm::ReservoirPropertyCommon::cflFactorGravity
double cflFactorGravity() const
A factor useful in gravity cfl computations.
Definition ReservoirPropertyCommon_impl.hpp:454
Opm::ReservoirPropertyCommon::setDensities
void setDensities(double d1, double d2)
Set densitities of both faces.
Definition ReservoirPropertyCommon_impl.hpp:345
Opm::ReservoirPropertyCommon::s_min
double s_min(int c) const
Definition ReservoirPropertyCommon_impl.hpp:493
Opm::ReservoirPropertyCommon< dim, ReservoirPropertyCapillary< dim >, RockJfunc >::MutablePermTensor
OwnCMatrix MutablePermTensor
Definition ReservoirPropertyCommon.hpp:64
Opm::ReservoirPropertyCommon< dim, ReservoirPropertyCapillary< dim >, RockJfunc >::SharedPermTensor
SharedCMatrix SharedPermTensor
Definition ReservoirPropertyCommon.hpp:66
Opm::ReservoirPropertyCommon::ntg
double ntg(int cell_index) const
Read-access to ntg.
Definition ReservoirPropertyCommon_impl.hpp:386
Opm::ReservoirPropertyCommon::writeSintefLegacyFormat
void writeSintefLegacyFormat(const std::string &grid_prefix) const
Write permeability and porosity in the Sintef legacy format.
Definition ReservoirPropertyCommon_impl.hpp:533
Opm::ReservoirPropertyCommon::cflFactor
double cflFactor() const
A factor useful in cfl computations.
Definition ReservoirPropertyCommon_impl.hpp:447
Opm::ReservoirPropertyCommon::init
void init(const Opm::Deck &, const std::vector< int > &global_cell, const double perm_threshold=0.0, const std::string *rock_list_filename=0, const bool use_jfunction_scaling=true, const double sigma=1.0, const double theta=0.0)
Initialize from a grdecl file.
Definition ReservoirPropertyCommon_impl.hpp:276
Opm::ReservoirPropertyCommon::phaseDensities
void phaseDensities(int, Vector &density) const
Densities for both phases.
Definition ReservoirPropertyCommon_impl.hpp:431
Opm::ReservoirPropertyCommon::s_max
double s_max(int c) const
Definition ReservoirPropertyCommon_impl.hpp:506
Opm::ReservoirPropertyCommon::permeabilityModifiable
SharedPermTensor permeabilityModifiable(int cell_index)
Read- and write-access to permeability.
Definition ReservoirPropertyCommon_impl.hpp:417
Opm::ReservoirPropertyCommon::sowcr
double sowcr(int cell_index) const
Read-access to sowcr.
Definition ReservoirPropertyCommon_impl.hpp:398
Opm::ReservoirPropertyCommon::init
void init(const int num_cells, const double uniform_poro=0.2, const double uniform_perm=100.0 *Opm::prefix::milli *Opm::unit::darcy)
Initialize a uniform reservoir.
Definition ReservoirPropertyCommon_impl.hpp:320
Opm
Inverting small matrices.
Definition ImplicitAssembly.hpp:43
Opm::PermeabilityKind
PermeabilityKind
Enum for the kind of permeability field originally retrieved.
Definition ReservoirPropertyCommon.hpp:50
Opm::OwnCMatrix
FullMatrix< double, OwnData, COrdering > OwnCMatrix
Convenience typedefs for C-ordered.
Definition Matrix.hpp:579