133 std::shared_ptr<EclipseState> eclipseState,
134 std::shared_ptr<Schedule> schedule,
139 void setArgvArgc_(
const std::string&
filename);
147 if (isSimulationRank_) {
148 return this->dispatchDynamic_();
155 template <
class TypeTag>
160 if (isSimulationRank_) {
173 std::unique_ptr<FlowMainEbosType> initFlowEbosBlackoil(
int&
exitCode)
179 this->setupVanguard();
181 argc_, argv_, outputCout_, outputFiles_);
184 return std::unique_ptr<FlowMainEbosType>();
189 int dispatchDynamic_()
191 const auto&
rspec = this->eclipseState_->runspec();
194 this->setupVanguard();
200 const bool thermal = eclipseState_->getSimulationConfig().isThermal();
204 return this->runMICP(
phases);
209 return this->runWaterOnly(
phases);
214 return this->runWaterOnlyEnergy(
phases);
219 return this->runTwoPhase(
phases);
223 else if (
phases.active(Phase::POLYMER)) {
224 return this->runPolymer(
phases);
228 else if (
phases.active(Phase::FOAM) && !
phases.active(Phase::SOLVENT)) {
229 return this->runFoam();
233 else if (
phases.active(Phase::SOLVENT)) {
234 return this->runSolvent(
phases);
239 return this->runBrine(
phases);
243 else if (
phases.active(Phase::ZFRACTION)) {
244 return this->runExtendedBlackOil();
249 return this->runThermal(
phases);
253 else if (
phases.size() == 3) {
254 return this->runBlackOil();
259 std::cerr <<
"No suitable configuration found, valid are "
260 <<
"Twophase, polymer, foam, brine, solvent, "
261 <<
"energy, and blackoil.\n";
268 template <
class TypeTag>
269 int dispatchStatic_()
271 this->setupVanguard();
281 template <
class TypeTagEarlyBird>
302 PreProblem::setBriefDescription(
"Flow, an advanced reservoir simulator for ECL-decks provided by the Open Porous Media project.");
318 if ( eclipseState_ ) {
319 deckFilename = eclipseState_->getIOConfig().fullBasePath();
320 outputDir = eclipseState_->getIOConfig().getOutputDir();
332 msg =
"\nUse of Damaris (command line argument --enable-damaris-output=true) has been disabled for run with only one rank.\n" ;
333 OpmLog::warning(
msg);
345 if (!isSimulationRank_) {
350 int mpiRank = EclGenericVanguard::comm().rank();
357 std::cerr <<
"No input case given. Try '--help' for a usage description.\n";
367 catch (
const std::exception&
e) {
369 std::cerr <<
"Exception received: " <<
e.what() <<
". Try '--help' for a usage description.\n";
380 printFlowBanner(EclGenericVanguard::comm().size(),
383 std::ostringstream
str;
384 Parameters::printValues<PreTypeTag>(
str);
403 catch (
const std::invalid_argument&
e)
406 std::cerr <<
"Failed to create valid EclipseState object." << std::endl;
407 std::cerr <<
"Exception caught: " <<
e.what() << std::endl;
427 void handleVersionCmdLine_(
int argc,
char**
argv,
436 void handleTestSplitCommunicatorCmdLine_();
440 if (!
phases.active(Phase::WATER) || (
phases.size() > 2)) {
442 std::cerr <<
"No valid configuration is found for MICP simulation, "
443 <<
"the only valid option is water + MICP\n";
457 const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
458 const bool disgasw = eclipseState_->getSimulationConfig().hasDISGASW();
459 const bool vapwat = eclipseState_->getSimulationConfig().hasVAPWAT();
462 if (
phases.active( Phase::OIL ) &&
phases.active( Phase::GAS )) {
471 else if (
phases.active( Phase::OIL ) &&
phases.active( Phase::WATER ) ) {
474 std::cerr <<
"The DIFFUSE option is not available for the two-phase water/oil model." << std::endl;
482 else if (
phases.active( Phase::GAS ) &&
phases.active( Phase::WATER ) ) {
491 std::cerr <<
"The DIFFUSE option is not available for the two-phase gas/water model without disgasw or vapwat." << std::endl;
500 std::cerr <<
"No suitable configuration found, valid are Twophase (oilwater, oilgas and gaswater), polymer, solvent, or blackoil" << std::endl;
509 if (!
phases.active(Phase::WATER)) {
511 std::cerr <<
"No valid configuration is found for polymer simulation, valid options include "
512 <<
"oilwater + polymer and blackoil + polymer" << std::endl;
519 if (
phases.active(Phase::POLYMW)) {
540 if (!
phases.active(Phase::WATER) ||
phases.size() != 1) {
542 std::cerr <<
"No valid configuration is found for water-only simulation, valid options include "
543 <<
"water, water + thermal" << std::endl;
553 if (!
phases.active(Phase::WATER) ||
phases.size() != 2) {
555 std::cerr <<
"No valid configuration is found for water-only simulation, valid options include "
556 <<
"water, water + thermal" << std::endl;
566 if (!
phases.active(Phase::WATER) ||
phases.size() == 2) {
568 std::cerr <<
"No valid configuration is found for brine simulation, valid options include "
569 <<
"oilwater + brine, gaswater + brine and blackoil + brine" << std::endl;
576 if (
phases.active(Phase::OIL)){
579 if (
phases.active(Phase::GAS)){
580 if (eclipseState_->getSimulationConfig().hasPRECSALT() &&
581 eclipseState_->getSimulationConfig().hasVAPWAT()) {
590 else if (eclipseState_->getSimulationConfig().hasPRECSALT()) {
591 if (eclipseState_->getSimulationConfig().hasVAPWAT()) {
608 if (
phases.active(Phase::FOAM)) {
612 if (!
phases.active( Phase::OIL ) &&
phases.active( Phase::WATER ) &&
phases.active( Phase::GAS )) {
617 if (
phases.active( Phase::OIL ) &&
phases.active( Phase::WATER ) &&
phases.active( Phase::GAS )) {
622 std::cerr <<
"No valid configuration is found for solvent simulation, valid options include "
623 <<
"gas + water + solvent and gas + oil + water + solvent" << std::endl;
628 int runExtendedBlackOil()
636 if (!
phases.active( Phase::WATER ) &&
phases.active( Phase::OIL ) &&
phases.active( Phase::GAS )) {
641 if (!
phases.active( Phase::OIL ) &&
phases.active( Phase::WATER ) &&
phases.active( Phase::GAS )) {
643 if (
phases.active(Phase::BRINE)){
654 const bool diffusive = eclipseState_->getSimulationConfig().isDiffusive();
676 void setupVanguard();
678 template<
class TypeTag>
679 static int getNumThreads()
688 if (std::getenv(
"OMP_NUM_THREADS")) {
712 char** argv_{
nullptr};
713 bool outputCout_{
false};
714 bool outputFiles_{
false};
715 double setupTime_{0.0};
716 std::string deckFilename_{};
717 std::string flowProgName_{};
718 char *saveArgs_[3]{
nullptr};
719 std::unique_ptr<UDQState> udqState_{};
720 std::unique_ptr<Action::State> actionState_{};
721 std::unique_ptr<WellTestState> wtestState_{};
724 std::shared_ptr<EclipseState> eclipseState_{};
725 std::shared_ptr<Schedule> schedule_{};
726 std::shared_ptr<SummaryConfig> summaryConfig_{};
729 bool test_split_comm_ =
false;
730 bool isSimulationRank_ =
true;