removing a few variables related to matrix opertaion

This commit is contained in:
Kai Bao 2017-09-26 15:01:26 +02:00
parent fc06923c50
commit 20c21a6cb2
2 changed files with 7 additions and 31 deletions

View File

@ -232,10 +232,6 @@ namespace Opm
// TODO: if we decided not to invert it, we better change the name of it
mutable DiagMatWell duneD_;
// several vector used in the matrix calculation
mutable BVectorWell Bx_;
mutable BVector scaleAddRes_;
// residuals of the well equations
mutable BVectorWell resWell_;
@ -343,9 +339,9 @@ namespace Opm
// obtain y = D^-1 * x
template<typename MatrixType, typename VectorType>
VectorType
invDX(MatrixType D, VectorType x)
invDX(const MatrixType& D, VectorType x)
{
// TODO: checking the problem related to use reference parameter
// the function will change the value of x, so we should not use reference of x here.
// TODO: store some of the following information to avoid to call it again and again for
// efficiency improvement.
@ -353,6 +349,7 @@ namespace Opm
VectorType y(x.size());
y = 0.;
Dune::MatrixAdapter<MatrixType, VectorType, VectorType> linearOperator(D);
// Sequential incomplete LU decomposition as the preconditioner

View File

@ -179,9 +179,6 @@ namespace Opm
resWell_.resize( numberOfSegments() );
// resize temporary class variables
Bx_.resize( duneC_.N() );
// TODO: maybe this function need a different name for better meaning
primary_variables_.resize(numberOfSegments());
primary_variables_evaluation_.resize(numberOfSegments());
@ -572,12 +569,12 @@ namespace Opm
MultisegmentWell<TypeTag>::
apply(const BVector& x, BVector& Ax) const
{
assert( Bx_.size() == duneB_.N() );
BVectorWell Bx(duneB_.N());
duneB_.mv(x, Bx);
// Bx_ = duneB_ * x
duneB_.mv(x, Bx_);
// invDBx = duneD^-1 * Bx_
BVectorWell invDBx = invDX(duneD_, Bx_);
BVectorWell invDBx = invDX(duneD_, Bx);
// Ax = Ax - duneC_^T * invDBx
duneC_.mmtv(invDBx,Ax);
@ -1628,24 +1625,6 @@ namespace Opm
}
}
// convert the fractions to be Q_p / G_total to calculate the phase rates
if (well_controls_get_current_type(well_controls_) == RESERVOIR_RATE) {
const double* distr = well_controls_get_current_distr(well_controls_);
for (int p = 0; p < number_of_phases_; ++p) {
if (distr[p] > 0.) { // for injection wells, thre is only one non-zero distr value
fractions[p] /= distr[p];
} else {
// this only happens to injection well so far
fractions[p] = 0.;
}
}
} else {
const std::vector<double> g = {1., 1., 0.01};
for (int p = 0; p < number_of_phases_; ++p) {
fractions[p] /= g[p];
}
}
// calculate the phase rates based on the primary variables
const double g_total = primary_variables_[seg][GTotal];
const int top_segment_location = well_state.topSegmentLocation(index_of_well_);