mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
[cleanup] Only iterate over grid once during getConvergence.
Resolved cherry-pick conflicts by @blattms.
This commit is contained in:
committed by
Markus Blatt
parent
990ea7c44c
commit
085df34183
@@ -584,10 +584,9 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
using namespace Opm::AutoDiffGrid;
|
using namespace Opm::AutoDiffGrid;
|
||||||
const int np = fluid_.numPhases();
|
const int np = fluid_.numPhases();
|
||||||
const int nc = numCells(grid_);
|
|
||||||
|
|
||||||
ElementContext elemCtx(ebosSimulator_);
|
ElementContext elemCtx( ebosSimulator_ );
|
||||||
const auto& gridView = grid_.leafGridView();
|
const auto& gridView = ebosSimulator_.gridView();
|
||||||
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
||||||
for (auto elemIt = gridView.template begin</*codim=*/0>();
|
for (auto elemIt = gridView.template begin</*codim=*/0>();
|
||||||
elemIt != elemEndIt;
|
elemIt != elemEndIt;
|
||||||
@@ -886,28 +885,28 @@ namespace Opm {
|
|||||||
const auto& ebosResid = ebosSimulator_.model().linearizer().residual();
|
const auto& ebosResid = ebosSimulator_.model().linearizer().residual();
|
||||||
|
|
||||||
ElementContext elemCtx(ebosSimulator_);
|
ElementContext elemCtx(ebosSimulator_);
|
||||||
const auto& gridView = grid_.leafGridView();
|
const auto& gridView = ebosSimulator().gridView();
|
||||||
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
||||||
|
|
||||||
for ( int idx = 0; idx < np; ++idx )
|
for (auto elemIt = gridView.template begin</*codim=*/0>();
|
||||||
|
elemIt != elemEndIt;
|
||||||
|
++elemIt)
|
||||||
{
|
{
|
||||||
Vector& R2_idx = R2[ idx ];
|
const auto& elem = *elemIt;
|
||||||
Vector& B_idx = B[ idx ];
|
elemCtx.updatePrimaryStencil(elem);
|
||||||
const int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(idx);
|
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||||
const int ebosCompIdx = flowPhaseToEbosCompIdx(idx);
|
const unsigned cell_idx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0);
|
||||||
|
const auto& intQuants = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0);
|
||||||
|
const auto& fs = intQuants.fluidState();
|
||||||
|
|
||||||
for (auto elemIt = gridView.template begin</*codim=*/0>();
|
for ( int idx = 0; idx < np; ++idx )
|
||||||
elemIt != elemEndIt;
|
|
||||||
++elemIt)
|
|
||||||
{
|
{
|
||||||
const auto& elem = *elemIt;
|
Vector& R2_idx = R2[ idx ];
|
||||||
elemCtx.updatePrimaryStencil(elem);
|
Vector& B_idx = B[ idx ];
|
||||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
const int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(idx);
|
||||||
const unsigned cell_idx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0);
|
const int ebosCompIdx = flowPhaseToEbosCompIdx(idx);
|
||||||
const auto& intQuants = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0);
|
|
||||||
const auto& fs = intQuants.fluidState();
|
|
||||||
|
|
||||||
B_idx [cell_idx] = 1 / fs.invB(ebosPhaseIdx).value();
|
B_idx [cell_idx] = 1.0 / fs.invB(ebosPhaseIdx).value();
|
||||||
R2_idx[cell_idx] = ebosResid[cell_idx][ebosCompIdx];
|
R2_idx[cell_idx] = ebosResid[cell_idx][ebosCompIdx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1034,7 +1033,7 @@ namespace Opm {
|
|||||||
computeFluidInPlace(const std::vector<int>& fipnum) const
|
computeFluidInPlace(const std::vector<int>& fipnum) const
|
||||||
{
|
{
|
||||||
const auto& comm = grid_.comm();
|
const auto& comm = grid_.comm();
|
||||||
const auto& gridView = grid_.leafGridView();
|
const auto& gridView = ebosSimulator().gridView();
|
||||||
const int nc = gridView.size(/*codim=*/0);
|
const int nc = gridView.size(/*codim=*/0);
|
||||||
const int maxnp = Opm::BlackoilPhases::MaxNumPhases;
|
const int maxnp = Opm::BlackoilPhases::MaxNumPhases;
|
||||||
int ntFip = *std::max_element(fipnum.begin(), fipnum.end());
|
int ntFip = *std::max_element(fipnum.begin(), fipnum.end());
|
||||||
|
|||||||
Reference in New Issue
Block a user