Added tolerance and maxiter arguments to CompressibleTpfa.

This commit is contained in:
Atgeirr Flø Rasmussen committed 2012-05-21 11:24:12 +02:00
1 parent 3342424a50
commit 521827c9d1
3 files changed
+28 -5

No files matched your search

+6 -1
View File
@@ -295,8 +295,13 @@ main(int argc, char** argv)
// Linear solver.
Opm::LinearSolverFactory linsolver(param);
// Pressure solver.
const double nl_press_res_tol = param.getDefault("nl_press_res_tol", 1e-6);
const double nl_press_change_tol = param.getDefault("nl_press_change_tol", 10.0);
const int nl_press_maxiter = param.getDefault("nl_press_maxiter", 20);
const double *grav = use_gravity ? &gravity[0] : 0;
Opm::CompressibleTpfa psolver(*grid->c_grid(), *props, linsolver, grav, wells->c_wells());
Opm::CompressibleTpfa psolver(*grid->c_grid(), *props, linsolver,
nl_press_res_tol, nl_press_change_tol, nl_press_maxiter,
grav, wells->c_wells());
// Reordering solver.
#if TRANSPORT_SOLVER_FIXED
const double nl_tolerance = param.getDefault("nl_tolerance", 1e-9);
+6
View File
@@ -53,11 +53,17 @@ namespace Opm
CompressibleTpfa::CompressibleTpfa(const UnstructuredGrid& grid,
const BlackoilPropertiesInterface& props,
const LinearSolverInterface& linsolver,
const double residual_tol,
const double change_tol,
const int maxiter,
const double* gravity,
const struct Wells* wells)
: grid_(grid),
props_(props),
linsolver_(linsolver),
residual_tol_(residual_tol),
change_tol_(change_tol),
maxiter_(maxiter),
gravity_(gravity),
wells_(wells),
htrans_(grid.cell_facepos[ grid.number_of_cells ]),
+16 -4
View File
@@ -47,7 +47,10 @@ namespace Opm
/// \param[in] grid A 2d or 3d grid.
/// \param[in] props Rock and fluid properties.
/// \param[in] linsolver Linear solver to use.
/// \param[in] gravity Gravity vector. If nonzero, the array should
/// \param[in] residual_tol Solution accepted if inf-norm of residual is smaller.
/// \param[in] change_tol Solution accepted if inf-norm of change is smaller.
/// \param[in] maxiter Maximum acceptable
/// \param[in] gravity Gravity vector. If non-null, the array should
/// have D elements.
/// \param[in] wells The wells argument. Will be used in solution,
/// is ignored if NULL.
@@ -59,12 +62,18 @@ namespace Opm
CompressibleTpfa(const UnstructuredGrid& grid,
const BlackoilPropertiesInterface& props,
const LinearSolverInterface& linsolver,
const double residual_tol,
const double change_tol,
const int maxiter,
const double* gravity,
const Wells* wells);
/// Destructor.
~CompressibleTpfa();
/// Solve the pressure equation by Newton-Raphson scheme.
/// May throw an exception if the number of iterations
/// exceed maxiter (set in constructor).
void solve(const double dt,
BlackoilState& state,
WellState& well_state);
@@ -89,8 +98,8 @@ namespace Opm
void assemble(const double dt,
const BlackoilState& state,
const WellState& well_state);
double residualNorm();
void solveIncrement();
void computeResults(std::vector<double>& pressure,
std::vector<double>& faceflux,
std::vector<double>& well_bhp,
@@ -100,8 +109,11 @@ namespace Opm
const UnstructuredGrid& grid_;
const BlackoilPropertiesInterface& props_;
const LinearSolverInterface& linsolver_;
const double* gravity_;
const Wells* wells_; // Outside may modify controls (only) between calls to solve().
const double residual_tol_;
const double change_tol_;
const int maxiter_;
const double* gravity_; // May be NULL
const Wells* wells_; // May be NULL, outside may modify controls (only) between calls to solve().
std::vector<double> htrans_;
std::vector<double> trans_ ;
std::vector<double> porevol_;