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 NewtonIterationBlackoilInterface& linsolver,
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.
/// This prevents flow across faces if the potential

View File

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

View File

@ -185,7 +185,7 @@ namespace Opm
solver_(linsolver),
has_disgas_(has_disgas),
has_vapoil_(has_vapoil),
terminal_output_(true),
terminal_output_(param.getDefault("output_terminal", true)),
eclipse_state_(eclipse_state),
output_writer_(output_writer),
rateConverter_(props_, std::vector<int>(AutoDiffGrid::numCells(grid_), 0)),
@ -198,6 +198,8 @@ namespace Opm
allcells_[cell] = cell;
}
#if HAVE_MPI
if( terminal_output_ )
{
if ( solver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
{
const ParallelISTLInformation& info =
@ -205,6 +207,7 @@ namespace Opm
// Only rank 0 does print to std::cout
terminal_output_= (info.communicator().rank()==0);
}
}
#endif
}
@ -283,7 +286,7 @@ namespace Opm
// Run a multiple steps of the solver depending on the time step control.
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()) {
solver.setThresholdPressures(threshold_pressures_by_face_);
}