2020-04-03 07:53:45 -05:00
|
|
|
/*
|
|
|
|
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
|
|
|
|
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
|
|
|
|
Copyright 2015 IRIS AS
|
|
|
|
Copyright 2014 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/>.
|
|
|
|
*/
|
|
|
|
#ifndef OPM_MAIN_HEADER_INCLUDED
|
|
|
|
#define OPM_MAIN_HEADER_INCLUDED
|
|
|
|
|
|
|
|
#include <flow/flow_ebos_blackoil.hpp>
|
2022-10-03 07:10:18 -05:00
|
|
|
#include <flow/flow_ebos_blackoil_legacyassembly.hpp>
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-11-10 02:55:25 -06:00
|
|
|
#include <flow/flow_ebos_gasoil.hpp>
|
2022-09-30 08:28:58 -05:00
|
|
|
#include <flow/flow_ebos_gasoildiffuse.hpp>
|
2021-12-06 03:26:54 -06:00
|
|
|
#include <flow/flow_ebos_gasoil_energy.hpp>
|
2021-11-10 02:55:25 -06:00
|
|
|
#include <flow/flow_ebos_oilwater.hpp>
|
|
|
|
#include <flow/flow_ebos_gaswater.hpp>
|
|
|
|
#include <flow/flow_ebos_solvent.hpp>
|
|
|
|
#include <flow/flow_ebos_polymer.hpp>
|
|
|
|
#include <flow/flow_ebos_extbo.hpp>
|
|
|
|
#include <flow/flow_ebos_foam.hpp>
|
|
|
|
#include <flow/flow_ebos_brine.hpp>
|
2022-01-06 05:50:52 -06:00
|
|
|
#include <flow/flow_ebos_brine_saltprecipitation.hpp>
|
2022-03-01 10:54:22 -06:00
|
|
|
#include <flow/flow_ebos_gaswater_saltprec_vapwat.hpp>
|
2022-04-11 14:56:44 -05:00
|
|
|
#include <flow/flow_ebos_brine_precsalt_vapwat.hpp>
|
2022-04-26 05:48:11 -05:00
|
|
|
#include <flow/flow_ebos_onephase.hpp>
|
|
|
|
#include <flow/flow_ebos_onephase_energy.hpp>
|
2021-11-10 02:55:25 -06:00
|
|
|
#include <flow/flow_ebos_oilwater_brine.hpp>
|
2021-12-08 07:35:22 -06:00
|
|
|
#include <flow/flow_ebos_gaswater_brine.hpp>
|
2021-11-10 02:55:25 -06:00
|
|
|
#include <flow/flow_ebos_energy.hpp>
|
|
|
|
#include <flow/flow_ebos_oilwater_polymer.hpp>
|
|
|
|
#include <flow/flow_ebos_oilwater_polymer_injectivity.hpp>
|
|
|
|
#include <flow/flow_ebos_micp.hpp>
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-12-14 01:30:15 -06:00
|
|
|
#include <opm/input/eclipse/Deck/Deck.hpp>
|
|
|
|
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
|
|
|
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
|
|
|
#include <opm/input/eclipse/Parser/ParseContext.hpp>
|
|
|
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
|
|
|
#include <opm/input/eclipse/EclipseState/checkDeck.hpp>
|
|
|
|
#include <opm/input/eclipse/Schedule/ArrayDimChecker.hpp>
|
|
|
|
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
|
|
|
|
#include <opm/input/eclipse/Schedule/Action/State.hpp>
|
|
|
|
#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2020-04-16 04:35:01 -05:00
|
|
|
#include <opm/models/utils/propertysystem.hh>
|
|
|
|
#include <opm/models/utils/parametersystem.hh>
|
|
|
|
|
|
|
|
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
2020-08-17 09:10:18 -05:00
|
|
|
#include <opm/simulators/utils/readDeck.hpp>
|
2020-04-16 04:35:01 -05:00
|
|
|
|
2020-04-03 07:53:45 -05:00
|
|
|
#if HAVE_DUNE_FEM
|
|
|
|
#include <dune/fem/misc/mpimanager.hh>
|
|
|
|
#else
|
|
|
|
#include <dune/common/parallel/mpihelper.hh>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAVE_MPI
|
|
|
|
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
|
|
|
#endif
|
|
|
|
|
2021-10-07 08:09:54 -05:00
|
|
|
#include <cassert>
|
|
|
|
#include <cstdlib>
|
2021-11-01 06:31:40 -05:00
|
|
|
#include <filesystem>
|
2021-10-07 08:09:54 -05:00
|
|
|
#include <iostream>
|
|
|
|
#include <memory>
|
|
|
|
#include <stdexcept>
|
2020-04-22 14:22:35 -05:00
|
|
|
#include <string>
|
2020-04-04 17:39:59 -05:00
|
|
|
#include <type_traits>
|
2021-10-07 08:09:54 -05:00
|
|
|
#include <utility>
|
2020-04-04 17:39:59 -05:00
|
|
|
|
2020-08-21 06:42:08 -05:00
|
|
|
namespace Opm::Properties {
|
2020-04-03 07:53:45 -05:00
|
|
|
|
|
|
|
// this is a dummy type tag that is used to setup the parameters before the actual
|
|
|
|
// simulator.
|
2020-08-27 03:30:29 -05:00
|
|
|
namespace TTag {
|
|
|
|
struct FlowEarlyBird {
|
|
|
|
using InheritsFrom = std::tuple<EclFlowProblem>;
|
|
|
|
};
|
|
|
|
}
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2020-08-21 06:42:08 -05:00
|
|
|
} // namespace Opm::Properties
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2020-04-04 17:39:59 -05:00
|
|
|
namespace Opm {
|
2021-10-07 08:09:54 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// ----------------- Main program -----------------
|
|
|
|
template <class TypeTag>
|
|
|
|
int flowEbosMain(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();
|
2020-04-04 17:39:59 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
FlowMainEbos<TypeTag> mainfunc(argc, argv, outputCout, outputFiles);
|
|
|
|
return mainfunc.execute();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------- Main class -----------------
|
|
|
|
// For now, we will either be instantiated from main() in flow.cpp,
|
|
|
|
// or from a Python pybind11 module..
|
|
|
|
// NOTE (March 2020): When used from a pybind11 module, we do not neccessarily
|
|
|
|
// want to run the whole simulation by calling run(), it is also
|
|
|
|
// useful to just run one report step at a time. According to these different
|
|
|
|
// usage scenarios, we refactored the original run() in flow.cpp into this class.
|
|
|
|
class Main
|
2020-04-03 07:53:45 -05:00
|
|
|
{
|
2021-11-10 07:24:51 -06:00
|
|
|
public:
|
|
|
|
Main(int argc, char** argv) : argc_(argc), argv_(argv) { initMPI(); }
|
2020-06-26 12:50:38 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// This constructor can be called from Python
|
|
|
|
Main(const std::string& filename)
|
|
|
|
{
|
|
|
|
setArgvArgc_(filename);
|
|
|
|
initMPI();
|
|
|
|
}
|
2020-04-22 14:22:35 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// This constructor can be called from Python when Python has
|
|
|
|
// already parsed a deck
|
|
|
|
Main(std::shared_ptr<Deck> deck,
|
|
|
|
std::shared_ptr<EclipseState> eclipseState,
|
|
|
|
std::shared_ptr<Schedule> schedule,
|
|
|
|
std::shared_ptr<SummaryConfig> summaryConfig)
|
|
|
|
: deck_{std::move(deck)}
|
|
|
|
, eclipseState_{std::move(eclipseState)}
|
|
|
|
, schedule_{std::move(schedule)}
|
|
|
|
, summaryConfig_{std::move(summaryConfig)}
|
|
|
|
{
|
|
|
|
setArgvArgc_(deck_->getDataFile());
|
|
|
|
initMPI();
|
|
|
|
}
|
2020-04-16 04:35:01 -05:00
|
|
|
|
2021-05-25 05:57:11 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
~Main()
|
|
|
|
{
|
2021-05-25 05:57:11 -05:00
|
|
|
#if HAVE_MPI
|
2021-12-10 10:42:44 -06:00
|
|
|
if (test_split_comm_) {
|
|
|
|
// Cannot use EclGenericVanguard::comm()
|
|
|
|
// to get world size here, as it may be
|
|
|
|
// a split communication at this point.
|
|
|
|
int world_size;
|
|
|
|
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
|
|
|
|
if (world_size > 1) {
|
|
|
|
MPI_Comm new_comm = EclGenericVanguard::comm();
|
|
|
|
int result;
|
|
|
|
MPI_Comm_compare(MPI_COMM_WORLD, new_comm, &result);
|
|
|
|
assert(result == MPI_UNEQUAL);
|
|
|
|
MPI_Comm_free(&new_comm);
|
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2021-05-25 05:57:11 -05:00
|
|
|
#endif // HAVE_MPI
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
EclGenericVanguard::setCommunication(nullptr);
|
2021-08-12 05:54:03 -05:00
|
|
|
|
|
|
|
#if HAVE_MPI && !HAVE_DUNE_FEM
|
2021-11-10 07:24:51 -06:00
|
|
|
MPI_Finalize();
|
2021-05-12 03:24:53 -05:00
|
|
|
#endif
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2021-05-12 03:24:53 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
void setArgvArgc_(const std::string& filename)
|
|
|
|
{
|
|
|
|
this->deckFilename_ = filename;
|
|
|
|
this->flowProgName_ = "flow";
|
2021-10-07 08:21:33 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
this->argc_ = 2;
|
|
|
|
this->saveArgs_[0] = const_cast<char *>(this->flowProgName_.c_str());
|
|
|
|
this->saveArgs_[1] = const_cast<char *>(this->deckFilename_.c_str());
|
2021-10-07 08:21:33 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Note: argv[argc] must exist and be nullptr
|
|
|
|
assert ((sizeof this->saveArgs_) > (this->argc_ * sizeof this->saveArgs_[0]));
|
|
|
|
this->saveArgs_[this->argc_] = nullptr;
|
2021-10-07 08:21:33 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
this->argv_ = this->saveArgs_;
|
|
|
|
}
|
2021-09-20 18:13:39 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
void initMPI()
|
|
|
|
{
|
2021-08-12 05:54:03 -05:00
|
|
|
#if HAVE_DUNE_FEM
|
2021-11-10 07:24:51 -06:00
|
|
|
Dune::Fem::MPIManager::initialize(argc_, argv_);
|
2021-08-12 05:54:03 -05:00
|
|
|
#elif HAVE_MPI
|
2021-11-10 07:24:51 -06:00
|
|
|
MPI_Init(&argc_, &argv_);
|
2021-08-12 05:54:03 -05:00
|
|
|
#endif
|
2021-11-10 07:24:51 -06:00
|
|
|
EclGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>());
|
2021-05-25 05:57:11 -05:00
|
|
|
|
2021-12-10 10:42:44 -06:00
|
|
|
handleTestSplitCommunicatorCmdLine_();
|
|
|
|
|
2021-05-25 05:57:11 -05:00
|
|
|
#if HAVE_MPI
|
2021-12-10 10:42:44 -06:00
|
|
|
if (test_split_comm_ && EclGenericVanguard::comm().size() > 1) {
|
2021-11-10 07:24:51 -06:00
|
|
|
int world_rank = EclGenericVanguard::comm().rank();
|
|
|
|
int color = (world_rank == 0);
|
|
|
|
MPI_Comm new_comm;
|
|
|
|
MPI_Comm_split(EclGenericVanguard::comm(), color, world_rank, &new_comm);
|
|
|
|
isSimulationRank_ = (world_rank > 0);
|
|
|
|
EclGenericVanguard::setCommunication(std::make_unique<Parallel::Communication>(new_comm));
|
|
|
|
}
|
2021-05-25 05:57:11 -05:00
|
|
|
#endif // HAVE_MPI
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2021-08-12 05:54:03 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runDynamic()
|
|
|
|
{
|
|
|
|
int exitCode = EXIT_SUCCESS;
|
|
|
|
if (isSimulationRank_) {
|
|
|
|
if (initialize_<Properties::TTag::FlowEarlyBird>(exitCode)) {
|
|
|
|
return this->dispatchDynamic_();
|
2020-04-03 07:53:45 -05:00
|
|
|
}
|
2020-04-16 04:35:01 -05:00
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
return exitCode;
|
|
|
|
}
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
template <class TypeTag>
|
|
|
|
int runStatic()
|
|
|
|
{
|
|
|
|
int exitCode = EXIT_SUCCESS;
|
|
|
|
if (isSimulationRank_) {
|
|
|
|
if (initialize_<TypeTag>(exitCode)) {
|
|
|
|
return this->dispatchStatic_<TypeTag>();
|
2020-05-11 10:57:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
return exitCode;
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2022-08-19 08:08:56 -05:00
|
|
|
using FlowMainEbosType = FlowMainEbos<Properties::TTag::EclFlowProblem>;
|
2021-11-10 07:24:51 -06:00
|
|
|
// To be called from the Python interface code. Only do the
|
|
|
|
// initialization and then return a pointer to the FlowEbosMain
|
|
|
|
// object that can later be accessed directly from the Python interface
|
|
|
|
// to e.g. advance the simulator one report step
|
|
|
|
std::unique_ptr<FlowMainEbosType> initFlowEbosBlackoil(int& exitCode)
|
|
|
|
{
|
|
|
|
exitCode = EXIT_SUCCESS;
|
|
|
|
if (initialize_<Properties::TTag::FlowEarlyBird>(exitCode)) {
|
|
|
|
// TODO: check that this deck really represents a blackoil
|
|
|
|
// case. E.g. check that number of phases == 3
|
2022-06-14 05:40:16 -05:00
|
|
|
EclGenericVanguard::setParams(
|
2021-11-10 07:24:51 -06:00
|
|
|
setupTime_,
|
|
|
|
deck_,
|
|
|
|
eclipseState_,
|
|
|
|
schedule_,
|
|
|
|
std::move(udqState_),
|
|
|
|
std::move(this->actionState_),
|
|
|
|
std::move(this->wtestState_),
|
|
|
|
summaryConfig_);
|
|
|
|
return flowEbosBlackoilMainInit(
|
|
|
|
argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
} else {
|
|
|
|
//NOTE: exitCode was set by initialize_() above;
|
|
|
|
return std::unique_ptr<FlowMainEbosType>(); // nullptr
|
|
|
|
}
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
private:
|
|
|
|
int dispatchDynamic_()
|
|
|
|
{
|
|
|
|
const auto& rspec = this->eclipseState_->runspec();
|
|
|
|
const auto& phases = rspec.phases();
|
2021-10-25 04:37:33 -05:00
|
|
|
|
2022-06-14 05:40:16 -05:00
|
|
|
EclGenericVanguard::setParams(this->setupTime_,
|
|
|
|
this->deck_,
|
|
|
|
this->eclipseState_,
|
|
|
|
this->schedule_,
|
|
|
|
std::move(this->udqState_),
|
|
|
|
std::move(this->actionState_),
|
|
|
|
std::move(this->wtestState_),
|
|
|
|
this->summaryConfig_);
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// run the actual simulator
|
|
|
|
//
|
|
|
|
// TODO: make sure that no illegal combinations like thermal and
|
|
|
|
// twophase are requested.
|
2022-09-30 08:28:58 -05:00
|
|
|
const bool thermal = eclipseState_->getSimulationConfig().isThermal();
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Single-phase case
|
|
|
|
if (rspec.micp()) {
|
|
|
|
return this->runMICP(phases);
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2022-04-26 05:48:11 -05:00
|
|
|
// water-only case
|
2022-09-30 08:28:58 -05:00
|
|
|
else if(phases.size() == 1 && phases.active(Phase::WATER) && !thermal) {
|
2022-04-26 05:48:11 -05:00
|
|
|
return this->runWaterOnly(phases);
|
|
|
|
}
|
|
|
|
|
|
|
|
// water-only case with energy
|
2022-09-30 08:28:58 -05:00
|
|
|
else if(phases.size() == 2 && phases.active(Phase::WATER) && thermal) {
|
2022-04-26 05:48:11 -05:00
|
|
|
return this->runWaterOnlyEnergy(phases);
|
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Twophase cases
|
2022-09-30 08:28:58 -05:00
|
|
|
else if (phases.size() == 2 && !thermal) {
|
2021-11-10 07:24:51 -06:00
|
|
|
return this->runTwoPhase(phases);
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Polymer case
|
|
|
|
else if (phases.active(Phase::POLYMER)) {
|
|
|
|
return this->runPolymer(phases);
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Foam case
|
|
|
|
else if (phases.active(Phase::FOAM)) {
|
|
|
|
return this->runFoam();
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Brine case
|
|
|
|
else if (phases.active(Phase::BRINE)) {
|
|
|
|
return this->runBrine(phases);
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Solvent case
|
|
|
|
else if (phases.active(Phase::SOLVENT)) {
|
|
|
|
return this->runSolvent();
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Extended BO case
|
|
|
|
else if (phases.active(Phase::ZFRACTION)) {
|
|
|
|
return this->runExtendedBlackOil();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Energy case
|
2022-09-30 08:28:58 -05:00
|
|
|
else if (thermal) {
|
2021-12-06 03:26:54 -06:00
|
|
|
return this->runThermal(phases);
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Blackoil case
|
|
|
|
else if (phases.size() == 3) {
|
|
|
|
return this->runBlackOil();
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
else {
|
|
|
|
if (outputCout_) {
|
|
|
|
std::cerr << "No suitable configuration found, valid are "
|
|
|
|
<< "Twophase, polymer, foam, brine, solvent, "
|
|
|
|
<< "energy, and blackoil.\n";
|
2020-04-03 07:53:45 -05:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
|
|
|
|
return EXIT_FAILURE;
|
2020-04-16 04:35:01 -05:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2020-04-16 04:35:01 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
template <class TypeTag>
|
|
|
|
int dispatchStatic_()
|
|
|
|
{
|
2022-06-14 05:40:16 -05:00
|
|
|
EclGenericVanguard::setParams(this->setupTime_,
|
|
|
|
this->deck_,
|
|
|
|
this->eclipseState_,
|
|
|
|
this->schedule_,
|
|
|
|
std::move(this->udqState_),
|
|
|
|
std::move(this->actionState_),
|
|
|
|
std::move(this->wtestState_),
|
|
|
|
this->summaryConfig_);
|
2021-11-10 07:24:51 -06:00
|
|
|
return flowEbosMain<TypeTag>(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
/// \brief Initialize
|
|
|
|
/// \param exitCode The exitCode of the program.
|
|
|
|
///
|
|
|
|
/// \return Whether to actually run the simulator. I.e. true if
|
|
|
|
/// parsing of command line was successful and no --help,
|
|
|
|
/// --print-properties, or --print-parameters have been found.
|
|
|
|
template <class TypeTagEarlyBird>
|
|
|
|
bool initialize_(int& exitCode)
|
|
|
|
{
|
|
|
|
Dune::Timer externalSetupTimer;
|
|
|
|
externalSetupTimer.start();
|
|
|
|
|
|
|
|
handleVersionCmdLine_(argc_, argv_);
|
2020-04-03 07:53:45 -05:00
|
|
|
#if HAVE_DUNE_FEM
|
2021-11-10 07:24:51 -06:00
|
|
|
int mpiRank = Dune::Fem::MPIManager::rank();
|
2020-04-03 07:53:45 -05:00
|
|
|
#else
|
2021-11-10 07:24:51 -06:00
|
|
|
int mpiRank = EclGenericVanguard::comm().rank();
|
2020-04-03 07:53:45 -05:00
|
|
|
#endif
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// we always want to use the default locale, and thus spare us the trouble
|
|
|
|
// with incorrect locale settings.
|
|
|
|
resetLocale();
|
|
|
|
|
|
|
|
// this is a work-around for a catch 22: we do not know what code path to use without
|
|
|
|
// parsing the deck, but we don't know the deck without having access to the
|
|
|
|
// parameters and this requires to know the type tag to be used. To solve this, we
|
|
|
|
// use a type tag just for parsing the parameters before we instantiate the actual
|
|
|
|
// simulator object. (Which parses the parameters again, but since this is done in an
|
|
|
|
// identical manner it does not matter.)
|
|
|
|
typedef TypeTagEarlyBird PreTypeTag;
|
|
|
|
using PreProblem = GetPropType<PreTypeTag, Properties::Problem>;
|
|
|
|
|
|
|
|
PreProblem::setBriefDescription("Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project.");
|
|
|
|
int status = FlowMainEbos<PreTypeTag>::setupParameters_(argc_, argv_, EclGenericVanguard::comm());
|
|
|
|
if (status != 0) {
|
|
|
|
// if setupParameters_ returns a value smaller than 0, there was no error, but
|
|
|
|
// the program should abort. This is the case e.g. for the --help and the
|
|
|
|
// --print-properties parameters.
|
2020-04-03 07:53:45 -05:00
|
|
|
#if HAVE_MPI
|
2021-11-10 07:24:51 -06:00
|
|
|
if (status >= 0)
|
|
|
|
MPI_Abort(MPI_COMM_WORLD, status);
|
2020-04-03 07:53:45 -05:00
|
|
|
#endif
|
2021-11-10 07:24:51 -06:00
|
|
|
exitCode = (status > 0) ? status : EXIT_SUCCESS;
|
|
|
|
return false; // Whether to run the simulator
|
|
|
|
}
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
FileOutputMode outputMode = FileOutputMode::OUTPUT_NONE;
|
|
|
|
outputCout_ = false;
|
|
|
|
if (mpiRank == 0)
|
|
|
|
outputCout_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableTerminalOutput);
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
std::string deckFilename;
|
|
|
|
std::string outputDir;
|
|
|
|
if ( eclipseState_ ) {
|
|
|
|
deckFilename = eclipseState_->getIOConfig().fullBasePath();
|
|
|
|
outputDir = eclipseState_->getIOConfig().getOutputDir();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
deckFilename = EWOMS_GET_PARAM(PreTypeTag, std::string, EclDeckFileName);
|
|
|
|
}
|
Fixup Deck, EclipseState, Schedule, ....
Fixup usage of Deck, EclipseState, Schedule, and SummaryConfig to take
into account the class variables deck_, eclipseState_, schedule_, and
summaryConfig_. These variables might initially be empty (nullptr) when
the object is constructed by calling Main(argc, argv) from flow.cpp,
flow_blackoil_dunecpr.cpp, flow_onephase.cpp, or
flow_onephase_energy.cpp. However, when Opm::Main is constructed from the
Python interface code (to be implemented in a later PR) by using the
constructor Main(argc, argv, deck, eclispeState, schedule, summaryConfig)
the variables will not be intially empty.
2020-04-15 16:49:44 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
if (deckFilename.empty()) {
|
|
|
|
if (mpiRank == 0) {
|
|
|
|
std::cerr << "No input case given. Try '--help' for a usage description.\n";
|
2021-10-26 02:14:48 -05:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
exitCode = EXIT_FAILURE;
|
|
|
|
return false;
|
|
|
|
}
|
2021-10-26 02:14:48 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
using PreVanguard = GetPropType<PreTypeTag, Properties::Vanguard>;
|
|
|
|
try {
|
|
|
|
deckFilename = PreVanguard::canonicalDeckPath(deckFilename);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e) {
|
|
|
|
if ( mpiRank == 0 ) {
|
|
|
|
std::cerr << "Exception received: " << e.what() << ". Try '--help' for a usage description.\n";
|
2020-04-03 07:53:45 -05:00
|
|
|
}
|
|
|
|
#if HAVE_MPI
|
2021-11-10 07:24:51 -06:00
|
|
|
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
|
2020-04-03 07:53:45 -05:00
|
|
|
#endif
|
2021-11-10 07:24:51 -06:00
|
|
|
exitCode = EXIT_FAILURE;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (outputCout_) {
|
|
|
|
FlowMainEbos<PreTypeTag>::printBanner(EclGenericVanguard::comm());
|
|
|
|
}
|
|
|
|
// Create Deck and EclipseState.
|
|
|
|
try {
|
|
|
|
auto python = std::make_shared<Python>();
|
|
|
|
const bool init_from_restart_file = !EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart);
|
|
|
|
if (outputDir.empty())
|
|
|
|
outputDir = EWOMS_GET_PARAM(PreTypeTag, std::string, OutputDir);
|
2022-01-27 10:00:39 -06:00
|
|
|
|
|
|
|
const bool allRanksDbgPrtLog = EWOMS_GET_PARAM(PreTypeTag, bool,
|
|
|
|
EnableLoggingFalloutWarning);
|
2021-11-10 07:24:51 -06:00
|
|
|
outputMode = setupLogging(mpiRank,
|
|
|
|
deckFilename,
|
|
|
|
outputDir,
|
|
|
|
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
|
2022-01-27 10:00:39 -06:00
|
|
|
outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog);
|
2021-11-10 07:24:51 -06:00
|
|
|
auto parseContext =
|
|
|
|
std::make_unique<ParseContext>(std::vector<std::pair<std::string , InputError::Action>>
|
|
|
|
{{ParseContext::PARSE_RANDOM_SLASH, InputError::IGNORE},
|
|
|
|
{ParseContext::PARSE_MISSING_DIMS_KEYWORD, InputError::WARN},
|
|
|
|
{ParseContext::SUMMARY_UNKNOWN_WELL, InputError::WARN},
|
|
|
|
{ParseContext::SUMMARY_UNKNOWN_GROUP, InputError::WARN}});
|
|
|
|
if (EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing))
|
|
|
|
parseContext->update(InputError::DELAYED_EXIT1);
|
|
|
|
|
|
|
|
FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout_);
|
|
|
|
|
2020-04-15 13:45:20 -05:00
|
|
|
if (outputCout_) {
|
2021-11-10 07:24:51 -06:00
|
|
|
OpmLog::info("Reading deck file '" + deckFilename + "'");
|
2020-04-03 07:53:45 -05:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
|
|
|
|
std::optional<int> outputInterval;
|
|
|
|
int output_param = EWOMS_GET_PARAM(PreTypeTag, int, EclOutputInterval);
|
|
|
|
if (output_param >= 0)
|
|
|
|
outputInterval = output_param;
|
|
|
|
|
|
|
|
readDeck(EclGenericVanguard::comm(), deckFilename, deck_, eclipseState_, schedule_, udqState_, actionState_, wtestState_,
|
|
|
|
summaryConfig_, nullptr, python, std::move(parseContext),
|
|
|
|
init_from_restart_file, outputCout_, outputInterval);
|
|
|
|
|
2022-03-25 05:08:32 -05:00
|
|
|
verifyValidCellGeometry(EclGenericVanguard::comm(), *this->eclipseState_);
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
setupTime_ = externalSetupTimer.elapsed();
|
|
|
|
outputFiles_ = (outputMode != FileOutputMode::OUTPUT_NONE);
|
|
|
|
}
|
|
|
|
catch (const std::invalid_argument& e)
|
|
|
|
{
|
|
|
|
if (outputCout_) {
|
|
|
|
std::cerr << "Failed to create valid EclipseState object." << std::endl;
|
|
|
|
std::cerr << "Exception caught: " << e.what() << std::endl;
|
2020-04-15 17:21:10 -05:00
|
|
|
}
|
2020-06-03 04:16:56 -05:00
|
|
|
#if HAVE_MPI
|
2021-11-10 07:24:51 -06:00
|
|
|
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
|
2020-06-03 04:16:56 -05:00
|
|
|
#endif
|
2021-11-10 07:24:51 -06:00
|
|
|
exitCode = EXIT_FAILURE;
|
|
|
|
return false;
|
2020-04-15 17:21:10 -05:00
|
|
|
}
|
2020-04-03 07:53:45 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
exitCode = EXIT_SUCCESS;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::filesystem::path simulationCaseName_(const std::string& casename)
|
|
|
|
{
|
|
|
|
namespace fs = ::std::filesystem;
|
|
|
|
|
|
|
|
auto exists = [](const fs::path& f)
|
2021-10-07 08:09:54 -05:00
|
|
|
{
|
2021-11-10 07:24:51 -06:00
|
|
|
return (fs::exists(f) && fs::is_regular_file(f))
|
|
|
|
|| (fs::is_symlink(f) &&
|
|
|
|
fs::is_regular_file(fs::read_symlink(f)));
|
|
|
|
};
|
2020-04-15 17:21:10 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
auto simcase = fs::path { casename };
|
2020-04-15 17:21:10 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
if (exists(simcase)) {
|
|
|
|
return simcase;
|
|
|
|
}
|
2020-04-15 17:21:10 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
for (const auto& ext : { std::string("DATA"), std::string("data") }) {
|
|
|
|
if (exists(simcase.replace_extension(ext))) {
|
2020-04-15 17:21:10 -05:00
|
|
|
return simcase;
|
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2020-04-15 17:21:10 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
throw std::invalid_argument {
|
|
|
|
"Cannot find input case '" + casename + '\''
|
|
|
|
};
|
|
|
|
}
|
2020-04-15 17:21:10 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// This function is an extreme special case, if the program has been invoked
|
|
|
|
// *exactly* as:
|
|
|
|
//
|
|
|
|
// flow --version
|
|
|
|
//
|
|
|
|
// the call is intercepted by this function which will print "flow $version"
|
|
|
|
// on stdout and exit(0).
|
|
|
|
void handleVersionCmdLine_(int argc, char** argv)
|
|
|
|
{
|
|
|
|
auto pos = std::find_if(argv, argv + argc,
|
|
|
|
[](const char* arg)
|
|
|
|
{
|
|
|
|
return std::strcmp(arg, "--version") == 0;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (pos != argv + argc) {
|
|
|
|
std::cout << "flow " << moduleVersionName() << std::endl;
|
|
|
|
std::exit(EXIT_SUCCESS);
|
2020-04-15 17:21:10 -05:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2020-04-15 17:21:10 -05:00
|
|
|
|
2021-12-10 10:42:44 -06:00
|
|
|
// This function is a special case, if the program has been invoked
|
|
|
|
// with the argument "--test-split-communicator=true" as the FIRST
|
|
|
|
// argument, it will be removed from the argument list and we set the
|
|
|
|
// test_split_comm_ flag to true.
|
|
|
|
// Note: initializing the parameter system before MPI could make this
|
|
|
|
// use the parameter system instead.
|
|
|
|
void handleTestSplitCommunicatorCmdLine_()
|
|
|
|
{
|
|
|
|
if (argc_ >= 2 && std::strcmp(argv_[1], "--test-split-communicator=true") == 0) {
|
|
|
|
test_split_comm_ = true;
|
|
|
|
--argc_; // We have one less argument.
|
|
|
|
argv_[1] = argv_[0]; // What used to be the first proper argument now becomes the command argument.
|
|
|
|
++argv_; // Pretend this is what it always was.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runMICP(const Phases& phases)
|
|
|
|
{
|
|
|
|
if (!phases.active(Phase::WATER) || (phases.size() > 2)) {
|
|
|
|
if (outputCout_) {
|
|
|
|
std::cerr << "No valid configuration is found for MICP simulation, "
|
|
|
|
<< "the only valid option is water + MICP\n";
|
2020-04-15 17:21:10 -05:00
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2021-10-25 04:37:33 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
return flowEbosMICPMain(this->argc_,
|
|
|
|
this->argv_,
|
|
|
|
this->outputCout_,
|
|
|
|
this->outputFiles_);
|
|
|
|
}
|
2021-10-25 04:37:33 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runTwoPhase(const Phases& phases)
|
|
|
|
{
|
2022-09-30 08:28:58 -05:00
|
|
|
const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// oil-gas
|
|
|
|
if (phases.active( Phase::OIL ) && phases.active( Phase::GAS )) {
|
2022-09-30 08:28:58 -05:00
|
|
|
if (diffusive) {
|
|
|
|
return flowEbosGasOilDiffuseMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
} else {
|
|
|
|
return flowEbosGasOilMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2021-10-25 04:37:33 -05:00
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// oil-water
|
|
|
|
else if ( phases.active( Phase::OIL ) && phases.active( Phase::WATER ) ) {
|
2022-09-30 08:28:58 -05:00
|
|
|
if (diffusive) {
|
|
|
|
if (outputCout_) {
|
|
|
|
std::cerr << "The DIFFUSE option is not available for the two-phase water/oil model." << std::endl;
|
|
|
|
}
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
return flowEbosOilWaterMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2020-04-15 17:21:10 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// gas-water
|
|
|
|
else if ( phases.active( Phase::GAS ) && phases.active( Phase::WATER ) ) {
|
2022-09-30 08:28:58 -05:00
|
|
|
if (diffusive) {
|
|
|
|
if (outputCout_) {
|
|
|
|
std::cerr << "The DIFFUSE option is not available for the two-phase gas/water model." << std::endl;
|
|
|
|
}
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
return flowEbosGasWaterMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (outputCout_) {
|
|
|
|
std::cerr << "No suitable configuration found, valid are Twophase (oilwater, oilgas and gaswater), polymer, solvent, or blackoil" << std::endl;
|
2021-10-07 08:17:41 -05:00
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
return EXIT_FAILURE;
|
2021-10-07 08:17:41 -05:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runPolymer(const Phases& phases)
|
|
|
|
{
|
|
|
|
if (! phases.active(Phase::WATER)) {
|
|
|
|
if (outputCout_)
|
|
|
|
std::cerr << "No valid configuration is found for polymer simulation, valid options include "
|
|
|
|
<< "oilwater + polymer and blackoil + polymer" << std::endl;
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
// Need to track the polymer molecular weight
|
|
|
|
// for the injectivity study
|
|
|
|
if (phases.active(Phase::POLYMW)) {
|
|
|
|
// only oil water two phase for now
|
|
|
|
assert (phases.size() == 4);
|
|
|
|
return flowEbosOilWaterPolymerInjectivityMain(argc_, argv_, outputCout_, outputFiles_);
|
2021-10-07 08:17:41 -05:00
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
if (phases.size() == 3) { // oil water polymer case
|
|
|
|
return flowEbosOilWaterPolymerMain(argc_, argv_, outputCout_, outputFiles_);
|
2021-10-07 08:17:41 -05:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
else {
|
|
|
|
return flowEbosPolymerMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runFoam()
|
|
|
|
{
|
|
|
|
return flowEbosFoamMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2022-04-26 05:48:11 -05:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
return flowEbosWaterOnlyEnergyMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runBrine(const Phases& phases)
|
|
|
|
{
|
2022-01-11 07:23:37 -06:00
|
|
|
if (! phases.active(Phase::WATER) || phases.size() == 2) {
|
2021-11-10 07:24:51 -06:00
|
|
|
if (outputCout_)
|
|
|
|
std::cerr << "No valid configuration is found for brine simulation, valid options include "
|
2022-01-11 07:23:37 -06:00
|
|
|
<< "oilwater + brine, gaswater + brine and blackoil + brine" << std::endl;
|
2021-11-10 07:24:51 -06:00
|
|
|
|
|
|
|
return EXIT_FAILURE;
|
2021-10-07 08:17:41 -05:00
|
|
|
}
|
|
|
|
|
2021-12-08 07:35:22 -06:00
|
|
|
if (phases.size() == 3) {
|
|
|
|
|
|
|
|
if (phases.active(Phase::OIL)){ // oil water brine case
|
|
|
|
return flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
if (phases.active(Phase::GAS)){ // gas water brine case
|
2022-03-01 10:54:22 -06:00
|
|
|
if (eclipseState_->getSimulationConfig().hasPRECSALT() &&
|
|
|
|
eclipseState_->getSimulationConfig().hasVAPWAT()) {
|
|
|
|
//case with water vaporization into gas phase and salt precipitation
|
2022-06-14 05:40:16 -05:00
|
|
|
return flowEbosGasWaterSaltprecVapwatMain(argc_, argv_, outputCout_, outputFiles_);
|
2022-03-01 10:54:22 -06:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return flowEbosGasWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2021-12-08 07:35:22 -06:00
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
}
|
2022-01-06 05:50:52 -06:00
|
|
|
else if (eclipseState_->getSimulationConfig().hasPRECSALT()) {
|
2022-04-11 14:56:44 -05:00
|
|
|
if (eclipseState_->getSimulationConfig().hasVAPWAT()) {
|
|
|
|
//case with water vaporization into gas phase and salt precipitation
|
|
|
|
return flowEbosBrinePrecsaltVapwatMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return flowEbosBrineSaltPrecipitationMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2022-01-06 05:50:52 -06:00
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
else {
|
|
|
|
return flowEbosBrineMain(argc_, argv_, outputCout_, outputFiles_);
|
2021-10-07 08:17:41 -05:00
|
|
|
}
|
2022-01-17 06:59:47 -06:00
|
|
|
|
|
|
|
return EXIT_FAILURE;
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runSolvent()
|
|
|
|
{
|
|
|
|
return flowEbosSolventMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2021-10-07 08:17:41 -05:00
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
int runExtendedBlackOil()
|
|
|
|
{
|
|
|
|
return flowEbosExtboMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
|
2021-12-06 03:26:54 -06:00
|
|
|
int runThermal(const Phases& phases)
|
2021-11-10 07:24:51 -06:00
|
|
|
{
|
2021-12-06 03:26:54 -06:00
|
|
|
// oil-gas-thermal
|
|
|
|
if (!phases.active( Phase::WATER ) && phases.active( Phase::OIL ) && phases.active( Phase::GAS )) {
|
|
|
|
return flowEbosGasOilEnergyMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
|
2021-11-10 07:24:51 -06:00
|
|
|
return flowEbosEnergyMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
|
|
|
|
|
|
|
int runBlackOil()
|
|
|
|
{
|
2022-09-30 08:28:58 -05:00
|
|
|
const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
|
|
|
|
if (diffusive) {
|
|
|
|
// Use the traditional linearizer, as the TpfaLinearizer does not
|
|
|
|
// support the diffusion module yet.
|
|
|
|
return flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
} else {
|
|
|
|
return flowEbosBlackoilTpfaMain(argc_, argv_, outputCout_, outputFiles_);
|
|
|
|
}
|
2021-11-10 07:24:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int argc_{0};
|
|
|
|
char** argv_{nullptr};
|
|
|
|
bool outputCout_{false};
|
|
|
|
bool outputFiles_{false};
|
|
|
|
double setupTime_{0.0};
|
|
|
|
std::string deckFilename_{};
|
|
|
|
std::string flowProgName_{};
|
|
|
|
char *saveArgs_[3]{nullptr};
|
|
|
|
std::unique_ptr<UDQState> udqState_{};
|
|
|
|
std::unique_ptr<Action::State> actionState_{};
|
|
|
|
std::unique_ptr<WellTestState> wtestState_{};
|
|
|
|
|
|
|
|
// These variables may be owned by both Python and the simulator
|
|
|
|
std::shared_ptr<Deck> deck_{};
|
|
|
|
std::shared_ptr<EclipseState> eclipseState_{};
|
|
|
|
std::shared_ptr<Schedule> schedule_{};
|
|
|
|
std::shared_ptr<SummaryConfig> summaryConfig_{};
|
|
|
|
|
|
|
|
// To demonstrate run with non_world_comm
|
2021-12-10 10:42:44 -06:00
|
|
|
bool test_split_comm_ = false;
|
2021-11-10 07:24:51 -06:00
|
|
|
bool isSimulationRank_ = true;
|
|
|
|
};
|
2020-04-16 04:35:01 -05:00
|
|
|
|
2020-04-03 07:53:45 -05:00
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#endif // OPM_MAIN_HEADER_INCLUDED
|