Add simple tests.

This commit is contained in:
Liu Ming 2015-12-02 10:59:13 +08:00
parent 35dff82700
commit bff9920814
2 changed files with 159 additions and 0 deletions

View File

@ -0,0 +1,94 @@
RUNSPEC
TITLE
DIMENS
10 10 3 /
EQLDIMS
/
TABDIMS
/
OIL
GAS
WATER
DISGAS
FIELD
START
1 'JAN' 2015 /
WELLDIMS
2 1 1 2 /
UNIFOUT
GRID
-- -------------------------------------------------------------------------
NOECHO
DX
300*1000 /
DY
300*1000 /
DZ
100*20 100*30 100*50 /
TOPS
100*8325 /
PORO
300*0.3 /
PERMX
100*500 100*50 100*200 /
PERMY
100*500 100*50 100*200 /
PERMZ
100*500 100*50 100*200 /
ECHO
PROPS
-- -------------------------------------------------------------------------
SWOF
0.12 1e-9 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 /
1.00 1.0 0.000 0 /

View File

@ -0,0 +1,65 @@
/*
Copyright 2015 Statoil 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/>.
*/
#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 RelpermDiagnostics
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <opm/core/grid.h>
#include <opm/core/grid/cart_grid.h>
#include <opm/core/grid/GridManager.hpp>
#include <opm/core/props/satfunc/RelpermDiagnostics.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
BOOST_AUTO_TEST_SUITE ()
BOOST_AUTO_TEST_CASE(diagnosis)
{
using namespace Opm;
EclipseStateConstPtr eclState;
ParserPtr parser(new Opm::Parser);
Opm::ParseMode parseMode({{ ParseMode::PARSE_RANDOM_SLASH , InputError::IGNORE },
{ ParseMode::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE},
{ ParseMode::PARSE_RANDOM_TEXT, InputError::IGNORE}
});
Opm::DeckConstPtr deck(parser->parseFile("../tests/relpermDiagnostics.DATA", parseMode));
eclState.reset(new EclipseState(deck, parseMode));
GridManager gm(deck);
const UnstructuredGrid& grid = *gm.c_grid();
std::string logFile = "LOGFILE.txt";
RelpermDiagnostics diagnostics(logFile);
diagnostics.diagnosis(eclState, deck, grid);
auto msg = diagnostics.getMessages();
BOOST_CHECK(!msg.empty());
BOOST_CHECK_EQUAL(msg.size(), 1);
}
BOOST_AUTO_TEST_SUITE_END()