Added tol and maxit arguments. Using Incomp*::satRange() for initial s-bracket.
This commit is contained in:
parent
153a656539
commit
93d4bd80f7
@ -32,10 +32,14 @@ namespace Opm
|
|||||||
|
|
||||||
TransportModelTwophase::TransportModelTwophase(const UnstructuredGrid& grid,
|
TransportModelTwophase::TransportModelTwophase(const UnstructuredGrid& grid,
|
||||||
const double* porevolume,
|
const double* porevolume,
|
||||||
const Opm::IncompPropertiesInterface& props)
|
const Opm::IncompPropertiesInterface& props,
|
||||||
|
const double tol,
|
||||||
|
const int maxit)
|
||||||
: grid_(grid),
|
: grid_(grid),
|
||||||
porevolume_(porevolume),
|
porevolume_(porevolume),
|
||||||
props_(props),
|
props_(props),
|
||||||
|
tol_(tol),
|
||||||
|
maxit_(maxit),
|
||||||
darcyflux_(0),
|
darcyflux_(0),
|
||||||
source_(0),
|
source_(0),
|
||||||
dt_(0.0),
|
dt_(0.0),
|
||||||
@ -48,6 +52,14 @@ namespace Opm
|
|||||||
THROW("Property object must have 2 phases");
|
THROW("Property object must have 2 phases");
|
||||||
}
|
}
|
||||||
visc_ = props.viscosity();
|
visc_ = props.viscosity();
|
||||||
|
int num_cells = props.numCells();
|
||||||
|
smin_.resize(props.numPhases()*num_cells);
|
||||||
|
smax_.resize(props.numPhases()*num_cells);
|
||||||
|
std::vector<int> cells(num_cells);
|
||||||
|
for (int i = 0; i < num_cells; ++i) {
|
||||||
|
cells[i] = i;
|
||||||
|
}
|
||||||
|
props.satRange(props.numCells(), &cells[0], &smin_[0], &smax_[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransportModelTwophase::solve(const double* darcyflux,
|
void TransportModelTwophase::solve(const double* darcyflux,
|
||||||
@ -128,17 +140,12 @@ namespace Opm
|
|||||||
void TransportModelTwophase::solveSingleCell(const int cell)
|
void TransportModelTwophase::solveSingleCell(const int cell)
|
||||||
{
|
{
|
||||||
Residual res(*this, cell);
|
Residual res(*this, cell);
|
||||||
const double tol = 1e-9;
|
|
||||||
// const double r0 = res(saturation_[cell]);
|
// const double r0 = res(saturation_[cell]);
|
||||||
// if (std::fabs(r0) < tol) {
|
// if (std::fabs(r0) < tol_) {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
const double a = 0.0;
|
|
||||||
const double b = 1.0;
|
|
||||||
const int maxit = 20;
|
|
||||||
int iters_used;
|
int iters_used;
|
||||||
// saturation_[cell] = modifiedRegulaFalsi(res, a, b, saturation_[cell], maxit, tol, iters_used);
|
saturation_[cell] = modifiedRegulaFalsi(res, smin_[2*cell], smax_[2*cell], maxit_, tol_, iters_used);
|
||||||
saturation_[cell] = modifiedRegulaFalsi(res, a, b, maxit, tol, iters_used);
|
|
||||||
fractionalflow_[cell] = fracFlow(saturation_[cell], cell);
|
fractionalflow_[cell] = fracFlow(saturation_[cell], cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,9 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
TransportModelTwophase(const UnstructuredGrid& grid,
|
TransportModelTwophase(const UnstructuredGrid& grid,
|
||||||
const double* porevolume,
|
const double* porevolume,
|
||||||
const Opm::IncompPropertiesInterface& props);
|
const Opm::IncompPropertiesInterface& props,
|
||||||
|
const double tol,
|
||||||
|
const int maxit);
|
||||||
|
|
||||||
void solve(const double* darcyflux,
|
void solve(const double* darcyflux,
|
||||||
const double* source,
|
const double* source,
|
||||||
@ -49,13 +51,17 @@ namespace Opm
|
|||||||
const UnstructuredGrid& grid_;
|
const UnstructuredGrid& grid_;
|
||||||
const double* porevolume_; // one volume per cell
|
const double* porevolume_; // one volume per cell
|
||||||
const IncompPropertiesInterface& props_;
|
const IncompPropertiesInterface& props_;
|
||||||
|
const double* visc_;
|
||||||
|
std::vector<double> smin_;
|
||||||
|
std::vector<double> smax_;
|
||||||
|
double tol_;
|
||||||
|
double maxit_;
|
||||||
|
|
||||||
const double* darcyflux_; // one flux per grid face
|
const double* darcyflux_; // one flux per grid face
|
||||||
const double* source_; // one source per cell
|
const double* source_; // one source per cell
|
||||||
double dt_;
|
double dt_;
|
||||||
double* saturation_; // one per cell
|
double* saturation_; // one per cell
|
||||||
std::vector<double> fractionalflow_; // one per cell
|
std::vector<double> fractionalflow_; // one per cell
|
||||||
const double* visc_;
|
|
||||||
|
|
||||||
// Storing the upwind graph for experiments.
|
// Storing the upwind graph for experiments.
|
||||||
// std::vector<int> ia_;
|
// std::vector<int> ia_;
|
||||||
|
Loading…
Reference in New Issue
Block a user