Change setThresholdPressures() interface.

Now it takes a std::vector instead of an Eigen::Array, more importantly
it expects one element per face, not interior face. The mapping now takes
place in setThresholdPressures().
This commit is contained in:
Atgeirr Flø Rasmussen 2014-08-27 14:21:34 +02:00
parent dc9ce967a2
commit 4af03dcdb8
2 changed files with 11 additions and 7 deletions

View File

@ -80,9 +80,9 @@ namespace Opm {
/// difference is greater, the threshold value is subtracted
/// before calculating flow. This is treated symmetrically, so
/// flow is prevented or reduced in both directions equally.
/// \param[in] threshold_pressures array of size equal to the number of interior faces
/// \param[in] threshold_pressures_by_face array of size equal to the number of faces
/// of the grid passed in the constructor.
void setThresholdPressures(const Eigen::Array<double, Eigen::Dynamic, 1>& threshold_pressures);
void setThresholdPressures(const std::vector<double>& threshold_pressures_by_face);
/// Take a single forward step, modifiying
/// state.pressure()

View File

@ -218,14 +218,18 @@ namespace {
template<class T>
void
FullyImplicitBlackoilSolver<T>::
setThresholdPressures(const Eigen::Array<double, Eigen::Dynamic, 1>& threshold_pressures)
setThresholdPressures(const std::vector<double>& threshold_pressures_by_face)
{
const int ifacesize = ops_.internal_faces.size();
if (threshold_pressures.size() != ifacesize) {
OPM_THROW(std::runtime_error, "Illegal size of threshold_pressures input, must be equal to number of interior faces.");
const int num_faces = AutoDiffGrid::numFaces(grid_);
if (int(threshold_pressures_by_face.size()) != num_faces) {
OPM_THROW(std::runtime_error, "Illegal size of threshold_pressures_by_face input, must be equal to number of faces.");
}
use_threshold_pressure_ = true;
threshold_pressures_by_interior_face_ = threshold_pressures;
// Map to interior faces.
const int num_ifaces = ops_.internal_faces.size();
for (int ii = 0; ii < num_ifaces; ++ii) {
threshold_pressures_by_interior_face_[ii] = threshold_pressures_by_face[ops_.internal_faces[ii]];
}
}