Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
95f52cc
BlackOilBioEffectsParams: separate out state verification
akva2 May 28, 2026
e9801cf
BlackOilBrineParams: separate out state verification
akva2 May 28, 2026
21461f4
BlackOilExtBoParams: separate out state verification
akva2 May 28, 2026
f306e23
BlackOilExtBoParams: separate out sdensity parsing
akva2 May 28, 2026
07943ca
BlackOilPolymerParams: mark utility methods private
akva2 May 28, 2026
8c76fef
BlackOilPolymerParams: separate out state verification
akva2 May 28, 2026
f4b124e
BlackOilPolymerParams: separate out plyRock processing
akva2 May 28, 2026
4681f04
BlackOilPolymerParams: separate out plyAds processing
akva2 May 28, 2026
ff54ccf
BlackOilPolymerParams: separate out plyVisc processing
akva2 May 28, 2026
6be1afe
BlackOilPolymerParams: separate out plyMax processing
akva2 May 28, 2026
32714ac
BlackOilPolymerParams: separate out plmixpar processing
akva2 May 28, 2026
b33fc18
BlackOilPolymerParams: separate out Plyshlog processing
akva2 May 28, 2026
7ef7b0f
BlackOilPolymerParams: separate out Shrate processing
akva2 May 28, 2026
50b75fb
BlackOilPolymerParams: separate out Plyvmh processing
akva2 May 28, 2026
c4d6815
BlackOilPolymerParams: separate out Plymwinj processing
akva2 May 28, 2026
e427c05
BlackOilPolymerParams: separate out Skprwat processing
akva2 May 28, 2026
99a3f34
BlackOilPolymerParams: separate out Skprpoly processing
akva2 May 28, 2026
b8943d8
BlackOilSolventParams: separate out state verification
akva2 May 28, 2026
c78ff6f
BlackOilSolventParams: mark utility methods private
akva2 May 28, 2026
4a13c8b
BlackOilSolventParams: split out pvt setup
akva2 May 28, 2026
c20e4b4
BlackOilSolventParams: separate out SSFN processing
akva2 May 28, 2026
cf9481f
BlackOilSolventParams: separate out SOF2 processing
akva2 May 28, 2026
550fa26
BlackOilSolventParams: separate out MISC processing
akva2 May 28, 2026
3d343e1
BlackOilSolventParams: separate out PMISC processing
akva2 May 28, 2026
fd8156b
BlackOilSolventParams: separate out MSFN processing
akva2 May 28, 2026
8ff2a1e
BlackOilSolventParams: separate out SORWMIS processing
akva2 May 28, 2026
c664121
BlackOilSolventParams: separate out SGCWMIS processing
akva2 May 28, 2026
df70acd
BlackOilSolventParams: separate out TLMIXPAR processing
akva2 May 28, 2026
295154f
BlackOilSolventParams: separate out TLPMIXPA processing
akva2 May 28, 2026
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
20 changes: 15 additions & 5 deletions opm/models/blackoil/blackoilbioeffectsparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@

#include <stdexcept>

namespace Opm {
namespace {

template<class Scalar>
template<bool enableBioeffects , bool enableMICP>
void BlackOilBioeffectsParams<Scalar>::
initFromState(const EclipseState& eclState)
template<bool enableBioeffects, bool enableMICP>
void verifyState(const Opm::EclipseState& eclState)
{
// some sanity checks:
// if biofilm is enabled, the BIOFILM keyword must be present,
Expand Down Expand Up @@ -70,6 +68,18 @@ initFromState(const EclipseState& eclState)
"contains the MICP keyword");
}
}
}

}

namespace Opm {

template<class Scalar>
template<bool enableBioeffects, bool enableMICP>
void BlackOilBioeffectsParams<Scalar>::
initFromState(const EclipseState& eclState)
{
verifyState<enableBioeffects, enableMICP>(eclState);

if (!eclState.runspec().micp() && !eclState.runspec().biof())
return; // bioeffects are supposed to be disabled
Expand Down
22 changes: 16 additions & 6 deletions opm/models/blackoil/blackoilbrineparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,37 @@
#include <cstddef>
#include <stdexcept>

namespace Opm {
namespace {

template<class Scalar>
template<bool enableBrine, bool enableSaltPrecipitation>
void BlackOilBrineParams<Scalar>::
initFromState(const EclipseState& eclState)
void verifyState(const Opm::EclipseState& eclState)
{
// some sanity checks: if brine are enabled, the BRINE keyword must be
// present, if brine are disabled the keyword must not be present.
if constexpr (enableBrine) {
if (!eclState.runspec().phases().active(Phase::BRINE)) {
if (!eclState.runspec().phases().active(Opm::Phase::BRINE)) {
throw std::runtime_error("Non-trivial brine treatment requested at compile time, but "
"the deck does not contain the BRINE keyword");
}
}
else {
if (eclState.runspec().phases().active(Phase::BRINE)) {
if (eclState.runspec().phases().active(Opm::Phase::BRINE)) {
throw std::runtime_error("Brine treatment disabled at compile time, but the deck "
"contains the BRINE keyword");
}
}
}

}

namespace Opm {

template<class Scalar>
template<bool enableBrine, bool enableSaltPrecipitation>
void BlackOilBrineParams<Scalar>::
initFromState(const EclipseState& eclState)
{
verifyState<enableBrine, enableSaltPrecipitation>(eclState);

if (!eclState.runspec().phases().active(Phase::BRINE)) {
return; // brine treatment is supposed to be disabled
Expand Down
66 changes: 42 additions & 24 deletions opm/models/blackoil/blackoilextboparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,65 @@
#include <cstddef>
#include <stdexcept>

namespace Opm {
namespace {

template<class Scalar>
template<bool enableExtbo>
void BlackOilExtboParams<Scalar>::
initFromState(const EclipseState& eclState)
void verifyState(const Opm::EclipseState& eclState)
{
// some sanity checks: if extended BO is enabled, the PVTSOL keyword must be
// present, if extended BO is disabled the keyword must not be present.
if constexpr (enableExtbo) {
if (!eclState.runspec().phases().active(Phase::ZFRACTION)) {
if (!eclState.runspec().phases().active(Opm::Phase::ZFRACTION)) {
throw std::runtime_error("Extended black oil treatment requested at compile "
"time, but the deck does not contain the PVTSOL keyword");
}
}
else {
if (!enableExtbo && eclState.runspec().phases().active(Phase::ZFRACTION)) {
if (eclState.runspec().phases().active(Opm::Phase::ZFRACTION)) {
throw std::runtime_error("Extended black oil treatment disabled at compile time, but the deck "
"contains the PVTSOL keyword");
}
Comment thread
akva2 marked this conversation as resolved.
}
}

template<class Scalar>
std::vector<Scalar>
parseSdensity(const Opm::EclipseState& eclState,
const std::size_t numPvtRegions)
{
const auto& sdensityTables = eclState.getTableManager().getSolventDensityTables();
if (sdensityTables.size() == numPvtRegions) {
std::vector<Scalar> zReferenceDensity(numPvtRegions);
for (std::size_t regionIdx = 0; regionIdx < numPvtRegions; ++regionIdx) {
const Scalar rhoRefS = sdensityTables[regionIdx].getSolventDensityColumn().front();
zReferenceDensity[regionIdx] = rhoRefS;
}
Comment thread
akva2 marked this conversation as resolved.
return zReferenceDensity;
}
else {
throw std::runtime_error("Extbo: kw SDENSITY is missing or not aligned with NTPVT\n");
}
}

}

namespace Opm {

template<class Scalar>
template<bool enableExtbo>
void BlackOilExtboParams<Scalar>::
initFromState(const EclipseState& eclState)
{
verifyState<enableExtbo>(eclState);
if (!eclState.runspec().phases().active(Phase::ZFRACTION)) {
return; // solvent treatment is supposed to be disabled
}

// pvt properties from kw PVTSOL:

const auto& tableManager = eclState.getTableManager();
const auto& pvtsolTables = tableManager.getPvtsolTables();

std::size_t numPvtRegions = pvtsolTables.size();
const std::size_t numPvtRegions = pvtsolTables.size();

BO_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme});
BG_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme});
Expand Down Expand Up @@ -120,7 +147,7 @@ initFromState(const EclipseState& eclState)
PBUB_RV_[regionIdx].appendXPos(ZCO2);

const auto& underSaturatedTable = pvtsolTable.getUnderSaturatedTable(outerIdx);
std::size_t numRows = underSaturatedTable.numRows();
const std::size_t numRows = underSaturatedTable.numRows();

Scalar bo0 = 0.0;
Scalar po0 = 0.0;
Expand All @@ -138,7 +165,7 @@ initFromState(const EclipseState& eclState)
if (bo0 > bo) { // This is undersaturated oil-phase for ZCO2 <= zLim ...
// Here we assume tabulated bo to decay beyond boiling point
if (extractCmpFromPvt) {
Scalar cmpFactor = (bo - bo0) / (po - po0);
const Scalar cmpFactor = (bo - bo0) / (po - po0);
oilCmp[outerIdx] = cmpFactor;
zLim_[regionIdx] = ZCO2;
//std::cout << "### cmpFactorOil: " << cmpFactor << " zLim: " << zLim_[regionIdx] << std::endl;
Expand All @@ -147,9 +174,9 @@ initFromState(const EclipseState& eclState)
} else if (bo0 == bo) { // This is undersaturated gas-phase for ZCO2 > zLim ...
// Here we assume tabulated bo to be constant extrapolated beyond dew point
if (innerIdx+1 < numRows && ZCO2<1.0 && extractCmpFromPvt) {
Scalar rvNxt = underSaturatedTable.get("RV", innerIdx + 1) + innerIdx * 1.0e-10;
Scalar bgNxt = underSaturatedTable.get("B_G", innerIdx + 1);
Scalar cmpFactor = (bgNxt - bg) / (rvNxt - rv);
const Scalar rvNxt = underSaturatedTable.get("RV", innerIdx + 1) + innerIdx * 1.0e-10;
const Scalar bgNxt = underSaturatedTable.get("B_G", innerIdx + 1);
const Scalar cmpFactor = (bgNxt - bg) / (rvNxt - rv);
gasCmp[outerIdx] = cmpFactor;
//std::cout << "### cmpFactorGas: " << cmpFactor << " zLim: " << zLim_[regionIdx] << std::endl;
}
Expand Down Expand Up @@ -189,17 +216,8 @@ initFromState(const EclipseState& eclState)
gasCmp_[regionIdx].setXYContainers(zArg, gasCmp, /*sortInput=*/false);
}

// Reference density for pure z-component taken from kw SDENSITY
const auto& sdensityTables = eclState.getTableManager().getSolventDensityTables();
if (sdensityTables.size() == numPvtRegions) {
zReferenceDensity_.resize(numPvtRegions);
for (unsigned regionIdx = 0; regionIdx < numPvtRegions; ++regionIdx) {
Scalar rhoRefS = sdensityTables[regionIdx].getSolventDensityColumn().front();
zReferenceDensity_[regionIdx] = rhoRefS;
}
}
else
throw std::runtime_error("Extbo: kw SDENSITY is missing or not aligned with NTPVT\n");
// Reference density for pure z-component taken from kw SDENSITY
zReferenceDensity_ = parseSdensity<Scalar>(eclState, numPvtRegions);
}

#define INSTANTIATE_TYPE(T) \
Expand Down
Loading