SimulatorState: store all data in a vector to allow for flexibility when used with

derived states.
BlackoilState: adjusted to SimulatorState changes.
This commit is contained in:
Robert Kloefkorn 2015-07-03 16:26:59 +02:00
parent 131bbd5846
commit 78c53fa1ed
2 changed files with 25 additions and 14 deletions

View File

@ -4,11 +4,16 @@
using namespace Opm; using namespace Opm;
void void
BlackoilState::init(int number_of_cells, int number_of_phases, int num_phases) { BlackoilState::init(int number_of_cells, int number_of_phases, int num_phases)
SimulatorState::init(number_of_cells, number_of_phases, num_phases); {
gor_.resize(number_of_cells, 0.) ; SimulatorState::init(number_of_cells, number_of_phases, num_phases);
rv_.resize(number_of_cells,0.);
// register cell data in base class
gorId_ = SimulatorState::registerCellData( "GASOILRATIO", 1 );
rvId_ = SimulatorState::registerCellData( "RV", 1 );
// surfvol_ intentionally empty, left to initBlackoilSurfvol // surfvol_ intentionally empty, left to initBlackoilSurfvol
surfaceVolId_ = SimulatorState::registerCellData( "SURFACEVOL", 0 );
} }
void void

View File

@ -32,8 +32,10 @@ namespace Opm
class BlackoilState : public SimulatorState class BlackoilState : public SimulatorState
{ {
public: public:
using SimulatorState :: cellData ;
virtual void init(const UnstructuredGrid& grid, int num_phases); virtual void init(const UnstructuredGrid& grid, int num_phases);
virtual void init(int number_of_cells, int number_of_faces, int num_phases); virtual void init(int number_of_cells, int number_of_faces, int num_phases);
/// Set the first saturation to either its min or max value in /// Set the first saturation to either its min or max value in
@ -47,18 +49,22 @@ namespace Opm
virtual bool equals(const SimulatorState& other, virtual bool equals(const SimulatorState& other,
double epsilon = 1e-8) const; double epsilon = 1e-8) const;
std::vector<double>& surfacevol () { return surfvol_; } std::vector<double>& surfacevol () { return cellData()[ surfaceVolId_ ]; }
std::vector<double>& gasoilratio () { return gor_ ; } std::vector<double>& gasoilratio () { return cellData()[ gorId_ ] ; }
std::vector<double>& rv () {return rv_ ; } std::vector<double>& rv () {return cellData()[ rvId_ ] ; }
const std::vector<double>& surfacevol () const { return surfvol_; } const std::vector<double>& surfacevol () const { return cellData()[ surfaceVolId_ ]; }
const std::vector<double>& gasoilratio () const { return gor_ ; } const std::vector<double>& gasoilratio () const { return cellData()[ gorId_ ] ; }
const std::vector<double>& rv () const {return rv_ ; } const std::vector<double>& rv () const { return cellData()[ rvId_ ] ; }
private: private:
std::vector<double> surfvol_; // no entries = no cells * no phases int gorId_ ; // no entries = no cells (gas oil ratio id)
std::vector<double> gor_ ; // no entries = no cells int rvId_ ; // no entries = no cells ( rv id )
std::vector<double> rv_ ; // no entries = no cells int surfaceVolId_ ; // no entries = no cells * no phases (surfaceVol id )
//std::vector<double> surfvol_; // no entries = no cells * no phases
//std::vector<double> gor_ ; // no entries = no cells
//std::vector<double> rv_ ; // no entries = no cells
}; };
} // namespace Opm } // namespace Opm