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 enableSaltPrecipitation,
bool enableExtbo,
bool enableMICP)
bool enableMICP,
bool isCompositional)
: eclState_(eclState)
, schedule_(schedule)
, summaryState_(summaryState)
@ -222,6 +223,7 @@ GenericOutputBlackoilModule(const EclipseState& eclState,
, enableSaltPrecipitation_(enableSaltPrecipitation)
, enableExtbo_(enableExtbo)
, enableMICP_(enableMICP)
, isCompositional_(isCompositional)
, local_data_valid_(false)
{
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
// and also, we need to map these values.
auto compositionalEntries = std::vector<DataEntry>{};
{
// ZMF
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]);
// TODO: the following should go to a function
if (this->isCompositional_) {
auto compositionalEntries = std::vector<DataEntry>{};
{
// ZMF
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 (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]);
for (const auto& array: compositionalEntries) {
doInsert(array, data::TargetType::RESTART_SOLUTION);
}
// 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) {
@ -688,8 +695,8 @@ assignToSolution(data::Solution& sol)
std::move(this->saturation_[gasPhaseIdx]),
data::TargetType::RESTART_SOLUTION);
}
if (FluidSystem::phaseIsActive(oilPhaseIdx) &&
if (this->isCompositional_ && FluidSystem::phaseIsActive(oilPhaseIdx) &&
! this->saturation_[oilPhaseIdx].empty())
{
sol.insert("SOIL", UnitSystem::measure::identity,
@ -1519,24 +1526,26 @@ doAllocBuffers(const unsigned bufferSize,
overburdenPressure_.resize(bufferSize, 0.0);
}
if (rstKeywords["ZMF"] > 0) {
rstKeywords["ZMF"] = 0;
for (int i = 0; i < numComponents; ++i) {
moleFractions_[i].resize(bufferSize, 0.0);
if (this->isCompositional_) {
if (rstKeywords["ZMF"] > 0) {
rstKeywords["ZMF"] = 0;
for (int i = 0; i < numComponents; ++i) {
moleFractions_[i].resize(bufferSize, 0.0);
}
}
}
if (rstKeywords["XMF"] > 0 && FluidSystem::phaseIsActive(oilPhaseIdx)) {
rstKeywords["XMF"] = 0;
for (int i = 0; i < numComponents; ++i) {
phaseMoleFractions_[oilPhaseIdx][i].resize(bufferSize, 0.0);
if (rstKeywords["XMF"] > 0 && FluidSystem::phaseIsActive(oilPhaseIdx)) {
rstKeywords["XMF"] = 0;
for (int i = 0; i < numComponents; ++i) {
phaseMoleFractions_[oilPhaseIdx][i].resize(bufferSize, 0.0);
}
}
}
if (rstKeywords["YMF"] > 0 && FluidSystem::phaseIsActive(gasPhaseIdx)) {
rstKeywords["YMF"] = 0;
for (int i = 0; i < numComponents; ++i) {
phaseMoleFractions_[gasPhaseIdx][i].resize(bufferSize, 0.0);
if (rstKeywords["YMF"] > 0 && FluidSystem::phaseIsActive(gasPhaseIdx)) {
rstKeywords["YMF"] = 0;
for (int i = 0; i < numComponents; ++i) {
phaseMoleFractions_[gasPhaseIdx][i].resize(bufferSize, 0.0);
}
}
}

View File

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

View File

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