diff --git a/opm/autodiff/FlowMainEbos.hpp b/opm/autodiff/FlowMainEbos.hpp old mode 100644 new mode 100755 index 354e853b9..ae9ab902a --- a/opm/autodiff/FlowMainEbos.hpp +++ b/opm/autodiff/FlowMainEbos.hpp @@ -23,6 +23,8 @@ #ifndef OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED #define OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED +#include + #include #include @@ -116,6 +118,7 @@ namespace Opm setupEbosSimulator(); setupOutput(); setupLogging(); + printPRTHeader(); extractMessages(); setupGridAndProps(); runDiagnostics(); @@ -189,7 +192,8 @@ namespace Opm // Print startup message if on output rank. void printStartupMessage() - { + { + if (output_cout_) { const int lineLen = 70; const std::string version = moduleVersionName(); @@ -318,13 +322,51 @@ namespace Opm streamLog->setMessageLimiter(std::make_shared(10, limits)); streamLog->setMessageFormatter(std::make_shared(true)); - // Read parameters. if ( output_cout_ ) - { + { + // Read Parameters. OpmLog::debug("\n--------------- Reading parameters ---------------\n"); } } - + + void printPRTHeader() + { + // Print header for PRT file. + if ( output_cout_ ) { + const std::string version = moduleVersionName(); + const double megabyte = 1024 * 1024; + unsigned num_cpu = std::thread::hardware_concurrency(); + struct utsname arch; + const char* user = getlogin(); + time_t now = std::time(0); + struct tm tstruct; + char tmstr[80]; + tstruct = *localtime(&now); + strftime(tmstr, sizeof(tmstr), "%d-%m-%Y at %X", &tstruct); + const double mem_size = getTotalSystemMemory() / megabyte; + std::ostringstream ss; + ss << "\n\n\n ######## # ###### # #\n"; + ss << " # # # # # # \n"; + ss << " ##### # # # # # # \n"; + ss << " # # # # # # # # \n"; + ss << " # ####### ###### # # \n\n"; + ss << "Flow is a simulator for fully implicit three-phase black-oil flow,"; + ss << " and is part of OPM.\nFor more information visit: http://opm-project.org \n\n"; + ss << "Flow Version = " + version + "\n"; + if (uname(&arch) == 0) { + ss << "System = " << arch.nodename << " (Number of cores: " << num_cpu; + ss << ", RAM: " << std::fixed << std::setprecision (2) << mem_size << " MB) \n"; + ss << "Architecture = " << arch.sysname << " " << arch.machine << " (Release: " << arch.release; + ss << ", Version: " << arch.version << " )\n"; + } + if (user) { + ss << "User = " << user << std::endl; + } + ss << "Simulation started on " << tmstr << " hrs\n"; + OpmLog::note(ss.str()); + } + } + void mergeParallelLogFiles() { // force closing of all log files. @@ -727,7 +769,13 @@ namespace Opm throw std::invalid_argument( "Cannot find input case " + casename ); } - + + unsigned long long getTotalSystemMemory() + { + long pages = sysconf(_SC_PHYS_PAGES); + long page_size = sysconf(_SC_PAGE_SIZE); + return pages * page_size; + } int64_t convertMessageType(const Message::type& mtype) { @@ -792,4 +840,4 @@ namespace Opm }; } // namespace Opm -#endif // OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED +#endif // OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED