Added writing of timings in param format
This commit is contained in:
parent
9a44eababc
commit
29c6be6752
@ -170,8 +170,10 @@ main(int argc, char** argv)
|
||||
|
||||
// Write parameters used for later reference.
|
||||
bool output = param.getDefault("output", true);
|
||||
std::ofstream epoch_os;
|
||||
std::string output_dir;
|
||||
if (output) {
|
||||
std::string output_dir =
|
||||
output_dir =
|
||||
param.getDefault("output_dir", std::string("output"));
|
||||
boost::filesystem::path fpath(output_dir);
|
||||
try {
|
||||
@ -180,7 +182,14 @@ main(int argc, char** argv)
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
}
|
||||
param.writeParam(output_dir + "/spu_2p.param");
|
||||
std::string filename = output_dir + "/epoch_timing.param";
|
||||
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
|
||||
// open file to clean it. The file is appended to in SimulatorTwophase
|
||||
filename = output_dir + "/step_timing.param";
|
||||
std::fstream step_os(filename.c_str(), std::fstream::trunc | std::fstream::out);
|
||||
step_os.close();
|
||||
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
|
||||
|
||||
@ -259,13 +268,24 @@ main(int argc, char** argv)
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state);
|
||||
|
||||
if(output){
|
||||
epoch_rep.reportParam(epoch_os);
|
||||
}
|
||||
// Update total timing report and remember step number.
|
||||
rep += epoch_rep;
|
||||
step = simtimer.currentStepNum();
|
||||
}
|
||||
}
|
||||
|
||||
epoch_os.close();
|
||||
std::cout << "\n\n================ End of simulation ===============\n\n";
|
||||
rep.report(std::cout);
|
||||
|
||||
if (output) {
|
||||
std::string filename = output_dir + "/walltime.param";
|
||||
std::fstream tot_os(filename.c_str(),std::fstream::trunc | std::fstream::out);
|
||||
rep.reportParam(tot_os);
|
||||
tot_os.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ main(int argc, char** argv)
|
||||
|
||||
// Write parameters used for later reference.
|
||||
if (output) {
|
||||
param.writeParam(output_dir + "/spu_2p.param");
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
|
||||
// Main simulation loop.
|
||||
|
@ -42,6 +42,12 @@ namespace Opm
|
||||
<< "\n Pressure time: " << pressure_time
|
||||
<< "\n Transport time: " << transport_time << std::endl;
|
||||
}
|
||||
void SimulatorReport::reportParam(std::ostream& os)
|
||||
{
|
||||
os << "/timing/total_time=" << total_time
|
||||
<< "\n/timing/pressure/total_time=" << pressure_time
|
||||
<< "\n/timing/transport/total_time=" << transport_time << std::endl;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -38,6 +38,7 @@ namespace Opm
|
||||
void operator+=(const SimulatorReport& sr);
|
||||
/// Print a report to the given stream.
|
||||
void report(std::ostream& os);
|
||||
void reportParam(std::ostream& os);
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -306,6 +306,7 @@ namespace Opm
|
||||
double ptime = 0.0;
|
||||
Opm::time::StopWatch transport_timer;
|
||||
double ttime = 0.0;
|
||||
Opm::time::StopWatch step_timer;
|
||||
Opm::time::StopWatch total_timer;
|
||||
total_timer.start();
|
||||
double init_satvol[2] = { 0.0 };
|
||||
@ -326,8 +327,14 @@ namespace Opm
|
||||
well_resflows_phase.resize((wells_->number_of_phases)*(wells_->number_of_wells), 0.0);
|
||||
wellreport.push(props_, *wells_, state.saturation(), 0.0, well_state.bhp(), well_state.perfRates());
|
||||
}
|
||||
std::fstream tstep_os;
|
||||
if(output_){
|
||||
std::string filename = output_dir_ + "/step_timing.param";
|
||||
tstep_os.open(filename.c_str(), std::fstream::out | std::fstream::app);
|
||||
}
|
||||
for (; !timer.done(); ++timer) {
|
||||
// Report timestep and (optionally) write state to disk.
|
||||
step_timer.start();
|
||||
timer.report(std::cout);
|
||||
if (output_ && (timer.currentStepNum() % output_interval_ == 0)) {
|
||||
if (output_vtk_) {
|
||||
@ -335,6 +342,7 @@ namespace Opm
|
||||
}
|
||||
outputStateMatlab(grid_, state, timer.currentStepNum(), output_dir_);
|
||||
}
|
||||
SimulatorReport sreport;
|
||||
|
||||
// Solve pressure.
|
||||
do {
|
||||
@ -344,6 +352,7 @@ namespace Opm
|
||||
double pt = pressure_timer.secsSinceStart();
|
||||
std::cout << "Pressure solver took: " << pt << " seconds." << std::endl;
|
||||
ptime += pt;
|
||||
sreport.pressure_time = pt;
|
||||
} while (false);
|
||||
|
||||
// Update pore volumes if rock is compressible.
|
||||
@ -372,9 +381,9 @@ namespace Opm
|
||||
}
|
||||
transport_timer.stop();
|
||||
double tt = transport_timer.secsSinceStart();
|
||||
sreport.transport_time = tt;
|
||||
std::cout << "Transport solver took: " << tt << " seconds." << std::endl;
|
||||
ttime += tt;
|
||||
|
||||
// Report volume balances.
|
||||
Opm::computeSaturatedVol(porevol, state.saturation(), satvol);
|
||||
tot_injected[0] += injected[0];
|
||||
@ -416,6 +425,12 @@ namespace Opm
|
||||
timer.currentTime() + timer.currentStepLength(),
|
||||
well_state.bhp(), well_state.perfRates());
|
||||
}
|
||||
sreport.total_time = step_timer.secsSinceStart();
|
||||
if(output_){
|
||||
sreport.reportParam(tstep_os);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (output_) {
|
||||
@ -427,6 +442,7 @@ namespace Opm
|
||||
if (wells_) {
|
||||
outputWellReport(wellreport, output_dir_);
|
||||
}
|
||||
tstep_os.close();
|
||||
}
|
||||
|
||||
total_timer.stop();
|
||||
|
Loading…
Reference in New Issue
Block a user