mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'tester' into master-refactor-for-cpgrid-support
Resolved conflicts: examples/sim_fibo_ad.cpp opm/autodiff/FullyImplicitBlackoilSolver_impl.hpp
This commit is contained in:
@@ -288,7 +288,10 @@ spdiag(const AutoDiffBlock<double>::V& d)
|
||||
public:
|
||||
typedef AutoDiffBlock<Scalar> ADB;
|
||||
|
||||
Selector(const typename ADB::V& selection_basis)
|
||||
enum CriterionForLeftElement { GreaterEqualZero, GreaterZero, Zero, NotEqualZero, LessZero, LessEqualZero };
|
||||
|
||||
Selector(const typename ADB::V& selection_basis,
|
||||
CriterionForLeftElement crit = GreaterEqualZero)
|
||||
{
|
||||
// Define selector structure.
|
||||
const int n = selection_basis.size();
|
||||
@@ -296,10 +299,33 @@ spdiag(const AutoDiffBlock<double>::V& d)
|
||||
left_elems_.reserve(n);
|
||||
right_elems_.reserve(n);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (selection_basis[i] < 0.0) {
|
||||
right_elems_.push_back(i);
|
||||
} else {
|
||||
bool chooseleft = false;
|
||||
switch (crit) {
|
||||
case GreaterEqualZero:
|
||||
chooseleft = selection_basis[i] >= 0.0;
|
||||
break;
|
||||
case GreaterZero:
|
||||
chooseleft = selection_basis[i] > 0.0;
|
||||
break;
|
||||
case Zero:
|
||||
chooseleft = selection_basis[i] == 0.0;
|
||||
break;
|
||||
case NotEqualZero:
|
||||
chooseleft = selection_basis[i] != 0.0;
|
||||
break;
|
||||
case LessZero:
|
||||
chooseleft = selection_basis[i] < 0.0;
|
||||
break;
|
||||
case LessEqualZero:
|
||||
chooseleft = selection_basis[i] <= 0.0;
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::logic_error, "No such criterion: " << crit);
|
||||
}
|
||||
if (chooseleft) {
|
||||
left_elems_.push_back(i);
|
||||
} else {
|
||||
right_elems_.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ namespace {
|
||||
|
||||
template<class T>
|
||||
void FullyImplicitBlackoilSolver<T>::computeWellConnectionPressures(const SolutionState& state,
|
||||
const WellStateFullyImplicitBlackoil& xw)
|
||||
const WellStateFullyImplicitBlackoil& xw)
|
||||
{
|
||||
using namespace Opm::AutoDiffGrid;
|
||||
// 1. Compute properties required by computeConnectionPressureDelta().
|
||||
@@ -702,7 +702,8 @@ namespace {
|
||||
|
||||
|
||||
|
||||
template<class T>
|
||||
|
||||
template <class T>
|
||||
void FullyImplicitBlackoilSolver<T>::addWellEq(const SolutionState& state,
|
||||
WellStateFullyImplicitBlackoil& xw)
|
||||
{
|
||||
@@ -806,14 +807,17 @@ namespace {
|
||||
|
||||
// check for dead wells
|
||||
V isNotDeadWells = V::Constant(nw,1.0);
|
||||
for (int c = 0; c < nw; ++c){
|
||||
if (wbqt.value()[c] == 0)
|
||||
isNotDeadWells[c] = 0;
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
if (wbqt.value()[w] == 0) {
|
||||
isNotDeadWells[w] = 0;
|
||||
}
|
||||
}
|
||||
// compute wellbore mixture at std conds
|
||||
Selector<double> notDeadWells_selector(wbqt.value(), Selector<double>::Zero);
|
||||
std::vector<ADB> mix_s(np, ADB::null());
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
mix_s[phase] = isNotDeadWells * wbq[phase]/wbqt;
|
||||
const int pos = pu.phase_pos[phase];
|
||||
mix_s[phase] = notDeadWells_selector.select(ADB::constant(compi.col(pos)), wbq[phase]/wbqt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user