Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions opm/input/eclipse/EclipseState/Tables/PvtgTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,38 @@

You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
*/

#ifndef OPM_PARSER_PVTG_TABLE_HPP
#define OPM_PARSER_PVTG_TABLE_HPP
#define OPM_PARSER_PVTG_TABLE_HPP

#include <opm/input/eclipse/EclipseState/Tables/PvtxTable.hpp>

#include <cstddef>

namespace Opm {

class DeckKeyword;

class PvtgTable : public PvtxTable {
} // namespace Opm

namespace Opm {

class PvtgTable : public PvtxTable
{
public:
PvtgTable() = default;
PvtgTable( const DeckKeyword& keyword, size_t tableIdx);
PvtgTable(const DeckKeyword& keyword, std::size_t tableIdx);

static PvtgTable serializationTestObject();

bool operator==(const PvtgTable& data) const;

private:
void makeScaledUSatTableCopy(const std::size_t src,
const std::size_t dest) override;
};
}

#endif
} // namespace Opm

#endif // OPM_PARSER_PVTG_TABLE_HPP
25 changes: 19 additions & 6 deletions opm/input/eclipse/EclipseState/Tables/PvtgwTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,38 @@

You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
*/

#ifndef OPM_PARSER_PVTGW_TABLE_HPP
#define OPM_PARSER_PVTGW_TABLE_HPP
#define OPM_PARSER_PVTGW_TABLE_HPP

#include <opm/input/eclipse/EclipseState/Tables/PvtxTable.hpp>

#include <cstddef>

namespace Opm {

class DeckKeyword;

class PvtgwTable : public PvtxTable {
} // namespace Opm

namespace Opm {

class PvtgwTable : public PvtxTable
{
public:
PvtgwTable() = default;
PvtgwTable( const DeckKeyword& keyword, size_t tableIdx);
PvtgwTable(const DeckKeyword& keyword, const std::size_t tableIdx);

static PvtgwTable serializationTestObject();

bool operator==(const PvtgwTable& data) const;

private:
void makeScaledUSatTableCopy(const std::size_t src,
const std::size_t dest) override;
};
}

#endif
} // namespace Opm

#endif // OPM_PARSER_PVTGW_TABLE_HPP
25 changes: 19 additions & 6 deletions opm/input/eclipse/EclipseState/Tables/PvtgwoTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,38 @@

You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
*/

#ifndef OPM_PARSER_PVTGWO_TABLE_HPP
#define OPM_PARSER_PVTGWO_TABLE_HPP
#define OPM_PARSER_PVTGWO_TABLE_HPP

#include <opm/input/eclipse/EclipseState/Tables/PvtxTable.hpp>

#include <cstddef>

namespace Opm {

class DeckKeyword;

class PvtgwoTable : public PvtxTable {
} // namespaced Opm

namespace Opm {

class PvtgwoTable : public PvtxTable
{
public:
PvtgwoTable() = default;
PvtgwoTable( const DeckKeyword& keyword, size_t tableIdx);
PvtgwoTable(const DeckKeyword& keyword, const std::size_t tableIdx);

static PvtgwoTable serializationTestObject();

bool operator==(const PvtgwoTable& data) const;

private:
void makeScaledUSatTableCopy(const std::size_t src,
const std::size_t dest) override;
};
}

#endif
} // namespace Opm

#endif // OPM_PARSER_PVTGWO_TABLE_HPP
24 changes: 18 additions & 6 deletions opm/input/eclipse/EclipseState/Tables/PvtoTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
*/

#ifndef OPM_PARSER_PVTO_TABLE_HPP
#define OPM_PARSER_PVTO_TABLE_HPP

Expand All @@ -29,23 +30,34 @@ namespace Opm {

class DeckKeyword;

class PvtoTable : public PvtxTable {
} // namespace Opm

namespace Opm {

class PvtoTable : public PvtxTable
{
public:
struct FlippedFVF {
struct FlippedFVF
{
std::size_t i;
std::array<double, std::size_t{2}> Rs;
std::array<double, std::size_t{2}> Bo;
};

PvtoTable() = default;
PvtoTable(const DeckKeyword& keyword, size_t tableIdx);
PvtoTable(const DeckKeyword& keyword, std::size_t tableIdx);

static PvtoTable serializationTestObject();

bool operator==(const PvtoTable& data) const;

std::vector<FlippedFVF> nonMonotonicSaturatedFVF() const;

private:
void makeScaledUSatTableCopy(const std::size_t src,
const std::size_t dest) override;
};
}

#endif
} // namespace Opm

#endif // OPM_PARSER_PVTO_TABLE_HPP
26 changes: 20 additions & 6 deletions opm/input/eclipse/EclipseState/Tables/PvtsolTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,37 @@

You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
*/

#ifndef OPM_PARSER_PVTSOL_TABLE_HPP
#define OPM_PARSER_PVTSOL_TABLE_HPP
#define OPM_PARSER_PVTSOL_TABLE_HPP

#include <opm/input/eclipse/EclipseState/Tables/PvtxTable.hpp>

#include <cstddef>

namespace Opm {

class DeckKeyword;

class PvtsolTable : public PvtxTable {
} // namespace Opm

namespace Opm {

class PvtsolTable : public PvtxTable
{
public:
PvtsolTable() = default;
PvtsolTable(const DeckKeyword& keyword, size_t tableIdx);
PvtsolTable(const DeckKeyword& keyword, const std::size_t tableIdx);

static PvtsolTable serializationTestObject();
bool operator==(const PvtsolTable& data) const;

private:
void makeScaledUSatTableCopy(const std::size_t src,
const std::size_t dest) override;
};
}

#endif
} // namespace Opm

#endif // OPM_PARSER_PVTSOL_TABLE_HPP
50 changes: 50 additions & 0 deletions opm/input/eclipse/EclipseState/Tables/PvtxTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ namespace Opm {
ranges[*tableIdx].first,
ranges[*tableIdx].second);

this->populateMissingUndersaturatedStates();

this->populateSaturatedTable(keyword.name());
}
Expand Down Expand Up @@ -240,4 +241,53 @@ namespace Opm {
}
}

void PvtxTable::populateMissingUndersaturatedStates()
{
for (const auto& [src, dest] : this->missingUSatTables()) {
this->makeScaledUSatTableCopy(src, dest);
}
}

std::vector<std::pair<std::size_t, std::size_t>>
PvtxTable::missingUSatTables() const
{
auto missing = std::vector<std::pair<std::size_t, std::size_t>>{};

if (this->m_underSaturatedTables.empty()) {
return missing;
}

auto src = this->m_underSaturatedTables.size() - 1;

for (auto destIx = src + 1; destIx > 0; --destIx) {
const auto dest = destIx - 1;

if (this->m_underSaturatedTables[dest].numRows() > 1) {
// There are undersaturated states in 'dest'. This is the
// new 'src'.
src = dest;
}
else {
// There are no undersaturated states in 'dest'. Schedule
// generation of a scaled copy of 'src's undersaturated
// states in 'dest'.
missing.emplace_back(src, dest);
}
}

return missing;
}

void PvtxTable::makeScaledUSatTableCopy([[maybe_unused]] const std::size_t src,
[[maybe_unused]] const std::size_t dest)
{
// Implemented only because we need to be able to create objects of
// type 'PvtxTable' for serialisation purposes. Ideally, this would
// be a pure virtual function.

throw std::runtime_error {
"Derived type does not implement makeScaledUSatTableCopy()"
};
}

} // namespace Opm
33 changes: 33 additions & 0 deletions opm/input/eclipse/EclipseState/Tables/PvtxTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,39 @@ namespace Opm {
/// \param[in] tableName Name of table/keyword we're internalising.
/// Typically \code "PVTO" \endcode or \code "PVTG" \endcode.
void populateSaturatedTable(const std::string& tableName);

/// Fill in any missing under-saturated states.
///
/// Takes scaled copies of under-saturated curves at higher
/// composition/pressure nodes. Amends m_underSaturatedTables.
void populateMissingUndersaturatedStates();

/// Identify missing under-saturated states in
/// m_underSaturatedTables.
///
/// \return Pairs of source/destination indices. The
/// under-saturated destination entries in m_underSaturatedTables
/// will be scaled copies of the under-saturated source entries in
/// m_underSaturatedTables.
std::vector<std::pair<std::size_t, std::size_t>>
missingUSatTables() const;

/// Generate scaled copies of under-saturated state curves.
///
/// Intended to amend a specific entry in m_underSaturatedTables
/// based on source values in another specific entry in
/// m_underSaturatedTables.
///
/// Virtual function in order to call back into the derived type for
/// type-specific copying.
///
/// \param[in] src Index of source table with full set of
/// under-saturated states.
///
/// \param[in] dest Index of destination table with no
/// under-saturated states.
virtual void makeScaledUSatTableCopy(const std::size_t src,
const std::size_t dest);
};

} // namespace Opm
Expand Down
25 changes: 19 additions & 6 deletions opm/input/eclipse/EclipseState/Tables/RwgsaltTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,38 @@

You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
*/

#ifndef OPM_PARSER_RWGSALT_TABLE_HPP
#define OPM_PARSER_RWGSALT_TABLE_HPP
#define OPM_PARSER_RWGSALT_TABLE_HPP

#include <opm/input/eclipse/EclipseState/Tables/PvtxTable.hpp>

#include <cstddef>

namespace Opm {

class DeckKeyword;

class RwgsaltTable : public PvtxTable {
} // namespace Opm

namespace Opm {

class RwgsaltTable : public PvtxTable
{
public:
RwgsaltTable() = default;
RwgsaltTable( const DeckKeyword& keyword, size_t tableIdx);
RwgsaltTable(const DeckKeyword& keyword, std::size_t tableIdx);

static RwgsaltTable serializationTestObject();

bool operator==(const RwgsaltTable& data) const;

private:
void makeScaledUSatTableCopy(const std::size_t src,
const std::size_t dest) override;
};
}

#endif
} // namespace Opm

#endif // OPM_PARSER_RWGSALT_TABLE_HPP
Loading