enable the foam extension for ebos/mebos

This commit is contained in:
Andreas Lauser 2019-08-09 11:04:45 +02:00
parent 1bc571535e
commit 993f1133c8
5 changed files with 214 additions and 11 deletions

View File

@ -185,9 +185,11 @@ endif()
# &black-&oil &simulator)
get_target_property(ecl_INCLUDE_DIRS ecl INTERFACE_INCLUDE_DIRECTORIES)
foreach(OBJ blackoil solvent polymer gasoil oilwater thermal)
set(MEBOS_TARGETS "")
foreach(OBJ blackoil solvent polymer foam gasoil oilwater thermal)
add_library(ebos_lib${OBJ} OBJECT EXCLUDE_FROM_ALL ebos/ebos_${OBJ}.cc)
target_include_directories(ebos_lib${OBJ} PRIVATE ${ecl_INCLUDE_DIRS})
list(APPEND MEBOS_TARGETS $<TARGET_OBJECTS:ebos_lib${OBJ}>)
endforeach()
opm_add_test(ebos
@ -209,7 +211,7 @@ else()
set(EBOS_EXTENSIONS_DEFAULT_ENABLE_IF "TRUE")
endif()
foreach(OBJ solvent polymer gasoil oilwater thermal)
foreach(OBJ solvent polymer foam gasoil oilwater thermal)
opm_add_test(ebos_${OBJ}
ONLY_COMPILE
DEFAULT_ENABLE_IF ${EBOS_EXTENSIONS_DEFAULT_ENABLE_IF}
@ -222,12 +224,7 @@ opm_add_test(mebos
ONLY_COMPILE
DEFAULT_ENABLE_IF ${EBOS_EXTENSIONS_DEFAULT_ENABLE_IF}
SOURCES ebos/mebos_main.cc
$<TARGET_OBJECTS:ebos_libblackoil>
$<TARGET_OBJECTS:ebos_libsolvent>
$<TARGET_OBJECTS:ebos_libpolymer>
$<TARGET_OBJECTS:ebos_libthermal>
$<TARGET_OBJECTS:ebos_liboilwater>
$<TARGET_OBJECTS:ebos_libgasoil>
${MEBOS_TARGETS}
EXE_NAME mebos
LIBRARIES opmsimulators)
@ -254,7 +251,7 @@ opm_add_test(ebos_plain
LIBRARIES opmsimulators)
if (BUILD_EBOS_EXTENSIONS)
foreach(TGT ebos_solvent ebos_polymer ebos_gasoil ebos_oilwater ebos_thermal mebos)
foreach(TGT ebos_solvent ebos_polymer ebos_foam ebos_gasoil ebos_oilwater ebos_thermal mebos)
install(TARGETS ${TGT} DESTINATION bin)
opm_add_bash_completion(${TGT})
endforeach()

63
ebos/ebos_foam.cc Normal file
View File

@ -0,0 +1,63 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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 2 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/>.
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.
*/
/*!
* \file
*
* \brief A general-purpose simulator for ECL decks using the black-oil model.
*/
#include "config.h"
#include "ebos.hh"
BEGIN_PROPERTIES
NEW_TYPE_TAG(EbosFoamTypeTag, INHERITS_FROM(EbosTypeTag));
// enable the foam extension of the black oil model
SET_BOOL_PROP(EbosFoamTypeTag, EnableFoam, true);
END_PROPERTIES
namespace Ewoms {
void ebosFoamSetDeck(Opm::Deck* deck,
Opm::ParseContext* parseContext,
Opm::ErrorGuard* errorGuard,
double externalSetupTime)
{
typedef TTAG(EbosFoamTypeTag) ProblemTypeTag;
typedef GET_PROP_TYPE(ProblemTypeTag, Vanguard) Vanguard;
Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext);
Vanguard::setExternalErrorGuard(errorGuard);
Vanguard::setExternalDeck(deck);
}
int ebosFoamMain(int argc, char **argv)
{
typedef TTAG(EbosFoamTypeTag) ProblemTypeTag;
return Ewoms::start<ProblemTypeTag>(argc, argv);
}
}

44
ebos/ebos_foam.hh Normal file
View File

@ -0,0 +1,44 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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 2 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/>.
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.
*/
/*!
* \file
*
* \brief The function prototypes required to start the foam variant of ebos
*/
#ifndef EBOS_FOAM_HH
#define EBOS_FOAM_HH
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Ewoms {
void ebosFoamSetDeck(Opm::Deck* deck,
Opm::ParseContext* parseContext,
Opm::ErrorGuard* errorGuard,
double externalSetupTime);
int ebosFoamMain(int argc, char** argv);
}
#endif

37
ebos/ebos_foam_main.cc Normal file
View File

@ -0,0 +1,37 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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 2 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/>.
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.
*/
/*!
* \file
*
* \brief The main function for the stand alone foam variant of ebos.
*
* This only calls the ebosFoamMain() function.
*/
#include "config.h"
#include "ebos_foam.hh"
int main(int argc, char** argv)
{
return Ewoms::ebosFoamMain(argc, argv);
}

View File

@ -38,6 +38,7 @@
#include "ebos_thermal.hh"
#include "ebos_solvent.hh"
#include "ebos_polymer.hh"
#include "ebos_foam.hh"
#include <ewoms/common/propertysystem.hh>
@ -84,6 +85,7 @@ int main(int argc, char **argv)
bool oilActive = deck->hasKeyword("OIL");
bool solventActive = deck->hasKeyword("SOLVENT");
bool polymerActive = deck->hasKeyword("POLYMER");
bool foamActive = deck->hasKeyword("FOAM");
bool thermalActive = deck->hasKeyword("THERMAL") || deck->hasKeyword("TEMP");
std::stringstream notSupportedErrorStream;
@ -93,6 +95,7 @@ int main(int argc, char **argv)
<< " oil: " << oilActive << "\n"
<< " solvent: " << solventActive << "\n"
<< " polymer: " << polymerActive << "\n"
<< " foam: " << foamActive << "\n"
<< " thermal/temperature: " << thermalActive << "\n";
int numBlackOilPhases = (waterActive?1:0) + (gasActive?1:0) + (oilActive?1:0);
@ -123,6 +126,13 @@ int main(int argc, char **argv)
std::abort();
}
if (foamActive) {
notSupportedErrorStream << "\n"
<< "combining twophase and foam is not supported by the multiplexed simulator\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
if (thermalActive) {
notSupportedErrorStream << "\n"
<< "combining twophase and energy conservation is not supported by the multiplexed simulator\n";
@ -156,6 +166,37 @@ int main(int argc, char **argv)
std::abort();
}
}
else if (foamActive) {
if (solventActive) {
notSupportedErrorStream << "\n"
<< "combining foam and solvent is not supported by the multiplexed simulator\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
if (polymerActive) {
notSupportedErrorStream << "\n"
<< "combining foam and polymer is not supported by the multiplexed simulator\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
if (thermalActive) {
notSupportedErrorStream << "\n"
<< "combining foam and and energy conservation is not supported by the multiplexed simulator\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
// run ebos_foam
if (myRank == 0)
std::cout << "Using foam mode" << std::endl;
Ewoms::ebosFoamSetDeck(deck.get(),
parseContext.get(),
errorGuard.get(),
externalSetupTimer.elapsed());
return Ewoms::ebosFoamMain(argc, argv);
}
else if (polymerActive) {
if (solventActive) {
notSupportedErrorStream << "\n"
@ -164,6 +205,13 @@ int main(int argc, char **argv)
std::abort();
}
if (foamActive) {
notSupportedErrorStream << "\n"
<< "combining polymer and foam is not supported by the multiplexed simulator\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
if (thermalActive) {
notSupportedErrorStream << "\n"
<< "combining polymer and and energy conservation is not supported by the multiplexed simulator\n";
@ -183,14 +231,21 @@ int main(int argc, char **argv)
else if (solventActive) {
if (polymerActive) {
notSupportedErrorStream << "\n"
<< "combining polymer and solvent is not supported\n";
<< "combining solvent and polymer is not supported\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
if (foamActive) {
notSupportedErrorStream << "\n"
<< "combining solvent and foam is not supported\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
if (thermalActive) {
notSupportedErrorStream << "\n"
<< "combining polymer and and energy conservation is not supported\n";
<< "combining solvent and and energy conservation is not supported\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
@ -219,6 +274,13 @@ int main(int argc, char **argv)
std::abort();
}
if (foamActive) {
notSupportedErrorStream << "\n"
<< "combining thermal and foam is not supported by the multiplexed simulator\n";
std::cerr << notSupportedErrorStream.str() << std::endl;
std::abort();
}
// run ebos_thermal
if (myRank == 0)
std::cout << "Using thermal mode" << std::endl;