Skip to content

Commit

Permalink
WIP compiles and dont segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
Tor Harald Sandve committed Jan 9, 2025
1 parent 7707228 commit 55359d3
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ namespace Opm {
m_diffuse = true;
}

this->m_isThermal = runspec.hasKeyword<ParserKeywords::THERMAL>()
|| runspec.hasKeyword<ParserKeywords::TEMP>();
this->m_isThermal = runspec.hasKeyword<ParserKeywords::THERMAL>();
this->m_isTemp = runspec.hasKeyword<ParserKeywords::TEMP>();

this->m_useEnthalpy = runspec.hasKeyword<ParserKeywords::THERMAL>();

Expand Down Expand Up @@ -140,6 +140,7 @@ namespace Opm {
result.m_VAPOIL = true;
result.m_VAPWAT = true;
result.m_isThermal = true;
result.m_isTemp = true;
result.m_diffuse = true;
result.m_PRECSALT = true;

Expand Down Expand Up @@ -206,6 +207,11 @@ namespace Opm {
return this->m_isThermal;
}

bool SimulationConfig::isTemp() const
{
return this->m_isTemp;
}

bool SimulationConfig::useEnthalpy() const
{
return this->m_useEnthalpy;
Expand Down Expand Up @@ -233,6 +239,7 @@ namespace Opm {
&& (this->hasDISGASW() == data.hasDISGASW())
&& (this->hasVAPOIL() == data.hasVAPOIL())
&& (this->hasVAPWAT() == data.hasVAPWAT())
&& (this->isTemp() == data.isTemp())
&& (this->isThermal() == data.isThermal())
&& (this->isDiffusive() == data.isDiffusive())
&& (this->hasPRECSALT() == data.hasPRECSALT())
Expand All @@ -252,6 +259,7 @@ namespace Opm {
&& (full_config.hasDISGASW() == rst_config.hasDISGASW())
&& (full_config.hasVAPOIL() == rst_config.hasVAPOIL())
&& (full_config.hasVAPWAT() == rst_config.hasVAPWAT())
&& (full_config.isTemp() == rst_config.isTemp())
&& (full_config.isThermal() == rst_config.isThermal())
&& (full_config.isDiffusive() == rst_config.isDiffusive())
&& (full_config.hasPRECSALT() == rst_config.hasPRECSALT())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace Opm {
bool hasVAPOIL() const;
bool hasVAPWAT() const;
bool isThermal() const;
bool isTemp() const;
bool useEnthalpy() const;
bool isDiffusive() const;
bool hasPRECSALT() const;
Expand All @@ -78,6 +79,7 @@ namespace Opm {
serializer(m_DISGASW);
serializer(m_VAPOIL);
serializer(m_VAPWAT);
serializer(m_isTemp);
serializer(m_isThermal);
serializer(m_useEnthalpy);
serializer(m_diffuse);
Expand All @@ -97,6 +99,7 @@ namespace Opm {
bool m_DISGASW{false};
bool m_VAPOIL{false};
bool m_VAPWAT{false};
bool m_isTemp{false};
bool m_isThermal{false};
bool m_useEnthalpy{false};
bool m_diffuse{false};
Expand Down
6 changes: 3 additions & 3 deletions opm/material/fluidstates/BlackOilFluidState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class BlackOilFluidState
Valgrind::CheckDefined(density_[storagePhaseIdx]);
Valgrind::CheckDefined(invB_[storagePhaseIdx]);

if constexpr (enableEnergy)
if constexpr (enableTemperature || enableEnergy)
Valgrind::CheckDefined((*enthalpy_)[storagePhaseIdx]);
}

Expand Down Expand Up @@ -215,7 +215,7 @@ class BlackOilFluidState
setPressure(phaseIdx, fs.pressure(phaseIdx));
setDensity(phaseIdx, fs.density(phaseIdx));

if constexpr (enableEnergy)
if constexpr (enableEnergy || enableTemperature)
setEnthalpy(phaseIdx, fs.enthalpy(phaseIdx));

setInvB(phaseIdx, getInvB_<FluidSystem, FluidState, Scalar>(fs, phaseIdx, pvtRegionIdx));
Expand Down Expand Up @@ -681,7 +681,7 @@ class BlackOilFluidState
}

ConditionalStorage<enableTemperature || enableEnergy, Scalar> temperature_{};
ConditionalStorage<enableEnergy, std::array<Scalar, numStoragePhases> > enthalpy_{};
ConditionalStorage<enableTemperature || enableEnergy, std::array<Scalar, numStoragePhases> > enthalpy_{};
Scalar totalSaturation_{};
std::array<Scalar, numStoragePhases> pressure_{};
std::array<Scalar, numStoragePhases> pc_{};
Expand Down
1 change: 0 additions & 1 deletion opm/material/fluidsystems/blackoilpvt/DryGasPvt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#endif

#include <fmt/format.h>

namespace Opm {

#if HAVE_ECL_INPUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ initFromState(const EclipseState& eclState, const Schedule& schedule)
setApproach(GasPvtApproach::Co2Gas);
else if (eclState.runspec().h2Storage())
setApproach(GasPvtApproach::H2Gas);
else if (enableThermal && eclState.getSimulationConfig().isThermal())
else if (enableThermal && (eclState.getSimulationConfig().isThermal() || eclState.getSimulationConfig().isTemp()))
setApproach(GasPvtApproach::ThermalGas);
else if (!eclState.getTableManager().getPvtgwTables().empty() &&
!eclState.getTableManager().getPvtgTables().empty())
Expand Down
1 change: 0 additions & 1 deletion opm/material/fluidsystems/blackoilpvt/GasPvtThermal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ initFromState(const EclipseState& eclState, const Schedule& schedule)
//////
isothermalPvt_ = new IsothermalPvt;
isothermalPvt_->initFromState(eclState, schedule);

//////
// initialize the thermal part
//////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ initFromState(const EclipseState& eclState, const Schedule& schedule)
setApproach(OilPvtApproach::BrineCo2);
else if (eclState.runspec().h2Storage())
setApproach(OilPvtApproach::BrineH2);
else if (enableThermal && eclState.getSimulationConfig().isThermal())
else if (enableThermal && (eclState.getSimulationConfig().isThermal() || eclState.getSimulationConfig().isTemp()))
setApproach(OilPvtApproach::ThermalOil);
else if (!eclState.getTableManager().getPvcdoTable().empty())
setApproach(OilPvtApproach::ConstantCompressibilityOil);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ initFromState(const EclipseState& eclState, const Schedule& schedule)
setApproach(WaterPvtApproach::BrineCo2);
else if (eclState.runspec().h2Storage() || eclState.runspec().h2Sol())
setApproach(WaterPvtApproach::BrineH2);
else if (enableThermal && eclState.getSimulationConfig().isThermal())
else if (enableThermal && (eclState.getSimulationConfig().isThermal() || eclState.getSimulationConfig().isTemp()))
setApproach(WaterPvtApproach::ThermalWater);
else if (!eclState.getTableManager().getPvtwTable().empty())
setApproach(WaterPvtApproach::ConstantCompressibilityWater);
Expand Down

0 comments on commit 55359d3

Please sign in to comment.