Tidy Up FlowProblem* Classes

In preparation of enabling the new saturation function consistency
checks.
This commit is contained in:
Bård Skaflestad
2024-10-15 18:09:25 +02:00
parent 585627295f
commit 92efa31c31
3 changed files with 92 additions and 70 deletions

View File

@@ -20,10 +20,20 @@
module for the precise wording of the license and the list of
copyright holders.
*/
#include "config.h"
#define BOOST_TEST_MODULE Equil
#include <boost/test/unit_test.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION / 100000 == 1) && ((BOOST_VERSION / 100) % 1000 < 71)
#include <boost/test/floating_point_comparison.hpp>
#else
#include <boost/test/tools/floating_point_comparison.hpp>
#endif
#include <opm/grid/UnstructuredGrid.h>
#include <opm/grid/GridManager.hpp>
#include <opm/grid/cpgrid/GridHelpers.hpp>
@@ -58,42 +68,37 @@
#include <string>
#include <vector>
#include <boost/test/unit_test.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION / 100000 == 1 && BOOST_VERSION / 100 % 1000 < 71
#include <boost/test/floating_point_comparison.hpp>
#else
#include <boost/test/tools/floating_point_comparison.hpp>
#endif
namespace Opm::Properties {
namespace TTag {
struct TestEquilTypeTag {
using InheritsFrom = std::tuple<FlowBaseProblemBlackoil,
BlackOilModel>;
};
struct TestEquilVapwatTypeTag {
using InheritsFrom = std::tuple<FlowBaseProblemBlackoil,
BlackOilModel>;
};
}
} // namespace TTag
template<class TypeTag>
struct WellModel<TypeTag, TTag::TestEquilTypeTag> {
using type = BlackoilWellModel<TypeTag>;
};
template<class TypeTag>
struct EnableVapwat<TypeTag, TTag::TestEquilTypeTag> {
static constexpr bool value = true;
};
template<class TypeTag>
struct WellModel<TypeTag, TTag::TestEquilVapwatTypeTag> {
using type = BlackoilWellModel<TypeTag>;
};
template<class TypeTag>
struct EnableVapwat<TypeTag, TTag::TestEquilVapwatTypeTag> {
static constexpr bool value = true;
@@ -101,18 +106,19 @@ struct EnableVapwat<TypeTag, TTag::TestEquilVapwatTypeTag> {
} // namespace Opm::Properties
namespace {
template <class TypeTag>
std::unique_ptr<Opm::GetPropType<TypeTag, Opm::Properties::Simulator>>
initSimulator(const char *filename)
{
using Simulator = Opm::GetPropType<TypeTag, Opm::Properties::Simulator>;
std::string filenameArg = "--ecl-deck-file-name=";
filenameArg += filename;
const auto filenameArg = std::string {"--ecl-deck-file-name="} + filename;
const char* argv[] = {
"test_equil",
filenameArg.c_str()
filenameArg.c_str(),
};
Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/false);
@@ -123,7 +129,8 @@ initSimulator(const char *filename)
}
template <class GridView>
static std::vector<std::pair<double,double>> cellVerticalExtent(const GridView& gridView)
std::vector<std::pair<double,double>>
cellVerticalExtent(const GridView& gridView)
{
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
@@ -142,7 +149,7 @@ static std::vector<std::pair<double,double>> cellVerticalExtent(const GridView&
}
template <class TypeTag>
static void initDefaultFluidSystem()
void initDefaultFluidSystem()
{
using FluidSystem = Opm::GetPropType<TypeTag, Opm::Properties::FluidSystem>;
@@ -207,11 +214,12 @@ static void initDefaultFluidSystem()
FluidSystem::initEnd();
}
static Opm::EquilRecord mkEquilRecord( double datd, double datp,
double zwoc, double pcow_woc,
double zgoc, double pcgo_goc )
Opm::EquilRecord
mkEquilRecord(const double datd, const double datp,
const double zwoc, const double pcow_woc,
const double zgoc, const double pcgo_goc)
{
return Opm::EquilRecord( datd, datp, zwoc, pcow_woc, zgoc, pcgo_goc, true, true, 0, true);
return { datd, datp, zwoc, pcow_woc, zgoc, pcgo_goc, true, true, 0, true};
}
template <typename Simulator>
@@ -220,8 +228,6 @@ double centerDepth(const Simulator& sim, const std::size_t cell)
return Opm::UgGridHelpers::cellCenterDepth(sim.vanguard().grid(), cell);
}
namespace {
struct EquilFixture {
EquilFixture() {
int argc = boost::unit_test::framework::master_test_suite().argc;
@@ -253,7 +259,7 @@ struct EquilFixture {
CartesianIndexMapper>;
};
}
} // Anonymous namespace
BOOST_GLOBAL_FIXTURE(EquilFixture);
@@ -845,7 +851,6 @@ BOOST_AUTO_TEST_CASE(DeckWithCO2STORE)
}
}
BOOST_AUTO_TEST_CASE(DeckWithWetGas)
{
using TypeTag = Opm::Properties::TTag::TestEquilTypeTag;