mirror of
				https://github.com/OPM/opm-simulators.git
				synced 2025-02-25 18:55:30 -06:00 
			
		
		
		
	Merge pull request #1433 from totto82/fix_reportStep
Add reportStep method in SimulatorReport and use it
This commit is contained in:
		@@ -259,16 +259,9 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                if( terminal_output_ )
 | 
					                if( terminal_output_ )
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    //stepReport.briefReport();
 | 
					                    std::ostringstream ss;
 | 
				
			||||||
                    std::ostringstream iter_msg;
 | 
					                    stepReport.reportStep(ss);
 | 
				
			||||||
                    iter_msg << "Stepsize " << (double)unit::convert::to(timer.currentStepLength(), unit::day);
 | 
					                    OpmLog::info(ss.str());
 | 
				
			||||||
                    if (solver->wellIterations() != 0) {
 | 
					 | 
				
			||||||
                        iter_msg << " days well iterations = " << solver->wellIterations() << ", ";
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    iter_msg << "non-linear iterations = " << solver->nonlinearIterations()
 | 
					 | 
				
			||||||
                             << ", total linear iterations = " << solver->linearIterations()
 | 
					 | 
				
			||||||
                             << "\n";
 | 
					 | 
				
			||||||
                    OpmLog::info(iter_msg.str());
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,8 @@
 | 
				
			|||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#include <opm/core/simulator/SimulatorReport.hpp>
 | 
					#include <opm/core/simulator/SimulatorReport.hpp>
 | 
				
			||||||
#include <ostream>
 | 
					#include <ostream>
 | 
				
			||||||
 | 
					#include <iomanip>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Opm
 | 
					namespace Opm
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -70,6 +72,22 @@ namespace Opm
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void SimulatorReport::reportStep(std::ostringstream& ss)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( verbose_ )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ss << "Time step summary: ";
 | 
				
			||||||
 | 
					            if (total_well_iterations != 0) {
 | 
				
			||||||
 | 
					                ss << "well its = " << std::setw(2) << total_well_iterations << ", ";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            ss << "newton its = " << std::setw(2) << total_newton_iterations << ", "
 | 
				
			||||||
 | 
					               << "linearizations = "  << std::setw(2) << total_linearizations
 | 
				
			||||||
 | 
					               << " ("  << std::fixed << std::setprecision(3) << std::setw(6) << assemble_time << " sec), "
 | 
				
			||||||
 | 
					               << "linear its = " << std::setw(3) << total_linear_iterations
 | 
				
			||||||
 | 
					               << " ("  << std::fixed << std::setprecision(3) << std::setw(6) << linear_solve_time << " sec)";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void SimulatorReport::reportFullyImplicit(std::ostream& os, const SimulatorReport* failureReport)
 | 
					    void SimulatorReport::reportFullyImplicit(std::ostream& os, const SimulatorReport* failureReport)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if ( verbose_ )
 | 
					        if ( verbose_ )
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,7 @@ namespace Opm
 | 
				
			|||||||
        void operator+=(const SimulatorReport& sr);
 | 
					        void operator+=(const SimulatorReport& sr);
 | 
				
			||||||
        /// Print a report to the given stream.
 | 
					        /// Print a report to the given stream.
 | 
				
			||||||
        void report(std::ostream& os);
 | 
					        void report(std::ostream& os);
 | 
				
			||||||
 | 
					        void reportStep(std::ostringstream& os);
 | 
				
			||||||
        /// Print a report, leaving out the transport time.
 | 
					        /// Print a report, leaving out the transport time.
 | 
				
			||||||
        void reportFullyImplicit(std::ostream& os, const SimulatorReport* failedReport = nullptr);
 | 
					        void reportFullyImplicit(std::ostream& os, const SimulatorReport* failedReport = nullptr);
 | 
				
			||||||
        void reportParam(std::ostream& os);
 | 
					        void reportParam(std::ostream& os);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -309,15 +309,7 @@ namespace Opm {
 | 
				
			|||||||
                if( timestep_verbose_ )
 | 
					                if( timestep_verbose_ )
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    std::ostringstream ss;
 | 
					                    std::ostringstream ss;
 | 
				
			||||||
                    ss << "Time step summary: ";
 | 
					                    substepReport.reportStep(ss);
 | 
				
			||||||
                    if (substepReport.total_well_iterations != 0) {
 | 
					 | 
				
			||||||
                        ss << "well its = " << std::setw(2) << substepReport.total_well_iterations << ", ";
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    ss << "newton its = " << std::setw(2) << substepReport.total_newton_iterations << ", "
 | 
					 | 
				
			||||||
                       << "linearizations = "  << std::setw(2) << substepReport.total_linearizations
 | 
					 | 
				
			||||||
                       << " ("  << std::fixed << std::setprecision(3) << std::setw(6) << substepReport.assemble_time << " sec), "
 | 
					 | 
				
			||||||
                       << "linear its = " << std::setw(3) << substepReport.total_linear_iterations
 | 
					 | 
				
			||||||
                       << " ("  << std::fixed << std::setprecision(3) << std::setw(6) << substepReport.linear_solve_time << " sec)";
 | 
					 | 
				
			||||||
                    OpmLog::info(ss.str());
 | 
					                    OpmLog::info(ss.str());
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user