mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2052 from bska/rewrite-ecl-output-test
Reimplement 'test_ecl_output' Unit Test Using ESmry
This commit is contained in:
commit
aaae8a4f49
@ -24,6 +24,9 @@ DISGAS
|
|||||||
|
|
||||||
METRIC
|
METRIC
|
||||||
|
|
||||||
|
UNIFOUT
|
||||||
|
UNIFIN
|
||||||
|
|
||||||
GRID
|
GRID
|
||||||
|
|
||||||
DX
|
DX
|
||||||
|
@ -31,16 +31,13 @@
|
|||||||
|
|
||||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||||
|
|
||||||
|
#include <opm/io/eclipse/ESmry.hpp>
|
||||||
|
|
||||||
#include <opm/output/eclipse/Summary.hpp>
|
#include <opm/output/eclipse/Summary.hpp>
|
||||||
#include <ebos/collecttoiorank.hh>
|
#include <ebos/collecttoiorank.hh>
|
||||||
#include <ebos/ecloutputblackoilmodule.hh>
|
#include <ebos/ecloutputblackoilmodule.hh>
|
||||||
#include <ebos/eclwriter.hh>
|
#include <ebos/eclwriter.hh>
|
||||||
|
|
||||||
#include <ert/ecl/ecl_sum.h>
|
|
||||||
#include <ert/ecl/smspec_node.h>
|
|
||||||
#include <ert/util/ert_unique_ptr.hpp>
|
|
||||||
#include <ert/util/util.h>
|
|
||||||
|
|
||||||
#if HAVE_DUNE_FEM
|
#if HAVE_DUNE_FEM
|
||||||
#include <dune/fem/misc/mpimanager.hh>
|
#include <dune/fem/misc/mpimanager.hh>
|
||||||
#else
|
#else
|
||||||
@ -87,6 +84,26 @@ SET_BOOL_PROP(TestEclOutputTypeTag, EnableAsyncEclOutput, false);
|
|||||||
|
|
||||||
END_PROPERTIES
|
END_PROPERTIES
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
std::unique_ptr<Opm::EclIO::ESmry> readsum(const std::string& base)
|
||||||
|
{
|
||||||
|
return std::make_unique<Opm::EclIO::ESmry>(base);
|
||||||
|
}
|
||||||
|
|
||||||
|
double ecl_sum_get_field_var(const Opm::EclIO::ESmry* smry,
|
||||||
|
const int timeIdx,
|
||||||
|
const std::string& var)
|
||||||
|
{
|
||||||
|
return smry->get(var)[timeIdx];
|
||||||
|
}
|
||||||
|
|
||||||
|
double ecl_sum_get_general_var(const Opm::EclIO::ESmry* smry,
|
||||||
|
const int timeIdx,
|
||||||
|
const std::string& var)
|
||||||
|
{
|
||||||
|
return smry->get(var)[timeIdx];
|
||||||
|
}
|
||||||
|
|
||||||
template <class TypeTag>
|
template <class TypeTag>
|
||||||
std::unique_ptr<typename GET_PROP_TYPE(TypeTag, Simulator)>
|
std::unique_ptr<typename GET_PROP_TYPE(TypeTag, Simulator)>
|
||||||
initSimulator(const char *filename)
|
initSimulator(const char *filename)
|
||||||
@ -106,14 +123,6 @@ initSimulator(const char *filename)
|
|||||||
return std::unique_ptr<Simulator>(new Simulator);
|
return std::unique_ptr<Simulator>(new Simulator);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERT::ert_unique_ptr<ecl_sum_type, ecl_sum_free> readsum(const std::string& base);
|
|
||||||
ERT::ert_unique_ptr<ecl_sum_type, ecl_sum_free> readsum(const std::string& base)
|
|
||||||
{
|
|
||||||
return ERT::ert_unique_ptr<ecl_sum_type, ecl_sum_free>(
|
|
||||||
ecl_sum_fread_alloc_case(base.c_str(), ":"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_summary();
|
|
||||||
void test_summary()
|
void test_summary()
|
||||||
{
|
{
|
||||||
typedef typename TTAG(TestEclOutputTypeTag) TypeTag;
|
typedef typename TTAG(TestEclOutputTypeTag) TypeTag;
|
||||||
@ -184,7 +193,6 @@ void test_summary()
|
|||||||
CHECK_CLOSE(roip2, ecl_sum_get_general_var( resp, 1, "ROIP:2" ), 1e-3 );
|
CHECK_CLOSE(roip2, ecl_sum_get_general_var( resp, 1, "ROIP:2" ), 1e-3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_readWriteWells();
|
|
||||||
void test_readWriteWells()
|
void test_readWriteWells()
|
||||||
{
|
{
|
||||||
using opt = Opm::data::Rates::opt;
|
using opt = Opm::data::Rates::opt;
|
||||||
@ -246,6 +254,7 @@ void test_readWriteWells()
|
|||||||
CHECK( wellRatesCopy.get( "OP_1" , opt::wat) , wellRates.get( "OP_1" , opt::wat));
|
CHECK( wellRatesCopy.get( "OP_1" , opt::wat) , wellRates.get( "OP_1" , opt::wat));
|
||||||
CHECK( wellRatesCopy.get( "OP_2" , 188 , opt::wat) , wellRates.get( "OP_2" , 188 , opt::wat));
|
CHECK( wellRatesCopy.get( "OP_2" , 188 , opt::wat) , wellRates.get( "OP_2" , 188 , opt::wat));
|
||||||
}
|
}
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user