diff --git a/examples/compute_initial_state.cpp b/examples/compute_initial_state.cpp
deleted file mode 100644
index a2bae9344..000000000
--- a/examples/compute_initial_state.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- Copyright 2014 SINTEF ICT, Applied Mathematics.
- Copyright 2017 IRIS
-
- 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 .
-*/
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif // HAVE_CONFIG_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-
-#include
-
-#include
-
-namespace
-{
- void warnIfUnusedParams(const Opm::ParameterGroup& param)
- {
- if (param.anyUnused()) {
- std::cout << "-------------------- Unused parameters: --------------------\n";
- param.displayUsage();
- std::cout << "----------------------------------------------------------------" << std::endl;
- }
- }
-
- void outputData(const std::string& output_dir,
- const std::string& name,
- const std::vector& data)
- {
- std::ostringstream fname;
- fname << output_dir << "/" << name;
- boost::filesystem::path fpath = fname.str();
- try {
- create_directories(fpath);
- }
- catch (...) {
- OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
- }
- fname << "/" << "initial.txt";
- std::ofstream file(fname.str().c_str());
- if (!file) {
- OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
- }
- std::copy(data.begin(), data.end(), std::ostream_iterator(file, "\n"));
- }
-
- /// Convert saturations from a vector of individual phase saturation vectors
- /// to an interleaved format where all values for a given cell come before all
- /// values for the next cell, all in a single vector.
- template
- void convertSats(std::vector& sat_interleaved, const std::vector< std::vector >& sat, const Opm::PhaseUsage& pu)
- {
- assert(sat.size() == 3);
- const auto nc = sat[0].size();
- const auto np = sat_interleaved.size() / nc;
- for (size_t c = 0; c < nc; ++c) {
- if ( FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
- const int opos = pu.phase_pos[Opm::BlackoilPhases::Liquid];
- const std::vector& sat_p = sat[ FluidSystem::oilPhaseIdx];
- sat_interleaved[np*c + opos] = sat_p[c];
- }
- if ( FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
- const int wpos = pu.phase_pos[Opm::BlackoilPhases::Aqua];
- const std::vector& sat_p = sat[ FluidSystem::waterPhaseIdx];
- sat_interleaved[np*c + wpos] = sat_p[c];
- }
- if ( FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
- const int gpos = pu.phase_pos[Opm::BlackoilPhases::Vapour];
- const std::vector& sat_p = sat[ FluidSystem::gasPhaseIdx];
- sat_interleaved[np*c + gpos] = sat_p[c];
- }
- }
- }
-
-} // anon namespace
-
-// ----------------- Main program -----------------
-int
-main(int argc, char** argv)
-try
-{
- using namespace Opm;
-
- // Setup.
- ParameterGroup param(argc, argv);
- std::cout << "--------------- Reading parameters ---------------" << std::endl;
- const std::string deck_filename = param.get("deck_filename");
- Opm::ParseContext parseContext;
- Opm::Parser parser;
- const Opm::Deck& deck = parser.parseFile(deck_filename , parseContext);
- const Opm::EclipseState eclipseState(deck, parseContext);
- const double grav = param.getDefault("gravity", unit::gravity);
- GridManager gm(eclipseState.getInputGrid());
- const UnstructuredGrid& grid = *gm.c_grid();
- warnIfUnusedParams(param);
-
- // Create material law manager.
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
-
- typedef FluidSystems::BlackOil FluidSystem;
-
- // Forward declaring the MaterialLawManager template.
- typedef Opm::ThreePhaseMaterialTraits MaterialTraits;
- typedef Opm::EclMaterialLawManager MaterialLawManager;
-
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
-
- // Initialisation.
- //initBlackoilSurfvolUsingRSorRV(UgGridHelpers::numCells(grid), props, state);
- BlackoilState state( UgGridHelpers::numCells(grid) , UgGridHelpers::numFaces(grid), 3);
- FluidSystem::initFromDeck(deck, eclipseState);
- PhaseUsage pu = phaseUsageFromDeck(deck);
-
- typedef EQUIL::DeckDependent::InitialStateComputer ISC;
-
- ISC isc(materialLawManager, eclipseState, grid, grav);
-
- const bool oil = FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx);
- const int oilpos = FluidSystem::oilPhaseIdx;
- const int waterpos = FluidSystem::waterPhaseIdx;
- const int ref_phase = oil ? oilpos : waterpos;
-
- state.pressure() = isc.press()[ref_phase];
- convertSats(state.saturation(), isc.saturation(), pu);
- state.gasoilratio() = isc.rs();
- state.rv() = isc.rv();
-
- // Output.
- const std::string output_dir = param.getDefault("output_dir", "output");
- outputData(output_dir, "pressure", state.pressure());
- outputData(output_dir, "saturation", state.saturation());
- outputData(output_dir, "rs", state.gasoilratio());
- outputData(output_dir, "rv", state.rv());
-}
-catch (const std::exception& e) {
- std::cerr << "Program threw an exception: " << e.what() << "\n";
- throw;
-}
diff --git a/tests/data/equil_base.DATA b/tests/data/equil_base.DATA
new file mode 100644
index 000000000..740ae0850
--- /dev/null
+++ b/tests/data/equil_base.DATA
@@ -0,0 +1,115 @@
+RUNSPEC
+
+WATER
+GAS
+OIL
+
+METRIC
+
+DIMENS
+ 10 1 10 /
+
+GRID
+
+DX
+ 100*1 /
+DY
+ 100*1 /
+DZ
+ 100*1 /
+
+TOPS
+ 10*0. /
+
+PORO
+ 100*0.3 /
+
+PERMX
+ 100*500 /
+
+PROPS
+
+PVTW
+ 4017.55 1.038 3.22E-6 0.318 0.0 /
+
+ROCK
+ 14.7 3E-6 /
+
+SWOF
+0.12 0 1 0
+0.18 4.64876033057851E-008 1 0
+0.24 0.000000186 0.997 0
+0.3 4.18388429752066E-007 0.98 0
+0.36 7.43801652892562E-007 0.7 0
+0.42 1.16219008264463E-006 0.35 0
+0.48 1.67355371900826E-006 0.2 0
+0.54 2.27789256198347E-006 0.09 0
+0.6 2.97520661157025E-006 0.021 0
+0.66 3.7654958677686E-006 0.01 0
+0.72 4.64876033057851E-006 0.001 0
+0.78 0.000005625 0.0001 0
+0.84 6.69421487603306E-006 0 0
+0.91 8.05914256198347E-006 0 0
+1 0.00001 0 0 /
+
+
+SGOF
+0 0 1 0
+0.001 0 1 0
+0.02 0 0.997 0
+0.05 0.005 0.980 0
+0.12 0.025 0.700 0
+0.2 0.075 0.350 0
+0.25 0.125 0.200 0
+0.3 0.190 0.090 0
+0.4 0.410 0.021 0
+0.45 0.60 0.010 0
+0.5 0.72 0.001 0
+0.6 0.87 0.0001 0
+0.7 0.94 0.000 0
+0.85 0.98 0.000 0
+0.88 0.984 0.000 0 /
+
+DENSITY
+ 53.66 64.49 0.0533 /
+
+PVDG
+14.700 166.666 0.008000
+264.70 12.0930 0.009600
+514.70 6.27400 0.011200
+1014.7 3.19700 0.014000
+2014.7 1.61400 0.018900
+2514.7 1.29400 0.020800
+3014.7 1.08000 0.022800
+4014.7 0.81100 0.026800
+5014.7 0.64900 0.030900
+9014.7 0.38600 0.047000 /
+
+PVTO
+0.0010 14.7 1.0620 1.0400 /
+0.0905 264.7 1.1500 0.9750 /
+0.1800 514.7 1.2070 0.9100 /
+0.3710 1014.7 1.2950 0.8300 /
+0.6360 2014.7 1.4350 0.6950 /
+0.7750 2514.7 1.5000 0.6410 /
+0.9300 3014.7 1.5650 0.5940 /
+1.2700 4014.7 1.6950 0.5100
+ 9014.7 1.5790 0.7400 /
+1.6180 5014.7 1.8270 0.4490
+ 9014.7 1.7370 0.6310 /
+/
+
+SOLUTION
+
+SWAT
+ 100*0.0 /
+
+SGAS
+ 100*0.0 /
+
+PRESSURE
+ 100*300.0 /
+
+SUMMARY
+
+SCHEDULE
diff --git a/tests/capillary.DATA b/tests/data/equil_capillary.DATA
similarity index 92%
rename from tests/capillary.DATA
rename to tests/data/equil_capillary.DATA
index 063db39fe..4289102e5 100644
--- a/tests/capillary.DATA
+++ b/tests/data/equil_capillary.DATA
@@ -11,7 +11,7 @@ OIL
GAS
DIMENS
-40 40 40 /
+1 1 20 /
TABDIMS
1 1 40 20 1 20 /
@@ -27,16 +27,22 @@ GRID
-- specify a fake one...
DXV
-40*1 /
+1*1 /
DYV
-40*1 /
+1*1 /
DZV
-40*1 /
+20*5 /
DEPTHZ
-1681*123.456 /
+4*0.0 /
+
+PORO
+ 20*0.3 /
+
+PERMX
+ 20*500 /
-------------------------------------
PROPS
diff --git a/tests/capillary_overlap.DATA b/tests/data/equil_capillary_overlap.DATA
similarity index 100%
rename from tests/capillary_overlap.DATA
rename to tests/data/equil_capillary_overlap.DATA
diff --git a/tests/capillarySwatinit.DATA b/tests/data/equil_capillary_swatinit.DATA
similarity index 100%
rename from tests/capillarySwatinit.DATA
rename to tests/data/equil_capillary_swatinit.DATA
diff --git a/tests/deadfluids.DATA b/tests/data/equil_deadfluids.DATA
similarity index 90%
rename from tests/deadfluids.DATA
rename to tests/data/equil_deadfluids.DATA
index 04264774e..e0d63cb37 100644
--- a/tests/deadfluids.DATA
+++ b/tests/data/equil_deadfluids.DATA
@@ -7,36 +7,43 @@
RUNSPEC
WATER
-OIL
GAS
+OIL
+
+METRIC
DIMENS
-3 3 3 /
+1 1 10 /
TABDIMS
1 1 40 20 1 20 /
-
+
EQLDIMS
-- NTEQUL
1 /
--------------------------------------
GRID
-- Opm::EclipseState assumes that _some_ grid gets defined, so let's
-- specify a fake one...
DXV
-1 2 3 /
+1*1 /
DYV
-4 5 6 /
+1*1 /
DZV
-7 8 9 /
+10*1 /
-DEPTHZ
-16*123.456 /
+TOPS
+1*0.0 /
+
+PORO
+ 10*0.3 /
+
+PERMX
+ 10*500 /
-------------------------------------
PROPS
diff --git a/tests/equil_livegas.DATA b/tests/data/equil_livegas.DATA
similarity index 100%
rename from tests/equil_livegas.DATA
rename to tests/data/equil_livegas.DATA
diff --git a/tests/equil_liveoil.DATA b/tests/data/equil_liveoil.DATA
similarity index 100%
rename from tests/equil_liveoil.DATA
rename to tests/data/equil_liveoil.DATA
diff --git a/tests/equil_rsvd_and_rvvd.DATA b/tests/data/equil_rsvd_and_rvvd.DATA
similarity index 100%
rename from tests/equil_rsvd_and_rvvd.DATA
rename to tests/data/equil_rsvd_and_rvvd.DATA
diff --git a/tests/test_equil.cpp b/tests/test_equil.cc
similarity index 57%
rename from tests/test_equil.cpp
rename to tests/test_equil.cc
index 5e33ae536..80a7616d3 100644
--- a/tests/test_equil.cpp
+++ b/tests/test_equil.cc
@@ -1,45 +1,38 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
/*
- Copyright 2014 SINTEF ICT, Applied Mathematics.
-*/
+ 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 .
+
+ Consult the COPYING file in the top-level source directory of this
+ module for the precise wording of the license and the list of
+ copyright holders.
+*/
#include "config.h"
-/* --- Boost.Test boilerplate --- */
-#if HAVE_DYNAMIC_BOOST_TEST
-#define BOOST_TEST_DYN_LINK
-#endif
-
-#define NVERBOSE // Suppress own messages when throw()ing
-
-#define BOOST_TEST_MODULE UnitsTest
-#include
-#include
-
-/* --- our own headers --- */
-
-#include
+#include
+#include
+#include
#include
-#include
#include
-#include
-#include
-
-#include
-#include
-#include
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
#include
+#include
+
#include
#include
#include
@@ -48,28 +41,56 @@
#include
#include
#include
+#include
+#define CHECK(value, expected) \
+ { \
+ if ((value) != (expected)) \
+ std::abort(); \
+ }
-typedef Opm::FluidSystems::BlackOil FluidSystem;
-// Forward declaring the MaterialLawManager template.
-typedef Opm::ThreePhaseMaterialTraits MaterialTraits;
-typedef Opm::EclMaterialLawManager MaterialLawManager;
+#define CHECK_CLOSE(value, expected, reltol) \
+ { \
+ if (std::fabs((expected) - (value)) > 1e-14 && \
+ std::fabs(((expected) - (value))/((expected) + (value))) > reltol) \
+ std::abort(); \
+ }
+#define REQUIRE(cond) \
+ { \
+ if (!(cond)) \
+ std::abort(); \
+ }
-#define CHECK(value, expected, reltol) \
-{ \
- if (std::fabs((expected)) < 1.e-14) \
- BOOST_CHECK_SMALL((value), (reltol)); \
- else \
- BOOST_CHECK_CLOSE((value), (expected), (reltol)); \
+namespace Ewoms {
+namespace Properties {
+NEW_TYPE_TAG(TestEquilTypeTag, INHERITS_FROM(BlackOilModel, EclBaseProblem));
+}}
+
+template
+std::unique_ptr
+initSimulator(const char *filename)
+{
+ typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
+
+ std::string filenameArg = "--ecl-deck-file-name=";
+ filenameArg += filename;
+
+ const char* argv[] = {
+ "test_equil",
+ filenameArg.c_str()
+ };
+
+ Ewoms::setupParameters_(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/false);
+
+ return std::unique_ptr(new Simulator);
}
-namespace
+template
+static void initDefaultFluidSystem()
{
-static void initDefaultFluidSystem() {
+ typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
+
std::vector > Bo = {
{ 101353, 1. },
{ 6.21542e+07, 1 }
@@ -130,13 +151,11 @@ static void initDefaultFluidSystem() {
FluidSystem::setWaterPvt(std::move(waterPvt));
FluidSystem::initEnd();
}
-}
-
-BOOST_AUTO_TEST_SUITE ()
static Opm::EquilRecord mkEquilRecord( double datd, double datp,
double zwoc, double pcow_woc,
- double zgoc, double pcgo_goc ) {
+ double zgoc, double pcgo_goc )
+{
using namespace Opm;
DeckItem dd( "datdep", double() );
@@ -190,71 +209,74 @@ static Opm::EquilRecord mkEquilRecord( double datd, double datp,
return EquilRecord( rec );
}
-BOOST_AUTO_TEST_CASE (PhasePressure)
+void test_PhasePressure()
{
typedef std::vector PVal;
typedef std::vector PPress;
- std::shared_ptr
- G(create_grid_cart3d(10, 1, 10), destroy_grid);
-
auto record = mkEquilRecord( 0, 1e5, 5, 0, 0, 0 );
- initDefaultFluidSystem();
+ typedef TTAG(TestEquilTypeTag) TypeTag;
+ typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
+ auto simulator = initSimulator("data/equil_base.DATA");
+ initDefaultFluidSystem();
- Opm::EQUIL::EquilReg
+ Ewoms::EQUIL::EquilReg
region(record,
- std::make_shared(),
- std::make_shared(),
+ std::make_shared(),
+ std::make_shared(),
0);
- std::vector cells(G->number_of_cells);
+ std::vector cells(simulator->gridManager().grid().size(0));
std::iota(cells.begin(), cells.end(), 0);
const double grav = 10;
- const PPress ppress = Opm::EQUIL::phasePressures(*G, region, cells, grav);
+ const PPress ppress = Ewoms::EQUIL::phasePressures(simulator->gridManager().grid(), region, cells, grav);
- const int first = 0, last = G->number_of_cells - 1;
+ const int first = 0, last = simulator->gridManager().grid().size(0) - 1;
const double reltol = 1.0e-8;
- BOOST_CHECK_CLOSE(ppress[0][first] , 90e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[0][last ] , 180e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[1][first] , 103.5e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[1][last ] , 166.5e3 , reltol);
+ CHECK_CLOSE(ppress[0][first] , 90e3 , reltol);
+ CHECK_CLOSE(ppress[0][last ] , 180e3 , reltol);
+ CHECK_CLOSE(ppress[1][first] , 103.5e3 , reltol);
+ CHECK_CLOSE(ppress[1][last ] , 166.5e3 , reltol);
}
-BOOST_AUTO_TEST_CASE (CellSubset)
+void test_CellSubset()
{
typedef std::vector PVal;
typedef std::vector PPress;
- std::shared_ptr
- G(create_grid_cart3d(10, 1, 10), destroy_grid);
-
- initDefaultFluidSystem();
+ typedef TTAG(TestEquilTypeTag) TypeTag;
+ typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
+ auto simulator = initSimulator("data/equil_base.DATA");
+ const auto& eclipseState = simulator->gridManager().eclState();
+ Opm::GridManager gm(eclipseState.getInputGrid());
+ const UnstructuredGrid& grid = *(gm.c_grid());
+ initDefaultFluidSystem();
Opm::EquilRecord record[] = { mkEquilRecord( 0, 1e5, 2.5, -0.075e5, 0, 0 ),
mkEquilRecord( 5, 1.35e5, 7.5, -0.225e5, 5, 0 ) };
- Opm::EQUIL::EquilReg region[] =
+ Ewoms::EQUIL::EquilReg region[] =
{
- Opm::EQUIL::EquilReg(record[0],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[0],
+ std::make_shared(),
+ std::make_shared(),
0)
,
- Opm::EQUIL::EquilReg(record[0],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[0],
+ std::make_shared(),
+ std::make_shared(),
0)
,
- Opm::EQUIL::EquilReg(record[1],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[1],
+ std::make_shared(),
+ std::make_shared(),
0)
,
- Opm::EQUIL::EquilReg(record[1],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[1],
+ std::make_shared(),
+ std::make_shared(),
0)
};
@@ -263,22 +285,22 @@ BOOST_AUTO_TEST_CASE (CellSubset)
for (std::size_t d = 1; d < 3; ++d) { ncoarse *= cdim[d]; }
std::vector< std::vector > cells(ncoarse);
- for (int c = 0; c < G->number_of_cells; ++c) {
+ for (int c = 0; c < simulator->gridManager().grid().size(0); ++c) {
int ci = c;
- const int i = ci % G->cartdims[0]; ci /= G->cartdims[0];
- const int j = ci % G->cartdims[1];
- const int k = ci / G->cartdims[1];
+ const int i = ci % grid.cartdims[0]; ci /= grid.cartdims[0];
+ const int j = ci % grid.cartdims[1];
+ const int k = ci / grid.cartdims[1];
- const int ic = (i / (G->cartdims[0] / cdim[0]));
- const int jc = (j / (G->cartdims[1] / cdim[1]));
- const int kc = (k / (G->cartdims[2] / cdim[2]));
+ const int ic = (i / (grid.cartdims[0] / cdim[0]));
+ const int jc = (j / (grid.cartdims[1] / cdim[1]));
+ const int kc = (k / (grid.cartdims[2] / cdim[2]));
const int ix = ic + cdim[0]*(jc + cdim[1]*kc);
assert ((0 <= ix) && (ix < ncoarse));
cells[ix].push_back(c);
}
- PPress ppress(2, PVal(G->number_of_cells, 0));
+ PPress ppress(2, PVal(simulator->gridManager().grid().size(0), 0));
for (std::vector< std::vector >::const_iterator
r = cells.begin(), e = cells.end();
r != e; ++r)
@@ -286,7 +308,7 @@ BOOST_AUTO_TEST_CASE (CellSubset)
const int rno = int(r - cells.begin());
const double grav = 10;
const PPress p =
- Opm::EQUIL::phasePressures(*G, region[rno], *r, grav);
+ Ewoms::EQUIL::phasePressures(simulator->gridManager().grid(), region[rno], *r, grav);
PVal::size_type i = 0;
for (std::vector::const_iterator
@@ -300,54 +322,51 @@ BOOST_AUTO_TEST_CASE (CellSubset)
}
}
- const int first = 0, last = G->number_of_cells - 1;
+ const int first = 0, last = simulator->gridManager().grid().size(0) - 1;
const double reltol = 1.0e-8;
- BOOST_CHECK_CLOSE(ppress[0][first] , 105e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[0][last ] , 195e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[1][first] , 103.5e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[1][last ] , 166.5e3 , reltol);
+ CHECK_CLOSE(ppress[0][first] , 105e3 , reltol);
+ CHECK_CLOSE(ppress[0][last ] , 195e3 , reltol);
+ CHECK_CLOSE(ppress[1][first] , 103.5e3 , reltol);
+ CHECK_CLOSE(ppress[1][last ] , 166.5e3 , reltol);
}
-
-
-
-BOOST_AUTO_TEST_CASE (RegMapping)
+void test_RegMapping()
{
typedef std::vector PVal;
typedef std::vector PPress;
- std::shared_ptr
- G(create_grid_cart3d(10, 1, 10), destroy_grid);
-
Opm::EquilRecord record[] = { mkEquilRecord( 0, 1e5, 2.5, -0.075e5, 0, 0 ),
mkEquilRecord( 5, 1.35e5, 7.5, -0.225e5, 5, 0 ) };
- initDefaultFluidSystem();
+ typedef TTAG(TestEquilTypeTag) TypeTag;
+ typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
+ auto simulator = initSimulator("data/equil_base.DATA");
+ initDefaultFluidSystem();
- Opm::EQUIL::EquilReg region[] =
+ Ewoms::EQUIL::EquilReg region[] =
{
- Opm::EQUIL::EquilReg(record[0],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[0],
+ std::make_shared(),
+ std::make_shared(),
0)
,
- Opm::EQUIL::EquilReg(record[0],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[0],
+ std::make_shared(),
+ std::make_shared(),
0)
,
- Opm::EQUIL::EquilReg(record[1],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[1],
+ std::make_shared(),
+ std::make_shared(),
0)
,
- Opm::EQUIL::EquilReg(record[1],
- std::make_shared(),
- std::make_shared(),
+ Ewoms::EQUIL::EquilReg(record[1],
+ std::make_shared(),
+ std::make_shared(),
0)
};
- std::vector eqlnum(G->number_of_cells);
+ std::vector eqlnum(simulator->gridManager().grid().size(0));
// [ 0 1; 2 3]
{
for (int i = 0; i < 5; ++i) {
@@ -368,16 +387,16 @@ BOOST_AUTO_TEST_CASE (RegMapping)
}
}
- Opm::RegionMapping<> eqlmap(eqlnum);
+ Ewoms::RegionMapping<> eqlmap(eqlnum);
- PPress ppress(2, PVal(G->number_of_cells, 0));
+ PPress ppress(2, PVal(simulator->gridManager().grid().size(0), 0));
for (const auto& r : eqlmap.activeRegions()) {
const auto& rng = eqlmap.cells(r);
const int rno = r;
const double grav = 10;
const PPress p =
- Opm::EQUIL::phasePressures(*G, region[rno], rng, grav);
+ Ewoms::EQUIL::phasePressures(simulator->gridManager().grid(), region[rno], rng, grav);
PVal::size_type i = 0;
for (const auto& c : rng) {
@@ -390,76 +409,47 @@ BOOST_AUTO_TEST_CASE (RegMapping)
}
}
- const int first = 0, last = G->number_of_cells - 1;
+ const int first = 0, last = simulator->gridManager().grid().size(0) - 1;
const double reltol = 1.0e-8;
- BOOST_CHECK_CLOSE(ppress[0][first] , 105e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[0][last ] , 195e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[1][first] , 103.5e3 , reltol);
- BOOST_CHECK_CLOSE(ppress[1][last ] , 166.5e3 , reltol);
+ CHECK_CLOSE(ppress[0][first] , 105e3 , reltol);
+ CHECK_CLOSE(ppress[0][last ] , 195e3 , reltol);
+ CHECK_CLOSE(ppress[1][first] , 103.5e3 , reltol);
+ CHECK_CLOSE(ppress[1][last ] , 166.5e3 , reltol);
}
-
-
-BOOST_AUTO_TEST_CASE (DeckAllDead)
+void test_DeckAllDead()
{
- std::shared_ptr
- grid(create_grid_cart3d(1, 1, 10), destroy_grid);
- Opm::ParseContext parseContext;
- Opm::Parser parser;
- Opm::Deck deck = parser.parseFile("deadfluids.DATA" , parseContext);
- Opm::EclipseState eclipseState(deck, parseContext); // Create material law manager.
+ typedef TTAG(TestEquilTypeTag) TypeTag;
+ auto simulator = initSimulator("data/equil_deadfluids.DATA");
+ const auto& eclipseState = simulator->gridManager().eclState();
+ Opm::GridManager gm(eclipseState.getInputGrid());
+ const UnstructuredGrid& grid = *(gm.c_grid());
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid->number_of_cells, grid->global_cell);
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
-
- typedef Opm::FluidSystems::BlackOil FluidSystem;
-
- // Initialize the fluid system
- FluidSystem::initFromDeck(deck, eclipseState);
-
- Opm::EQUIL::DeckDependent::InitialStateComputer comp(materialLawManager, eclipseState, *grid, 10.0);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer comp(*simulator->problem().materialLawManager(), eclipseState, simulator->gridManager().grid(), 10.0);
const auto& pressures = comp.press();
- BOOST_REQUIRE(pressures.size() == 3);
- BOOST_REQUIRE(int(pressures[0].size()) == grid->number_of_cells);
+ REQUIRE(pressures.size() == 3);
+ REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
- const int first = 0, last = grid->number_of_cells - 1;
+ const int first = 0, last = grid.number_of_cells - 1;
// The relative tolerance is too loose to be very useful,
// but the answer we are checking is the result of an ODE
// solver, and it is unclear if we should check it against
// the true answer or something else.
const double reltol = 1.0e-3;
- BOOST_CHECK_CLOSE(pressures[0][first] , 1.496329839e7 , reltol);
- BOOST_CHECK_CLOSE(pressures[0][last ] , 1.504526940e7 , reltol);
- BOOST_CHECK_CLOSE(pressures[1][last] , 1.504526940e7 , reltol);
+ CHECK_CLOSE(pressures[0][first] , 1.496329839e7 , reltol);
+ CHECK_CLOSE(pressures[0][last ] , 1.504526940e7 , reltol);
+ CHECK_CLOSE(pressures[1][last] , 1.504526940e7 , reltol);
}
-
-
-BOOST_AUTO_TEST_CASE (CapillaryInversion)
+void test_CapillaryInversion()
{
// Test setup.
- Opm::GridManager gm(1, 1, 40, 1.0, 1.0, 2.5);
- const UnstructuredGrid& grid = *(gm.c_grid());
- Opm::Parser parser;
- Opm::ParseContext parseContext;
- Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext);
- Opm::EclipseState eclipseState(deck , parseContext);
+ typedef typename TTAG(TestEquilTypeTag) TypeTag;
+ typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
+ typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
+ typedef typename GET_PROP(TypeTag, MaterialLaw)::EclMaterialLawManager MaterialLawManager;
+ auto simulator = initSimulator("data/equil_capillary.DATA");
- // Create material law manager.
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
-
- typedef Opm::FluidSystems::BlackOil FluidSystem;
- typedef MaterialLawManager::MaterialLaw MaterialLaw;
-
- if (!FluidSystem::isInitialized()) {
- // make sure that we don't initialize the fluid system twice
- FluidSystem::initFromDeck(deck, eclipseState);
- }
// Test the capillary inversion for oil-water.
const int cell = 0;
const double reltol = 1.0e-7;
@@ -468,10 +458,10 @@ BOOST_AUTO_TEST_CASE (CapillaryInversion)
const bool increasing = false;
const std::vector pc = { 10.0e5, 0.5e5, 0.4e5, 0.3e5, 0.2e5, 0.1e5, 0.099e5, 0.0e5, -10.0e5 };
const std::vector s = { 0.2, 0.2, 0.2, 0.466666666666, 0.733333333333, 1.0, 1.0, 1.0, 1.0 };
- BOOST_REQUIRE(pc.size() == s.size());
+ REQUIRE(pc.size() == s.size());
for (size_t i = 0; i < pc.size(); ++i) {
- const double s_computed = Opm::EQUIL::satFromPc(materialLawManager, phase, cell, pc[i], increasing);
- BOOST_CHECK_CLOSE(s_computed, s[i], reltol);
+ const double s_computed = Ewoms::EQUIL::satFromPc(*simulator->problem().materialLawManager(), phase, cell, pc[i], increasing);
+ CHECK_CLOSE(s_computed, s[i], reltol);
}
}
@@ -481,10 +471,10 @@ BOOST_AUTO_TEST_CASE (CapillaryInversion)
const bool increasing = true;
const std::vector pc = { 10.0e5, 0.6e5, 0.5e5, 0.4e5, 0.3e5, 0.2e5, 0.1e5, 0.0e5, -10.0e5 };
const std::vector s = { 0.8, 0.8, 0.8, 0.533333333333, 0.266666666666, 0.0, 0.0, 0.0, 0.0 };
- BOOST_REQUIRE(pc.size() == s.size());
+ REQUIRE(pc.size() == s.size());
for (size_t i = 0; i < pc.size(); ++i) {
- const double s_computed = Opm::EQUIL::satFromPc(materialLawManager, phase, cell, pc[i], increasing);
- BOOST_CHECK_CLOSE(s_computed, s[i], reltol);
+ const double s_computed = Ewoms::EQUIL::satFromPc(*simulator->problem().materialLawManager(), phase, cell, pc[i], increasing);
+ CHECK_CLOSE(s_computed, s[i], reltol);
}
}
@@ -494,41 +484,27 @@ BOOST_AUTO_TEST_CASE (CapillaryInversion)
const int gas = 2;
const std::vector pc = { 0.9e5, 0.8e5, 0.6e5, 0.4e5, 0.3e5 };
const std::vector s = { 0.2, 0.333333333333, 0.6, 0.866666666666, 1.0 };
- BOOST_REQUIRE(pc.size() == s.size());
+ REQUIRE(pc.size() == s.size());
for (size_t i = 0; i < pc.size(); ++i) {
- const double s_computed = Opm::EQUIL::satFromSumOfPcs(materialLawManager, water, gas, cell, pc[i]);
- BOOST_CHECK_CLOSE(s_computed, s[i], reltol);
+ const double s_computed = Ewoms::EQUIL::satFromSumOfPcs(*simulator->problem().materialLawManager(), water, gas, cell, pc[i]);
+ CHECK_CLOSE(s_computed, s[i], reltol);
}
}
}
-
-
-BOOST_AUTO_TEST_CASE (DeckWithCapillary)
+void test_DeckWithCapillary()
{
- Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
+ typedef typename TTAG(TestEquilTypeTag) TypeTag;
+ auto simulator = initSimulator("data/equil_capillary.DATA");
+ auto& eclipseState = simulator->gridManager().eclState();
+ Opm::GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *(gm.c_grid());
- Opm::Parser parser;
- Opm::ParseContext parseContext;
- Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext);
- Opm::EclipseState eclipseState(deck , parseContext);
- // Create material law manager.
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
-
- typedef Opm::FluidSystems::BlackOil FluidSystem;
-
- // Initialize the fluid system
- FluidSystem::initFromDeck(deck, eclipseState);
-
- Opm::EQUIL::DeckDependent::InitialStateComputer comp(materialLawManager, eclipseState, grid, 10.0);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer comp(*simulator->problem().materialLawManager(), eclipseState, simulator->gridManager().grid(), 10.0);
const auto& pressures = comp.press();
- BOOST_REQUIRE(pressures.size() == 3);
- BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
+ REQUIRE(pressures.size() == 3);
+ REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
const int first = 0, last = grid.number_of_cells - 1;
// The relative tolerance is too loose to be very useful,
@@ -536,9 +512,9 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillary)
// solver, and it is unclear if we should check it against
// the true answer or something else.
const double reltol = 1.0e-6;
- BOOST_CHECK_CLOSE(pressures[0][first] , 1.469769063e7 , reltol);
- BOOST_CHECK_CLOSE(pressures[0][last ] , 15452880.328284413 , reltol);
- BOOST_CHECK_CLOSE(pressures[1][last] , 15462880.328284413 , reltol);
+ CHECK_CLOSE(pressures[0][first] , 1.469769063e7 , reltol);
+ CHECK_CLOSE(pressures[0][last ] , 15452880.328284413 , reltol);
+ CHECK_CLOSE(pressures[1][last] , 15462880.328284413 , reltol);
const auto& sats = comp.saturation();
const std::vector s[3]{
@@ -547,39 +523,25 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillary)
{ 0.8, 0.8, 0.8, 0.79265183888768165, 0.0072772917691866562, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
for (int phase = 0; phase < 3; ++phase) {
- BOOST_REQUIRE(sats[phase].size() == s[phase].size());
+ REQUIRE(sats[phase].size() == s[phase].size());
for (size_t i = 0; i < s[phase].size(); ++i) {
- CHECK(sats[phase][i], s[phase][i], reltol);
+ CHECK_CLOSE(sats[phase][i], s[phase][i], reltol);
}
}
}
-
-
-BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap)
+void test_DeckWithCapillaryOverlap()
{
- Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
+ typedef typename TTAG(TestEquilTypeTag) TypeTag;
+ auto simulator = initSimulator("data/equil_capillary_overlap.DATA");
+ const auto& eclipseState = simulator->gridManager().eclState();
+ Opm::GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *(gm.c_grid());
- Opm::Parser parser;
- Opm::ParseContext parseContext;
- Opm::Deck deck = parser.parseFile("capillary_overlap.DATA" , parseContext);
- Opm::EclipseState eclipseState(deck , parseContext);
- // Create material law manager.
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
- typedef Opm::FluidSystems::BlackOil FluidSystem;
-
- // Initialize the fluid system
- FluidSystem::initFromDeck(deck, eclipseState);
-
-
- Opm::EQUIL::DeckDependent::InitialStateComputer comp(materialLawManager, eclipseState, grid, 9.80665);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer comp(*simulator->problem().materialLawManager(), eclipseState, simulator->gridManager().grid(), 9.80665);
const auto& pressures = comp.press();
- BOOST_REQUIRE(pressures.size() == 3);
- BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
+ REQUIRE(pressures.size() == 3);
+ REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
const int first = 0, last = grid.number_of_cells - 1;
// The relative tolerance is too loose to be very useful,
@@ -588,14 +550,14 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap)
// the true answer or something else.
const double reltol = 1.0e-6;
const double reltol_ecl = 1.0;
- BOOST_CHECK_CLOSE(pressures[0][first], 1.48324e+07, reltol_ecl); // eclipse
- BOOST_CHECK_CLOSE(pressures[0][last], 1.54801e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][first], 1.49224e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][last], 1.54901e+07, reltol_ecl);
-
- BOOST_CHECK_CLOSE(pressures[0][first] , 14832467.14, reltol); // opm
- BOOST_CHECK_CLOSE(pressures[0][last ] , 15479883.47, reltol);
- BOOST_CHECK_CLOSE(pressures[1][last ] , 15489883.47, reltol);
+ CHECK_CLOSE(pressures[0][first], 1.48324e+07, reltol_ecl); // eclipse
+ CHECK_CLOSE(pressures[0][last], 1.54801e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][first], 1.49224e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][last], 1.54901e+07, reltol_ecl);
+
+ CHECK_CLOSE(pressures[0][first] , 14832467.14, reltol); // opm
+ CHECK_CLOSE(pressures[0][last ] , 15479883.47, reltol);
+ CHECK_CLOSE(pressures[1][last ] , 15489883.47, reltol);
const auto& sats = comp.saturation();
// std::cout << "Saturations:\n";
@@ -605,52 +567,41 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap)
// }
// std::cout << std::endl;
// }
-
+
const std::vector s_ecl[3]{// eclipse
{ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.22874042, 0.53397995, 0.78454906, 0.91542006, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20039, 0.08458, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.77125955, 0.46602005, 0.015063271, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
- const std::vector s_opm[3]{ // opm
+ const std::vector s_opm[3]{ // opm
{ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.22892931226886132, 0.53406457830052489, 0.78457075254244724, 0.91539712466977541, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20023624994125844, 0.084602875330224592, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.77107068773113863, 0.46593542169947511, 0.015192997516294321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
for (int phase = 0; phase < 3; ++phase) {
- BOOST_REQUIRE(sats[phase].size() == s_opm[phase].size());
+ REQUIRE(sats[phase].size() == s_opm[phase].size());
for (size_t i = 0; i < s_opm[phase].size(); ++i) {
//std::cout << std::setprecision(10) << sats[phase][i] << '\n';
- CHECK(sats[phase][i], s_ecl[phase][i], reltol_ecl);
- CHECK(sats[phase][i], s_opm[phase][i], reltol);
+ CHECK_CLOSE(sats[phase][i], s_ecl[phase][i], reltol_ecl);
+ CHECK_CLOSE(sats[phase][i], s_opm[phase][i], reltol);
}
}
}
-
-
-BOOST_AUTO_TEST_CASE (DeckWithLiveOil)
+void test_DeckWithLiveOil()
{
- Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
+ typedef typename TTAG(TestEquilTypeTag) TypeTag;
+ auto simulator = initSimulator("data/equil_liveoil.DATA");
+ const auto& eclipseState = simulator->gridManager().eclState();
+ Opm::GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *(gm.c_grid());
- Opm::Parser parser;
- Opm::ParseContext parseContext;
- Opm::Deck deck = parser.parseFile("equil_liveoil.DATA" , parseContext);
- Opm::EclipseState eclipseState(deck , parseContext);
- // Create material law manager.
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
-
- typedef Opm::FluidSystems::BlackOil FluidSystem;
// Initialize the fluid system
- FluidSystem::initFromDeck(deck, eclipseState);
- Opm::EQUIL::DeckDependent::InitialStateComputer comp(materialLawManager, eclipseState, grid, 9.80665);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer comp(*simulator->problem().materialLawManager(), eclipseState, simulator->gridManager().grid(), 9.80665);
const auto& pressures = comp.press();
- BOOST_REQUIRE(pressures.size() == 3);
- BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
+ REQUIRE(pressures.size() == 3);
+ REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
const int first = 0, last = grid.number_of_cells - 1;
// The relative tolerance is too loose to be very useful,
@@ -659,15 +610,15 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveOil)
// the true answer or something else.
const double reltol = 1.0e-6;
const double reltol_ecl = 1.0;
- BOOST_CHECK_CLOSE(pressures[0][first], 1.48324e+07, reltol_ecl); // eclipse
- BOOST_CHECK_CLOSE(pressures[0][last], 1.54801e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][first], 1.49224e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][last], 1.54901e+07, reltol_ecl);
-
- BOOST_CHECK_CLOSE(pressures[0][first], 1.483246714e7, reltol); // opm
- BOOST_CHECK_CLOSE(pressures[0][last], 1.547991652e7, reltol);
- BOOST_CHECK_CLOSE(pressures[1][first], 1.492246714e7, reltol);
- BOOST_CHECK_CLOSE(pressures[1][last], 1.548991652e7, reltol);
+ CHECK_CLOSE(pressures[0][first], 1.48324e+07, reltol_ecl); // eclipse
+ CHECK_CLOSE(pressures[0][last], 1.54801e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][first], 1.49224e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][last], 1.54901e+07, reltol_ecl);
+
+ CHECK_CLOSE(pressures[0][first], 1.483246714e7, reltol); // opm
+ CHECK_CLOSE(pressures[0][last], 1.547991652e7, reltol);
+ CHECK_CLOSE(pressures[1][first], 1.492246714e7, reltol);
+ CHECK_CLOSE(pressures[1][last], 1.548991652e7, reltol);
const auto& sats = comp.saturation();
// std::cout << "Saturations:\n";
@@ -682,64 +633,51 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveOil)
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20073, 0.08469, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.77102, 0.46578, 0.01458, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
- const std::vector s_opm[3]{ // opm
+ const std::vector s_opm[3]{ // opm
{ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.22916963446461344, 0.53430490523774521, 0.78471886612242092, 0.91528324362210933, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.20057438297017782, 0.084716756377890667, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.77083036553538653, 0.46569509476225479, 0.014706750907401245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
for (int phase = 0; phase < 3; ++phase) {
- BOOST_REQUIRE(sats[phase].size() == s_opm[phase].size());
+ REQUIRE(sats[phase].size() == s_opm[phase].size());
for (size_t i = 0; i < s_opm[phase].size(); ++i) {
//std::cout << std::setprecision(10) << sats[phase][i] << '\n';
- CHECK(sats[phase][i], s_opm[phase][i], reltol);
- CHECK(sats[phase][i], s_ecl[phase][i], reltol_ecl);
+ CHECK_CLOSE(sats[phase][i], s_opm[phase][i], reltol);
+ CHECK_CLOSE(sats[phase][i], s_ecl[phase][i], reltol_ecl);
}
std::cout << std::endl;
}
-
+
const auto& rs = comp.rs();
const std::vector rs_opm {74.61233568, 74.64905212, 74.68578656, 74.72253902, // opm
74.75930951, 74.79609803, 74.83290459, 74.87519876,
- 74.96925416, 75.09067512, 75.0, 75.0,
- 75.0, 75.0, 75.0, 75.0,
+ 74.96925416, 75.09067512, 75.0, 75.0,
+ 75.0, 75.0, 75.0, 75.0,
75.0, 75.0, 75.0, 75.0};
const std::vector rs_ecl {74.612228, 74.648956, 74.685707, 74.722473, // eclipse
74.759254, 74.796051, 74.832870, 74.875145,
74.969231, 75.090706, 75.000000, 75.000000,
75.000000, 75.000000, 75.000000, 75.000000,
- 75.000000, 75.000000, 75.000000, 75.000000};
+ 75.000000, 75.000000, 75.000000, 75.000000};
for (size_t i = 0; i < rs_opm.size(); ++i) {
//std::cout << std::setprecision(10) << rs[i] << '\n';
- BOOST_CHECK_CLOSE(rs[i], rs_opm[i], reltol);
- BOOST_CHECK_CLOSE(rs[i], rs_ecl[i], reltol_ecl);
+ CHECK_CLOSE(rs[i], rs_opm[i], reltol);
+ CHECK_CLOSE(rs[i], rs_ecl[i], reltol_ecl);
}
}
-
-
-BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
+void test_DeckWithLiveGas()
{
- Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
+ typedef typename TTAG(TestEquilTypeTag) TypeTag;
+ auto simulator = initSimulator("data/equil_livegas.DATA");
+ const auto& eclipseState = simulator->gridManager().eclState();
+ Opm::GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *(gm.c_grid());
- Opm::Parser parser;
- Opm::ParseContext parseContext;
- Opm::Deck deck = parser.parseFile("equil_livegas.DATA" , parseContext);
- Opm::EclipseState eclipseState(deck , parseContext);
- // Create material law manager.
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
- typedef Opm::FluidSystems::BlackOil FluidSystem;
-
- // Initialize the fluid system
- FluidSystem::initFromDeck(deck, eclipseState);
-
- Opm::EQUIL::DeckDependent::InitialStateComputer comp(materialLawManager, eclipseState, grid, 9.80665);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer comp(*simulator->problem().materialLawManager(), eclipseState, simulator->gridManager().grid(), 9.80665);
const auto& pressures = comp.press();
- BOOST_REQUIRE(pressures.size() == 3);
- BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
+ REQUIRE(pressures.size() == 3);
+ REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
const int first = 0, last = grid.number_of_cells - 1;
// The relative tolerance is too loose to be very useful,
@@ -748,15 +686,15 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
// the true answer or something else.
const double reltol = 1.0e-3;
const double reltol_ecl = 1.0;
- BOOST_CHECK_CLOSE(pressures[0][first], 1.48215e+07, reltol_ecl); // eclipse
- BOOST_CHECK_CLOSE(pressures[0][last], 1.54801e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][first], 1.49115e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][last], 1.54901e+07, reltol_ecl);
-
- BOOST_CHECK_CLOSE(pressures[0][first], 1.482150311e7, reltol); // opm
- BOOST_CHECK_CLOSE(pressures[0][last], 1.547988347e7, reltol);
- BOOST_CHECK_CLOSE(pressures[1][first], 1.491150311e7, reltol);
- BOOST_CHECK_CLOSE(pressures[1][last], 1.548988347e7, reltol);
+ CHECK_CLOSE(pressures[0][first], 1.48215e+07, reltol_ecl); // eclipse
+ CHECK_CLOSE(pressures[0][last], 1.54801e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][first], 1.49115e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][last], 1.54901e+07, reltol_ecl);
+
+ CHECK_CLOSE(pressures[0][first], 1.482150311e7, reltol); // opm
+ CHECK_CLOSE(pressures[0][last], 1.547988347e7, reltol);
+ CHECK_CLOSE(pressures[1][first], 1.491150311e7, reltol);
+ CHECK_CLOSE(pressures[1][last], 1.548988347e7, reltol);
const auto& sats = comp.saturation();
// std::cout << "Saturations:\n";
@@ -772,27 +710,27 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.75714386, 0.46130988, 0.032345835, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
- const std::vector s_opm[3]{ // opm
+ const std::vector s_opm[3]{ // opm
{ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.24310545, 0.5388, 0.78458, 0.91540, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.18288667, 0.0846, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.75689455, 0.4612, 0.03253333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
for (int phase = 0; phase < 3; ++phase) {
- BOOST_REQUIRE(sats[phase].size() == s_opm[phase].size());
+ REQUIRE(sats[phase].size() == s_opm[phase].size());
for (size_t i = 0; i < s_opm[phase].size(); ++i) {
//std::cout << std::setprecision(10) << sats[phase][i] << '\n';
- CHECK(sats[phase][i], s_opm[phase][i], 100.*reltol);
- CHECK(sats[phase][i], s_ecl[phase][i], reltol_ecl);
+ CHECK_CLOSE(sats[phase][i], s_opm[phase][i], 100.*reltol);
+ CHECK_CLOSE(sats[phase][i], s_ecl[phase][i], reltol_ecl);
}
std::cout << std::endl;
}
-
+
const auto& rv = comp.rv();
const std::vector rv_opm { // opm
2.4884509e-4, 2.4910378e-4, 2.4936267e-4, 2.4962174e-4,
- 2.4988100e-4, 2.5014044e-4, 2.5040008e-4, 2.5065990e-4,
- 2.5091992e-4, 2.5118012e-4, 2.5223082e-4, 2.5105e-4,
- 2.5105e-4, 2.5105e-4, 2.5105e-4, 2.5105e-4,
+ 2.4988100e-4, 2.5014044e-4, 2.5040008e-4, 2.5065990e-4,
+ 2.5091992e-4, 2.5118012e-4, 2.5223082e-4, 2.5105e-4,
+ 2.5105e-4, 2.5105e-4, 2.5105e-4, 2.5105e-4,
2.5105e-4, 2.5105e-4, 2.5105e-4, 2.5105e-4};
const std::vector rv_ecl { // eclipse
@@ -801,36 +739,25 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
0.25091995E-03, 0.25118008E-03, 0.25223137E-03, 0.25104999E-03,
0.25104999E-03, 0.25104999E-03, 0.25104999E-03, 0.25104999E-03,
0.25104999E-03, 0.25104999E-03, 0.25104999E-03, 0.25104999E-03};
-
+
for (size_t i = 0; i < rv_opm.size(); ++i) {
- CHECK(rv[i], rv_opm[i], reltol);
- CHECK(rv[i], rv_ecl[i], reltol_ecl);
+ CHECK_CLOSE(rv[i], rv_opm[i], reltol);
+ CHECK_CLOSE(rv[i], rv_ecl[i], reltol_ecl);
}
}
-BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
+void test_DeckWithRSVDAndRVVD()
{
- Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
+ typedef typename TTAG(TestEquilTypeTag) TypeTag;
+ auto simulator = initSimulator("data/equil_rsvd_and_rvvd.DATA");
+ const auto& eclipseState = simulator->gridManager().eclState();
+ Opm::GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *(gm.c_grid());
- Opm::ParseContext parseContext;
- Opm::Parser parser;
- Opm::Deck deck = parser.parseFile("equil_rsvd_and_rvvd.DATA", parseContext);
- Opm::EclipseState eclipseState(deck , parseContext);
- // Create material law manager.
- std::vector compressedToCartesianIdx
- = Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
- MaterialLawManager materialLawManager = MaterialLawManager();
- materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
- typedef Opm::FluidSystems::BlackOil FluidSystem;
-
- // Initialize the fluid system
- FluidSystem::initFromDeck(deck, eclipseState);
-
- Opm::EQUIL::DeckDependent::InitialStateComputer comp(materialLawManager, eclipseState, grid, 9.80665);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer comp(*simulator->problem().materialLawManager(), eclipseState, simulator->gridManager().grid(), 9.80665);
const auto& pressures = comp.press();
- BOOST_REQUIRE(pressures.size() == 3);
- BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
+ REQUIRE(pressures.size() == 3);
+ REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
const int first = 0, last = grid.number_of_cells - 1;
// The relative tolerance is too loose to be very useful,
@@ -839,15 +766,15 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
// the true answer or something else.
const double reltol = 1.0e-6;
const double reltol_ecl = 1.0;
- BOOST_CHECK_CLOSE(pressures[0][first], 1.48350e+07, reltol_ecl); // eclipse
- BOOST_CHECK_CLOSE(pressures[0][last], 1.54794e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][first], 1.49250e+07, reltol_ecl);
- BOOST_CHECK_CLOSE(pressures[1][last], 1.54894e+07, reltol_ecl);
-
- BOOST_CHECK_CLOSE(pressures[0][first], 1.483499660e7, reltol); // opm
- BOOST_CHECK_CLOSE(pressures[0][last], 1.547924516e7, reltol);
- BOOST_CHECK_CLOSE(pressures[1][first], 1.492499660e7, reltol);
- BOOST_CHECK_CLOSE(pressures[1][last], 1.548924516e7, reltol);
+ CHECK_CLOSE(pressures[0][first], 1.48350e+07, reltol_ecl); // eclipse
+ CHECK_CLOSE(pressures[0][last], 1.54794e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][first], 1.49250e+07, reltol_ecl);
+ CHECK_CLOSE(pressures[1][last], 1.54894e+07, reltol_ecl);
+
+ CHECK_CLOSE(pressures[0][first], 1.483499660e7, reltol); // opm
+ CHECK_CLOSE(pressures[0][last], 1.547924516e7, reltol);
+ CHECK_CLOSE(pressures[1][first], 1.492499660e7, reltol);
+ CHECK_CLOSE(pressures[1][last], 1.548924516e7, reltol);
const auto& sats = comp.saturation();
// std::cout << "Saturations:\n";
@@ -863,22 +790,22 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.77793652, 0.47128031, 0.021931054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
- const std::vector s_opm[3]{ // opm
+ const std::vector s_opm[3]{ // opm
{ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.22231423543119974, 0.52882640735211706, 0.78152142505479982, 0.91816512259416283, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.19636279642563928, 0.08183487740583717, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.77768576456880023, 0.47117359264788294, 0.022115778519560897, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
-
+
for (int phase = 0; phase < 3; ++phase) {
- BOOST_REQUIRE(sats[phase].size() == s_opm[phase].size());
+ REQUIRE(sats[phase].size() == s_opm[phase].size());
for (size_t i = 0; i < s_opm[phase].size(); ++i) {
//std::cout << std::setprecision(10) << sats[phase][i] << '\n';
- CHECK(sats[phase][i], s_opm[phase][i], reltol);
- CHECK(sats[phase][i], s_ecl[phase][i], reltol_ecl);
+ CHECK_CLOSE(sats[phase][i], s_opm[phase][i], reltol);
+ CHECK_CLOSE(sats[phase][i], s_ecl[phase][i], reltol_ecl);
}
std::cout << std::endl;
}
-
+
const auto& rs = comp.rs();
const std::vector rs_opm { // opm
74.62498302, 74.65959041, 74.69438035, 74.72935336,
@@ -893,13 +820,13 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
74.968628, 75.088951, 52.500000, 57.500000,
62.500000, 67.500000, 72.500000, 76.168388,
76.349953, 76.531532, 76.713142, 76.894775,};
-
+
const auto& rv = comp.rv();
const std::vector rv_opm { // opm
2.50e-6, 7.50e-6, 1.25e-5, 1.75e-5,
- 2.25e-5, 2.75e-5, 3.25e-5, 3.75e-5,
- 4.25e-5, 2.51158386e-4, 2.52203372e-4, 5.75e-5,
- 6.25e-5, 6.75e-5, 7.25e-5, 7.75e-5,
+ 2.25e-5, 2.75e-5, 3.25e-5, 3.75e-5,
+ 4.25e-5, 2.51158386e-4, 2.52203372e-4, 5.75e-5,
+ 6.25e-5, 6.75e-5, 7.25e-5, 7.75e-5,
8.25e-5, 8.75e-5, 9.25e-5, 9.75e-5};
const std::vector rv_ecl { // eclipse
@@ -908,23 +835,22 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
0.42500000E-04, 0.25115837E-03, 0.25220393E-03, 0.57500001E-04,
0.62500003E-04, 0.67499997E-04, 0.72499999E-04, 0.77500001E-04,
0.82500002E-04, 0.87499997E-04, 0.92499999E-04, 0.97500000E-04};
-
+
for (size_t i = 0; i < rv_opm.size(); ++i) {
//std::cout << std::setprecision(10) << rs[i] << '\n';
- BOOST_CHECK_CLOSE(rs[i], rs_opm[i], reltol);
- BOOST_CHECK_CLOSE(rs[i], rs_ecl[i], reltol_ecl);
- BOOST_CHECK_CLOSE(rv[i], rv_opm[i], reltol);
- BOOST_CHECK_CLOSE(rv[i], rv_ecl[i], reltol_ecl);
+ CHECK_CLOSE(rs[i], rs_opm[i], reltol);
+ CHECK_CLOSE(rs[i], rs_ecl[i], reltol_ecl);
+ CHECK_CLOSE(rv[i], rv_opm[i], reltol);
+ CHECK_CLOSE(rv[i], rv_ecl[i], reltol_ecl);
}
}
-BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
+void test_DeckWithSwatinit()
{
- //Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
- Opm::Parser parser;
- Opm::ParseContext parseContext;
- Opm::Deck deck = parser.parseFile("capillarySwatinit.DATA" , parseContext);
- Opm::EclipseState eclipseState(deck , parseContext);
+#if 0
+ typedef typename TTAG(TestEquilTypeTag) TypeTag;
+ auto simulator = initSimulator("data/equil_capillary_swatinit.DATA");
+ const auto& eclipseState = simulator->gridManager().eclState();
Opm::GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *(gm.c_grid());
@@ -953,17 +879,17 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
// Adjust oil pressure according to gas saturation and cap pressure
typedef Opm::SimpleModularFluidState SatOnlyFluidState;
+ /*numPhases=*/3,
+ /*numComponents=*/3,
+ FluidSystem,
+ /*storePressure=*/false,
+ /*storeTemperature=*/false,
+ /*storeComposition=*/false,
+ /*storeFugacity=*/false,
+ /*storeSaturation=*/true,
+ /*storeDensity=*/false,
+ /*storeViscosity=*/false,
+ /*storeEnthalpy=*/false> SatOnlyFluidState;
SatOnlyFluidState fluidState;
typedef MaterialLawManager::MaterialLaw MaterialLaw;
@@ -1008,9 +934,9 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
// compute the initial state
// apply swatinit
- Opm::EQUIL::DeckDependent::InitialStateComputer compScaled(materialLawManagerScaled, eclipseState, grid, 9.81, true);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer compScaled(materialLawManagerScaled, eclipseState, simulator->gridManager().grid(), 9.81, true);
// don't apply swatinit
- Opm::EQUIL::DeckDependent::InitialStateComputer compUnscaled(materialLawManager, eclipseState, grid, 9.81, false);
+ Ewoms::EQUIL::DeckDependent::InitialStateComputer compUnscaled(*simulator->problem().materialLawManager(), eclipseState, simulator->gridManager().grid(), 9.81, false);
// compute pc
std::vector pc_scaled(numCells * FluidSystem::numPhases);
@@ -1051,17 +977,38 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
const double reltol = 1.0e-3;
for (int phase = 0; phase < 3; ++phase) {
for (size_t i = 0; i < 20; ++i) {
- CHECK( pc_original[3*i + phase ], pc_unscaled[3*i + phase ], reltol);
- CHECK( pc_scaled_truth[3*i + phase], pc_scaled[3*i + phase ], reltol);
+ CHECK_CLOSE( pc_original[3*i + phase ], pc_unscaled[3*i + phase ], reltol);
+ CHECK_CLOSE( pc_scaled_truth[3*i + phase], pc_scaled[3*i + phase ], reltol);
}
}
for (int phase = 0; phase < 3; ++phase) {
for (size_t i = 0; i < 20; ++i) {
- CHECK(compUnscaled.saturation()[phase][i], s[phase][i], reltol);
- CHECK(compScaled.saturation()[phase][i], swatinit[phase][i], reltol);
+ CHECK_CLOSE(compUnscaled.saturation()[phase][i], s[phase][i], reltol);
+ CHECK_CLOSE(compScaled.saturation()[phase][i], swatinit[phase][i], reltol);
}
}
+#endif
}
-BOOST_AUTO_TEST_SUITE_END()
+int main(int argc, char** argv)
+{
+ Dune::MPIHelper::instance(argc, argv);
+
+ typedef TTAG(TestEquilTypeTag) TypeTag;
+ Ewoms::registerAllParameters_();
+
+ test_PhasePressure();
+ test_CellSubset();
+ test_RegMapping();
+ test_DeckAllDead();
+ test_CapillaryInversion();
+ test_DeckWithCapillary();
+ test_DeckWithCapillaryOverlap();
+ test_DeckWithLiveOil();
+ test_DeckWithLiveGas();
+ test_DeckWithRSVDAndRVVD();
+ //test_DeckWithSwatinit();
+
+ return 0;
+}
diff --git a/tests/test_regionmapping.cpp b/tests/test_regionmapping.cpp
deleted file mode 100644
index 760a719f9..000000000
--- a/tests/test_regionmapping.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- Copyright 2014 SINTEF ICT, Applied Mathematics.
-
- 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 .
-*/
-
-#include "config.h"
-
-/* --- Boost.Test boilerplate --- */
-#if HAVE_DYNAMIC_BOOST_TEST
-#define BOOST_TEST_DYN_LINK
-#endif
-
-#define NVERBOSE // Suppress own messages when throw()ing
-
-#define BOOST_TEST_MODULE RegionMapping
-
-#include
-#include
-#include
-
-/* --- our own headers --- */
-
-#include
-
-#include
-#include