diff --git a/opm/autodiff/FullyImplicitBlackoilSolver.hpp b/opm/autodiff/FullyImplicitBlackoilSolver.hpp index 441209abd..abdfc937c 100644 --- a/opm/autodiff/FullyImplicitBlackoilSolver.hpp +++ b/opm/autodiff/FullyImplicitBlackoilSolver.hpp @@ -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 diff --git a/opm/autodiff/FullyImplicitBlackoilSolver_impl.hpp b/opm/autodiff/FullyImplicitBlackoilSolver_impl.hpp index 69f63aed4..f4821d3df 100644 --- a/opm/autodiff/FullyImplicitBlackoilSolver_impl.hpp +++ b/opm/autodiff/FullyImplicitBlackoilSolver_impl.hpp @@ -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,15 +220,18 @@ namespace detail { , residual_ ( { std::vector(fluid.numPhases(), ADB::null()), ADB::null(), ADB::null() } ) - , terminal_output_ (true) + , terminal_output_ (terminal_output) { #if HAVE_MPI - if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) + if( terminal_output_ ) { - const ParallelISTLInformation& info = - boost::any_cast(linsolver_.parallelInformation()); - // Only rank 0 does print to std::cout - terminal_output_ = (info.communicator().rank()==0); + if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) + { + const ParallelISTLInformation& info = + boost::any_cast(linsolver_.parallelInformation()); + // Only rank 0 does print to std::cout if terminal_output is enabled + terminal_output_ = (info.communicator().rank()==0); + } } #endif } diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp index 085dd9621..c20fbfac3 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp @@ -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(AutoDiffGrid::numCells(grid_), 0)), @@ -198,12 +198,15 @@ namespace Opm allcells_[cell] = cell; } #if HAVE_MPI - if ( solver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) + if( terminal_output_ ) { - const ParallelISTLInformation& info = - boost::any_cast(solver_.parallelInformation()); - // Only rank 0 does print to std::cout - terminal_output_= (info.communicator().rank()==0); + if ( solver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) + { + const ParallelISTLInformation& info = + boost::any_cast(solver_.parallelInformation()); + // 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 solver(solverParam, grid_, props_, geo_, rock_comp_props_, wells, solver_, has_disgas_, has_vapoil_); + FullyImplicitBlackoilSolver 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_); }