Remove usage of cachedIntensiveQuantities from getWellConvergence

This commit is contained in:
Markus Blatt 2017-03-24 11:58:54 +01:00
parent f6153f8133
commit 4768bc9e90
2 changed files with 20 additions and 7 deletions

View File

@ -23,6 +23,8 @@
#ifndef OPM_STANDARDWELLSDENSE_HEADER_INCLUDED
#define OPM_STANDARDWELLSDENSE_HEADER_INCLUDED
#include <opm/autodiff/BlackoilModelEbosTypeTags.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/utility/platform_dependent/disable_warnings.h>
@ -69,7 +71,9 @@ enum WellVariablePositions {
template<typename FluidSystem, typename BlackoilIndices>
class StandardWellsDense {
public:
// --------- Ebos property system stuff -------
typedef typename TTAG(EclFlowProblem) TypeTag;
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
// --------- Types ---------
typedef WellStateFullyImplicitBlackoilDense WellState;
typedef BlackoilModelParameters ModelParameters;

View File

@ -934,15 +934,24 @@ namespace Opm {
std::vector< Vector > B( np, Vector( nc ) );
std::vector< Vector > R2( np, Vector( nc ) );
std::vector< Vector > tempV( np, Vector( nc ) );
auto& grid = ebosSimulator.gridManager().grid();
const auto& gridView = grid.leafGridView();
ElementContext elemCtx(ebosSimulator);
const auto& elemEndIt = gridView.template end</*codim=*/0, Dune::Interior_Partition>();
for ( int idx = 0; idx < np; ++idx )
for (auto elemIt = gridView.template begin</*codim=*/0, Dune::Interior_Partition>();
elemIt != elemEndIt; ++elemIt)
{
Vector& B_idx = B[ idx ];
const int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(idx);
elemCtx.updatePrimaryStencil(*elemIt);
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
for (int cell_idx = 0; cell_idx < nc; ++cell_idx) {
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
const auto& fs = intQuants.fluidState();
const auto& intQuants = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0);
const auto& fs = intQuants.fluidState();
for ( int idx = 0; idx < np; ++idx )
{
Vector& B_idx = B[ idx ];
const int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(idx);
B_idx [cell_idx] = 1 / fs.invB(ebosPhaseIdx).value();
}