Moved Watercut class to miscUtilities.hpp.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-03-14 12:47:01 +01:00
parent 86284d06c1
commit 06d72587cc
3 changed files with 34 additions and 29 deletions

View File

@ -224,30 +224,7 @@ static void outputState(const UnstructuredGrid& grid,
}
/// Encapsulates the watercut curves.
class Watercut
{
public:
void push(double time, double fraction, double produced)
{
data_.push_back(time);
data_.push_back(fraction);
data_.push_back(produced);
}
void write(std::ostream& os) const
{
int sz = data_.size()/3;
for (int i = 0; i < sz; ++i) {
os << data_[3*i]/Opm::unit::day << " "
<< data_[3*i+1] << " "
<< data_[3*i+2] << '\n';
}
}
private:
std::vector<double> data_;
};
static void outputWaterCut(const Watercut& watercut,
static void outputWaterCut(const Opm::Watercut& watercut,
const std::string& output_dir)
{
// Write water cut curve.
@ -674,11 +651,11 @@ main(int argc, char** argv)
double produced[2] = { 0.0 };
double tot_injected[2] = { 0.0 };
double tot_produced[2] = { 0.0 };
Watercut watercut;
watercut.push(0.0, 0.0, 0.0);
Opm::computeSaturatedVol(porevol, state.saturation(), init_satvol);
std::cout << "\nInitial saturations are " << init_satvol[0]/tot_porevol
<< " " << init_satvol[1]/tot_porevol << std::endl;
Opm::Watercut watercut;
watercut.push(0.0, 0.0, 0.0);
for (; !simtimer.done(); ++simtimer) {
// Report timestep and (optionally) write state to disk.
simtimer.report(std::cout);
@ -779,9 +756,9 @@ main(int argc, char** argv)
total_timer.stop();
std::cout << "\n\n================ End of simulation ===============\n"
<< "Total time taken: " << total_timer.secsSinceStart()
<< "\n Pressure time: " << ptime
<< "\n Transport time: " << ttime << std::endl;
<< "Total time taken: " << total_timer.secsSinceStart()
<< "\n Pressure time: " << ptime
<< "\n Transport time: " << ttime << std::endl;
if (output) {
outputState(*grid->c_grid(), state, simtimer.currentStepNum(), output_dir);

View File

@ -18,6 +18,7 @@
*/
#include <opm/core/utility/miscUtilities.hpp>
#include <opm/core/utility/Units.hpp>
#include <opm/core/grid.h>
#include <opm/core/newwells.h>
#include <opm/core/fluid/IncompPropertiesInterface.hpp>
@ -358,5 +359,22 @@ namespace Opm
}
}
void Watercut::push(double time, double fraction, double produced)
{
data_.push_back(time);
data_.push_back(fraction);
data_.push_back(produced);
}
void Watercut::write(std::ostream& os) const
{
int sz = data_.size()/3;
for (int i = 0; i < sz; ++i) {
os << data_[3*i]/Opm::unit::day << " "
<< data_[3*i+1] << " "
<< data_[3*i+2] << '\n';
}
}
} // namespace Opm

View File

@ -21,6 +21,7 @@
#define OPM_MISCUTILITIES_HEADER_INCLUDED
#include <vector>
#include <iosfwd>
struct Wells;
struct UnstructuredGrid;
@ -157,6 +158,15 @@ namespace Opm
/// single-perforation.
void wellsToSrc(const Wells& wells, const int num_cells, std::vector<double>& src);
/// Encapsulates the watercut curves.
class Watercut
{
public:
void push(double time, double fraction, double produced);
void write(std::ostream& os) const;
private:
std::vector<double> data_;
};
} // namespace Opm