make terminal output a parameter to avoid output.

This commit is contained in:
Robert Kloefkorn 2015-03-04 13:42:27 +01:00
parent 06396b4b82
commit e5eec509d2
3 changed files with 23 additions and 15 deletions

View File

@ -101,7 +101,8 @@ namespace Opm {
const Wells* wells, const Wells* wells,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil ); const bool has_vapoil,
const bool terminal_output);
/// \brief Set threshold pressures that prevent or reduce flow. /// \brief Set threshold pressures that prevent or reduce flow.
/// This prevents flow across faces if the potential /// This prevents flow across faces if the potential

View File

@ -198,7 +198,8 @@ namespace detail {
const Wells* wells, const Wells* wells,
const NewtonIterationBlackoilInterface& linsolver, const NewtonIterationBlackoilInterface& linsolver,
const bool has_disgas, const bool has_disgas,
const bool has_vapoil) const bool has_vapoil,
const bool terminal_output)
: grid_ (grid) : grid_ (grid)
, fluid_ (fluid) , fluid_ (fluid)
, geo_ (geo) , geo_ (geo)
@ -219,15 +220,18 @@ namespace detail {
, residual_ ( { std::vector<ADB>(fluid.numPhases(), ADB::null()), , residual_ ( { std::vector<ADB>(fluid.numPhases(), ADB::null()),
ADB::null(), ADB::null(),
ADB::null() } ) ADB::null() } )
, terminal_output_ (true) , terminal_output_ (terminal_output)
{ {
#if HAVE_MPI #if HAVE_MPI
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) if( terminal_output_ )
{ {
const ParallelISTLInformation& info = if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
boost::any_cast<const ParallelISTLInformation&>(linsolver_.parallelInformation()); {
// Only rank 0 does print to std::cout const ParallelISTLInformation& info =
terminal_output_ = (info.communicator().rank()==0); boost::any_cast<const ParallelISTLInformation&>(linsolver_.parallelInformation());
// Only rank 0 does print to std::cout if terminal_output is enabled
terminal_output_ = (info.communicator().rank()==0);
}
} }
#endif #endif
} }

View File

@ -185,7 +185,7 @@ namespace Opm
solver_(linsolver), solver_(linsolver),
has_disgas_(has_disgas), has_disgas_(has_disgas),
has_vapoil_(has_vapoil), has_vapoil_(has_vapoil),
terminal_output_(true), terminal_output_(param.getDefault("output_terminal", true)),
eclipse_state_(eclipse_state), eclipse_state_(eclipse_state),
output_writer_(output_writer), output_writer_(output_writer),
rateConverter_(props_, std::vector<int>(AutoDiffGrid::numCells(grid_), 0)), rateConverter_(props_, std::vector<int>(AutoDiffGrid::numCells(grid_), 0)),
@ -198,12 +198,15 @@ namespace Opm
allcells_[cell] = cell; allcells_[cell] = cell;
} }
#if HAVE_MPI #if HAVE_MPI
if ( solver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) if( terminal_output_ )
{ {
const ParallelISTLInformation& info = if ( solver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
boost::any_cast<const ParallelISTLInformation&>(solver_.parallelInformation()); {
// Only rank 0 does print to std::cout const ParallelISTLInformation& info =
terminal_output_= (info.communicator().rank()==0); boost::any_cast<const ParallelISTLInformation&>(solver_.parallelInformation());
// Only rank 0 does print to std::cout
terminal_output_= (info.communicator().rank()==0);
}
} }
#endif #endif
} }
@ -283,7 +286,7 @@ namespace Opm
// Run a multiple steps of the solver depending on the time step control. // Run a multiple steps of the solver depending on the time step control.
solver_timer.start(); solver_timer.start();
FullyImplicitBlackoilSolver<T> solver(solverParam, grid_, props_, geo_, rock_comp_props_, wells, solver_, has_disgas_, has_vapoil_); FullyImplicitBlackoilSolver<T> solver(solverParam, grid_, props_, geo_, rock_comp_props_, wells, solver_, has_disgas_, has_vapoil_, terminal_output_);
if (!threshold_pressures_by_face_.empty()) { if (!threshold_pressures_by_face_.empty()) {
solver.setThresholdPressures(threshold_pressures_by_face_); solver.setThresholdPressures(threshold_pressures_by_face_);
} }