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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ if(dune-common_FOUND)
test_blackoilfluidsystem_nonstatic test_fluidmatrixinteractions
test_fluidsystems test_tabulation test_h2brinepvt test_co2brinepvt
test_eclblackoilfluidsystem test_eclblackoilfluidsystemnonstatic
test_eclblackoilpvt)
test_eclblackoilpvt test_materialstates)
target_link_libraries(${tst} dunecommon)
endforeach()
endif()
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ list (APPEND TEST_SOURCE_FILES
tests/material/test_binarycoefficients.cpp
tests/material/test_fluidmatrixinteractions.cpp
tests/material/test_fluidsystems.cpp
tests/material/test_materialstates.cpp
tests/material/test_spline.cpp
tests/material/test_tabulation.cpp
tests/test_Visitor.cpp
Expand Down Expand Up @@ -1085,6 +1086,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/fluidmatrixinteractions/BrooksCoreyParams.hpp
opm/material/fluidmatrixinteractions/BrooksCorey.hpp
opm/material/fluidmatrixinteractions/PiecewiseLinearTwoPhaseMaterial.hpp
opm/material/materialstates/MaterialStateTPSA.hpp
opm/material/checkFluidSystem.hpp
opm/material/viscositymodels/LBC.hpp
opm/material/viscositymodels/LBCco2rich.hpp
Expand Down
2 changes: 2 additions & 0 deletions opm/input/eclipse/EclipseState/Grid/FieldProps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ static const std::unordered_map<std::string, keyword_info<double>> double_keywor
{"THCGAS", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
{"THCWATER",keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
{"YMODULE", keyword_info<double>{}.unit_string("Ymodule")},
{"SMODULUS",keyword_info<double>{}.unit_string("Ymodule")},
{"LAME", keyword_info<double>{}.unit_string("Ymodule")},
{"CSTRESS", keyword_info<double>{}.unit_string("1")},
{"PRATIO", keyword_info<double>{}.unit_string("1")},
{"BIOTCOEF", keyword_info<double>{}.unit_string("1")},
Expand Down
66 changes: 66 additions & 0 deletions opm/input/eclipse/EclipseState/Runspec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,71 @@ bool Nupcol::operator==(const Nupcol& data) const {
}


Tpsa::Tpsa(const Deck& deck)
{
using TPSA = ParserKeywords::TPSA;
if (deck.hasKeyword<TPSA>()) {
// Get record
const auto& keyword = deck.get<TPSA>().back();
const auto& record = keyword[0];

// Set coupling scheme
const auto& scheme = record.getItem<TPSA::COUPLING>().get<std::string>(0);
if (scheme == "LAGGED") {
this->m_coupling = Tpsa::CouplingScheme::Lagged;
}
else if (scheme == "FIXED-STRESS") {
this->m_coupling = Tpsa::CouplingScheme::FixedStress;
}
else {
const std::string msg = fmt::format("TPSA item 1 = {} not valid!", scheme);
OpmLog::error(msg);
throw std::runtime_error(msg);
}

// Set fixed stress iteration range
this->m_fixed_stress_min_iter = record.getItem<TPSA::FIXED_STRESS_MIN_ITER>().get<int>(0);
this->m_fixed_stress_max_iter = record.getItem<TPSA::FIXED_STRESS_MAX_ITER>().get<int>(0);

if (this->fixedStressScheme() &&
(this->m_fixed_stress_min_iter > this->m_fixed_stress_max_iter)) {
this->m_fixed_stress_max_iter = this->m_fixed_stress_min_iter;
OpmLog::warning(fmt::format("TPSA item 2 (={}) is larger than item 3 (={}).\n"
"Maximum fixed-stress iterations set equal to minimum!",
this->m_fixed_stress_min_iter,
this->m_fixed_stress_max_iter));
}

// Turn on TPSA
this->m_active = true;
}
}

bool Tpsa::operator==(const Tpsa& other) const
{
return
this->m_coupling == other.m_coupling &&
this->m_fixed_stress_min_iter == other.m_fixed_stress_min_iter &&
this->m_fixed_stress_max_iter == other.m_fixed_stress_max_iter &&
this->m_active == other.m_active;
}

Tpsa Tpsa::serializationTestObject()
{
Tpsa tpsa;
tpsa.m_coupling = CouplingScheme::Lagged;
tpsa.m_fixed_stress_min_iter = 2;
tpsa.m_fixed_stress_max_iter = 8;
tpsa.m_active = true;

return tpsa;
}

const Tpsa& Runspec::tpsa() const
{
return this->m_tpsa;
}

bool Tracers::operator==(const Tracers& other) const {
return
this->m_oil_tracers == other.m_oil_tracers &&
Expand Down Expand Up @@ -666,6 +731,7 @@ Runspec::Runspec(const Deck& deck)
, m_actdims (deck)
, m_sfuncctrl (deck)
, m_nupcol ()
, m_tpsa (deck)
, m_tracers (deck)
, m_co2storage (false)
, m_co2sol (false)
Expand Down
58 changes: 58 additions & 0 deletions opm/input/eclipse/EclipseState/Runspec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,61 @@ class Nupcol {
};


class Tpsa
{
public:
enum class CouplingScheme {
Lagged,
FixedStress
};

Tpsa() = default;
explicit Tpsa(const Deck&);
bool operator==(const Tpsa& data) const;
static Tpsa serializationTestObject();

template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->m_coupling);
serializer(this->m_fixed_stress_min_iter);
serializer(this->m_fixed_stress_max_iter);
serializer(this->m_active);
}

bool laggedScheme() const
{
return this->m_coupling == CouplingScheme::Lagged;
}

bool fixedStressScheme() const
{
return this->m_coupling == CouplingScheme::FixedStress;
}

int fixedStressMinIter() const
{
return this->m_fixed_stress_min_iter;
}

int fixedStressMaxIter() const
{
return this->m_fixed_stress_max_iter;
}

bool active() const
{
return this->m_active;
}

private:
CouplingScheme m_coupling = CouplingScheme::Lagged;
int m_fixed_stress_min_iter{};
int m_fixed_stress_max_iter{};
bool m_active{false};
};


class Tracers {
public:
Tracers() = default;
Expand Down Expand Up @@ -510,6 +565,7 @@ class Runspec {
const Actdims& actdims() const noexcept;
const SatFuncControls& saturationFunctionControls() const noexcept;
const Nupcol& nupcol() const noexcept;
const Tpsa& tpsa() const;
const Tracers& tracers() const;
bool compositionalMode() const;
size_t numComps() const;
Expand Down Expand Up @@ -554,6 +610,7 @@ class Runspec {
serializer(m_mech);
serializer(m_frac);
serializer(m_temp);
serializer(m_tpsa);
serializer(m_biof);
}

Expand All @@ -572,6 +629,7 @@ class Runspec {
Actdims m_actdims{};
SatFuncControls m_sfuncctrl{};
Nupcol m_nupcol{};
Tpsa m_tpsa{};
Tracers m_tracers{};
size_t m_comps = 0;
bool m_co2storage{false};
Expand Down
11 changes: 11 additions & 0 deletions opm/input/eclipse/share/keywords/900_OPM/L/LAME
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "LAME",
"sections": [
"GRID"
],
"description": "The LAME item is used to set Lame's first parameter for a cell in mechanics models.",
"data": {
"value_type": "DOUBLE",
"dimension": "Ymodule"
}
}
11 changes: 11 additions & 0 deletions opm/input/eclipse/share/keywords/900_OPM/S/SMODULUS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "SMODULUS",
"sections": [
"GRID"
],
"description": "The SMODULUS item is used to set the shear modulus (Lame's second parameter) for a cell in mechanics models.",
"data": {
"value_type": "DOUBLE",
"dimension": "Ymodule"
}
}
30 changes: 30 additions & 0 deletions opm/input/eclipse/share/keywords/900_OPM/T/TPSA
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "TPSA",
"sections": [
"RUNSPEC"
],
"requires": [
"MECH"
],
"size": 1,
"items": [
{
"item": 1,
"name": "COUPLING",
"value_type": "STRING",
"default": "LAGGED"
},
{
"item": 2,
"name": "FIXED_STRESS_MIN_ITER",
"value_type": "INT",
"default": 1
},
{
"item": 3,
"name": "FIXED_STRESS_MAX_ITER",
"value_type": "INT",
"default": 5
}
]
}
3 changes: 3 additions & 0 deletions opm/input/eclipse/share/keywords/keyword_list.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ set( keywords
900_OPM/G/GROUP_PROBE_OPM
900_OPM/H/H2SOL
900_OPM/H/H2STORE
900_OPM/L/LAME
900_OPM/M/MECH
900_OPM/M/MICP
900_OPM/M/MINNPCOL
Expand Down Expand Up @@ -1178,6 +1179,7 @@ set( keywords
900_OPM/S/SKPRPOLY
900_OPM/S/SKPRWAT
900_OPM/S/SMICR
900_OPM/S/SMODULUS
900_OPM/S/SOURCE
900_OPM/S/SOXYG
900_OPM/S/SPIDER
Expand All @@ -1190,6 +1192,7 @@ set( keywords
900_OPM/T/THELCOEF
900_OPM/T/THERMEXR
900_OPM/T/TLPMIXPA
900_OPM/T/TPSA
900_OPM/V/VAPWAT
900_OPM/Y/YMODULE
900_OPM/W/WATJT
Expand Down
Loading