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); 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> template<class FluidSystem>
void void
FIPContainer<FluidSystem>:: FIPContainer<FluidSystem>::

View File

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

View File

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