2015-12-01 20:59:13 -06:00
|
|
|
/*
|
|
|
|
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"
|
|
|
|
|
|
|
|
#define NVERBOSE // Suppress own messages when throw()ing
|
|
|
|
|
|
|
|
#define BOOST_TEST_MODULE RelpermDiagnostics
|
2015-12-14 08:25:27 -06:00
|
|
|
|
|
|
|
|
|
|
|
#include <opm/common/utility/platform_dependent/disable_warnings.h>
|
2015-12-01 20:59:13 -06:00
|
|
|
#include <boost/test/unit_test.hpp>
|
2020-04-30 02:47:45 -05:00
|
|
|
#include <boost/version.hpp>
|
|
|
|
#if BOOST_VERSION / 100000 == 1 && BOOST_VERSION / 100 % 1000 < 71
|
2015-12-01 20:59:13 -06:00
|
|
|
#include <boost/test/floating_point_comparison.hpp>
|
2020-04-30 02:47:45 -05:00
|
|
|
#else
|
|
|
|
#include <boost/test/tools/floating_point_comparison.hpp>
|
|
|
|
#endif
|
2015-12-14 08:25:27 -06:00
|
|
|
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
|
2016-03-31 21:49:27 -05:00
|
|
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
2016-05-18 20:47:57 -05:00
|
|
|
#include <opm/common/OpmLog/CounterLog.hpp>
|
2015-12-01 20:59:13 -06:00
|
|
|
|
2021-01-26 07:59:22 -06:00
|
|
|
#include <opm/grid/CpGrid.hpp>
|
|
|
|
#include <dune/grid/common/mcmgmapper.hh>
|
2015-12-01 20:59:13 -06:00
|
|
|
|
|
|
|
#include <opm/core/props/satfunc/RelpermDiagnostics.hpp>
|
2021-12-14 01:30:15 -06:00
|
|
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
|
|
|
#include <opm/input/eclipse/Deck/Deck.hpp>
|
2022-07-26 07:59:09 -05:00
|
|
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
|
|
|
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
|
2015-12-01 20:59:13 -06:00
|
|
|
|
2021-01-26 07:59:22 -06:00
|
|
|
#if HAVE_DUNE_FEM
|
|
|
|
#include <dune/fem/misc/mpimanager.hh>
|
|
|
|
#else
|
|
|
|
#include <dune/common/parallel/mpihelper.hh>
|
|
|
|
#endif
|
|
|
|
|
2015-12-01 20:59:13 -06:00
|
|
|
BOOST_AUTO_TEST_SUITE ()
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(diagnosis)
|
|
|
|
{
|
2021-01-26 07:59:22 -06:00
|
|
|
// MPI setup.
|
|
|
|
int argcDummy = 1;
|
|
|
|
const char *tmp[] = {"test_relpermdiagnostic"};
|
|
|
|
char **argvDummy = const_cast<char**>(tmp);
|
|
|
|
|
|
|
|
#if HAVE_DUNE_FEM
|
|
|
|
Dune::Fem::MPIManager::initialize(argcDummy, argvDummy);
|
|
|
|
#else
|
|
|
|
Dune::MPIHelper::instance(argcDummy, argvDummy);
|
|
|
|
#endif
|
|
|
|
|
2015-12-01 20:59:13 -06:00
|
|
|
using namespace Opm;
|
2016-10-13 09:03:35 -05:00
|
|
|
Parser parser;
|
2018-01-17 04:27:16 -06:00
|
|
|
|
2019-01-07 03:22:47 -06:00
|
|
|
Opm::Deck deck = parser.parseFile("../tests/relpermDiagnostics.DATA");
|
|
|
|
EclipseState eclState(deck);
|
2021-01-26 07:59:22 -06:00
|
|
|
typedef Dune::CpGrid Grid;
|
|
|
|
Grid grid = Grid();
|
2021-04-15 16:36:21 -05:00
|
|
|
grid.processEclipseFormat(&eclState.getInputGrid(),
|
|
|
|
&eclState,
|
2021-04-08 13:47:02 -05:00
|
|
|
/*isPeriodic=*/false,
|
|
|
|
/*flipNormals=*/false,
|
|
|
|
/*clipZ=*/false);
|
2021-01-26 07:59:22 -06:00
|
|
|
|
|
|
|
typedef Dune::CartesianIndexMapper<Grid> CartesianIndexMapper;
|
|
|
|
CartesianIndexMapper cartesianIndexMapper = CartesianIndexMapper(grid);
|
2016-05-18 20:47:57 -05:00
|
|
|
std::shared_ptr<CounterLog> counterLog = std::make_shared<CounterLog>(Log::DefaultMessageTypes);
|
|
|
|
OpmLog::addBackend( "COUNTERLOG" , counterLog );
|
2016-03-31 21:49:27 -05:00
|
|
|
RelpermDiagnostics diagnostics;
|
2021-01-26 07:59:22 -06:00
|
|
|
diagnostics.diagnosis(eclState, cartesianIndexMapper);
|
2016-05-18 20:47:57 -05:00
|
|
|
BOOST_CHECK_EQUAL(1, counterLog->numMessages(Log::MessageType::Warning));
|
2015-12-01 20:59:13 -06:00
|
|
|
}
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|