added writing of reorder iterations for each cell

This commit is contained in:
Halvor Møll Nilsen 2012-08-21 15:23:46 +02:00 committed by Bård Skaflestad
parent 50ff22141d
commit 7ee5d5e403
2 changed files with 13 additions and 8 deletions

View File

@ -52,6 +52,7 @@ namespace Opm
source_(0),
dt_(0.0),
saturation_(grid.number_of_cells, -1.0),
reorder_iterations_(grid.number_of_cells, 0),
fractionalflow_(grid.number_of_cells, -1.0),
mob_(2*grid.number_of_cells, -1.0)
#ifdef EXPERIMENT_GAUSS_SEIDEL
@ -101,7 +102,7 @@ namespace Opm
&seq[0], &comp[0], &ncomp,
&ia_downw_[0], &ja_downw_[0]);
#endif
std::fill(reorder_iterations_.begin(),reorder_iterations_.end(),0);
reorderAndTransport(grid_, darcyflux);
toBothSat(saturation_, saturation);
}
@ -170,9 +171,11 @@ namespace Opm
// if (std::fabs(r0) < tol_) {
// return;
// }
int iters_used;
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
reorder_iterations_[cell] = reorder_iterations_[cell] + iters_used;
fractionalflow_[cell] = fracFlow(saturation_[cell], cell);
}
@ -544,8 +547,9 @@ namespace Opm
const int cell = cells[pos];
GravityResidual res(*this, cells, pos, gravflux);
if (std::fabs(res(saturation_[cell])) > tol_) {
int iters_used;
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;
}
saturation_[cell] = std::min(std::max(saturation_[cell], smin_[2*cell]), smax_[2*cell]);
mobility(saturation_[cell], cell, &mob_[2*cell]);
@ -641,7 +645,6 @@ namespace Opm
toBothSat(saturation_, saturation);
}
} // namespace Opm

View File

@ -23,7 +23,7 @@
#include <opm/core/transport/reorder/TransportModelInterface.hpp>
#include <vector>
#include <map>
#include <ostream>
struct UnstructuredGrid;
namespace Opm
@ -74,7 +74,8 @@ namespace Opm
const double* porevolume,
const double dt,
std::vector<double>& saturation);
void reportIterations(std::ostream &os);
const std::vector<int>& getReorderIterations(){return reorder_iterations_;};
private:
virtual void solveSingleCell(const int cell);
virtual void solveMultiCell(const int num_cells, const int* cells);
@ -83,8 +84,7 @@ namespace Opm
const int pos,
const double* gravflux);
int solveGravityColumn(const std::vector<int>& cells);
private:
private:
const UnstructuredGrid& grid_;
const IncompPropertiesInterface& props_;
const double* visc_;
@ -99,6 +99,8 @@ namespace Opm
double dt_;
std::vector<double> saturation_; // one per cell, only water saturation!
std::vector<double> fractionalflow_; // = m[0]/(m[0] + m[1]) per cell
std::vector<int> reorder_iterations_;
//std::vector<double> reorder_fval_;
// For gravity segregation.
std::vector<double> gravflux_;
std::vector<double> mob_;