FIPContainer: add query function for phase presence

This commit is contained in:
Arne Morten Kvarving 2025-01-31 10:40:50 +01:00
parent 57ef2b63e8
commit f816995329
3 changed files with 16 additions and 4 deletions

View File

@ -82,6 +82,15 @@ FIPContainer<FluidSystem>::add(const Inplace::Phase phase)
this->fip_[phase].resize(bufferSize_, 0.0);
}
template<class FluidSystem>
bool
FIPContainer<FluidSystem>::
has(const Inplace::Phase phase) const
{
const auto it = this->fip_.find(phase);
return it != this->fip_.end() && !it->second.empty();
}
template<class FluidSystem>
void
FIPContainer<FluidSystem>::

View File

@ -77,6 +77,8 @@ public:
Scalar strandedGas;
};
bool has(const Inplace::Phase phase) const;
void assignCo2InGas(const unsigned globalDofIdx,
const Co2InGasInput& v);

View File

@ -1569,8 +1569,9 @@ private:
}
Scalar trappedGasSaturation = scaledDrainageInfo.Sgcr;
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty() ) {
if (this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseMaximumTrapped) ||
this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped))
{
if (this->simulator_.problem().materialLawManager()->enableHysteresis()) {
const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx);
// Get the maximum trapped gas saturation
@ -1580,8 +1581,8 @@ private:
const Scalar sg = getValue(fs.saturation(gasPhaseIdx));
Scalar strandedGasSaturation = scaledDrainageInfo.Sgcr;
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty())
if (this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped) ||
this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped))
{
if (this->simulator_.problem().materialLawManager()->enableHysteresis()) {
const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx);