mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-19 05:53:28 -06:00
Added possibility to set tolerance for linear solvers.
This commit is contained in:
parent
d1a4fa6dcd
commit
c81a840382
@ -93,6 +93,15 @@ namespace Opm
|
|||||||
return solver_->solve(size, nonzeros, ia, ja, sa, rhs, solution);
|
return solver_->solve(size, nonzeros, ia, ja, sa, rhs, solution);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinearSolverFactory::setTolerance(const double tol)
|
||||||
|
{
|
||||||
|
solver_->setTolerance(tol);
|
||||||
|
}
|
||||||
|
|
||||||
|
double LinearSolverFactory::getTolerance() const
|
||||||
|
{
|
||||||
|
return solver_->getTolerance();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,6 +75,17 @@ namespace Opm
|
|||||||
const double* sa,
|
const double* sa,
|
||||||
const double* rhs,
|
const double* rhs,
|
||||||
double* solution) const;
|
double* solution) const;
|
||||||
|
|
||||||
|
/// Set tolerance for the linear solver.
|
||||||
|
/// \param[in] tol tolerance value
|
||||||
|
/// Not used for LinearSolverFactory
|
||||||
|
virtual void setTolerance(const double tol);
|
||||||
|
|
||||||
|
/// Get tolerance for the linear solver.
|
||||||
|
/// \param[out] tolerance value
|
||||||
|
/// Not used for LinearSolverFactory. Returns -1.
|
||||||
|
virtual double getTolerance() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::tr1::shared_ptr<LinearSolverInterface> solver_;
|
std::tr1::shared_ptr<LinearSolverInterface> solver_;
|
||||||
};
|
};
|
||||||
|
@ -71,6 +71,14 @@ namespace Opm
|
|||||||
const double* rhs,
|
const double* rhs,
|
||||||
double* solution) const = 0;
|
double* solution) const = 0;
|
||||||
|
|
||||||
|
/// Set tolerance for the linear solver.
|
||||||
|
/// \param[in] tol tolerance value
|
||||||
|
virtual void setTolerance(const double tol) = 0;
|
||||||
|
|
||||||
|
/// Get tolerance for the linear solver.
|
||||||
|
/// \param[out] tolerance value
|
||||||
|
virtual double getTolerance() const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,6 +172,17 @@ namespace Opm
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinearSolverIstl::setTolerance(const double tol)
|
||||||
|
{
|
||||||
|
linsolver_residual_tolerance_ = tol;
|
||||||
|
}
|
||||||
|
|
||||||
|
double LinearSolverIstl::getTolerance() const
|
||||||
|
{
|
||||||
|
return linsolver_residual_tolerance_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,15 @@ namespace Opm
|
|||||||
const double* sa,
|
const double* sa,
|
||||||
const double* rhs,
|
const double* rhs,
|
||||||
double* solution) const;
|
double* solution) const;
|
||||||
|
|
||||||
|
/// Set tolerance for the residual in dune istl linear solver.
|
||||||
|
/// \param[in] tol tolerance value
|
||||||
|
virtual void setTolerance(const double tol);
|
||||||
|
|
||||||
|
/// Get tolerance ofthe linear solver.
|
||||||
|
/// \param[out] tolerance value
|
||||||
|
virtual double getTolerance() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double linsolver_residual_tolerance_;
|
double linsolver_residual_tolerance_;
|
||||||
int linsolver_verbosity_;
|
int linsolver_verbosity_;
|
||||||
|
@ -60,5 +60,15 @@ namespace Opm
|
|||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinearSolverUmfpack::setTolerance(const double /*tol*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
double LinearSolverUmfpack::getTolerance() const
|
||||||
|
{
|
||||||
|
return -1.;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
|
@ -56,6 +56,18 @@ namespace Opm
|
|||||||
const double* sa,
|
const double* sa,
|
||||||
const double* rhs,
|
const double* rhs,
|
||||||
double* solution) const;
|
double* solution) const;
|
||||||
|
|
||||||
|
/// Set tolerance for the linear solver.
|
||||||
|
/// \param[in] tol tolerance value
|
||||||
|
/// Not used for UMFPACK solver.
|
||||||
|
virtual void setTolerance(const double /*tol*/);
|
||||||
|
|
||||||
|
/// Get tolerance for the linear solver.
|
||||||
|
/// \param[out] tolerance value
|
||||||
|
/// Not used for UMFPACK solver. Returns -1.
|
||||||
|
virtual double getTolerance() const;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace Opm
|
|||||||
IncompTpfa::IncompTpfa(const UnstructuredGrid& g,
|
IncompTpfa::IncompTpfa(const UnstructuredGrid& g,
|
||||||
const double* permeability,
|
const double* permeability,
|
||||||
const double* gravity,
|
const double* gravity,
|
||||||
const LinearSolverInterface& linsolver,
|
LinearSolverInterface& linsolver,
|
||||||
const struct Wells* wells)
|
const struct Wells* wells)
|
||||||
: grid_(g),
|
: grid_(g),
|
||||||
linsolver_(linsolver),
|
linsolver_(linsolver),
|
||||||
@ -294,6 +294,16 @@ namespace Opm
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IncompTpfa::setTolerance(const double tol)
|
||||||
|
{
|
||||||
|
linsolver_.setTolerance(tol);
|
||||||
|
}
|
||||||
|
|
||||||
|
double IncompTpfa::getTolerance() const {
|
||||||
|
return linsolver_.getTolerance();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void IncompTpfa::computeFaceFlux(const std::vector<double>& totmob,
|
void IncompTpfa::computeFaceFlux(const std::vector<double>& totmob,
|
||||||
const std::vector<double>& omega,
|
const std::vector<double>& omega,
|
||||||
const std::vector<double>& src,
|
const std::vector<double>& src,
|
||||||
|
@ -56,7 +56,7 @@ namespace Opm
|
|||||||
IncompTpfa(const UnstructuredGrid& g,
|
IncompTpfa(const UnstructuredGrid& g,
|
||||||
const double* permeability,
|
const double* permeability,
|
||||||
const double* gravity,
|
const double* gravity,
|
||||||
const LinearSolverInterface& linsolver,
|
LinearSolverInterface& linsolver,
|
||||||
const struct Wells* wells = 0);
|
const struct Wells* wells = 0);
|
||||||
|
|
||||||
/// Destructor.
|
/// Destructor.
|
||||||
@ -155,9 +155,18 @@ namespace Opm
|
|||||||
/// Expose read-only reference to internal half-transmissibility.
|
/// Expose read-only reference to internal half-transmissibility.
|
||||||
const ::std::vector<double>& getHalfTrans() const { return htrans_; }
|
const ::std::vector<double>& getHalfTrans() const { return htrans_; }
|
||||||
|
|
||||||
|
/// Set tolerance for the linear solver.
|
||||||
|
/// \param[in] tol tolerance value
|
||||||
|
void setTolerance(const double tol);
|
||||||
|
|
||||||
|
/// Get tolerance of the linear solver.
|
||||||
|
/// \param[out] tolerance value
|
||||||
|
double getTolerance() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const UnstructuredGrid& grid_;
|
const UnstructuredGrid& grid_;
|
||||||
const LinearSolverInterface& linsolver_;
|
LinearSolverInterface& linsolver_;
|
||||||
::std::vector<double> htrans_;
|
::std::vector<double> htrans_;
|
||||||
::std::vector<double> trans_ ;
|
::std::vector<double> trans_ ;
|
||||||
::std::vector<double> gpress_;
|
::std::vector<double> gpress_;
|
||||||
|
Loading…
Reference in New Issue
Block a user