add MICPContainer, a container for MICP 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 71a70c57eb
commit 012141b281
7 changed files with 158 additions and 74 deletions

View File

@ -108,6 +108,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/Main.cpp
opm/simulators/flow/MainDispatchDynamic.cpp
opm/simulators/flow/MechContainer.cpp
opm/simulators/flow/MICPContainer.cpp
opm/simulators/flow/MixingRateControls.cpp
opm/simulators/flow/NonlinearSolver.cpp
opm/simulators/flow/partitionCells.cpp
@ -858,6 +859,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/LogOutputHelper.hpp
opm/simulators/flow/Main.hpp
opm/simulators/flow/MechContainer.hpp
opm/simulators/flow/MICPContainer.hpp
opm/simulators/flow/MixingRateControls.hpp
opm/simulators/flow/NewTranFluxModule.hpp
opm/simulators/flow/NonlinearSolver.hpp

View File

@ -1180,11 +1180,11 @@ protected:
if constexpr (enablePolymer)
this->polymer_.concentration[elemIdx] = this->eclWriter_->outputModule().getPolymerConcentration(elemIdx);
if constexpr (enableMICP){
this->micp_.microbialConcentration[elemIdx] = this->eclWriter_->outputModule().getMicrobialConcentration(elemIdx);
this->micp_.oxygenConcentration[elemIdx] = this->eclWriter_->outputModule().getOxygenConcentration(elemIdx);
this->micp_.ureaConcentration[elemIdx] = this->eclWriter_->outputModule().getUreaConcentration(elemIdx);
this->micp_.biofilmConcentration[elemIdx] = this->eclWriter_->outputModule().getBiofilmConcentration(elemIdx);
this->micp_.calciteConcentration[elemIdx] = this->eclWriter_->outputModule().getCalciteConcentration(elemIdx);
this->micp_.microbialConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getMicrobialConcentration(elemIdx);
this->micp_.oxygenConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getOxygenConcentration(elemIdx);
this->micp_.ureaConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getUreaConcentration(elemIdx);
this->micp_.biofilmConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getBiofilmConcentration(elemIdx);
this->micp_.calciteConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getCalciteConcentration(elemIdx);
}
// if we need to restart for polymer molecular weight simulation, we need to add related here
}

View File

@ -514,11 +514,11 @@ assignToSolution(data::Solution& sol)
addEntry(flowsSolutionVector, "FLRWATK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx], waterCompIdx);
auto extendedSolutionArrays = std::array {
DataEntry{"BIOFILM", UnitSystem::measure::identity, cBiofilm_},
DataEntry{"CALCITE", UnitSystem::measure::identity, cCalcite_},
DataEntry{"BIOFILM", UnitSystem::measure::identity, micpC_.cBiofilm_},
DataEntry{"CALCITE", UnitSystem::measure::identity, micpC_.cCalcite_},
DataEntry{"DRSDTCON", UnitSystem::measure::gas_oil_ratio_rate, drsdtcon_},
DataEntry{"MICROBES", UnitSystem::measure::density, cMicrobes_},
DataEntry{"OXYGEN", UnitSystem::measure::density, cOxygen_},
DataEntry{"MICROBES", UnitSystem::measure::density, micpC_.cMicrobes_},
DataEntry{"OXYGEN", UnitSystem::measure::density, micpC_.cOxygen_},
DataEntry{"PERMFACT", UnitSystem::measure::identity, permFact_},
DataEntry{"PORV_RC", UnitSystem::measure::identity, rockCompPorvMultiplier_},
DataEntry{"PRES_OVB", UnitSystem::measure::pressure, overburdenPressure_},
@ -535,7 +535,7 @@ assignToSolution(data::Solution& sol)
DataEntry{"STD_GAS", UnitSystem::measure::identity, mFracGas_},
DataEntry{"STD_OIL", UnitSystem::measure::identity, mFracOil_},
DataEntry{"TMULT_RC", UnitSystem::measure::identity, rockCompTransMultiplier_},
DataEntry{"UREA", UnitSystem::measure::density, cUrea_},
DataEntry{"UREA", UnitSystem::measure::density, micpC_.cUrea_},
};
// basically, for compositional, we can not use std::array for this. We need to generate the ZMF1, ZMF2, and so on
@ -763,11 +763,11 @@ setRestart(const data::Solution& sol,
};
const auto fields = std::array{
std::pair{"BIOFILM", &cBiofilm_},
std::pair{"CALCITE", &cCalcite_},
std::pair{"BIOFILM", &micpC_.cBiofilm_},
std::pair{"CALCITE", &micpC_.cCalcite_},
std::pair{"FOAM", &cFoam_},
std::pair{"MICROBES", &cMicrobes_},
std::pair{"OXYGEN", &cOxygen_},
std::pair{"MICROBES", &micpC_.cMicrobes_},
std::pair{"OXYGEN", &micpC_.cOxygen_},
std::pair{"PERMFACT", &permFact_},
std::pair{"POLYMER", &cPolymer_},
std::pair{"PPCW", &ppcw_},
@ -785,7 +785,7 @@ setRestart(const data::Solution& sol,
std::pair{"SWHY1", &swmin_},
std::pair{"SWMAX", &swMax_},
std::pair{"TEMP", &temperature_},
std::pair{"UREA", &cUrea_},
std::pair{"UREA", &micpC_.cUrea_},
};
std::for_each(fields.begin(), fields.end(),
@ -1036,11 +1036,11 @@ doAllocBuffers(const unsigned bufferSize,
}
if (enableMICP_) {
cMicrobes_.resize(bufferSize, 0.0);
cOxygen_.resize(bufferSize, 0.0);
cUrea_.resize(bufferSize, 0.0);
cBiofilm_.resize(bufferSize, 0.0);
cCalcite_.resize(bufferSize, 0.0);
micpC_.cMicrobes_.resize(bufferSize, 0.0);
micpC_.cOxygen_.resize(bufferSize, 0.0);
micpC_.cUrea_.resize(bufferSize, 0.0);
micpC_.cBiofilm_.resize(bufferSize, 0.0);
micpC_.cCalcite_.resize(bufferSize, 0.0);
}
if (vapparsActive) {

View File

@ -37,6 +37,7 @@
#include <opm/simulators/flow/InterRegFlows.hpp>
#include <opm/simulators/flow/LogOutputHelper.hpp>
#include <opm/simulators/flow/MechContainer.hpp>
#include <opm/simulators/flow/MICPContainer.hpp>
#include <opm/simulators/flow/RegionPhasePVAverage.hpp>
#include <opm/simulators/utils/ParallelCommunication.hpp>
@ -198,45 +199,8 @@ public:
return 0;
}
Scalar getMicrobialConcentration(unsigned elemIdx) const
{
if (cMicrobes_.size() > elemIdx)
return cMicrobes_[elemIdx];
return 0;
}
Scalar getOxygenConcentration(unsigned elemIdx) const
{
if (cOxygen_.size() > elemIdx)
return cOxygen_[elemIdx];
return 0;
}
Scalar getUreaConcentration(unsigned elemIdx) const
{
if (cUrea_.size() > elemIdx)
return cUrea_[elemIdx];
return 0;
}
Scalar getBiofilmConcentration(unsigned elemIdx) const
{
if (cBiofilm_.size() > elemIdx)
return cBiofilm_[elemIdx];
return 0;
}
Scalar getCalciteConcentration(unsigned elemIdx) const
{
if (cCalcite_.size() > elemIdx)
return cCalcite_[elemIdx];
return 0;
}
const MICPContainer<Scalar>& getMICP() const
{ return this->micpC_; }
const std::array<FlowsData<double>, 3>& getFlowsn() const
{
@ -494,11 +458,7 @@ protected:
ScalarBuffer minimumOilPressure_;
ScalarBuffer saturatedOilFormationVolumeFactor_;
ScalarBuffer rockCompTransMultiplier_;
ScalarBuffer cMicrobes_;
ScalarBuffer cOxygen_;
ScalarBuffer cUrea_;
ScalarBuffer cBiofilm_;
ScalarBuffer cCalcite_;
MICPContainer<Scalar> micpC_;
ScalarBuffer pcgw_;
ScalarBuffer pcow_;
ScalarBuffer pcog_;

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/MICPContainer.hpp>
namespace Opm {
template class MICPContainer<double>;
#if FLOW_INSTANTIATE_FLOAT
template class MICPContainer<float>;
#endif
} // namespace Opm

View File

@ -0,0 +1,88 @@
// -*- 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_MICP_CONTAINER_HPP
#define OPM_MICP_CONTAINER_HPP
#include <vector>
namespace Opm {
template<class Scalar>
class MICPContainer
{
using ScalarBuffer = std::vector<Scalar>;
public:
Scalar getMicrobialConcentration(unsigned elemIdx) const
{
if (cMicrobes_.size() > elemIdx)
return cMicrobes_[elemIdx];
return 0;
}
Scalar getOxygenConcentration(unsigned elemIdx) const
{
if (cOxygen_.size() > elemIdx)
return cOxygen_[elemIdx];
return 0;
}
Scalar getUreaConcentration(unsigned elemIdx) const
{
if (cUrea_.size() > elemIdx)
return cUrea_[elemIdx];
return 0;
}
Scalar getBiofilmConcentration(unsigned elemIdx) const
{
if (cBiofilm_.size() > elemIdx)
return cBiofilm_[elemIdx];
return 0;
}
Scalar getCalciteConcentration(unsigned elemIdx) const
{
if (cCalcite_.size() > elemIdx)
return cCalcite_[elemIdx];
return 0;
}
ScalarBuffer cMicrobes_;
ScalarBuffer cOxygen_;
ScalarBuffer cUrea_;
ScalarBuffer cBiofilm_;
ScalarBuffer cCalcite_;
};
} // namespace Opm
#endif // OPM_MICP_CONTAINER_HPP

View File

@ -475,26 +475,26 @@ public:
this->mFracCo2_[globalDofIdx] = stdVolCo2 * rhoCO2 / stdMassTotal;
}
if (!this->cMicrobes_.empty()) {
this->cMicrobes_[globalDofIdx] = intQuants.microbialConcentration().value();
if (!this->micpC_.cMicrobes_.empty()) {
this->micpC_.cMicrobes_[globalDofIdx] = intQuants.microbialConcentration().value();
}
if (!this->cOxygen_.empty()) {
this->cOxygen_[globalDofIdx] = intQuants.oxygenConcentration().value();
if (!this->micpC_.cOxygen_.empty()) {
this->micpC_.cOxygen_[globalDofIdx] = intQuants.oxygenConcentration().value();
}
if (!this->cUrea_.empty()) {
this->cUrea_[globalDofIdx] = 10
if (!this->micpC_.cUrea_.empty()) {
this->micpC_.cUrea_[globalDofIdx] = 10
* intQuants.ureaConcentration()
.value(); // Reescaling back the urea concentration (see WellInterface_impl.hpp)
}
if (!this->cBiofilm_.empty()) {
this->cBiofilm_[globalDofIdx] = intQuants.biofilmConcentration().value();
if (!this->micpC_.cBiofilm_.empty()) {
this->micpC_.cBiofilm_[globalDofIdx] = intQuants.biofilmConcentration().value();
}
if (!this->cCalcite_.empty()) {
this->cCalcite_[globalDofIdx] = intQuants.calciteConcentration().value();
if (!this->micpC_.cCalcite_.empty()) {
this->micpC_.cCalcite_[globalDofIdx] = intQuants.calciteConcentration().value();
}
if (!this->bubblePointPressure_.empty()) {