From fd0d060ed8a585b71b3a0e36de377cd6b762d992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halvor=20M=C3=B8ll=20Nilsen?= Date: Fri, 24 Aug 2012 12:52:41 +0200 Subject: [PATCH] Corrected typing pointed out by atgeirr in respose to pullrequest --- .../simulator/SimulatorIncompTwophase.cpp | 101 +++++++++--------- .../reorder/TransportModelTwophase.cpp | 8 +- .../reorder/TransportModelTwophase.hpp | 4 +- 3 files changed, 60 insertions(+), 53 deletions(-) diff --git a/opm/core/simulator/SimulatorIncompTwophase.cpp b/opm/core/simulator/SimulatorIncompTwophase.cpp index 35b3e84b..d4e7459f 100644 --- a/opm/core/simulator/SimulatorIncompTwophase.cpp +++ b/opm/core/simulator/SimulatorIncompTwophase.cpp @@ -132,10 +132,11 @@ namespace Opm return pimpl_->run(timer, state, well_state); } - static void reportVolumes(std::ostream &os,double satvol[2],double tot_porevol_init, - double tot_injected[2],double tot_produced[2], - double injected[2], double produced[2], - double init_satvol[2]){ + static void reportVolumes(std::ostream &os,double satvol[2],double tot_porevol_init, + double tot_injected[2], double tot_produced[2], + double injected[2], double produced[2], + double init_satvol[2]) + { std::cout.precision(5); const int width = 18; os << "\nVolume balance report (all numbers relative to total pore volume).\n"; @@ -163,7 +164,7 @@ namespace Opm << std::endl; os.precision(8); } - + static void outputStateVtk(const UnstructuredGrid& grid, const Opm::TwophaseState& state, const int step, @@ -174,10 +175,10 @@ namespace Opm vtkfilename << output_dir << "/vtk_files"; boost::filesystem::path fpath(vtkfilename.str()); try { - create_directories(fpath); + create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + THROW("Creating directories failed: " << fpath); } vtkfilename << "/" << std::setw(3) << std::setfill('0') << step << ".vtu"; std::ofstream vtkfile(vtkfilename.str().c_str()); @@ -193,47 +194,47 @@ namespace Opm Opm::writeVtkData(grid, dm, vtkfile); } static void outputVectorMatlab(const std::string name, - const std::vector vec, - const int step, - const std::string& output_dir) + const std::vector& vec, + const int step, + const std::string& output_dir) { - std::ostringstream fname; - fname << output_dir << "/" << name; - boost::filesystem::path fpath = fname.str(); - try { - create_directories(fpath); - } - catch (...) { - THROW("Creating directories failed: " << fpath); - } - fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; - std::ofstream file(fname.str().c_str()); - if (!file) { - THROW("Failed to open " << fname.str()); - } - std::copy(vec.begin(), vec.end(), std::ostream_iterator(file, "\n")); + std::ostringstream fname; + fname << output_dir << "/" << name; + boost::filesystem::path fpath = fname.str(); + try { + create_directories(fpath); + } + catch (...) { + THROW("Creating directories failed: " << fpath); + } + fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; + std::ofstream file(fname.str().c_str()); + if (!file) { + THROW("Failed to open " << fname.str()); + } + std::copy(vec.begin(), vec.end(), std::ostream_iterator(file, "\n")); } static void outputVectorMatlab(const std::string name, - const std::vector vec, - const int step, - const std::string& output_dir) + const std::vector vec, + const int step, + const std::string& output_dir) { - std::ostringstream fname; - fname << output_dir << "/" << name; - boost::filesystem::path fpath = fname.str(); - try { - create_directories(fpath); - } - catch (...) { - THROW("Creating directories failed: " << fpath); - } - fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; - std::ofstream file(fname.str().c_str()); - if (!file) { - THROW("Failed to open " << fname.str()); - } - std::copy(vec.begin(), vec.end(), std::ostream_iterator(file, "\n")); + std::ostringstream fname; + fname << output_dir << "/" << name; + boost::filesystem::path fpath = fname.str(); + try { + create_directories(fpath); + } + catch (...) { + THROW("Creating directories failed: " << fpath); + } + fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; + std::ofstream file(fname.str().c_str()); + if (!file) { + THROW("Failed to open " << fname.str()); + } + std::copy(vec.begin(), vec.end(), std::ostream_iterator(file, "\n")); } @@ -255,10 +256,10 @@ namespace Opm fname << output_dir << "/" << it->first; boost::filesystem::path fpath = fname.str(); try { - create_directories(fpath); + create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + THROW("Creating directories failed: " << fpath); } fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; std::ofstream file(fname.str().c_str()); @@ -543,18 +544,18 @@ namespace Opm } for (int tr_substep = 0; tr_substep < num_transport_substeps_; ++tr_substep) { tsolver_.solve(&state.faceflux()[0], &porevol[0], &transport_src[0], - stepsize, state.saturation()); + stepsize, state.saturation()); Opm::computeInjectedProduced(props_, state.saturation(), transport_src, stepsize, injected, produced); if (use_segregation_split_) { - tsolver_.solveGravity(columns_, &porevol[0], stepsize, state.saturation()); + tsolver_.solveGravity(columns_, &porevol[0], stepsize, state.saturation()); } watercut.push(timer.currentTime() + timer.currentStepLength(), produced[0]/(produced[0] + produced[1]), tot_produced[0]/tot_porevol_init); if (wells_) { - wellreport.push(props_, *wells_, state.saturation(), - timer.currentTime() + timer.currentStepLength(), - well_state.bhp(), well_state.perfRates()); + wellreport.push(props_, *wells_, state.saturation(), + timer.currentTime() + timer.currentStepLength(), + well_state.bhp(), well_state.perfRates()); } } transport_timer.stop(); diff --git a/opm/core/transport/reorder/TransportModelTwophase.cpp b/opm/core/transport/reorder/TransportModelTwophase.cpp index 49cafa49..b6451809 100644 --- a/opm/core/transport/reorder/TransportModelTwophase.cpp +++ b/opm/core/transport/reorder/TransportModelTwophase.cpp @@ -171,7 +171,7 @@ namespace Opm // if (std::fabs(r0) < tol_) { // return; // } - int iters_used=0; + int iters_used = 0; // saturation_[cell] = modifiedRegulaFalsi(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used); saturation_[cell] = RootFinder::solve(res, saturation_[cell], 0.0, 1.0, maxit_, tol_, iters_used); // add if it is iteration on an out loop @@ -547,7 +547,7 @@ namespace Opm const int cell = cells[pos]; GravityResidual res(*this, cells, pos, gravflux); if (std::fabs(res(saturation_[cell])) > tol_) { - int iters_used=0; + int iters_used = 0; saturation_[cell] = RootFinder::solve(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used); reorder_iterations_[cell] = reorder_iterations_[cell] + iters_used; } @@ -645,6 +645,10 @@ namespace Opm toBothSat(saturation_, saturation); } + void TransportModelTwophase::getReorderIterations() + { + return reorder_iterations_; + }; } // namespace Opm diff --git a/opm/core/transport/reorder/TransportModelTwophase.hpp b/opm/core/transport/reorder/TransportModelTwophase.hpp index 69297607..358baaa3 100644 --- a/opm/core/transport/reorder/TransportModelTwophase.hpp +++ b/opm/core/transport/reorder/TransportModelTwophase.hpp @@ -74,7 +74,9 @@ namespace Opm const double* porevolume, const double dt, std::vector& saturation); - void reportIterations(std::ostream &os); + //// Return reorder iterations + //// + //// \param[out] vector of iteration per cell const std::vector& getReorderIterations(){return reorder_iterations_;}; private: virtual void solveSingleCell(const int cell);