mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Minor performance improvement for non-VFP runs
This commit is contained in:
parent
3fddf86eef
commit
139071d39e
@ -374,6 +374,8 @@ namespace Opm {
|
|||||||
|
|
||||||
bool getWellConvergence(const int iteration);
|
bool getWellConvergence(const int iteration);
|
||||||
|
|
||||||
|
bool isVFPActive(const WellState& well_state) const;
|
||||||
|
|
||||||
std::vector<ADB>
|
std::vector<ADB>
|
||||||
computePressures(const ADB& po,
|
computePressures(const ADB& po,
|
||||||
const ADB& sw,
|
const ADB& sw,
|
||||||
|
@ -774,19 +774,16 @@ namespace detail {
|
|||||||
{
|
{
|
||||||
using namespace Opm::AutoDiffGrid;
|
using namespace Opm::AutoDiffGrid;
|
||||||
|
|
||||||
if (true) {
|
// If we have VFP tables, we need the well connection
|
||||||
// Create the primary variables.
|
// pressures for the "simple" hydrostatic correction
|
||||||
|
// between well depth and vfp table depth.
|
||||||
|
if (isVFPActive(well_state)) {
|
||||||
SolutionState state = asImpl().variableState(reservoir_state, well_state);
|
SolutionState state = asImpl().variableState(reservoir_state, well_state);
|
||||||
|
|
||||||
if (true || initial_assembly) {
|
|
||||||
// Create the (constant, derivativeless) initial state.
|
|
||||||
SolutionState state0 = state;
|
SolutionState state0 = state;
|
||||||
asImpl().makeConstantState(state0);
|
asImpl().makeConstantState(state0);
|
||||||
computeWellConnectionPressures(state0, well_state);
|
computeWellConnectionPressures(state0, well_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Possibly switch well controls and updating well state to
|
// Possibly switch well controls and updating well state to
|
||||||
// get reasonable initial conditions for the wells
|
// get reasonable initial conditions for the wells
|
||||||
updateWellControls(well_state);
|
updateWellControls(well_state);
|
||||||
@ -1211,6 +1208,37 @@ namespace detail {
|
|||||||
} //Namespace
|
} //Namespace
|
||||||
|
|
||||||
|
|
||||||
|
template <class Grid, class Implementation>
|
||||||
|
bool BlackoilModelBase<Grid, Implementation>::isVFPActive(const WellState& xw) const
|
||||||
|
{
|
||||||
|
if( ! wellsActive() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( vfp_properties_->getProd()->empty() && vfp_properties_->getInj()->empty() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int nw = wells().number_of_wells;
|
||||||
|
//Loop over all wells
|
||||||
|
for (int w = 0; w < nw; ++w) {
|
||||||
|
const WellControls* wc = wells().ctrls[w];
|
||||||
|
|
||||||
|
const int nwc = well_controls_get_num(wc);
|
||||||
|
|
||||||
|
//Loop over all controls
|
||||||
|
for (int c=0; c < nwc; ++c) {
|
||||||
|
const WellControlType ctrl_type = well_controls_iget_type(wc, c);
|
||||||
|
|
||||||
|
if (ctrl_type == THP) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class Implementation>
|
template <class Grid, class Implementation>
|
||||||
void BlackoilModelBase<Grid, Implementation>::updateWellControls(WellState& xw) const
|
void BlackoilModelBase<Grid, Implementation>::updateWellControls(WellState& xw) const
|
||||||
|
@ -132,6 +132,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
const VFPInjTable* getTable(const int table_id) const;
|
const VFPInjTable* getTable(const int table_id) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if no vfp tables are in the current map
|
||||||
|
*/
|
||||||
|
inline const bool empty() const {
|
||||||
|
return m_tables.empty();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Map which connects the table number with the table itself
|
// Map which connects the table number with the table itself
|
||||||
std::map<int, const VFPInjTable*> m_tables;
|
std::map<int, const VFPInjTable*> m_tables;
|
||||||
|
@ -143,6 +143,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
const VFPProdTable* getTable(const int table_id) const;
|
const VFPProdTable* getTable(const int table_id) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if no vfp tables are in the current map
|
||||||
|
*/
|
||||||
|
inline const bool empty() const {
|
||||||
|
return m_tables.empty();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Map which connects the table number with the table itself
|
// Map which connects the table number with the table itself
|
||||||
std::map<int, const VFPProdTable*> m_tables;
|
std::map<int, const VFPProdTable*> m_tables;
|
||||||
|
@ -58,14 +58,14 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns the VFP properties for injection wells
|
* Returns the VFP properties for injection wells
|
||||||
*/
|
*/
|
||||||
const VFPInjProperties* getInj() const {
|
inline const VFPInjProperties* getInj() const {
|
||||||
return m_inj.get();
|
return m_inj.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the VFP properties for production wells
|
* Returns the VFP properties for production wells
|
||||||
*/
|
*/
|
||||||
const VFPProdProperties* getProd() const {
|
inline const VFPProdProperties* getProd() const {
|
||||||
return m_prod.get();
|
return m_prod.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user