VFPProperties: template Scalar type

This commit is contained in:
Arne Morten Kvarving 2024-02-19 14:00:51 +01:00
parent 29d142b5e4
commit 3747981347
6 changed files with 24 additions and 19 deletions

View File

@ -46,7 +46,7 @@ struct Setup
std::shared_ptr<Python> python;
std::unique_ptr<const Schedule> schedule;
std::unique_ptr<SummaryState> summary_state;
std::unique_ptr<VFPProperties> vfp_properties;
std::unique_ptr<VFPProperties<double>> vfp_properties;
Setup(const std::string& file)
{
@ -63,7 +63,9 @@ struct Setup
const int step = 0;
const auto& sched_state = schedule->operator[](step);
WellState<double> well_state(phaseUsage(runspec.phases()));
vfp_properties = std::make_unique<VFPProperties>(sched_state.vfpinj(), sched_state.vfpprod(), well_state);
vfp_properties = std::make_unique<VFPProperties<double>>(sched_state.vfpinj(),
sched_state.vfpprod(),
well_state);
};
};

View File

@ -63,7 +63,7 @@ namespace Opm {
class Schedule;
struct SimulatorUpdate;
class SummaryConfig;
class VFPProperties;
template<class Scalar> class VFPProperties;
template<class Scalar> class WellInterfaceGeneric;
template<class Scalar> class WellState;
} // namespace Opm
@ -557,7 +557,7 @@ protected:
mutable std::unordered_set<std::string> closed_this_step_;
GuideRate guideRate_;
std::unique_ptr<VFPProperties> vfp_properties_{};
std::unique_ptr<VFPProperties<Scalar>> vfp_properties_{};
std::map<std::string, Scalar> node_pressures_; // Storing network pressures for output.
// previous injection multiplier, it is used in the injection multiplier calculation for WINJMULT keyword

View File

@ -275,7 +275,7 @@ namespace Opm {
{
const auto& sched_state = this->schedule()[timeStepIdx];
this->vfp_properties_ = std::make_unique<VFPProperties>
this->vfp_properties_ = std::make_unique<VFPProperties<Scalar>>
(sched_state.vfpinj(), sched_state.vfpprod(), this->wellState());
}
}

View File

@ -36,6 +36,7 @@ class VFPProdTable;
* A thin wrapper class that holds one VFPProdProperties and one
* VFPInjProperties object.
*/
template<class Scalar>
class VFPProperties {
public:
/**
@ -47,8 +48,8 @@ public:
VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
const WellState<double>& well_state)
:well_state_(well_state)
const WellState<Scalar>& well_state)
: well_state_(well_state)
{
for (const auto& vfpinj : inj_tables)
this->m_inj.addTable( vfpinj );
@ -60,7 +61,7 @@ public:
/**
* Returns the VFP properties for injection wells
*/
const VFPInjProperties<double>* getInj() const
const VFPInjProperties<Scalar>* getInj() const
{
return &m_inj;
}
@ -68,12 +69,13 @@ public:
/**
* Returns the VFP properties for production wells
*/
const VFPProdProperties<double>* getProd() const
const VFPProdProperties<Scalar>* getProd() const
{
return &m_prod;
}
double getExplicitWFR(const int table_id, const std::size_t well_index) const {
Scalar getExplicitWFR(const int table_id, const std::size_t well_index) const
{
const auto& rates = well_state_.well(well_index).prev_surface_rates;
const auto& pu = well_state_.phaseUsage();
const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;
@ -83,7 +85,8 @@ public:
return detail::getWFR(table, aqua, liquid, vapour);
}
double getExplicitGFR(const int table_id, const std::size_t well_index) const {
Scalar getExplicitGFR(const int table_id, const std::size_t well_index) const
{
const auto& rates = well_state_.well(well_index).prev_surface_rates;
const auto& pu = well_state_.phaseUsage();
const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;
@ -94,9 +97,9 @@ public:
}
private:
VFPInjProperties<double> m_inj;
VFPProdProperties<double> m_prod;
const WellState<double>& well_state_;
VFPInjProperties<Scalar> m_inj;
VFPProdProperties<Scalar> m_prod;
const WellState<Scalar>& well_state_;
};
} // namespace Opm

View File

@ -374,7 +374,7 @@ closeCompletions(const WellTestState& wellTestState)
template<class Scalar>
void WellInterfaceGeneric<Scalar>::
setVFPProperties(const VFPProperties* vfp_properties_arg)
setVFPProperties(const VFPProperties<Scalar>* vfp_properties_arg)
{
vfp_properties_ = vfp_properties_arg;
}

View File

@ -40,7 +40,7 @@ class ParallelWellInfo;
struct PerforationData;
struct PhaseUsage;
class SummaryState;
class VFPProperties;
template<class Scalar> class VFPProperties;
class WellTestState;
template<class Scalar> class WellState;
template<class Scalar> class SingleWellState;
@ -94,7 +94,7 @@ public:
void initCompletions();
void closeCompletions(const WellTestState& wellTestState);
void setVFPProperties(const VFPProperties* vfp_properties_arg);
void setVFPProperties(const VFPProperties<Scalar>* vfp_properties_arg);
void setPrevSurfaceRates(WellState<Scalar>& well_state,
const WellState<Scalar>& prev_well_state) const;
void setGuideRate(const GuideRate* guide_rate_arg);
@ -129,7 +129,7 @@ public:
Scalar gravity() const { return gravity_; }
const VFPProperties* vfpProperties() const { return vfp_properties_; }
const VFPProperties<Scalar>* vfpProperties() const { return vfp_properties_; }
const ParallelWellInfo& parallelWellInfo() const { return parallel_well_info_; }
@ -358,7 +358,7 @@ protected:
std::vector<Scalar> inj_fc_multiplier_;
Scalar well_efficiency_factor_;
const VFPProperties* vfp_properties_;
const VFPProperties<Scalar>* vfp_properties_;
const GuideRate* guide_rate_;
std::vector<std::string> well_control_log_;