mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3235 from akva2/constexpr_micro_optim_wells
Small micro-optims in WellInterface
This commit is contained in:
commit
817e81d3b7
@ -107,15 +107,15 @@ namespace Opm
|
|||||||
typedef Dune::BlockVector<VectorBlockType> BVector;
|
typedef Dune::BlockVector<VectorBlockType> BVector;
|
||||||
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
||||||
|
|
||||||
static const bool has_solvent = getPropValue<TypeTag, Properties::EnableSolvent>();
|
static constexpr bool has_solvent = getPropValue<TypeTag, Properties::EnableSolvent>();
|
||||||
static const bool has_zFraction = getPropValue<TypeTag, Properties::EnableExtbo>();
|
static constexpr bool has_zFraction = getPropValue<TypeTag, Properties::EnableExtbo>();
|
||||||
static const bool has_polymer = getPropValue<TypeTag, Properties::EnablePolymer>();
|
static constexpr bool has_polymer = getPropValue<TypeTag, Properties::EnablePolymer>();
|
||||||
static const bool has_energy = getPropValue<TypeTag, Properties::EnableEnergy>();
|
static const bool has_energy = getPropValue<TypeTag, Properties::EnableEnergy>();
|
||||||
static const bool has_temperature = getPropValue<TypeTag, Properties::EnableTemperature>();
|
static const bool has_temperature = getPropValue<TypeTag, Properties::EnableTemperature>();
|
||||||
// flag for polymer molecular weight related
|
// flag for polymer molecular weight related
|
||||||
static const bool has_polymermw = getPropValue<TypeTag, Properties::EnablePolymerMW>();
|
static const bool has_polymermw = getPropValue<TypeTag, Properties::EnablePolymerMW>();
|
||||||
static const bool has_foam = getPropValue<TypeTag, Properties::EnableFoam>();
|
static constexpr bool has_foam = getPropValue<TypeTag, Properties::EnableFoam>();
|
||||||
static const bool has_brine = getPropValue<TypeTag, Properties::EnableBrine>();
|
static constexpr bool has_brine = getPropValue<TypeTag, Properties::EnableBrine>();
|
||||||
static const int contiSolventEqIdx = Indices::contiSolventEqIdx;
|
static const int contiSolventEqIdx = Indices::contiSolventEqIdx;
|
||||||
static const int contiZfracEqIdx = Indices::contiZfracEqIdx;
|
static const int contiZfracEqIdx = Indices::contiZfracEqIdx;
|
||||||
static const int contiPolymerEqIdx = Indices::contiPolymerEqIdx;
|
static const int contiPolymerEqIdx = Indices::contiPolymerEqIdx;
|
||||||
|
@ -97,13 +97,15 @@ namespace Opm
|
|||||||
|
|
||||||
wsolvent_ = 0.0;
|
wsolvent_ = 0.0;
|
||||||
|
|
||||||
if ((has_solvent || has_zFraction) && well.isInjector()) {
|
if constexpr (has_solvent || has_zFraction) {
|
||||||
|
if (well.isInjector()) {
|
||||||
auto injectorType = well_ecl_.injectorType();
|
auto injectorType = well_ecl_.injectorType();
|
||||||
if (injectorType == InjectorType::GAS) {
|
if (injectorType == InjectorType::GAS) {
|
||||||
wsolvent_ = well_ecl_.getSolventFraction();
|
wsolvent_ = well_ecl_.getSolventFraction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
@ -373,10 +375,7 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
wpolymer() const
|
wpolymer() const
|
||||||
{
|
{
|
||||||
if (!has_polymer) {
|
if constexpr (has_polymer) {
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto injectorType = well_ecl_.injectorType();
|
auto injectorType = well_ecl_.injectorType();
|
||||||
|
|
||||||
if (injectorType == InjectorType::WATER) {
|
if (injectorType == InjectorType::WATER) {
|
||||||
@ -389,6 +388,9 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -398,10 +400,7 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
wfoam() const
|
wfoam() const
|
||||||
{
|
{
|
||||||
if (!has_foam) {
|
if constexpr (has_foam) {
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto injectorType = well_ecl_.injectorType();
|
auto injectorType = well_ecl_.injectorType();
|
||||||
|
|
||||||
if (injectorType == InjectorType::GAS) {
|
if (injectorType == InjectorType::GAS) {
|
||||||
@ -413,6 +412,9 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
@ -420,10 +422,7 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
wsalt() const
|
wsalt() const
|
||||||
{
|
{
|
||||||
if (!has_brine) {
|
if constexpr (has_brine) {
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto injectorType = well_ecl_.injectorType();
|
auto injectorType = well_ecl_.injectorType();
|
||||||
|
|
||||||
if (injectorType == InjectorType::WATER) {
|
if (injectorType == InjectorType::WATER) {
|
||||||
@ -435,6 +434,9 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user