move assignment of volumes into ExtboContainer

This commit is contained in:
Arne Morten Kvarving 2025-02-07 14:19:00 +01:00
parent 3aa252e8b2
commit 6024f10527
3 changed files with 23 additions and 11 deletions

View File

@ -48,6 +48,16 @@ allocate(const unsigned bufferSize)
allocated_ = true;
}
template<class Scalar>
void ExtboContainer<Scalar>::
assignVolumes(const unsigned globalDofIdx,
const Scalar xVolume,
const Scalar yVolume)
{
X_volume_[globalDofIdx] = xVolume;
Y_volume_[globalDofIdx] = yVolume;
}
template<class Scalar>
void ExtboContainer<Scalar>::
outputRestart(data::Solution& sol)

View File

@ -40,6 +40,10 @@ class ExtboContainer
public:
void allocate(const unsigned bufferSize);
void assignVolumes(const unsigned globalDofIdx,
const Scalar xVolume,
const Scalar yVolume);
void outputRestart(data::Solution& sol);
bool allocated() const

View File

@ -388,9 +388,9 @@ public:
if (this->viscosity_[phaseIdx].empty())
continue;
if (!this->extboC_.X_volume_.empty() && phaseIdx == oilPhaseIdx)
if (this->extboC_.allocated() && phaseIdx == oilPhaseIdx)
this->viscosity_[phaseIdx][globalDofIdx] = getValue(intQuants.oilViscosity());
else if (!this->extboC_.X_volume_.empty() && phaseIdx == gasPhaseIdx)
else if (this->extboC_.allocated() && phaseIdx == gasPhaseIdx)
this->viscosity_[phaseIdx][globalDofIdx] = getValue(intQuants.gasViscosity());
else
this->viscosity_[phaseIdx][globalDofIdx] = getValue(fs.viscosity(phaseIdx));
@ -438,23 +438,21 @@ public:
this->permFact_[globalDofIdx] = intQuants.permFactor().value();
}
if (!this->extboC_.X_volume_.empty()) {
this->extboC_.X_volume_[globalDofIdx] = intQuants.xVolume().value();
if (!this->rPorV_.empty()) {
const auto totVolume = elemCtx.simulator().model().dofTotalVolume(globalDofIdx);
this->rPorV_[globalDofIdx] = totVolume * intQuants.porosity().value();
}
if (!this->extboC_.Y_volume_.empty()) {
this->extboC_.Y_volume_[globalDofIdx] = intQuants.yVolume().value();
if (this->extboC_.allocated()) {
this->extboC_.assignVolumes(globalDofIdx,
intQuants.xVolume().value(),
intQuants.yVolume().value());
}
if (!this->extboC_.Z_fraction_.empty()) {
this->extboC_.Z_fraction_[globalDofIdx] = intQuants.zFraction().value();
}
if (!this->rPorV_.empty()) {
const auto totVolume = elemCtx.simulator().model().dofTotalVolume(globalDofIdx);
this->rPorV_[globalDofIdx] = totVolume * intQuants.porosity().value();
}
if (!this->extboC_.mFracCo2_.empty()) {
const Scalar stdVolOil = getValue(fs.saturation(oilPhaseIdx)) * getValue(fs.invB(oilPhaseIdx))
+ getValue(fs.saturation(gasPhaseIdx)) * getValue(fs.invB(gasPhaseIdx)) * getValue(fs.Rv());