Merge pull request #2928 from akva2/simplify_buildsystem_models

Use lists in buildsystem and rename some ebos models to be consistent with flow
This commit is contained in:
Arne Morten Kvarving 2020-11-27 19:39:39 +01:00 committed by GitHub
commit b7e3ca1326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 34 deletions

View File

@ -227,10 +227,11 @@ set_property(TARGET moduleVersion PROPERTY POSITION_INDEPENDENT_CODE ON)
# but this is not exposed in a super-build.
add_dependencies(moduleVersion opmsimulators)
set(COMMON_MODELS brine energy extbo foam gasoil oilwater oilwater_polymer polymer solvent)
set(FLOW_MODELS blackoil oilwater_brine oilwater_polymer_injectivity)
set(FLOW_TGTS)
foreach(OBJ blackoil brine energy foam gasoil oilwater
oilwater_brine oilwater_polymer
oilwater_polymer_injectivity polymer solvent extbo)
foreach(OBJ ${COMMON_MODELS} ${FLOW_MODELS})
add_library(flow_lib${OBJ} OBJECT flow/flow_ebos_${OBJ}.cpp)
list(APPEND FLOW_TGTS $<TARGET_OBJECTS:flow_lib${OBJ}>)
endforeach()
@ -344,7 +345,7 @@ endif()
# the research oriented general-purpose ECL simulator ("ebos" == &ecl
# &black-&oil &simulator)
set(MEBOS_TARGETS "")
foreach(OBJ blackoil solvent extbo polymer foam brine gasoil oilwater oilwaterpolymer thermal)
foreach(OBJ ${COMMON_MODELS} blackoil)
add_library(ebos_lib${OBJ} OBJECT EXCLUDE_FROM_ALL ebos/ebos_${OBJ}.cc)
list(APPEND MEBOS_TARGETS $<TARGET_OBJECTS:ebos_lib${OBJ}>)
endforeach()
@ -368,7 +369,7 @@ else()
set(EBOS_EXTENSIONS_DEFAULT_ENABLE_IF "TRUE")
endif()
foreach(OBJ solvent extbo polymer foam brine gasoil oilwater oilwaterpolymer thermal)
foreach(OBJ ${COMMON_MODELS})
opm_add_test(ebos_${OBJ}
ONLY_COMPILE
DEFAULT_ENABLE_IF ${EBOS_EXTENSIONS_DEFAULT_ENABLE_IF}
@ -408,10 +409,12 @@ opm_add_test(ebos_plain
LIBRARIES opmsimulators)
if (BUILD_EBOS_EXTENSIONS)
foreach(TGT ebos_solvent ebos_extbo ebos_polymer ebos_foam ebos_brine ebos_gasoil ebos_oilwater ebos_oilwaterpolymer ebos_thermal mebos)
install(TARGETS ${TGT} DESTINATION bin)
opm_add_bash_completion(${TGT})
foreach(TGT ${COMMON_MODELS})
install(TARGETS ebos_${TGT} DESTINATION bin)
opm_add_bash_completion(ebos_${TGT})
endforeach()
install(TARGETS mebos DESTINATION bin)
opm_add_bash_completion(mebos)
endif()
if (OPM_ENABLE_PYTHON)

View File

@ -33,14 +33,14 @@
namespace Opm::Properties {
namespace TTag {
struct EbosThermalTypeTag {
struct EbosEnergyTypeTag {
using InheritsFrom = std::tuple<EbosTypeTag>;
};
}
// enable the energy extension of the black oil model
template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::EbosThermalTypeTag> {
struct EnableEnergy<TypeTag, TTag::EbosEnergyTypeTag> {
static constexpr bool value = true;
};
@ -48,12 +48,12 @@ struct EnableEnergy<TypeTag, TTag::EbosThermalTypeTag> {
namespace Opm {
void ebosThermalSetDeck(std::unique_ptr<Opm::Deck> deck,
std::unique_ptr<Opm::ParseContext> parseContext,
std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime)
void ebosEnergySetDeck(std::unique_ptr<Opm::Deck> deck,
std::unique_ptr<Opm::ParseContext> parseContext,
std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime)
{
using ProblemTypeTag = Properties::TTag::EbosThermalTypeTag;
using ProblemTypeTag = Properties::TTag::EbosEnergyTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime);
@ -62,9 +62,9 @@ void ebosThermalSetDeck(std::unique_ptr<Opm::Deck> deck,
Vanguard::setExternalDeck(std::move(deck));
}
int ebosThermalMain(int argc, char **argv)
int ebosEnergyMain(int argc, char **argv)
{
using ProblemTypeTag = Properties::TTag::EbosThermalTypeTag;
using ProblemTypeTag = Properties::TTag::EbosEnergyTypeTag;
return Opm::startEbos<ProblemTypeTag>(argc, argv);
}

View File

@ -25,20 +25,20 @@
*
* \brief The function prototypes required to start the thermal variant of ebos
*/
#ifndef EBOS_THERMAL_HH
#define EBOS_THERMAL_HH
#ifndef EBOS_ENERGY_HH
#define EBOS_ENERGY_HH
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm {
void ebosThermalSetDeck(std::unique_ptr<Opm::Deck> deck,
std::unique_ptr<Opm::ParseContext> parseContext,
std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime);
void ebosEnergySetDeck(std::unique_ptr<Opm::Deck> deck,
std::unique_ptr<Opm::ParseContext> parseContext,
std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime);
int ebosThermalMain(int argc, char** argv);
int ebosEnergyMain(int argc, char** argv);
}
#endif

View File

@ -29,9 +29,9 @@
*/
#include "config.h"
#include "ebos_thermal.hh"
#include "ebos_energy.hh"
int main(int argc, char** argv)
{
return Opm::ebosThermalMain(argc, argv);
return Opm::ebosEnergyMain(argc, argv);
}

View File

@ -29,7 +29,7 @@
*/
#include "config.h"
#include "ebos_oilwaterpolymer.hh"
#include "ebos_oilwater_polymer.hh"
int main(int argc, char** argv)
{

View File

@ -33,10 +33,10 @@
#include "ebos_blackoil.hh"
#include "ebos_oilwater.hh"
#include "ebos_oilwaterpolymer.hh"
#include "ebos_oilwater_polymer.hh"
#include "ebos_gasoil.hh"
// TODO (?): #include "ebos_watergas.hh"
#include "ebos_thermal.hh"
#include "ebos_energy.hh"
#include "ebos_solvent.hh"
#include "ebos_polymer.hh"
#include "ebos_foam.hh"
@ -295,11 +295,11 @@ int main(int argc, char **argv)
// run ebos_thermal
if (myRank == 0)
std::cout << "Using thermal mode" << std::endl;
Opm::ebosThermalSetDeck(std::move(deck),
std::move(parseContext),
std::move(errorGuard),
externalSetupTimer.elapsed());
return Opm::ebosThermalMain(argc, argv);
Opm::ebosEnergySetDeck(std::move(deck),
std::move(parseContext),
std::move(errorGuard),
externalSetupTimer.elapsed());
return Opm::ebosEnergyMain(argc, argv);
}
else {
if (myRank == 0)