mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Disable output to console if parameter quiet = true
If the standard output is not desirable, it can be suppressed and custom output can be written through the timestep_completed event instead.
This commit is contained in:
parent
941f0f5391
commit
e1823dc9a7
@ -22,6 +22,7 @@
|
|||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#include <opm/core/simulator/SimulatorIncompTwophase.hpp>
|
#include <opm/core/simulator/SimulatorIncompTwophase.hpp>
|
||||||
|
#include <opm/core/utility/NullStream.hpp>
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ namespace Opm
|
|||||||
|
|
||||||
// Data.
|
// Data.
|
||||||
// Parameters for output.
|
// Parameters for output.
|
||||||
|
std::ostream* log_;
|
||||||
bool output_;
|
bool output_;
|
||||||
bool output_vtk_;
|
bool output_vtk_;
|
||||||
std::string output_dir_;
|
std::string output_dir_;
|
||||||
@ -147,7 +149,7 @@ namespace Opm
|
|||||||
double injected[2], double produced[2],
|
double injected[2], double produced[2],
|
||||||
double init_satvol[2])
|
double init_satvol[2])
|
||||||
{
|
{
|
||||||
std::cout.precision(5);
|
os.precision(5);
|
||||||
const int width = 18;
|
const int width = 18;
|
||||||
os << "\nVolume balance report (all numbers relative to total pore volume).\n";
|
os << "\nVolume balance report (all numbers relative to total pore volume).\n";
|
||||||
os << " Saturated volumes: "
|
os << " Saturated volumes: "
|
||||||
@ -369,6 +371,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For output.
|
// For output.
|
||||||
|
log_ = param.getDefault("quiet", false) ? &Opm::null_stream : &std::cout;
|
||||||
output_ = param.getDefault("output", true);
|
output_ = param.getDefault("output", true);
|
||||||
if (output_) {
|
if (output_) {
|
||||||
output_vtk_ = param.getDefault("output_vtk", true);
|
output_vtk_ = param.getDefault("output_vtk", true);
|
||||||
@ -433,8 +436,8 @@ namespace Opm
|
|||||||
double tot_injected[2] = { 0.0 };
|
double tot_injected[2] = { 0.0 };
|
||||||
double tot_produced[2] = { 0.0 };
|
double tot_produced[2] = { 0.0 };
|
||||||
Opm::computeSaturatedVol(porevol, state.saturation(), init_satvol);
|
Opm::computeSaturatedVol(porevol, state.saturation(), init_satvol);
|
||||||
std::cout << "\nInitial saturations are " << init_satvol[0]/tot_porevol_init
|
*log_ << "\nInitial saturations are " << init_satvol[0]/tot_porevol_init
|
||||||
<< " " << init_satvol[1]/tot_porevol_init << std::endl;
|
<< " " << init_satvol[1]/tot_porevol_init << std::endl;
|
||||||
Opm::Watercut watercut;
|
Opm::Watercut watercut;
|
||||||
watercut.push(0.0, 0.0, 0.0);
|
watercut.push(0.0, 0.0, 0.0);
|
||||||
Opm::WellReport wellreport;
|
Opm::WellReport wellreport;
|
||||||
@ -452,7 +455,7 @@ namespace Opm
|
|||||||
for (; !timer.done(); ++timer) {
|
for (; !timer.done(); ++timer) {
|
||||||
// Report timestep and (optionally) write state to disk.
|
// Report timestep and (optionally) write state to disk.
|
||||||
step_timer.start();
|
step_timer.start();
|
||||||
timer.report(std::cout);
|
timer.report(*log_);
|
||||||
if (output_ && (timer.currentStepNum() % output_interval_ == 0)) {
|
if (output_ && (timer.currentStepNum() % output_interval_ == 0)) {
|
||||||
if (output_vtk_) {
|
if (output_vtk_) {
|
||||||
outputStateVtk(grid_, state, timer.currentStepNum(), output_dir_);
|
outputStateVtk(grid_, state, timer.currentStepNum(), output_dir_);
|
||||||
@ -512,7 +515,7 @@ namespace Opm
|
|||||||
// Stop timer and report.
|
// Stop timer and report.
|
||||||
pressure_timer.stop();
|
pressure_timer.stop();
|
||||||
double pt = pressure_timer.secsSinceStart();
|
double pt = pressure_timer.secsSinceStart();
|
||||||
std::cout << "Pressure solver took: " << pt << " seconds." << std::endl;
|
*log_ << "Pressure solver took: " << pt << " seconds." << std::endl;
|
||||||
ptime += pt;
|
ptime += pt;
|
||||||
sreport.pressure_time = pt;
|
sreport.pressure_time = pt;
|
||||||
|
|
||||||
@ -522,7 +525,7 @@ namespace Opm
|
|||||||
well_state.perfRates(),
|
well_state.perfRates(),
|
||||||
fractional_flows,
|
fractional_flows,
|
||||||
well_resflows_phase);
|
well_resflows_phase);
|
||||||
std::cout << "Checking well conditions." << std::endl;
|
*log_ << "Checking well conditions." << std::endl;
|
||||||
// For testing we set surface := reservoir
|
// For testing we set surface := reservoir
|
||||||
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
|
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
|
||||||
++well_control_iteration;
|
++well_control_iteration;
|
||||||
@ -530,9 +533,9 @@ namespace Opm
|
|||||||
OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
||||||
}
|
}
|
||||||
if (!well_control_passed) {
|
if (!well_control_passed) {
|
||||||
std::cout << "Well controls not passed, solving again." << std::endl;
|
*log_ << "Well controls not passed, solving again." << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Well conditions met." << std::endl;
|
*log_ << "Well conditions met." << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!well_control_passed);
|
} while (!well_control_passed);
|
||||||
@ -552,7 +555,7 @@ namespace Opm
|
|||||||
double stepsize = timer.currentStepLength();
|
double stepsize = timer.currentStepLength();
|
||||||
if (num_transport_substeps_ != 1) {
|
if (num_transport_substeps_ != 1) {
|
||||||
stepsize /= double(num_transport_substeps_);
|
stepsize /= double(num_transport_substeps_);
|
||||||
std::cout << "Making " << num_transport_substeps_ << " transport substeps." << std::endl;
|
*log_ << "Making " << num_transport_substeps_ << " transport substeps." << std::endl;
|
||||||
}
|
}
|
||||||
double injected[2] = { 0.0 };
|
double injected[2] = { 0.0 };
|
||||||
double produced[2] = { 0.0 };
|
double produced[2] = { 0.0 };
|
||||||
@ -585,7 +588,7 @@ namespace Opm
|
|||||||
transport_timer.stop();
|
transport_timer.stop();
|
||||||
double tt = transport_timer.secsSinceStart();
|
double tt = transport_timer.secsSinceStart();
|
||||||
sreport.transport_time = tt;
|
sreport.transport_time = tt;
|
||||||
std::cout << "Transport solver took: " << tt << " seconds." << std::endl;
|
*log_ << "Transport solver took: " << tt << " seconds." << std::endl;
|
||||||
ttime += tt;
|
ttime += tt;
|
||||||
// Report volume balances.
|
// Report volume balances.
|
||||||
Opm::computeSaturatedVol(porevol, state.saturation(), satvol);
|
Opm::computeSaturatedVol(porevol, state.saturation(), satvol);
|
||||||
@ -593,7 +596,7 @@ namespace Opm
|
|||||||
tot_injected[1] += injected[1];
|
tot_injected[1] += injected[1];
|
||||||
tot_produced[0] += produced[0];
|
tot_produced[0] += produced[0];
|
||||||
tot_produced[1] += produced[1];
|
tot_produced[1] += produced[1];
|
||||||
reportVolumes(std::cout,satvol, tot_porevol_init,
|
reportVolumes(*log_, satvol, tot_porevol_init,
|
||||||
tot_injected, tot_produced,
|
tot_injected, tot_produced,
|
||||||
injected, produced,
|
injected, produced,
|
||||||
init_satvol);
|
init_satvol);
|
||||||
|
Loading…
Reference in New Issue
Block a user