Prevent printing stats on more than 1 process for CPR.

This commit is contained in:
Markus Blatt 2015-05-08 13:15:59 +02:00
parent db06fa48f5
commit f0691504af
2 changed files with 33 additions and 17 deletions

View File

@ -93,7 +93,7 @@
namespace namespace
{ {
void warnIfUnusedParams(const Opm::parameter::ParameterGroup& param) void warnIfUnusedParams(const Opm::parameter::ParameterGroup& param)
{ {
if (param.anyUnused()) { if (param.anyUnused()) {
std::cout << "-------------------- Unused parameters: --------------------\n"; std::cout << "-------------------- Unused parameters: --------------------\n";
@ -113,7 +113,11 @@ try
// Must ensure an instance of the helper is created to initialise MPI. // Must ensure an instance of the helper is created to initialise MPI.
const Dune::MPIHelper& mpi_helper = Dune::MPIHelper::instance(argc, argv); const Dune::MPIHelper& mpi_helper = Dune::MPIHelper::instance(argc, argv);
using namespace Opm; using namespace Opm;
// Write parameters used for later reference. (only if rank is zero)
bool output_cout = ( mpi_helper.rank() == 0 );
if(output_cout)
{
std::cout << "******************************************************************************************\n"; std::cout << "******************************************************************************************\n";
std::cout << "* *\n"; std::cout << "* *\n";
std::cout << "* This is Flow (version 2015.04, experimental variant using dune-cornerpoint) *\n"; std::cout << "* This is Flow (version 2015.04, experimental variant using dune-cornerpoint) *\n";
@ -123,10 +127,20 @@ try
std::cout << "* http://opm-project.org *\n"; std::cout << "* http://opm-project.org *\n";
std::cout << "* *\n"; std::cout << "* *\n";
std::cout << "******************************************************************************************\n\n"; std::cout << "******************************************************************************************\n\n";
}
// Read parameters, see if a deck was specified on the command line. // Read parameters, see if a deck was specified on the command line.
if ( output_cout )
{
std::cout << "--------------- Reading parameters ---------------" << std::endl; std::cout << "--------------- Reading parameters ---------------" << std::endl;
parameter::ParameterGroup param(argc, argv, false); }
parameter::ParameterGroup param(argc, argv, false, output_cout);
if( !output_cout )
{
param.disableOutput();
}
if (!param.unhandledArguments().empty()) { if (!param.unhandledArguments().empty()) {
if (param.unhandledArguments().size() != 1) { if (param.unhandledArguments().size() != 1) {
std::cerr << "You can only specify a single input deck on the command line.\n"; std::cerr << "You can only specify a single input deck on the command line.\n";
@ -336,7 +350,7 @@ try
threshold_pressures); threshold_pressures);
if (!schedule->initOnly()){ if (!schedule->initOnly()){
if( grid->comm().rank()==0 ) if( output_cout )
{ {
std::cout << "\n\n================ Starting main simulation loop ===============\n" std::cout << "\n\n================ Starting main simulation loop ===============\n"
<< std::flush; << std::flush;
@ -344,7 +358,7 @@ try
SimulatorReport fullReport = simulator.run(simtimer, must_distribute ? distributed_state : state); SimulatorReport fullReport = simulator.run(simtimer, must_distribute ? distributed_state : state);
if( grid->comm().rank()==0 ) if( output_cout )
{ {
std::cout << "\n\n================ End of simulation ===============\n\n"; std::cout << "\n\n================ End of simulation ===============\n\n";
fullReport.reportFullyImplicit(std::cout); fullReport.reportFullyImplicit(std::cout);
@ -358,6 +372,7 @@ try
} }
} else { } else {
outputWriter.writeInit( simtimer ); outputWriter.writeInit( simtimer );
if ( output_cout )
std::cout << "\n\n================ Simulation turned off ===============\n" << std::flush; std::cout << "\n\n================ Simulation turned off ===============\n" << std::flush;
} }
} }

View File

@ -459,7 +459,8 @@ createEllipticPreconditionerPointer(const M& Ae, double relax,
// Linear solver parameters // Linear solver parameters
const double tolerance = param_.cpr_solver_tol_; const double tolerance = param_.cpr_solver_tol_;
const int maxit = param_.cpr_max_ell_iter_; const int maxit = param_.cpr_max_ell_iter_;
const int verbosity = param_.cpr_solver_verbose_ ? 1 : 0; const int verbosity = ( param_.cpr_solver_verbose_ &&
comm_.communicator().rank()==0 ) ? 1 : 0;
// operator result containing iterations etc. // operator result containing iterations etc.
Dune::InverseOperatorResult result; Dune::InverseOperatorResult result;