Merge pull request #700 from bska/print-pvtfunc-to-init-pt1

Structurally Correct PVT Tables in INIT File (Part 1)
This commit is contained in:
Joakim Hove 2019-04-04 15:11:20 +02:00 committed by GitHub
commit dbfad81253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2799 additions and 26 deletions

View File

@ -1,4 +1,5 @@
/*
Copyright 2019 Equinor.
Copyright 2017 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
@ -35,6 +36,8 @@ namespace Opm {
public:
/// Constructor.
///
/// Padded table entries set to +1.0e+20.
///
/// \param[in] numTables Number of tables managed by internal
/// buffer. Typically corresponds to maximum value of a region
/// ID vector such as SATNUM, IMBNUM, or PVTNUM.
@ -57,6 +60,33 @@ namespace Opm {
const std::size_t numRows,
const std::size_t numCols);
/// Constructor.
///
/// \param[in] numTables Number of tables managed by internal
/// buffer. Typically corresponds to maximum value of a region
/// ID vector such as SATNUM, IMBNUM, or PVTNUM.
///
/// \param[in] numPrimary Number of primary look-up keys for the
/// tabular data managed by the internal buffer. Mostly relevant
/// (i.e., greater than one) for miscible oil ("PVTO") or
/// miscible gas ("PVTG") tables and typically corresponds to the
/// number of Rs/Rv entries from the TABDIMS keyword.
///
/// \param[in] numRows Number of rows in each sub-table
/// corresponding to a single primary look-up key. Typically the
/// number of nodes (e.g., NSSFUN or NPPVT) of the corresponding
/// input keyword.
///
/// \param[in] numCols Number of columns in each sub-table (and main
/// table). Typically 5.
///
/// \param[in] fillValue Data element value for padded table entries.
LinearisedOutputTable(const std::size_t numTables,
const std::size_t numPrimary,
const std::size_t numRows,
const std::size_t numCols,
const double fillValue);
/// Retrieve iterator to start of \c numRows (contiguous) column
/// elements of a particular sub-table of a particular main table.
///

View File

@ -1,4 +1,6 @@
/*
Copyright 2019 Equinor.
Copyright 2017 Statoil ASA.
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
@ -42,6 +44,15 @@ namespace Opm {
void addPVTW(const PvtwTable& pvtwTable);
void addDensity(const DensityTable& density);
/// Add normalised PVT function tables to INIT file's TAB vector.
///
/// \param[in] es Valid \c EclipseState object with accurate RUNSPEC
/// information on active phases and table dimensions ("TABDIMS").
///
/// \param[in] logihead Flag specifications identifying which tables
/// to output.
void addPVTTables(const EclipseState& es);
/// Add normalised saturation function tables to INIT file's TAB
/// vector.
///
@ -101,6 +112,30 @@ namespace Opm {
const bool gas,
const bool oil,
const bool wat);
/// Add gas PVT tables (keywords PVDG and PVTG) to the tabular data
/// (TABDIMS and TAB vectors).
///
/// \param[in] es Valid \c EclipseState object with accurate table
/// dimensions ("TABDIMS" keyword) and an initialised \c
/// TableManager sub-object.
void addGasPVTTables(const EclipseState& es);
/// Add oil PVT tables (keywords PVCDO, PVDO and PVTO) to the
/// tabular data (TABDIMS and TAB vectors).
///
/// \param[in] es Valid \c EclipseState object with accurate table
/// dimensions ("TABDIMS" keyword) and an initialised \c
/// TableManager sub-object.
void addOilPVTTables(const EclipseState& es);
/// Add water PVT tables (keyword PVTW) to the tabular data (TABDIMS
/// and TAB vectors).
///
/// \param[in] es Valid \c EclipseState object with accurate table
/// dimensions ("TABDIMS" keyword) and an initialised \c
/// TableManager sub-object.
void addWaterPVTTables(const EclipseState& es);
};
/// Emit normalised tabular information (TABDIMS and TAB vectors) to

View File

@ -1,3 +1,23 @@
/*
Copyright 2019 Equinor.
Copyright 2017 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <opm/output/eclipse/LinearisedOutputTable.hpp>
#include <algorithm>
@ -10,7 +30,17 @@ LinearisedOutputTable(const std::size_t numTables0,
const std::size_t numPrimary0,
const std::size_t numRows0,
const std::size_t numCols0)
: data (numTables0 * numPrimary0 * numRows0 * numCols0, 1.0e20)
: LinearisedOutputTable(numTables0, numPrimary0,
numRows0, numCols0, 1.0e20)
{}
Opm::LinearisedOutputTable::
LinearisedOutputTable(const std::size_t numTables0,
const std::size_t numPrimary0,
const std::size_t numRows0,
const std::size_t numCols0,
const double fillValue)
: data (numTables0 * numPrimary0 * numRows0 * numCols0, fillValue)
, numTables (numTables0)
, numPrimary(numPrimary0)
, numRows (numRows0)

File diff suppressed because it is too large Load Diff

View File

@ -125,6 +125,48 @@ namespace {
}
} // Anonymous
// ---------------------------------------------------------------------
// Constructors
BOOST_AUTO_TEST_SUITE (Basic_Operations)
BOOST_AUTO_TEST_CASE (Construct_Defaulted_FillVal)
{
const auto numTables = std::size_t{2};
const auto numPrimary = std::size_t{3};
const auto numRows = std::size_t{4};
const auto numCols = std::size_t{5};
auto linTable = ::Opm::LinearisedOutputTable {
numTables, numPrimary, numRows, numCols
};
const auto expect_initial = std::vector<double>(
numTables * numPrimary * numRows * numCols, 1.0e20);
check_is_close(linTable.getData(), expect_initial);
}
BOOST_AUTO_TEST_CASE (Construct_UserDefined_FillVal)
{
const auto numTables = std::size_t{2};
const auto numPrimary = std::size_t{3};
const auto numRows = std::size_t{4};
const auto numCols = std::size_t{5};
const auto fillVal = 1.234e-5;
auto linTable = ::Opm::LinearisedOutputTable {
numTables, numPrimary, numRows, numCols, fillVal
};
const auto expect_initial = std::vector<double>(
numTables * numPrimary * numRows * numCols, fillVal);
check_is_close(linTable.getData(), expect_initial);
}
BOOST_AUTO_TEST_SUITE_END ()
// ---------------------------------------------------------------------
// Saturation Functions

File diff suppressed because it is too large Load Diff