mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-24 18:20:22 -06:00
changed: add a container for micp solution components
makes it easy to pass data around to enable some refactoring
This commit is contained in:
parent
841d11efed
commit
eaa3281485
@ -113,16 +113,12 @@ serializationTestObject(const EclipseState& eclState,
|
|||||||
{
|
{
|
||||||
EclGenericProblem result(eclState, schedule, gridView);
|
EclGenericProblem result(eclState, schedule, gridView);
|
||||||
result.maxOilSaturation_ = {1.0, 2.0};
|
result.maxOilSaturation_ = {1.0, 2.0};
|
||||||
result.polymer_ = PolymerSolutionContainer<Scalar>::serializationTestObject();
|
|
||||||
result.maxWaterSaturation_ = {6.0};
|
result.maxWaterSaturation_ = {6.0};
|
||||||
result.minOilPressure_ = {7.0, 8.0, 9.0, 10.0};
|
result.minOilPressure_ = {7.0, 8.0, 9.0, 10.0};
|
||||||
result.overburdenPressure_ = {11.0};
|
result.overburdenPressure_ = {11.0};
|
||||||
result.solventSaturation_ = {15.0};
|
result.solventSaturation_ = {15.0};
|
||||||
result.microbialConcentration_ = {16.0};
|
result.polymer_ = PolymerSolutionContainer<Scalar>::serializationTestObject();
|
||||||
result.oxygenConcentration_ = {17.0};
|
result.micp_ = MICPSolutionContainer<Scalar>::serializationTestObject();
|
||||||
result.ureaConcentration_ = {18.0};
|
|
||||||
result.biofilmConcentration_ = {19.0};
|
|
||||||
result.calciteConcentration_ = {20.0};
|
|
||||||
result.lastRv_ = {21.0};
|
result.lastRv_ = {21.0};
|
||||||
result.maxDRv_ = {22.0, 23.0};
|
result.maxDRv_ = {22.0, 23.0};
|
||||||
result.convectiveDrs_ = {24.0, 25.0, 26.0};
|
result.convectiveDrs_ = {24.0, 25.0, 26.0};
|
||||||
@ -587,25 +583,25 @@ readBlackoilExtentionsInitialConditions_(size_t numDof,
|
|||||||
|
|
||||||
if (enableMICP) {
|
if (enableMICP) {
|
||||||
if (eclState_.fieldProps().has_double("SMICR"))
|
if (eclState_.fieldProps().has_double("SMICR"))
|
||||||
microbialConcentration_ = eclState_.fieldProps().get_double("SMICR");
|
micp_.microbialConcentration = eclState_.fieldProps().get_double("SMICR");
|
||||||
else
|
else
|
||||||
microbialConcentration_.resize(numDof, 0.0);
|
micp_.microbialConcentration.resize(numDof, 0.0);
|
||||||
if (eclState_.fieldProps().has_double("SOXYG"))
|
if (eclState_.fieldProps().has_double("SOXYG"))
|
||||||
oxygenConcentration_ = eclState_.fieldProps().get_double("SOXYG");
|
micp_.oxygenConcentration = eclState_.fieldProps().get_double("SOXYG");
|
||||||
else
|
else
|
||||||
oxygenConcentration_.resize(numDof, 0.0);
|
micp_.oxygenConcentration.resize(numDof, 0.0);
|
||||||
if (eclState_.fieldProps().has_double("SUREA"))
|
if (eclState_.fieldProps().has_double("SUREA"))
|
||||||
ureaConcentration_ = eclState_.fieldProps().get_double("SUREA");
|
micp_.ureaConcentration = eclState_.fieldProps().get_double("SUREA");
|
||||||
else
|
else
|
||||||
ureaConcentration_.resize(numDof, 0.0);
|
micp_.ureaConcentration.resize(numDof, 0.0);
|
||||||
if (eclState_.fieldProps().has_double("SBIOF"))
|
if (eclState_.fieldProps().has_double("SBIOF"))
|
||||||
biofilmConcentration_ = eclState_.fieldProps().get_double("SBIOF");
|
micp_.biofilmConcentration = eclState_.fieldProps().get_double("SBIOF");
|
||||||
else
|
else
|
||||||
biofilmConcentration_.resize(numDof, 0.0);
|
micp_.biofilmConcentration.resize(numDof, 0.0);
|
||||||
if (eclState_.fieldProps().has_double("SCALC"))
|
if (eclState_.fieldProps().has_double("SCALC"))
|
||||||
calciteConcentration_ = eclState_.fieldProps().get_double("SCALC");
|
micp_.calciteConcentration = eclState_.fieldProps().get_double("SCALC");
|
||||||
else
|
else
|
||||||
calciteConcentration_.resize(numDof, 0.0);
|
micp_.calciteConcentration.resize(numDof, 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,50 +687,55 @@ template<class GridView, class FluidSystem, class Scalar>
|
|||||||
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
||||||
microbialConcentration(unsigned elemIdx) const
|
microbialConcentration(unsigned elemIdx) const
|
||||||
{
|
{
|
||||||
if (microbialConcentration_.empty())
|
if (micp_.microbialConcentration.empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return microbialConcentration_[elemIdx];
|
return micp_.microbialConcentration[elemIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class GridView, class FluidSystem, class Scalar>
|
template<class GridView, class FluidSystem, class Scalar>
|
||||||
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
||||||
oxygenConcentration(unsigned elemIdx) const
|
oxygenConcentration(unsigned elemIdx) const
|
||||||
{
|
{
|
||||||
if (oxygenConcentration_.empty())
|
if (micp_.oxygenConcentration.empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return oxygenConcentration_[elemIdx];
|
return micp_.oxygenConcentration[elemIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class GridView, class FluidSystem, class Scalar>
|
template<class GridView, class FluidSystem, class Scalar>
|
||||||
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
||||||
ureaConcentration(unsigned elemIdx) const
|
ureaConcentration(unsigned elemIdx) const
|
||||||
{
|
{
|
||||||
if (ureaConcentration_.empty())
|
if (micp_.ureaConcentration.empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return ureaConcentration_[elemIdx];
|
return micp_.ureaConcentration[elemIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class GridView, class FluidSystem, class Scalar>
|
template<class GridView, class FluidSystem, class Scalar>
|
||||||
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
||||||
biofilmConcentration(unsigned elemIdx) const
|
biofilmConcentration(unsigned elemIdx) const
|
||||||
{
|
{
|
||||||
if (biofilmConcentration_.empty())
|
if (micp_.biofilmConcentration.empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return biofilmConcentration_[elemIdx];
|
return micp_.biofilmConcentration[elemIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class GridView, class FluidSystem, class Scalar>
|
template<class GridView, class FluidSystem, class Scalar>
|
||||||
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
Scalar EclGenericProblem<GridView,FluidSystem,Scalar>::
|
||||||
calciteConcentration(unsigned elemIdx) const
|
calciteConcentration(unsigned elemIdx) const
|
||||||
{
|
{
|
||||||
if (calciteConcentration_.empty())
|
if (micp_.calciteConcentration.empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return calciteConcentration_[elemIdx];
|
return micp_.calciteConcentration[elemIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class GridView, class FluidSystem, class Scalar>
|
template<class GridView, class FluidSystem, class Scalar>
|
||||||
@ -823,11 +824,7 @@ operator==(const EclGenericProblem& rhs) const
|
|||||||
this->overburdenPressure_ == rhs.overburdenPressure_ &&
|
this->overburdenPressure_ == rhs.overburdenPressure_ &&
|
||||||
this->polymer_ == rhs.polymer_ &&
|
this->polymer_ == rhs.polymer_ &&
|
||||||
this->solventSaturation_ == rhs.solventSaturation_ &&
|
this->solventSaturation_ == rhs.solventSaturation_ &&
|
||||||
this->microbialConcentration_ == rhs.microbialConcentration_ &&
|
this->micp_ == rhs.micp_ &&
|
||||||
this->oxygenConcentration_ == rhs.oxygenConcentration_ &&
|
|
||||||
this->ureaConcentration_ == rhs.ureaConcentration_ &&
|
|
||||||
this->biofilmConcentration_ == rhs.biofilmConcentration_ &&
|
|
||||||
this->calciteConcentration_ == rhs.calciteConcentration_ &&
|
|
||||||
this->lastRv_ == rhs.lastRv_ &&
|
this->lastRv_ == rhs.lastRv_ &&
|
||||||
this->maxDRv_ == rhs.maxDRv_ &&
|
this->maxDRv_ == rhs.maxDRv_ &&
|
||||||
this->convectiveDrs_ == rhs.convectiveDrs_ &&
|
this->convectiveDrs_ == rhs.convectiveDrs_ &&
|
||||||
|
@ -289,11 +289,7 @@ public:
|
|||||||
serializer(minOilPressure_);
|
serializer(minOilPressure_);
|
||||||
serializer(overburdenPressure_);
|
serializer(overburdenPressure_);
|
||||||
serializer(solventSaturation_);
|
serializer(solventSaturation_);
|
||||||
serializer(microbialConcentration_);
|
serializer(micp_);
|
||||||
serializer(oxygenConcentration_);
|
|
||||||
serializer(ureaConcentration_);
|
|
||||||
serializer(biofilmConcentration_);
|
|
||||||
serializer(calciteConcentration_);
|
|
||||||
serializer(lastRv_);
|
serializer(lastRv_);
|
||||||
serializer(maxDRv_);
|
serializer(maxDRv_);
|
||||||
serializer(convectiveDrs_);
|
serializer(convectiveDrs_);
|
||||||
@ -383,11 +379,7 @@ protected:
|
|||||||
std::vector<Scalar> minOilPressure_;
|
std::vector<Scalar> minOilPressure_;
|
||||||
std::vector<Scalar> overburdenPressure_;
|
std::vector<Scalar> overburdenPressure_;
|
||||||
std::vector<Scalar> solventSaturation_;
|
std::vector<Scalar> solventSaturation_;
|
||||||
std::vector<Scalar> microbialConcentration_;
|
MICPSolutionContainer<Scalar> micp_;
|
||||||
std::vector<Scalar> oxygenConcentration_;
|
|
||||||
std::vector<Scalar> ureaConcentration_;
|
|
||||||
std::vector<Scalar> biofilmConcentration_;
|
|
||||||
std::vector<Scalar> calciteConcentration_;
|
|
||||||
|
|
||||||
std::vector<Scalar> lastRv_;
|
std::vector<Scalar> lastRv_;
|
||||||
std::vector<Scalar> maxDRv_;
|
std::vector<Scalar> maxDRv_;
|
||||||
|
@ -1765,11 +1765,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (enableMICP){
|
if constexpr (enableMICP){
|
||||||
values[Indices::microbialConcentrationIdx]= this->microbialConcentration_[globalDofIdx];
|
values[Indices::microbialConcentrationIdx] = this->micp_.microbialConcentration[globalDofIdx];
|
||||||
values[Indices::oxygenConcentrationIdx]= this->oxygenConcentration_[globalDofIdx];
|
values[Indices::oxygenConcentrationIdx]= this->micp_.oxygenConcentration[globalDofIdx];
|
||||||
values[Indices::ureaConcentrationIdx]= this->ureaConcentration_[globalDofIdx];
|
values[Indices::ureaConcentrationIdx]= this->micp_.ureaConcentration[globalDofIdx];
|
||||||
values[Indices::calciteConcentrationIdx]= this->calciteConcentration_[globalDofIdx];
|
values[Indices::calciteConcentrationIdx]= this->micp_.calciteConcentration[globalDofIdx];
|
||||||
values[Indices::biofilmConcentrationIdx]= this->biofilmConcentration_[globalDofIdx];
|
values[Indices::biofilmConcentrationIdx]= this->micp_.biofilmConcentration[globalDofIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
values.checkDefined();
|
values.checkDefined();
|
||||||
@ -2550,13 +2550,9 @@ protected:
|
|||||||
this->polymer_.moleWeight.resize(numElems, 0.0);
|
this->polymer_.moleWeight.resize(numElems, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (enableMICP){
|
if constexpr (enableMICP) {
|
||||||
this->microbialConcentration_.resize(numElems, 0.0);
|
this->micp_.resize(numElems);
|
||||||
this->oxygenConcentration_.resize(numElems, 0.0);
|
}
|
||||||
this->ureaConcentration_.resize(numElems, 0.0);
|
|
||||||
this->biofilmConcentration_.resize(numElems, 0.0);
|
|
||||||
this->calciteConcentration_.resize(numElems, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) {
|
for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) {
|
||||||
auto& elemFluidState = initialFluidStates_[elemIdx];
|
auto& elemFluidState = initialFluidStates_[elemIdx];
|
||||||
@ -2592,11 +2588,11 @@ protected:
|
|||||||
if constexpr (enablePolymer)
|
if constexpr (enablePolymer)
|
||||||
this->polymer_.concentration[elemIdx] = eclWriter_->eclOutputModule().getPolymerConcentration(elemIdx);
|
this->polymer_.concentration[elemIdx] = eclWriter_->eclOutputModule().getPolymerConcentration(elemIdx);
|
||||||
if constexpr (enableMICP){
|
if constexpr (enableMICP){
|
||||||
this->microbialConcentration_[elemIdx] = eclWriter_->eclOutputModule().getMicrobialConcentration(elemIdx);
|
this->micp_.microbialConcentration[elemIdx] = eclWriter_->eclOutputModule().getMicrobialConcentration(elemIdx);
|
||||||
this->oxygenConcentration_[elemIdx] = eclWriter_->eclOutputModule().getOxygenConcentration(elemIdx);
|
this->micp_.oxygenConcentration[elemIdx] = eclWriter_->eclOutputModule().getOxygenConcentration(elemIdx);
|
||||||
this->ureaConcentration_[elemIdx] = eclWriter_->eclOutputModule().getUreaConcentration(elemIdx);
|
this->micp_.ureaConcentration[elemIdx] = eclWriter_->eclOutputModule().getUreaConcentration(elemIdx);
|
||||||
this->biofilmConcentration_[elemIdx] = eclWriter_->eclOutputModule().getBiofilmConcentration(elemIdx);
|
this->micp_.biofilmConcentration[elemIdx] = eclWriter_->eclOutputModule().getBiofilmConcentration(elemIdx);
|
||||||
this->calciteConcentration_[elemIdx] = eclWriter_->eclOutputModule().getCalciteConcentration(elemIdx);
|
this->micp_.calciteConcentration[elemIdx] = eclWriter_->eclOutputModule().getCalciteConcentration(elemIdx);
|
||||||
}
|
}
|
||||||
// if we need to restart for polymer molecular weight simulation, we need to add related here
|
// if we need to restart for polymer molecular weight simulation, we need to add related here
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,39 @@ operator==(const PolymerSolutionContainer<Scalar>& rhs) const
|
|||||||
this->moleWeight == rhs.moleWeight;
|
this->moleWeight == rhs.moleWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
|
MICPSolutionContainer<Scalar>
|
||||||
|
MICPSolutionContainer<Scalar>::serializationTestObject()
|
||||||
|
{
|
||||||
|
return {{16.0},
|
||||||
|
{17.0},
|
||||||
|
{18.0},
|
||||||
|
{19.0},
|
||||||
|
{20.0}};
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
|
void MICPSolutionContainer<Scalar>::resize(const unsigned numElems)
|
||||||
|
{
|
||||||
|
microbialConcentration.resize(numElems, 0.0);
|
||||||
|
oxygenConcentration.resize(numElems, 0.0);
|
||||||
|
ureaConcentration.resize(numElems, 0.0);
|
||||||
|
biofilmConcentration.resize(numElems, 0.0);
|
||||||
|
calciteConcentration.resize(numElems, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
|
bool MICPSolutionContainer<Scalar>::
|
||||||
|
operator==(const MICPSolutionContainer<Scalar>& rhs) const
|
||||||
|
{
|
||||||
|
return this->microbialConcentration == rhs.microbialConcentration &&
|
||||||
|
this->oxygenConcentration == rhs.oxygenConcentration &&
|
||||||
|
this->ureaConcentration == rhs.ureaConcentration &&
|
||||||
|
this->biofilmConcentration == rhs.biofilmConcentration &&
|
||||||
|
this->calciteConcentration == rhs.calciteConcentration;
|
||||||
|
}
|
||||||
|
|
||||||
template struct PolymerSolutionContainer<double>;
|
template struct PolymerSolutionContainer<double>;
|
||||||
|
template struct MICPSolutionContainer<double>;
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -52,6 +52,33 @@ struct PolymerSolutionContainer {
|
|||||||
bool operator==(const PolymerSolutionContainer& rhs) const;
|
bool operator==(const PolymerSolutionContainer& rhs) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! \brief Struct holding MICP extension data.
|
||||||
|
template<class Scalar>
|
||||||
|
struct MICPSolutionContainer {
|
||||||
|
std::vector<Scalar> microbialConcentration;
|
||||||
|
std::vector<Scalar> oxygenConcentration;
|
||||||
|
std::vector<Scalar> ureaConcentration;
|
||||||
|
std::vector<Scalar> biofilmConcentration;
|
||||||
|
std::vector<Scalar> calciteConcentration;
|
||||||
|
|
||||||
|
static MICPSolutionContainer serializationTestObject();
|
||||||
|
|
||||||
|
//! \brief Resize vectors and zero initialize.
|
||||||
|
void resize(const unsigned numElems);
|
||||||
|
|
||||||
|
template<class Serializer>
|
||||||
|
void serializeOp(Serializer& serializer)
|
||||||
|
{
|
||||||
|
serializer(microbialConcentration);
|
||||||
|
serializer(oxygenConcentration);
|
||||||
|
serializer(ureaConcentration);
|
||||||
|
serializer(biofilmConcentration);
|
||||||
|
serializer(calciteConcentration);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const MICPSolutionContainer& rhs) const;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user