130 std::shared_ptr<Schedule> schedule,
135 void setArgvArgc_(
const std::string&
filename);
142 if (isSimulationRank_) {
144 return this->dispatchDynamic_();
151 template <
class TypeTag>
155 if (isSimulationRank_) {
169 std::unique_ptr<FlowMainEbosType> initFlowEbosBlackoil(
int&
exitCode)
175 this->setupVanguard();
177 argc_, argv_, outputCout_, outputFiles_);
180 return std::unique_ptr<FlowMainEbosType>();
185 int dispatchDynamic_()
187 const auto&
rspec = this->eclipseState_->runspec();
190 this->setupVanguard();
196 const bool thermal = eclipseState_->getSimulationConfig().isThermal();
200 return this->runMICP(
phases);
205 return this->runWaterOnly(
phases);
210 return this->runWaterOnlyEnergy(
phases);
215 return this->runTwoPhase(
phases);
219 else if (
phases.active(Phase::POLYMER)) {
220 return this->runPolymer(
phases);
224 else if (
phases.active(Phase::FOAM)) {
225 return this->runFoam();
229 else if (
phases.active(Phase::BRINE)) {
230 return this->runBrine(
phases);
234 else if (
phases.active(Phase::SOLVENT)) {
235 return this->runSolvent();
239 else if (
phases.active(Phase::ZFRACTION)) {
240 return this->runExtendedBlackOil();
245 return this->runThermal(
phases);
249 else if (
phases.size() == 3) {
250 return this->runBlackOil();
255 std::cerr <<
"No suitable configuration found, valid are "
256 <<
"Twophase, polymer, foam, brine, solvent, "
257 <<
"energy, and blackoil.\n";
264 template <
class TypeTag>
265 int dispatchStatic_()
267 this->setupVanguard();
277 template <
class TypeTagEarlyBird>
298 PreProblem::setBriefDescription(
"Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project.");
314 if ( eclipseState_ ) {
315 deckFilename = eclipseState_->getIOConfig().fullBasePath();
316 outputDir = eclipseState_->getIOConfig().getOutputDir();
331 int mpiRank = EclGenericVanguard::comm().rank();
339 std::cerr <<
"No input case given. Try '--help' for a usage description.\n";
349 catch (
const std::exception&
e) {
351 std::cerr <<
"Exception received: " <<
e.what() <<
". Try '--help' for a usage description.\n";
362 printFlowBanner(EclGenericVanguard::comm().size(),
365 std::ostringstream
str;
366 Parameters::printValues<PreTypeTag>(
str);
385 catch (
const std::invalid_argument&
e)
388 std::cerr <<
"Failed to create valid EclipseState object." << std::endl;
389 std::cerr <<
"Exception caught: " <<
e.what() << std::endl;
409 void handleVersionCmdLine_(
int argc,
char**
argv,
418 void handleTestSplitCommunicatorCmdLine_();
422 if (!
phases.active(Phase::WATER) || (
phases.size() > 2)) {
424 std::cerr <<
"No valid configuration is found for MICP simulation, "
425 <<
"the only valid option is water + MICP\n";
439 const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
440 const bool disgasw = eclipseState_->getSimulationConfig().hasDISGASW();
443 if (
phases.active( Phase::OIL ) &&
phases.active( Phase::GAS )) {
452 else if (
phases.active( Phase::OIL ) &&
phases.active( Phase::WATER ) ) {
455 std::cerr <<
"The DIFFUSE option is not available for the two-phase water/oil model." << std::endl;
463 else if (
phases.active( Phase::GAS ) &&
phases.active( Phase::WATER ) ) {
472 std::cerr <<
"The DIFFUSE option is not available for the two-phase gas/water model without disgasw." << std::endl;
481 std::cerr <<
"No suitable configuration found, valid are Twophase (oilwater, oilgas and gaswater), polymer, solvent, or blackoil" << std::endl;
490 if (!
phases.active(Phase::WATER)) {
492 std::cerr <<
"No valid configuration is found for polymer simulation, valid options include "
493 <<
"oilwater + polymer and blackoil + polymer" << std::endl;
500 if (
phases.active(Phase::POLYMW)) {
521 if (!
phases.active(Phase::WATER) ||
phases.size() != 1) {
523 std::cerr <<
"No valid configuration is found for water-only simulation, valid options include "
524 <<
"water, water + thermal" << std::endl;
534 if (!
phases.active(Phase::WATER) ||
phases.size() != 2) {
536 std::cerr <<
"No valid configuration is found for water-only simulation, valid options include "
537 <<
"water, water + thermal" << std::endl;
547 if (!
phases.active(Phase::WATER) ||
phases.size() == 2) {
549 std::cerr <<
"No valid configuration is found for brine simulation, valid options include "
550 <<
"oilwater + brine, gaswater + brine and blackoil + brine" << std::endl;
557 if (
phases.active(Phase::OIL)){
560 if (
phases.active(Phase::GAS)){
561 if (eclipseState_->getSimulationConfig().hasPRECSALT() &&
562 eclipseState_->getSimulationConfig().hasVAPWAT()) {
571 else if (eclipseState_->getSimulationConfig().hasPRECSALT()) {
572 if (eclipseState_->getSimulationConfig().hasVAPWAT()) {
592 int runExtendedBlackOil()
600 if (!
phases.active( Phase::WATER ) &&
phases.active( Phase::OIL ) &&
phases.active( Phase::GAS )) {
605 if (!
phases.active( Phase::OIL ) &&
phases.active( Phase::WATER ) &&
phases.active( Phase::GAS )) {
614 const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
636 void setupVanguard();
638 template<
class TypeTag>
639 static int getNumThreads()
648 if (std::getenv(
"OMP_NUM_THREADS"))
668 char** argv_{
nullptr};
669 bool outputCout_{
false};
670 bool outputFiles_{
false};
671 double setupTime_{0.0};
672 std::string deckFilename_{};
673 std::string flowProgName_{};
674 char *saveArgs_[3]{
nullptr};
675 std::unique_ptr<UDQState> udqState_{};
676 std::unique_ptr<Action::State> actionState_{};
677 std::unique_ptr<WellTestState> wtestState_{};
680 std::shared_ptr<EclipseState> eclipseState_{};
681 std::shared_ptr<Schedule> schedule_{};
682 std::shared_ptr<SummaryConfig> summaryConfig_{};
685 bool test_split_comm_ =
false;
686 bool isSimulationRank_ =
true;