Make saturation functions work with two phases again.

Note that this changes ExplicitArraysFluidState to take
a run-time argument for the number of phases.
This commit is contained in:
Atgeirr Flø Rasmussen 2015-08-12 13:38:32 +02:00
parent 6c821aef10
commit 6921bd2af9
2 changed files with 9 additions and 10 deletions

View File

@ -280,10 +280,10 @@ namespace Opm
{
assert(cells != 0);
ExplicitArraysFluidState fluidState;
const int np = phase_usage_.num_phases;
ExplicitArraysFluidState fluidState(np);
fluidState.setSaturationArray(s);
const int np = phase_usage_.num_phases;
if (dkrds) {
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
@ -333,10 +333,10 @@ namespace Opm
{
assert(cells != 0);
ExplicitArraysFluidState fluidState;
const int np = phase_usage_.num_phases;
ExplicitArraysFluidState fluidState(np);
fluidState.setSaturationArray(s);
const int np = phase_usage_.num_phases;
if (dpcds) {
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
@ -474,7 +474,7 @@ namespace Opm
const int max_np = BlackoilPhases::MaxNumPhases;
double s[max_np] = { 0.0 };
s[wpos] = swat;
ExplicitArraysFluidState fluidState;
ExplicitArraysFluidState fluidState(phase_usage_.num_phases);
fluidState.setSaturationArray(s);
fluidState.setIndex(0);
double pc[max_np] = { 0.0 };

View File

@ -36,10 +36,8 @@ class ExplicitArraysFluidState
public:
typedef double Scalar;
enum { numPhases = 3 };
enum { numComponents = 3 };
ExplicitArraysFluidState()
explicit ExplicitArraysFluidState(const unsigned int num_phases)
: numPhases_(num_phases)
{}
/*!
@ -75,7 +73,7 @@ public:
* \brief Returns the saturation of a phase for the current cell index.
*/
Scalar saturation(int phaseIdx) const
{ return saturations_[numPhases*arrayIdx_ + phaseIdx]; }
{ return saturations_[numPhases_*arrayIdx_ + phaseIdx]; }
/*!
* \brief Returns the temperature [K] of a phase for the current cell index.
@ -90,6 +88,7 @@ private:
const double* temperature_;
unsigned arrayIdx_;
unsigned numPhases_;
};
} // namespace Opm