mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
eclproblem: use if constexpr for enableEnergy
This commit is contained in:
parent
94fe38fc93
commit
99273fee85
@ -1839,7 +1839,7 @@ public:
|
|||||||
if(!context.intersection(spaceIdx).boundary())
|
if(!context.intersection(spaceIdx).boundary())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!enableEnergy || !enableThermalFluxBoundaries)
|
if constexpr (!enableEnergy || !enableThermalFluxBoundaries)
|
||||||
values.setNoFlow();
|
values.setNoFlow();
|
||||||
else {
|
else {
|
||||||
// in the energy case we need to specify a non-trivial boundary condition
|
// in the energy case we need to specify a non-trivial boundary condition
|
||||||
@ -2329,10 +2329,13 @@ private:
|
|||||||
throw std::runtime_error("The deck enables both, the TEMP and the THERMAL options, but they are mutually exclusive.");
|
throw std::runtime_error("The deck enables both, the TEMP and the THERMAL options, but they are mutually exclusive.");
|
||||||
|
|
||||||
bool deckEnergyEnabled = (deck.hasKeyword("TEMP") || deck.hasKeyword("THERMAL"));
|
bool deckEnergyEnabled = (deck.hasKeyword("TEMP") || deck.hasKeyword("THERMAL"));
|
||||||
if (enableEnergy && !deckEnergyEnabled)
|
if constexpr (enableEnergy) {
|
||||||
throw std::runtime_error("The simulator requires the TEMP or the THERMAL option to be enabled, but the deck activates neither.");
|
if (!deckEnergyEnabled)
|
||||||
else if (!enableEnergy && deckEnergyEnabled)
|
throw std::runtime_error("The simulator requires the TEMP or the THERMAL option to be enabled, but the deck activates neither.");
|
||||||
throw std::runtime_error("The deck enables the TEMP or the THERMAL option, but the simulator is not compiled to support either.");
|
} else {
|
||||||
|
if (deckEnergyEnabled)
|
||||||
|
throw std::runtime_error("The deck enables the TEMP or the THERMAL option, but the simulator is not compiled to support either.");
|
||||||
|
}
|
||||||
|
|
||||||
if (deckEnergyEnabled && deck.hasKeyword("TEMP"))
|
if (deckEnergyEnabled && deck.hasKeyword("TEMP"))
|
||||||
std::cerr << "WARNING: The deck requests the TEMP option, i.e., treating energy "
|
std::cerr << "WARNING: The deck requests the TEMP option, i.e., treating energy "
|
||||||
@ -2757,16 +2760,16 @@ private:
|
|||||||
|
|
||||||
void readThermalParameters_()
|
void readThermalParameters_()
|
||||||
{
|
{
|
||||||
if (!enableEnergy)
|
if constexpr (enableEnergy)
|
||||||
return;
|
{
|
||||||
|
const auto& simulator = this->simulator();
|
||||||
|
const auto& vanguard = simulator.vanguard();
|
||||||
|
const auto& eclState = vanguard.eclState();
|
||||||
|
|
||||||
const auto& simulator = this->simulator();
|
// fluid-matrix interactions (saturation functions; relperm/capillary pressure)
|
||||||
const auto& vanguard = simulator.vanguard();
|
thermalLawManager_ = std::make_shared<EclThermalLawManager>();
|
||||||
const auto& eclState = vanguard.eclState();
|
thermalLawManager_->initParamsForElements(eclState, this->model().numGridDof());
|
||||||
|
}
|
||||||
// fluid-matrix interactions (saturation functions; relperm/capillary pressure)
|
|
||||||
thermalLawManager_ = std::make_shared<EclThermalLawManager>();
|
|
||||||
thermalLawManager_->initParamsForElements(eclState, this->model().numGridDof());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateReferencePorosity_()
|
void updateReferencePorosity_()
|
||||||
@ -3272,7 +3275,7 @@ private:
|
|||||||
unsigned globalCenterElemIdx = elementMapper.index(stencil.entity(/*dofIdx=*/0));
|
unsigned globalCenterElemIdx = elementMapper.index(stencil.entity(/*dofIdx=*/0));
|
||||||
dofData.transmissibility = transmissibilities_.transmissibility(globalCenterElemIdx, globalElemIdx);
|
dofData.transmissibility = transmissibilities_.transmissibility(globalCenterElemIdx, globalElemIdx);
|
||||||
|
|
||||||
if (enableEnergy) {
|
if constexpr (enableEnergy) {
|
||||||
*dofData.thermalHalfTransIn = transmissibilities_.thermalHalfTrans(globalCenterElemIdx, globalElemIdx);
|
*dofData.thermalHalfTransIn = transmissibilities_.thermalHalfTrans(globalCenterElemIdx, globalElemIdx);
|
||||||
*dofData.thermalHalfTransOut = transmissibilities_.thermalHalfTrans(globalElemIdx, globalCenterElemIdx);
|
*dofData.thermalHalfTransOut = transmissibilities_.thermalHalfTrans(globalElemIdx, globalCenterElemIdx);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user