mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
-- prepared for possibliy of not using cached intentensive quantities
This commit is contained in:
@@ -638,7 +638,7 @@ namespace Opm
|
||||
const bool allow_cf = this->getAllowCrossFlow() || openCrossFlowAvoidSingularity(ebosSimulator);
|
||||
const EvalWell& bhp = this->primary_variables_.eval(Bhp);
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& intQuants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
std::vector<EvalWell> mob(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.});
|
||||
getMobilityEval(ebosSimulator, perf, mob, deferred_logger);
|
||||
|
||||
@@ -856,7 +856,7 @@ namespace Opm
|
||||
{
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
assert (int(mob.size()) == this->num_components_);
|
||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
|
||||
const auto& intQuants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/0);
|
||||
const auto& materialLawManager = ebosSimulator.problem().materialLawManager();
|
||||
|
||||
// either use mobility of the perforation cell or calcualte its own
|
||||
@@ -925,7 +925,7 @@ namespace Opm
|
||||
{
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
assert (int(mob.size()) == this->num_components_);
|
||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
|
||||
const auto& intQuants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/0);
|
||||
const auto& materialLawManager = ebosSimulator.problem().materialLawManager();
|
||||
|
||||
// either use mobility of the perforation cell or calcualte its own
|
||||
@@ -1065,7 +1065,7 @@ namespace Opm
|
||||
getMobilityScalar(ebos_simulator, perf, mob, deferred_logger);
|
||||
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quantities = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& int_quantities = ebos_simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
const auto& fs = int_quantities.fluidState();
|
||||
// the pressure of the reservoir grid block the well connection is in
|
||||
double p_r = this->getPerfCellPressure(fs).value();
|
||||
@@ -1260,7 +1260,7 @@ namespace Opm
|
||||
|
||||
for (int perf = 0; perf < this->number_of_perforations_; ++perf) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& intQuants = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
|
||||
const auto& intQuants = ebos_simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/0);
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
const double pressure = this->getPerfCellPressure(fs).value();
|
||||
@@ -1355,27 +1355,27 @@ namespace Opm
|
||||
std::function<Scalar(int,int)> getTemperature =
|
||||
[&ebosSimulator](int cell_idx, int phase_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->fluidState().temperature(phase_idx).value();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).fluidState().temperature(phase_idx).value();
|
||||
};
|
||||
std::function<Scalar(int)> getSaltConcentration =
|
||||
[&ebosSimulator](int cell_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->fluidState().saltConcentration().value();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).fluidState().saltConcentration().value();
|
||||
};
|
||||
std::function<int(int)> getPvtRegionIdx =
|
||||
[&ebosSimulator](int cell_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->fluidState().pvtRegionIndex();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).fluidState().pvtRegionIndex();
|
||||
};
|
||||
std::function<Scalar(int)> getInvFac =
|
||||
[&ebosSimulator](int cell_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->solventInverseFormationVolumeFactor().value();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).solventInverseFormationVolumeFactor().value();
|
||||
};
|
||||
std::function<Scalar(int)> getSolventDensity =
|
||||
[&ebosSimulator](int cell_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->solventRefDensity();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).solventRefDensity();
|
||||
};
|
||||
|
||||
this->connections_.computePropertiesForPressures(well_state,
|
||||
@@ -1438,7 +1438,7 @@ namespace Opm
|
||||
{
|
||||
const auto cell_idx = this->well_cells_[perf];
|
||||
return ebosSimulator.model()
|
||||
.cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0)->fluidState();
|
||||
.intensiveQuantities(cell_idx, /*timeIdx=*/ 0).fluidState();
|
||||
};
|
||||
|
||||
const int np = this->number_of_phases_;
|
||||
@@ -1518,22 +1518,22 @@ namespace Opm
|
||||
std::function<Scalar(int,int)> invB =
|
||||
[&ebosSimulator](int cell_idx, int phase_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->fluidState().invB(phase_idx).value();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).fluidState().invB(phase_idx).value();
|
||||
};
|
||||
std::function<Scalar(int,int)> mobility =
|
||||
[&ebosSimulator](int cell_idx, int phase_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->mobility(phase_idx).value();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).mobility(phase_idx).value();
|
||||
};
|
||||
std::function<Scalar(int)> invFac =
|
||||
[&ebosSimulator](int cell_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->solventInverseFormationVolumeFactor().value();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).solventInverseFormationVolumeFactor().value();
|
||||
};
|
||||
std::function<Scalar(int)> solventMobility =
|
||||
[&ebosSimulator](int cell_idx)
|
||||
{
|
||||
return ebosSimulator.model().cachedIntensiveQuantities(cell_idx, 0)->solventMobility().value();
|
||||
return ebosSimulator.model().intensiveQuantities(cell_idx, 0).solventMobility().value();
|
||||
};
|
||||
|
||||
this->connections_.computeProperties(well_state,
|
||||
@@ -1680,7 +1680,7 @@ namespace Opm
|
||||
|
||||
for (int perf = 0; perf < this->number_of_perforations_; ++perf) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& intQuants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
// flux for each perforation
|
||||
std::vector<Scalar> mob(this->num_components_, 0.);
|
||||
getMobilityScalar(ebosSimulator, perf, mob, deferred_logger);
|
||||
@@ -2007,7 +2007,7 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quant = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& int_quant = ebos_simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
const EvalWell polymer_concentration = this->extendEval(int_quant.polymerConcentration());
|
||||
|
||||
// TODO: not sure should based on the well type or injecting/producing peforations
|
||||
@@ -2230,7 +2230,7 @@ namespace Opm
|
||||
std::vector<EvalWell>& cq_s) const
|
||||
{
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& int_quants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
const auto& fs = int_quants.fluidState();
|
||||
const EvalWell b_w = this->extendEval(fs.invB(FluidSystem::waterPhaseIdx));
|
||||
const double area = M_PI * this->bore_diameters_[perf] * this->perf_length_[perf];
|
||||
@@ -2255,7 +2255,7 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& int_quants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
const auto& fs = int_quants.fluidState();
|
||||
const EvalWell b_w = this->extendEval(fs.invB(FluidSystem::waterPhaseIdx));
|
||||
const EvalWell water_flux_r = water_flux_s / b_w;
|
||||
@@ -2393,7 +2393,7 @@ namespace Opm
|
||||
double max_pressure = 0.0;
|
||||
for (int perf = 0; perf < this->number_of_perforations_; ++perf) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& int_quants = *(ebos_simulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& int_quants = ebos_simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
const auto& fs = int_quants.fluidState();
|
||||
double pressure_cell = this->getPerfCellPressure(fs).value();
|
||||
max_pressure = std::max(max_pressure, pressure_cell);
|
||||
@@ -2537,7 +2537,7 @@ namespace Opm
|
||||
const bool allow_cf = this->getAllowCrossFlow() || openCrossFlowAvoidSingularity(ebosSimulator);
|
||||
for (int perf = 0; perf < this->number_of_perforations_; ++perf) {
|
||||
const int cell_idx = this->well_cells_[perf];
|
||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/ 0));
|
||||
const auto& intQuants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
|
||||
std::vector<Scalar> mob(this->num_components_, 0.);
|
||||
getMobilityScalar(ebosSimulator, perf, mob, deferred_logger);
|
||||
std::vector<Scalar> cq_s(this->num_components_, 0.);
|
||||
|
||||
Reference in New Issue
Block a user