flow: print the startup banner immediately

also, add a "reading deck" output. The idea is to make `flow`'s
behaviour less surprising by preventing people from thinking that
nothing happens after starting `flow` for a large deck.
This commit is contained in:
Andreas Lauser 2018-10-22 10:37:16 +02:00
parent ab94700f9a
commit 7d30a8408a
2 changed files with 23 additions and 25 deletions

View File

@ -134,13 +134,16 @@ int main(int argc, char** argv)
deckFilename = PreVanguard::canonicalDeckPath(deckFilename).string();
}
catch (const std::exception& e) {
Ewoms::Parameters::printUsage<PreTypeTag>(PreProblem::helpPreamble(argc, const_cast<const char**>(argv)),
e.what());
std::cerr << "Exception received: " << e.what() << ". Try '--help' for a usage description.\n";
return 1;
}
Opm::FlowMainEbos<PreTypeTag>::printBanner();
// Create Deck and EclipseState.
try {
std::cout << "Reading deck file '" << deckFilename << "'\n";
std::cout.flush();
Opm::Parser parser;
typedef std::pair<std::string, Opm::InputError::Action> ParseModePair;
typedef std::vector<ParseModePair> ParseModePairs;

View File

@ -193,6 +193,24 @@ namespace Opm
return status;
}
static void printBanner()
{
const int lineLen = 70;
const std::string version = moduleVersionName();
const std::string banner = "This is flow "+version;
const int bannerPreLen = (lineLen - 2 - banner.size())/2;
const int bannerPostLen = bannerPreLen + (lineLen - 2 - banner.size())%2;
std::cout << "**********************************************************************\n";
std::cout << "* *\n";
std::cout << "*" << std::string(bannerPreLen, ' ') << banner << std::string(bannerPostLen, ' ') << "*\n";
std::cout << "* *\n";
std::cout << "* Flow is a simulator for fully implicit three-phase black-oil flow, *\n";
std::cout << "* including solvent and polymer capabilities. *\n";
std::cout << "* For more information, see https://opm-project.org *\n";
std::cout << "* *\n";
std::cout << "**********************************************************************\n\n";
}
/// This is the main function of Flow. It runs a complete simulation with the
/// given grid and simulator classes, based on the user-specified command-line
/// input.
@ -207,7 +225,6 @@ namespace Opm
setupParallelism();
setupOutput();
printStartupMessage();
setupEbosSimulator();
setupLogging();
printPRTHeader();
@ -266,28 +283,6 @@ namespace Opm
ThreadManager::init();
}
// Print startup message if on output rank.
void printStartupMessage()
{
if (output_cout_) {
const int lineLen = 70;
const std::string version = moduleVersionName();
const std::string banner = "This is flow "+version;
const int bannerPreLen = (lineLen - 2 - banner.size())/2;
const int bannerPostLen = bannerPreLen + (lineLen - 2 - banner.size())%2;
std::cout << "**********************************************************************\n";
std::cout << "* *\n";
std::cout << "*" << std::string(bannerPreLen, ' ') << banner << std::string(bannerPostLen, ' ') << "*\n";
std::cout << "* *\n";
std::cout << "* Flow is a simulator for fully implicit three-phase black-oil flow, *\n";
std::cout << "* including solvent and polymer capabilities. *\n";
std::cout << "* For more information, see https://opm-project.org *\n";
std::cout << "* *\n";
std::cout << "**********************************************************************\n\n";
}
}
// Extract the minimum priority and determines if log files ought to be created.
// Writes to:
// output_to_files_