Changed interface of solve() and solveGravity() to accept full saturation (both phases) input.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-06-09 14:56:29 +02:00
parent bebde670d6
commit 8befffcbbb
3 changed files with 13 additions and 15 deletions

View File

@ -273,12 +273,9 @@ main(int argc, char** argv)
}
double tot_porevol_init = std::accumulate(porevol.begin(), porevol.end(), 0.0);
// We need a separate reorder_sat, because the reorder
// code expects a scalar sw, not both sw and so.
std::vector<double> reorder_sat(num_cells);
std::vector<double> src(num_cells, 0.0);
// Initialising src
std::vector<double> src(num_cells, 0.0);
if (wells->c_wells()) {
// Do nothing, wells will be the driving force, not source terms.
// Opm::wellsToSrc(*wells->c_wells(), num_cells, src);
@ -426,15 +423,12 @@ main(int argc, char** argv)
std::cout << "Making " << num_transport_substeps << " transport substeps." << std::endl;
}
for (int tr_substep = 0; tr_substep < num_transport_substeps; ++tr_substep) {
Opm::toWaterSat(state.saturation(), reorder_sat);
reorder_model.solve(&state.faceflux()[0], &state.pressure()[0], &state.surfacevol()[0],
&porevol[0], &reorder_src[0], stepsize, &reorder_sat[0]);
Opm::toBothSat(reorder_sat, state.saturation());
&porevol[0], &reorder_src[0], stepsize, state.saturation());
// Opm::computeInjectedProduced(*props, state.saturation(), reorder_src, stepsize, injected, produced);
if (use_segregation_split) {
THROW("Segregation not implemented yet.");
// reorder_model.solveGravity(columns, &porevol[0], stepsize, reorder_sat);
Opm::toBothSat(reorder_sat, state.saturation());
// reorder_model.solveGravity(columns, &porevol[0], stepsize, state.saturation());
}
}
#endif // TRANSPORT_SOLVER_FIXED

View File

@ -49,7 +49,7 @@ namespace Opm
darcyflux_(0),
source_(0),
dt_(0.0),
saturation_(0),
saturation_(grid.number_of_cells, -1.0),
fractionalflow_(grid.number_of_cells, -1.0),
mob_(2*grid.number_of_cells, -1.0),
ia_upw_(grid.number_of_cells + 1, -1),
@ -79,14 +79,15 @@ namespace Opm
const double* porevolume,
const double* source,
const double dt,
double* saturation)
std::vector<double>& saturation)
{
darcyflux_ = darcyflux;
surfacevol0_ = surfacevol0;
porevolume_ = porevolume;
source_ = source;
dt_ = dt;
saturation_ = saturation;
toWaterSat(saturation, saturation_);
props_.viscosity(props_.numCells(), pressure, NULL, &allcells_[0], &visc_[0], NULL);
props_.matrix(props_.numCells(), pressure, NULL, &allcells_[0], &A_[0], NULL);
@ -103,6 +104,7 @@ namespace Opm
&seq[0], &comp[0], &ncomp,
&ia_downw_[0], &ja_downw_[0]);
reorderAndTransport(grid_, darcyflux);
toBothSat(saturation_, saturation);
}
// Residual function r(s) for a single-cell implicit Euler transport
@ -489,7 +491,7 @@ namespace Opm
// Set up other variables.
porevolume_ = porevolume;
dt_ = dt;
saturation_ = &saturation[0];
toWaterSat(saturation, saturation_);
// Solve on all columns.
int num_iters = 0;
@ -499,6 +501,7 @@ namespace Opm
}
std::cout << "Gauss-Seidel column solver average iterations: "
<< double(num_iters)/double(columns.size()) << std::endl;
toBothSat(saturation_, saturation);
}
} // namespace Opm

View File

@ -38,13 +38,14 @@ namespace Opm
const double tol,
const int maxit);
/// \param[in, out] saturation Phase saturations.
void solve(const double* darcyflux,
const double* pressure,
const double* surfacevol0,
const double* porevolume,
const double* source,
const double dt,
double* saturation);
std::vector<double>& saturation);
virtual void solveSingleCell(const int cell);
virtual void solveMultiCell(const int num_cells, const int* cells);
@ -76,7 +77,7 @@ namespace Opm
const double* porevolume_; // one volume per cell
const double* source_; // one source per cell
double dt_;
double* saturation_; // one per cell
std::vector<double> saturation_; // one per cell
std::vector<double> fractionalflow_; // = m[0]/(m[0] + m[1]) per cell
// For gravity segregation.
std::vector<double> gravflux_;