Added support for water-only and water-only + thermal to flow.

Also run the onephase tests with flow now.
This commit is contained in:
Markus Blatt 2022-04-26 12:48:11 +02:00
parent 4b5a53eaeb
commit c66fb8a93d
8 changed files with 163 additions and 27 deletions

View File

@ -363,21 +363,19 @@ add_test_compareECLFiles(CASENAME spe1_metric_vfp1
REL_TOL ${rel_tol} REL_TOL ${rel_tol}
DIR vfpprod_spe1) DIR vfpprod_spe1)
if(BUILD_FLOW_VARIANTS) add_test_compareECLFiles(CASENAME spe1_water
add_test_compareECLFiles(CASENAME spe1_water FILENAME SPE1CASE1_WATER
FILENAME SPE1CASE1_WATER SIMULATOR flow
SIMULATOR flow_onephase ABS_TOL ${abs_tol}
ABS_TOL ${abs_tol} REL_TOL ${rel_tol}
REL_TOL ${rel_tol} DIR spe1)
DIR spe1)
add_test_compareECLFiles(CASENAME spe1_thermal_onephase add_test_compareECLFiles(CASENAME spe1_thermal_onephase
FILENAME SPE1CASE2_THERMAL_ONEPHASE FILENAME SPE1CASE2_THERMAL_ONEPHASE
SIMULATOR flow_onephase_energy SIMULATOR flow
ABS_TOL ${abs_tol} ABS_TOL ${abs_tol}
REL_TOL ${rel_tol} REL_TOL ${rel_tol}
DIR spe1) DIR spe1)
endif()
add_test_compareECLFiles(CASENAME spe1_spider add_test_compareECLFiles(CASENAME spe1_spider
FILENAME SPIDER_CAKESLICE FILENAME SPIDER_CAKESLICE

View File

@ -27,13 +27,13 @@ namespace Opm {
namespace Properties { namespace Properties {
namespace TTag { namespace TTag {
struct EclFlowProblemSimple { struct EclFlowProblemWaterOnly {
using InheritsFrom = std::tuple<EclFlowProblem>; using InheritsFrom = std::tuple<EclFlowProblem>;
}; };
} }
//! The indices required by the model //! The indices required by the model
template<class TypeTag> template<class TypeTag>
struct Indices<TypeTag, TTag::EclFlowProblemSimple> struct Indices<TypeTag, TTag::EclFlowProblemWaterOnly>
{ {
private: private:
// it is unfortunately not possible to simply use 'TypeTag' here because this leads // it is unfortunately not possible to simply use 'TypeTag' here because this leads
@ -57,9 +57,36 @@ public:
} // namespace Opm::Properties } // namespace Opm::Properties
int flowEbosOnephaseMain(int argc, char** argv) void flowEbosWaterOnlySetDeck(double setupTime, std::shared_ptr<Deck> deck,
std::shared_ptr<EclipseState> eclState,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Opm::Properties::TTag::EclFlowProblemSimple; using TypeTag = Properties::TTag::EclFlowProblemWaterOnly;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
}
// ----------------- Main program -----------------
int flowEbosWaterOnlyMain(int argc, char** argv, bool outputCout, bool outputFiles)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
resetLocale();
FlowMainEbos<Properties::TTag::EclFlowProblemWaterOnly>
mainfunc {argc, argv, outputCout, outputFiles};
return mainfunc.execute();
}
int flowEbosWaterOnlyMainStandalone(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::EclFlowProblemWaterOnly;
auto mainObject = Opm::Main(argc, argv); auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>(); return mainObject.runStatic<TypeTag>();
} }

View File

@ -22,8 +22,27 @@
#ifndef FLOW_ONEPHASE_HPP #ifndef FLOW_ONEPHASE_HPP
#define FLOW_ONEPHASE_HPP #define FLOW_ONEPHASE_HPP
#include <memory>
namespace Opm { namespace Opm {
int flowEbosOnephaseMain(int argc, char** argv);
class Deck;
class EclipseState;
template<class TypeTag> class FlowMainEbos;
class Schedule;
class SummaryConfig;
class UDQState;
class WellTestState;
namespace Action {
class State;
}
void flowEbosWaterOnlySetDeck(double setupTime, std::shared_ptr<Deck> deck,
std::shared_ptr<EclipseState> eclState,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig);
int flowEbosWaterOnlyMain(int argc, char** argv, bool outputCout, bool outputFiles);
int flowEbosWaterOnlyMainStandalone(int argc, char** argv);
} }
#endif #endif

View File

@ -19,24 +19,28 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h" #include "config.h"
#include <flow/flow_ebos_onephase_energy.hpp>
#include <opm/simulators/flow/Main.hpp> #include <opm/simulators/flow/Main.hpp>
#include <opm/models/blackoil/blackoilonephaseindices.hh> #include <opm/models/blackoil/blackoilonephaseindices.hh>
#include <opm/material/common/ResetLocale.hpp>
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
namespace TTag { namespace TTag {
struct EclFlowProblemSimple { struct EclFlowProblemWaterOnlyEnergy {
using InheritsFrom = std::tuple<EclFlowProblem>; using InheritsFrom = std::tuple<EclFlowProblem>;
}; };
} }
template<class TypeTag> template<class TypeTag>
struct EnableEnergy<TypeTag, TTag::EclFlowProblemSimple> { struct EnableEnergy<TypeTag, TTag::EclFlowProblemWaterOnlyEnergy> {
static constexpr bool value = true; static constexpr bool value = true;
}; };
//! The indices required by the model //! The indices required by the model
template<class TypeTag> template<class TypeTag>
struct Indices<TypeTag, TTag::EclFlowProblemSimple> struct Indices<TypeTag, TTag::EclFlowProblemWaterOnlyEnergy>
{ {
private: private:
// it is unfortunately not possible to simply use 'TypeTag' here because this leads // it is unfortunately not possible to simply use 'TypeTag' here because this leads
@ -60,9 +64,36 @@ public:
} // namespace Opm::Properties } // namespace Opm::Properties
int flowEbosOnephaseEnergyMain(int argc, char** argv) void flowEbosWaterOnlyEnergySetDeck(double setupTime, std::shared_ptr<Deck> deck,
std::shared_ptr<EclipseState> eclState,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Opm::Properties::TTag::EclFlowProblemSimple; using TypeTag = Properties::TTag::EclFlowProblemWaterOnlyEnergy;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
}
// ----------------- Main program -----------------
int flowEbosWaterOnlyEnergyMain(int argc, char** argv, bool outputCout, bool outputFiles)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
resetLocale();
FlowMainEbos<Properties::TTag::EclFlowProblemWaterOnlyEnergy>
mainfunc {argc, argv, outputCout, outputFiles};
return mainfunc.execute();
}
int flowEbosWaterOnlyEnergyMainStandalone(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::EclFlowProblemWaterOnlyEnergy;
auto mainObject = Opm::Main(argc, argv); auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>(); return mainObject.runStatic<TypeTag>();
} }

View File

@ -22,8 +22,27 @@
#ifndef FLOW_ONEPHASE_ENERGY_HPP #ifndef FLOW_ONEPHASE_ENERGY_HPP
#define FLOW_ONEPHASE_ENERGY_HPP #define FLOW_ONEPHASE_ENERGY_HPP
#include <memory>
namespace Opm { namespace Opm {
int flowEbosOnephaseEnergyMain(int argc, char** argv);
class Deck;
class EclipseState;
template<class TypeTag> class FlowMainEbos;
class Schedule;
class SummaryConfig;
class UDQState;
class WellTestState;
namespace Action {
class State;
}
void flowEbosWaterOnlyEnergySetDeck(double setupTime, std::shared_ptr<Deck> deck,
std::shared_ptr<EclipseState> eclState,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig);
int flowEbosWaterOnlyEnergyMain(int argc, char** argv, bool outputCout, bool outputFiles);
int flowEbosWaterOnlyEnergyMainStandalone(int argc, char** argv);
} }
#endif #endif

View File

@ -24,5 +24,5 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
return Opm::flowEbosOnephaseMain(argc, argv); return Opm::flowEbosWaterOnlyMainStandalone(argc, argv);
} }

View File

@ -23,5 +23,5 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
return Opm::flowEbosOnephaseEnergyMain(argc,argv); return Opm::flowEbosWaterOnlyEnergyMainStandalone(argc,argv);
} }

View File

@ -35,6 +35,8 @@
#include <flow/flow_ebos_brine.hpp> #include <flow/flow_ebos_brine.hpp>
#include <flow/flow_ebos_brine_saltprecipitation.hpp> #include <flow/flow_ebos_brine_saltprecipitation.hpp>
#include <flow/flow_ebos_gaswater_saltprec_vapwat.hpp> #include <flow/flow_ebos_gaswater_saltprec_vapwat.hpp>
#include <flow/flow_ebos_onephase.hpp>
#include <flow/flow_ebos_onephase_energy.hpp>
#include <flow/flow_ebos_oilwater_brine.hpp> #include <flow/flow_ebos_oilwater_brine.hpp>
#include <flow/flow_ebos_gaswater_brine.hpp> #include <flow/flow_ebos_gaswater_brine.hpp>
#include <flow/flow_ebos_energy.hpp> #include <flow/flow_ebos_energy.hpp>
@ -290,6 +292,16 @@ private:
return this->runMICP(phases); return this->runMICP(phases);
} }
// water-only case
else if(phases.size() == 1 && phases.active(Phase::WATER) && !eclipseState_->getSimulationConfig().isThermal()) {
return this->runWaterOnly(phases);
}
// water-only case with energy
else if(phases.size() == 2 && phases.active(Phase::WATER) && eclipseState_->getSimulationConfig().isThermal()) {
return this->runWaterOnlyEnergy(phases);
}
// Twophase cases // Twophase cases
else if (phases.size() == 2 && !eclipseState_->getSimulationConfig().isThermal()) { else if (phases.size() == 2 && !eclipseState_->getSimulationConfig().isThermal()) {
return this->runTwoPhase(phases); return this->runTwoPhase(phases);
@ -652,6 +664,36 @@ private:
return flowEbosFoamMain(argc_, argv_, outputCout_, outputFiles_); return flowEbosFoamMain(argc_, argv_, outputCout_, outputFiles_);
} }
int runWaterOnly(const Phases& phases)
{
if (!phases.active(Phase::WATER) || phases.size() != 1) {
if (outputCout_)
std::cerr << "No valid configuration is found for water-only simulation, valid options include "
<< "water, water + thermal" << std::endl;
return EXIT_FAILURE;
}
flowEbosWaterOnlySetDeck(
setupTime_, deck_, eclipseState_, schedule_, summaryConfig_);
return flowEbosWaterOnlyMain(argc_, argv_, outputCout_, outputFiles_);
}
int runWaterOnlyEnergy(const Phases& phases)
{
if (!phases.active(Phase::WATER) || phases.size() != 2) {
if (outputCout_)
std::cerr << "No valid configuration is found for water-only simulation, valid options include "
<< "water, water + thermal" << std::endl;
return EXIT_FAILURE;
}
flowEbosWaterOnlyEnergySetDeck(
setupTime_, deck_, eclipseState_, schedule_, summaryConfig_);
return flowEbosWaterOnlyEnergyMain(argc_, argv_, outputCout_, outputFiles_);
}
int runBrine(const Phases& phases) int runBrine(const Phases& phases)
{ {
if (! phases.active(Phase::WATER) || phases.size() == 2) { if (! phases.active(Phase::WATER) || phases.size() == 2) {