add ExtboContainer, a container for extbo data output

start by moving data members into it
This commit is contained in:
Arne Morten Kvarving 2025-02-04 16:31:52 +01:00
parent 6b84b8498d
commit 336a99a226
6 changed files with 111 additions and 30 deletions

View File

@ -92,6 +92,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/CollectDataOnIORank.cpp
opm/simulators/flow/ConvergenceOutputConfiguration.cpp
opm/simulators/flow/EclGenericWriter.cpp
opm/simulators/flow/ExtboContainer.cpp
opm/simulators/flow/ExtraConvergenceOutputThread.cpp
opm/simulators/flow/FIPContainer.cpp
opm/simulators/flow/FlowGenericProblem.cpp
@ -829,6 +830,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/EclGenericWriter_impl.hpp
opm/simulators/flow/EclWriter.hpp
opm/simulators/flow/EquilInitializer.hpp
opm/simulators/flow/ExtboContainer.hpp
opm/simulators/flow/ExtraConvergenceOutputThread.hpp
opm/simulators/flow/FemCpGridCompat.hpp
opm/simulators/flow/FIBlackoilModel.hpp

View File

@ -0,0 +1,34 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#include <config.h>
#include <opm/simulators/flow/ExtboContainer.hpp>
namespace Opm {
template class ExtboContainer<double>;
#if FLOW_INSTANTIATE_FLOAT
template class ExtboContainer<float>;
#endif
} // namespace Opm

View File

@ -0,0 +1,49 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
* \copydoc Opm::OutputBlackOilModule
*/
#ifndef OPM_EXTBO_CONTAINER_HPP
#define OPM_EXTBO_CONTAINER_HPP
#include <vector>
namespace Opm {
template<class Scalar>
class ExtboContainer
{
using ScalarBuffer = std::vector<Scalar>;
public:
ScalarBuffer X_volume_;
ScalarBuffer Y_volume_;
ScalarBuffer Z_fraction_;
ScalarBuffer mFracOil_;
ScalarBuffer mFracGas_;
ScalarBuffer mFracCo2_;
};
} // namespace Opm
#endif // OPM_EXTBO_CONTAINER_HPP

View File

@ -524,12 +524,12 @@ assignToSolution(data::Solution& sol)
DataEntry{"RVW", UnitSystem::measure::oil_gas_ratio, rvw_},
DataEntry{"RVWSAT", UnitSystem::measure::oil_gas_ratio, waterVaporizationFactor_},
DataEntry{"SALTP", UnitSystem::measure::identity, pSalt_},
DataEntry{"SS_X", UnitSystem::measure::identity, extboX_},
DataEntry{"SS_Y", UnitSystem::measure::identity, extboY_},
DataEntry{"SS_Z", UnitSystem::measure::identity, extboZ_},
DataEntry{"STD_CO2", UnitSystem::measure::identity, mFracCo2_},
DataEntry{"STD_GAS", UnitSystem::measure::identity, mFracGas_},
DataEntry{"STD_OIL", UnitSystem::measure::identity, mFracOil_},
DataEntry{"SS_X", UnitSystem::measure::identity, extboC_.X_volume_},
DataEntry{"SS_Y", UnitSystem::measure::identity, extboC_.Y_volume_},
DataEntry{"SS_Z", UnitSystem::measure::identity, extboC_.Z_fraction_},
DataEntry{"STD_CO2", UnitSystem::measure::identity, extboC_.mFracCo2_},
DataEntry{"STD_GAS", UnitSystem::measure::identity, extboC_.mFracGas_},
DataEntry{"STD_OIL", UnitSystem::measure::identity, extboC_.mFracOil_},
DataEntry{"TMULT_RC", UnitSystem::measure::identity, rockCompTransMultiplier_},
};
@ -1025,12 +1025,12 @@ doAllocBuffers(const unsigned bufferSize,
}
if (enableExtbo_) {
extboX_.resize(bufferSize, 0.0);
extboY_.resize(bufferSize, 0.0);
extboZ_.resize(bufferSize, 0.0);
mFracOil_.resize(bufferSize, 0.0);
mFracGas_.resize(bufferSize, 0.0);
mFracCo2_.resize(bufferSize, 0.0);
extboC_.X_volume_.resize(bufferSize, 0.0);
extboC_.Y_volume_.resize(bufferSize, 0.0);
extboC_.Z_fraction_.resize(bufferSize, 0.0);
extboC_.mFracOil_.resize(bufferSize, 0.0);
extboC_.mFracGas_.resize(bufferSize, 0.0);
extboC_.mFracCo2_.resize(bufferSize, 0.0);
}
if (enableMICP_) {

View File

@ -32,6 +32,7 @@
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/Inplace.hpp>
#include <opm/simulators/flow/ExtboContainer.hpp>
#include <opm/simulators/flow/FIPContainer.hpp>
#include <opm/simulators/flow/FlowsData.hpp>
#include <opm/simulators/flow/InterRegFlows.hpp>
@ -435,12 +436,7 @@ protected:
ScalarBuffer cSalt_;
ScalarBuffer pSalt_;
ScalarBuffer permFact_;
ScalarBuffer extboX_;
ScalarBuffer extboY_;
ScalarBuffer extboZ_;
ScalarBuffer mFracOil_;
ScalarBuffer mFracGas_;
ScalarBuffer mFracCo2_;
ExtboContainer<Scalar> extboC_;
ScalarBuffer soMax_;
ScalarBuffer swMax_;
ScalarBuffer sgmax_;

View File

@ -388,9 +388,9 @@ public:
if (this->viscosity_[phaseIdx].empty())
continue;
if (!this->extboX_.empty() && phaseIdx == oilPhaseIdx)
if (!this->extboC_.X_volume_.empty() && phaseIdx == oilPhaseIdx)
this->viscosity_[phaseIdx][globalDofIdx] = getValue(intQuants.oilViscosity());
else if (!this->extboX_.empty() && phaseIdx == gasPhaseIdx)
else if (!this->extboC_.X_volume_.empty() && phaseIdx == gasPhaseIdx)
this->viscosity_[phaseIdx][globalDofIdx] = getValue(intQuants.gasViscosity());
else
this->viscosity_[phaseIdx][globalDofIdx] = getValue(fs.viscosity(phaseIdx));
@ -438,16 +438,16 @@ public:
this->permFact_[globalDofIdx] = intQuants.permFactor().value();
}
if (!this->extboX_.empty()) {
this->extboX_[globalDofIdx] = intQuants.xVolume().value();
if (!this->extboC_.X_volume_.empty()) {
this->extboC_.X_volume_[globalDofIdx] = intQuants.xVolume().value();
}
if (!this->extboY_.empty()) {
this->extboY_[globalDofIdx] = intQuants.yVolume().value();
if (!this->extboC_.Y_volume_.empty()) {
this->extboC_.Y_volume_[globalDofIdx] = intQuants.yVolume().value();
}
if (!this->extboZ_.empty()) {
this->extboZ_[globalDofIdx] = intQuants.zFraction().value();
if (!this->extboC_.Z_fraction_.empty()) {
this->extboC_.Z_fraction_[globalDofIdx] = intQuants.zFraction().value();
}
if (!this->rPorV_.empty()) {
@ -455,7 +455,7 @@ public:
this->rPorV_[globalDofIdx] = totVolume * intQuants.porosity().value();
}
if (!this->mFracCo2_.empty()) {
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());
const Scalar stdVolGas = getValue(fs.saturation(gasPhaseIdx)) * getValue(fs.invB(gasPhaseIdx))
@ -470,9 +470,9 @@ public:
const Scalar rhoG = FluidSystem::referenceDensity(gasPhaseIdx, pvtRegionIdx);
const Scalar rhoCO2 = intQuants.zRefDensity();
const Scalar stdMassTotal = 1.0e-10 + stdVolOil * rhoO + stdVolGas * rhoG + stdVolCo2 * rhoCO2;
this->mFracOil_[globalDofIdx] = stdVolOil * rhoO / stdMassTotal;
this->mFracGas_[globalDofIdx] = stdVolGas * rhoG / stdMassTotal;
this->mFracCo2_[globalDofIdx] = stdVolCo2 * rhoCO2 / stdMassTotal;
this->extboC_.mFracOil_[globalDofIdx] = stdVolOil * rhoO / stdMassTotal;
this->extboC_.mFracGas_[globalDofIdx] = stdVolGas * rhoG / stdMassTotal;
this->extboC_.mFracCo2_[globalDofIdx] = stdVolCo2 * rhoCO2 / stdMassTotal;
}
if (this->micpC_.allocated()) {