-- added stress equilibrium data for initconfig

This commit is contained in:
hnil
2023-05-31 14:09:50 +02:00
committed by Arne Morten Kvarving
parent 111aa44936
commit a0ba0be7cc
7 changed files with 266 additions and 0 deletions

View File

@@ -64,6 +64,51 @@ namespace Opm {
bool humid_gas_init_proc = false;
};
class StressEquilRecord {
public:
StressEquilRecord() = default;
explicit StressEquilRecord(const DeckRecord& record);
static StressEquilRecord serializationTestObject();
bool operator==(const StressEquilRecord& data) const;
double datumDepth() const;
double datumPosX() const;
double datumPosY() const;
double stressXX() const;
double stressXX_grad() const;
double stressYY() const;
double stressYY_grad() const;
double stressZZ() const;
double stressZZ_grad() const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(datum_depth);
serializer(datum_posx);
serializer(datum_posy);
serializer(stress_xx);
serializer(stress_xx_grad);
serializer(stress_yy);
serializer(stress_yy_grad);
serializer(stress_zz);
serializer(stress_zz_grad);
}
private:
double datum_depth = 0.0;
double datum_posx = 0.0;
double datum_posy = 0.0;
double stress_xx = 0.0;
double stress_xx_grad = 0.0;
double stress_yy = 0.0;
double stress_yy_grad = 0.0;
double stress_zz = 0.0;
double stress_zz_grad = 0.0;
};
template<class RecordType>
class EquilContainer {
public:
@@ -95,6 +140,7 @@ namespace Opm {
};
using Equil = EquilContainer<EquilRecord>;
using StressEquil = EquilContainer<StressEquilRecord>;
}
#endif //OPM_EQUIL_HPP

View File

@@ -45,6 +45,9 @@ namespace Opm {
bool hasEquil() const;
const Equil& getEquil() const;
bool hasStressEquil() const;
const StressEquil& getStressEquil() const;
bool hasGravity() const;
bool hasFoamConfig() const;
@@ -64,6 +67,7 @@ namespace Opm {
void serializeOp(Serializer& serializer)
{
serializer(equil);
serializer(stress_equil);
serializer(foamconfig);
serializer(m_filleps);
serializer(m_gravity);
@@ -74,6 +78,7 @@ namespace Opm {
private:
Equil equil;
StressEquil stress_equil;
FoamConfig foamconfig;
bool m_filleps;
bool m_gravity = true;

View File

@@ -2,6 +2,7 @@
#include <opm/input/eclipse/Deck/DeckKeyword.hpp>
#include <opm/input/eclipse/Parser/ParserKeywords/E.hpp>
#include <opm/input/eclipse/Parser/ParserKeywords/S.hpp>
#include <vector>
@@ -100,6 +101,82 @@ namespace Opm {
humid_gas_init_proc == data.humid_gas_init_proc;
}
StressEquilRecord::StressEquilRecord(const DeckRecord& record)
: datum_depth(record.getItem<ParserKeywords::STREQUIL::DATUM_DEPTH>().getSIDouble(0))
, datum_posx(record.getItem<ParserKeywords::STREQUIL::DATUM_POSX>().getSIDouble(0))
, datum_posy(record.getItem<ParserKeywords::STREQUIL::DATUM_POSY>().getSIDouble(0))
, stress_xx(record.getItem<ParserKeywords::STREQUIL::STRESSXX>().getSIDouble(0))
, stress_xx_grad(record.getItem<ParserKeywords::STREQUIL::STRESSXXGRAD>().getSIDouble(0))
, stress_yy(record.getItem<ParserKeywords::STREQUIL::STRESSYY>().getSIDouble(0))
, stress_yy_grad(record.getItem<ParserKeywords::STREQUIL::STRESSYYGRAD>().getSIDouble(0))
, stress_zz(record.getItem<ParserKeywords::STREQUIL::STRESSZZ>().getSIDouble(0))
, stress_zz_grad(record.getItem<ParserKeywords::STREQUIL::STRESSZZGRAD>().getSIDouble(0))
{}
StressEquilRecord StressEquilRecord::serializationTestObject()
{
StressEquilRecord result;
result.datum_depth = 1.0;
result.datum_posx = 2.0;
result.datum_posy = 3.0;
result.stress_xx = 4.0;
result.stress_xx_grad = 5.0;
result.stress_yy = 6.0;
result.stress_yy_grad = 7.0;
result.stress_zz = 8.0;
result.stress_zz_grad = 9.0;
return result;
}
double StressEquilRecord::datumDepth() const {
return this->datum_depth;
}
double StressEquilRecord::datumPosX() const {
return this->datum_posx;
}
double StressEquilRecord::datumPosY() const {
return this->datum_posy;
}
double StressEquilRecord::stressXX() const {
return this->stress_xx;
}
double StressEquilRecord::stressXX_grad() const {
return this->stress_xx_grad;
}
double StressEquilRecord::stressYY() const {
return this->stress_yy;
}
double StressEquilRecord::stressYY_grad() const {
return this->stress_yy_grad;
}
double StressEquilRecord::stressZZ() const {
return this->stress_zz;
}
double StressEquilRecord::stressZZ_grad() const {
return this->stress_zz_grad;
}
bool StressEquilRecord::operator==(const StressEquilRecord& data) const {
return datum_depth == data.datum_depth &&
datum_posx == data.datum_posx &&
datum_posy == data.datum_posy &&
stress_xx == data.stress_xx &&
stress_xx_grad == data.stress_xx_grad &&
stress_yy == data.stress_yy &&
stress_yy_grad == data.stress_yy_grad &&
stress_zz == data.stress_zz &&
stress_zz_grad == data.stress_zz_grad;
}
/* ----------------------------------------------------------------- */
template<class RecordType>
@@ -155,4 +232,5 @@ namespace Opm {
}
template class EquilContainer<EquilRecord>;
template class EquilContainer<StressEquilRecord>;
}

View File

@@ -38,6 +38,11 @@ namespace Opm {
return Equil( deck.get<ParserKeywords::EQUIL>( ).back() );
}
static inline DeckKeyword stressequils( const Deck& deck ) {
if( !deck.hasKeyword<ParserKeywords::STREQUIL>( ) ) return {};
return deck.get<ParserKeywords::STREQUIL>( ).back();
}
InitConfig::InitConfig()
: m_filleps(false)
{
@@ -45,6 +50,7 @@ namespace Opm {
InitConfig::InitConfig(const Deck& deck)
: equil(equils(deck))
, stress_equil(stressequils(deck))
, foamconfig(deck)
, m_filleps(PROPSSection{deck}.hasKeyword("FILLEPS"))
{
@@ -82,6 +88,7 @@ namespace Opm {
{
InitConfig result;
result.equil = Equil::serializationTestObject();
result.stress_equil = StressEquil::serializationTestObject();
result.foamconfig = FoamConfig::serializationTestObject();
result.m_filleps = true;
result.m_gravity = false;
@@ -121,6 +128,17 @@ namespace Opm {
return this->equil;
}
bool InitConfig::hasStressEquil() const {
return !this->stress_equil.empty();
}
const StressEquil& InitConfig::getStressEquil() const {
if( !this->hasStressEquil() )
throw std::runtime_error( "Error: No 'STREQUIL' present" );
return this->stress_equil;
}
bool InitConfig::hasGravity() const {
return m_gravity;
}
@@ -139,6 +157,7 @@ namespace Opm {
bool InitConfig::operator==(const InitConfig& data) const {
return equil == data.equil &&
stress_equil == data.stress_equil &&
foamconfig == data.foamconfig &&
m_filleps == data.m_filleps &&
m_gravity == data.m_gravity &&

View File

@@ -0,0 +1,66 @@
{
"name": "STREQUIL",
"sections": [
"SOLUTION"
],
"description": "The STREQUIL item is used when equilibrating the mechanics model. The item should consist of exactly one record for each EQUIL region",
"items": [
{
"item": 1,
"name": "DATUM_DEPTH",
"value_type": "DOUBLE",
"default": 0,
"dimension": "Length"
},
{
"item": 2,
"name": "DATUM_POSX",
"value_type": "DOUBLE",
"default": 0,
"dimension": "Length"
},
{
"item": 3,
"name": "DATUM_POSY",
"value_type": "DOUBLE",
"default": 0,
"dimension": "Length"
},
{
"item": 4,
"name": "STRESSXX",
"value_type": "DOUBLE",
"dimension": "Pressure"
},
{
"item": 5,
"name": "STRESSXXGRAD",
"value_type": "DOUBLE",
"dimension": "Pressure/Length"
},
{
"item": 6,
"name": "STRESSYY",
"value_type": "DOUBLE",
"dimension": "Pressure"
},
{
"item": 7,
"name": "STRESSYYGRAD",
"value_type": "DOUBLE",
"dimension": "Pressure/Length"
},
{
"item": 8,
"name": "STRESSZZ",
"value_type": "DOUBLE",
"dimension": "Pressure"
},
{
"item": 8,
"name": "STRESSZZGRAD",
"value_type": "DOUBLE",
"dimension": "Pressure/Length"
}
]
}

View File

@@ -1146,6 +1146,7 @@ set( keywords
900_OPM/S/SOXYG
900_OPM/S/SPIDER
900_OPM/S/SPOLYMW
900_OPM/S/STREQUIL
900_OPM/S/SUREA
900_OPM/S/SWOFLET
900_OPM/T/TLPMIXPA

View File

@@ -185,6 +185,25 @@ const std::string& deckWithEquil =
"SCHEDULE\n"
"SKIPREST \n";
const std::string& deckWithStrEquil =
"RUNSPEC\n"
"DIMENS\n"
" 10 10 10 /\n"
"EQLDIMS\n"
"1 100 20 1 1 /\n"
"SOLUTION\n"
"RESTART\n"
"BASE 5\n"
"/\n"
"STREQUIL\n"
"1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 /\n"
"/\n"
"GRID\n"
"START -- 0 \n"
"19 JUN 2007 / \n"
"SCHEDULE\n"
"SKIPREST \n";
static Deck createDeck(const std::string& input) {
Opm::Parser parser;
auto deck = parser.parseString(input);
@@ -247,6 +266,14 @@ BOOST_AUTO_TEST_CASE( InitConfigWithEquil ) {
BOOST_CHECK_NO_THROW( config.getEquil() );
}
BOOST_AUTO_TEST_CASE( InitConfigWithStrEquil ) {
auto deck = createDeck( deckWithStrEquil );
InitConfig config( deck );
BOOST_CHECK( config.hasStressEquil() );
BOOST_CHECK_NO_THROW( config.getStressEquil() );
}
BOOST_AUTO_TEST_CASE( EquilOperations ) {
auto deck = createDeck( deckWithEquil );
InitConfig config( deck );
@@ -271,6 +298,30 @@ BOOST_AUTO_TEST_CASE( EquilOperations ) {
BOOST_CHECK_EQUAL( 20, record.initializationTargetAccuracy() );
}
BOOST_AUTO_TEST_CASE( StrEquilOperations ) {
auto deck = createDeck( deckWithStrEquil );
InitConfig config( deck );
const auto& equil = config.getStressEquil();
BOOST_CHECK( !equil.empty() );
BOOST_CHECK_EQUAL( 1U, equil.size() );
BOOST_CHECK_NO_THROW( equil.getRecord( 0 ) );
BOOST_CHECK_THROW( equil.getRecord( 1 ), std::out_of_range );
const auto& record = equil.getRecord( 0 );
BOOST_CHECK_CLOSE(1.0, record.datumDepth(), 1.0 );
BOOST_CHECK_CLOSE(2.0, record.datumPosX(), 1e-12 );
BOOST_CHECK_CLOSE(3.0, record.datumPosY(), 1e-12 );
BOOST_CHECK_CLOSE(4.0 * unit::barsa, record.stressXX(), 1e-12 );
BOOST_CHECK_CLOSE(5.0 * unit::barsa, record.stressXX_grad(), 1e-12 );
BOOST_CHECK_CLOSE(6.0 * unit::barsa, record.stressYY(), 1e-12 );
BOOST_CHECK_CLOSE(7.0 * unit::barsa, record.stressYY_grad(), 1e-12 );
BOOST_CHECK_CLOSE(8.0 * unit::barsa, record.stressZZ(), 1e-12 );
BOOST_CHECK_CLOSE(9.0 * unit::barsa, record.stressZZ_grad(), 1e-12 );
}
BOOST_AUTO_TEST_CASE(RestartCWD) {
WorkArea output_area;