adding isCompositional_ variable to GenericOutputBlackoilModule

to indicate whether it is a compostional simulation.
This commit is contained in:
Kai Bao 2024-10-24 14:25:20 +02:00
parent 65e858c84c
commit cd9009dc75
3 changed files with 51 additions and 39 deletions

View File

@ -203,7 +203,8 @@ GenericOutputBlackoilModule(const EclipseState& eclState,
bool enableBrine, bool enableBrine,
bool enableSaltPrecipitation, bool enableSaltPrecipitation,
bool enableExtbo, bool enableExtbo,
bool enableMICP) bool enableMICP,
bool isCompositional)
: eclState_(eclState) : eclState_(eclState)
, schedule_(schedule) , schedule_(schedule)
, summaryState_(summaryState) , summaryState_(summaryState)
@ -222,6 +223,7 @@ GenericOutputBlackoilModule(const EclipseState& eclState,
, enableSaltPrecipitation_(enableSaltPrecipitation) , enableSaltPrecipitation_(enableSaltPrecipitation)
, enableExtbo_(enableExtbo) , enableExtbo_(enableExtbo)
, enableMICP_(enableMICP) , enableMICP_(enableMICP)
, isCompositional_(isCompositional)
, local_data_valid_(false) , local_data_valid_(false)
{ {
const auto& fp = eclState_.fieldProps(); const auto& fp = eclState_.fieldProps();
@ -628,29 +630,34 @@ assignToSolution(data::Solution& sol)
// basically, for compositional, we can not use std::array for this. We need to generate the ZMF1, ZMF2, and so on // basically, for compositional, we can not use std::array for this. We need to generate the ZMF1, ZMF2, and so on
// and also, we need to map these values. // and also, we need to map these values.
auto compositionalEntries = std::vector<DataEntry>{}; // TODO: the following should go to a function
{ if (this->isCompositional_) {
// ZMF auto compositionalEntries = std::vector<DataEntry>{};
for (int i = 0; i < numComponents; ++i) { {
const std::string name = "ZMF" + std::to_string(i + 1); // Generate ZMF1, ZMF2, ... // ZMF
compositionalEntries.emplace_back(name, UnitSystem::measure::identity, moleFractions_[i]); for (int i = 0; i < numComponents; ++i) {
const std::string name = "ZMF" + std::to_string(i + 1); // Generate ZMF1, ZMF2, ...
compositionalEntries.emplace_back(name, UnitSystem::measure::identity, moleFractions_[i]);
}
// XMF
for (int i = 0; i < numComponents; ++i) {
const std::string name = "XMF" + std::to_string(i + 1); // Generate XMF1, XMF2, ...
compositionalEntries.emplace_back(name, UnitSystem::measure::identity,
phaseMoleFractions_[oilPhaseIdx][i]);
}
// YMF
for (int i = 0; i < numComponents; ++i) {
const std::string name = "YMF" + std::to_string(i + 1); // Generate YMF1, YMF2, ...
compositionalEntries.emplace_back(name, UnitSystem::measure::identity,
phaseMoleFractions_[gasPhaseIdx][i]);
}
} }
// XMF for (const auto& array: compositionalEntries) {
for (int i = 0; i < numComponents; ++i) { doInsert(array, data::TargetType::RESTART_SOLUTION);
const std::string name = "XMF" + std::to_string(i + 1); // Generate XMF1, XMF2, ...
compositionalEntries.emplace_back(name, UnitSystem::measure::identity, phaseMoleFractions_[oilPhaseIdx][i]);
} }
// YMF
for (int i = 0; i < numComponents; ++i) {
const std::string name = "YMF" + std::to_string(i + 1); // Generate YMF1, YMF2, ...
compositionalEntries.emplace_back(name, UnitSystem::measure::identity, phaseMoleFractions_[gasPhaseIdx][i]);
}
}
for (const auto& array : compositionalEntries) {
doInsert(array, data::TargetType::RESTART_SOLUTION);
} }
for (const auto& array : baseSolutionArrays) { for (const auto& array : baseSolutionArrays) {
@ -688,8 +695,8 @@ assignToSolution(data::Solution& sol)
std::move(this->saturation_[gasPhaseIdx]), std::move(this->saturation_[gasPhaseIdx]),
data::TargetType::RESTART_SOLUTION); data::TargetType::RESTART_SOLUTION);
} }
if (FluidSystem::phaseIsActive(oilPhaseIdx) && if (this->isCompositional_ && FluidSystem::phaseIsActive(oilPhaseIdx) &&
! this->saturation_[oilPhaseIdx].empty()) ! this->saturation_[oilPhaseIdx].empty())
{ {
sol.insert("SOIL", UnitSystem::measure::identity, sol.insert("SOIL", UnitSystem::measure::identity,
@ -1519,24 +1526,26 @@ doAllocBuffers(const unsigned bufferSize,
overburdenPressure_.resize(bufferSize, 0.0); overburdenPressure_.resize(bufferSize, 0.0);
} }
if (rstKeywords["ZMF"] > 0) { if (this->isCompositional_) {
rstKeywords["ZMF"] = 0; if (rstKeywords["ZMF"] > 0) {
for (int i = 0; i < numComponents; ++i) { rstKeywords["ZMF"] = 0;
moleFractions_[i].resize(bufferSize, 0.0); for (int i = 0; i < numComponents; ++i) {
moleFractions_[i].resize(bufferSize, 0.0);
}
} }
}
if (rstKeywords["XMF"] > 0 && FluidSystem::phaseIsActive(oilPhaseIdx)) { if (rstKeywords["XMF"] > 0 && FluidSystem::phaseIsActive(oilPhaseIdx)) {
rstKeywords["XMF"] = 0; rstKeywords["XMF"] = 0;
for (int i = 0; i < numComponents; ++i) { for (int i = 0; i < numComponents; ++i) {
phaseMoleFractions_[oilPhaseIdx][i].resize(bufferSize, 0.0); phaseMoleFractions_[oilPhaseIdx][i].resize(bufferSize, 0.0);
}
} }
}
if (rstKeywords["YMF"] > 0 && FluidSystem::phaseIsActive(gasPhaseIdx)) { if (rstKeywords["YMF"] > 0 && FluidSystem::phaseIsActive(gasPhaseIdx)) {
rstKeywords["YMF"] = 0; rstKeywords["YMF"] = 0;
for (int i = 0; i < numComponents; ++i) { for (int i = 0; i < numComponents; ++i) {
phaseMoleFractions_[gasPhaseIdx][i].resize(bufferSize, 0.0); phaseMoleFractions_[gasPhaseIdx][i].resize(bufferSize, 0.0);
}
} }
} }

View File

@ -335,7 +335,8 @@ protected:
bool enableBrine, bool enableBrine,
bool enableSaltPrecipitation, bool enableSaltPrecipitation,
bool enableExtbo, bool enableExtbo,
bool enableMICP); bool enableMICP,
bool isCompositional = false);
void doAllocBuffers(unsigned bufferSize, void doAllocBuffers(unsigned bufferSize,
unsigned reportStepNum, unsigned reportStepNum,
@ -405,6 +406,7 @@ protected:
bool enableSaltPrecipitation_{false}; bool enableSaltPrecipitation_{false};
bool enableExtbo_{false}; bool enableExtbo_{false};
bool enableMICP_{false}; bool enableMICP_{false};
bool isCompositional_{false};
bool forceDisableFipOutput_{false}; bool forceDisableFipOutput_{false};
bool forceDisableFipresvOutput_{false}; bool forceDisableFipresvOutput_{false};

View File

@ -126,7 +126,8 @@ public:
getPropValue<TypeTag, Properties::EnableBrine>(), getPropValue<TypeTag, Properties::EnableBrine>(),
getPropValue<TypeTag, Properties::EnableSaltPrecipitation>(), getPropValue<TypeTag, Properties::EnableSaltPrecipitation>(),
getPropValue<TypeTag, Properties::EnableExtbo>(), getPropValue<TypeTag, Properties::EnableExtbo>(),
getPropValue<TypeTag, Properties::EnableMICP>()) getPropValue<TypeTag, Properties::EnableMICP>(),
true)
, simulator_(simulator) , simulator_(simulator)
{ {
for (auto& region_pair : this->regions_) { for (auto& region_pair : this->regions_) {