diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 57e39a1b8..50f18cb83 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -106,6 +106,8 @@ namespace Opm { static const int numEq = Indices::numEq; static const int solventSaturationIdx = Indices::solventSaturationIdx; + static constexpr bool has_solvent_ = getPropValue(); + static constexpr bool has_polymer_ = getPropValue(); // TODO: where we should put these types, WellInterface or Well Model? // or there is some other strategy, like TypeTag @@ -315,9 +317,6 @@ namespace Opm { const ModelParameters param_; bool terminal_output_; - bool has_solvent_; - bool has_zFraction_; - bool has_polymer_; std::vector pvt_region_idx_; PhaseUsage phase_usage_; size_t global_num_cells_; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 621c62cb1..9086544b3 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -34,9 +34,6 @@ namespace Opm { BlackoilWellModel:: BlackoilWellModel(Simulator& ebosSimulator) : ebosSimulator_(ebosSimulator) - , has_solvent_(getPropValue()) - , has_zFraction_(getPropValue()) - , has_polymer_(getPropValue()) { terminal_output_ = false; if (ebosSimulator.gridView().comm().rank() == 0) @@ -359,7 +356,7 @@ namespace Opm { // calculate the efficiency factors for each well calculateEfficiencyFactors(reportStepIdx); - if (has_polymer_) + if constexpr (has_polymer_) { if (PolymerModule::hasPlyshlog() || getPropValue() ) { setRepRadiusPerfLength(); @@ -1620,7 +1617,7 @@ namespace Opm { B += 1 / fs.invB(phaseIdx).value(); } - if (has_solvent_) { + if constexpr (has_solvent_) { auto& B = B_avg[solventSaturationIdx]; B += 1 / intQuants.solventInverseFormationVolumeFactor().value(); } @@ -1672,7 +1669,7 @@ namespace Opm { return numPhases(); } int numComp = FluidSystem::numComponents; - if (has_solvent_) { + if constexpr (has_solvent_) { numComp ++; }