added functions for direct setting of well rates contribution to reservoir

This commit is contained in:
hnil 2022-06-20 14:44:15 +02:00 committed by Atgeirr Flø Rasmussen
parent c5d547efff
commit 5a39724606
2 changed files with 25 additions and 1 deletions

View File

@ -128,7 +128,7 @@ namespace Opm {
typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
typedef Dune::BlockVector<VectorBlockType> BVector;
// typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
typedef Opm::MatrixBlock<Scalar, numEq, numEq > MatrixBlockType;
typedef BlackOilPolymerModule<TypeTag> PolymerModule;
typedef BlackOilMICPModule<TypeTag> MICPModule;
@ -273,6 +273,29 @@ namespace Opm {
void addWellContributions(SparseMatrixAdapter& jacobian) const;
void addReseroirSourceTerms(GlobalEqVector& residual,
SparseMatrixAdapter& jacobian) const
{
for ( const auto& well: well_container_ ) {
if(!well->isOperableAndSolvable() && !well->wellIsStopped())
return;
const auto& cells = well->cells();
const auto& rates = well->connectionRates();
for (unsigned perfIdx = 0; perfIdx < rates.size(); ++perfIdx) {
unsigned cellIdx = cells[perfIdx];
auto rate = rates[perfIdx];
Scalar volume = ebosSimulator_.problem().volume(cellIdx,0);
rate *= -1.0;
VectorBlockType res(0.0);
MatrixBlockType bMat(0.0);
ebosSimulator_.model().linearizer().setResAndJacobi(res,bMat,rate);
residual[cellIdx] += res;
jacobian.addToBlock(cellIdx,cellIdx,bMat);
}
}
}
// called at the beginning of a report step
void beginReportStep(const int time_step);

View File

@ -288,6 +288,7 @@ public:
const GroupState& group_state,
DeferredLogger& deferred_logger);
const std::vector<RateVector>& connectionRates() const {return connectionRates_;}
protected:
// simulation parameters