Output WSTAT numerical value to summary file

This commit is contained in:
Joakim Hove
2021-11-17 12:11:38 +01:00
parent 2a50e28085
commit cb2e90bb71
5 changed files with 93 additions and 0 deletions

View File

@@ -963,6 +963,7 @@ if(ENABLE_ECL_OUTPUT)
opm/output/eclipse/Summary.hpp
opm/output/eclipse/Tables.hpp
opm/output/eclipse/UDQDims.hpp
opm/output/eclipse/WStat.hpp
opm/output/eclipse/WindowedArray.hpp
opm/output/eclipse/WriteInit.hpp
opm/output/eclipse/WriteRFT.hpp

View File

@@ -0,0 +1,58 @@
/*
Copyright 2021 Equinor 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/>.
*/
#ifndef WSTAT_HPP
#define WSTAT_HPP
#include <string>
namespace Opm {
namespace WStat {
namespace numeric {
constexpr int UNKNOWN = 0;
constexpr int PROD = 1;
constexpr int INJ = 2;
constexpr int SHUT = 3;
constexpr int STOP = 4;
constexpr int PSHUT = 5;
constexpr int PSTOP = 6;
}
namespace symbolic {
const std::string UNKNOWN = "UNKNOWN";
const std::string PROD = "PROD";
const std::string INJ = "INJ";
const std::string SHUT = "SHUT";
const std::string STOP = "STOP";
const std::string PSHUT = "PSHUT";
const std::string PSTOP = "PSTOP";
}
}
}
#endif

View File

@@ -20,6 +20,7 @@
*/
#include <opm/output/eclipse/Summary.hpp>
#include <opm/output/eclipse/WStat.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/OpmLog/KeywordLocation.hpp>
@@ -1064,6 +1065,25 @@ inline quantity segpress ( const fn_args& args )
return { segment->second.pressures[ix], measure::pressure };
}
inline quantity wstat( const fn_args& args ) {
const quantity zero = { Opm::WStat::numeric::UNKNOWN, measure::identity};
if (args.schedule_wells.empty())
return zero;
const auto& sched_well = args.schedule_wells.front();
const auto& arg_well = args.wells.find(sched_well->name());
if (arg_well == args.wells.end() || arg_well->second.dynamicStatus == Opm::Well::Status::SHUT)
return {Opm::WStat::numeric::SHUT, measure::identity};
if (arg_well->second.dynamicStatus == Opm::Well::Status::STOP)
return {Opm::WStat::numeric::STOP, measure::identity};
if (sched_well->isInjector())
return {Opm::WStat::numeric::INJ, measure::identity};
return {Opm::WStat::numeric::PROD, measure::identity};
}
inline quantity bhp( const fn_args& args ) {
const quantity zero = { 0, measure::pressure };
if (args.schedule_wells.empty())
@@ -1676,6 +1696,7 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "WGLR", div( rate< rt::gas, producer >,
sum( rate< rt::wat, producer >, rate< rt::oil, producer > ) ) },
{ "WSTAT", wstat },
{ "WBHP", bhp },
{ "WTHP", thp },
{ "WTPCHEA", temperature< producer >},

View File

@@ -748,6 +748,9 @@ COPRL
W_2 /
/
WSTAT
/
-- Water injection per connection
CWIR

View File

@@ -35,6 +35,7 @@
#include <opm/output/data/Groups.hpp>
#include <opm/output/data/GuideRateValue.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/WStat.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/common/utility/TimeService.hpp>
@@ -791,6 +792,11 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
BOOST_CHECK_CLOSE( 0.2, ecl_sum_get_well_var( resp, 1, "W_1", "WTHPH" ), 1e-5 );
BOOST_CHECK_CLOSE( 1.2, ecl_sum_get_well_var( resp, 1, "W_2", "WTHPH" ), 1e-5 );
BOOST_CHECK_CLOSE( 2.2, ecl_sum_get_well_var( resp, 1, "W_3", "WTHPH" ), 1e-5 );
/* State */
BOOST_CHECK_CLOSE( WStat::numeric::PROD, ecl_sum_get_well_var(resp, 1,"W_1", "WSTAT"), 1e-5 );
BOOST_CHECK_CLOSE( WStat::numeric::PROD, ecl_sum_get_well_var(resp, 1,"W_2", "WSTAT"), 1e-5 );
BOOST_CHECK_CLOSE( WStat::numeric::INJ, ecl_sum_get_well_var(resp, 1,"W_3", "WSTAT"), 1e-5 );
}
BOOST_AUTO_TEST_CASE(well_keywords_dynamic_close) {
@@ -819,6 +825,10 @@ BOOST_AUTO_TEST_CASE(well_keywords_dynamic_close) {
auto res = readsum( cfg.name );
const auto* resp = res.get();
/* State */
BOOST_CHECK_CLOSE( WStat::numeric::SHUT, ecl_sum_get_well_var(resp, 1,"W_2", "WSTAT"), 1e-5 );
BOOST_CHECK_CLOSE( WStat::numeric::PROD, ecl_sum_get_well_var(resp, 2,"W_2", "WSTAT"), 1e-5 );
/* Production rates */
BOOST_CHECK_CLOSE( 0.0, ecl_sum_get_well_var( resp, 1, "W_2", "WWPR" ), 1e-5 );
BOOST_CHECK_CLOSE( 0.0, ecl_sum_get_well_var( resp, 1, "W_2", "WTPRSEA" ), 1e-5 );