addressing reviewing comments

This commit is contained in:
Kai Bao
2024-10-30 10:20:13 +01:00
parent 56db6ad3fe
commit c6201e9b6a
4 changed files with 15 additions and 11 deletions

View File

@@ -504,9 +504,11 @@ private:
Dune::FieldVector<Scalar, numComponents> z(0.0);
Scalar sumMoles = 0.0;
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
const auto saturation = getValue(fs.saturation(phaseIdx));
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
Scalar tmp = Opm::getValue(fs.molarity(phaseIdx, compIdx) * fs.saturation(phaseIdx));
z[compIdx] += Opm::max(tmp, 1e-8);
Scalar tmp = getValue(fs.molarity(phaseIdx, compIdx)) * saturation;
tmp = max(tmp, 1.e-8);
z[compIdx] += tmp;
sumMoles += tmp;
}
}

View File

@@ -252,7 +252,7 @@ public:
const bool isSubStep = !this->simulator().episodeWillBeOver();
// after the solution is updated, the values in output module needs also updated
// after the solution is updated, the values in output module also needs to be updated
this->eclWriter_->mutableOutputModule().invalidateLocalData();
// For CpGrid with LGRs, ecl/vtk output is not supported yet.
@@ -365,9 +365,11 @@ public:
Dune::FieldVector<Scalar, numComponents> z(0.0);
Scalar sumMoles = 0.0;
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
const auto saturation = getValue(fs.saturation(phaseIdx));
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
Scalar tmp = Opm::getValue(fs.molarity(phaseIdx, compIdx) * fs.saturation(phaseIdx));
z[compIdx] += Opm::max(tmp, 1e-8);
Scalar tmp = getValue(fs.molarity(phaseIdx, compIdx)) * saturation;
tmp = max(tmp, 1e-8);
z[compIdx] += tmp;
sumMoles += tmp;
}
}
@@ -593,10 +595,10 @@ private:
std::vector<InitialFluidState> initialFluidStates_;
bool enableEclOutput_;
bool enableEclOutput_{false};
std::unique_ptr<EclWriterType> eclWriter_;
bool enableVtkOutput_;
bool enableVtkOutput_{false};
};
} // namespace Opm

View File

@@ -636,20 +636,20 @@ assignToSolution(data::Solution& sol)
{
// ZMF
for (int i = 0; i < numComponents; ++i) {
const std::string name = "ZMF" + std::to_string(i + 1); // Generate ZMF1, ZMF2, ...
const auto name = fmt::format("ZMF{}", 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, ...
const auto name = fmt::format("XMF{}", 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, ...
const auto name = fmt::format("YMF{}", i + 1); // Generate YMF1, YMF2, ...
compositionalEntries.emplace_back(name, UnitSystem::measure::identity,
phaseMoleFractions_[gasPhaseIdx][i]);
}

View File

@@ -541,7 +541,7 @@ protected:
std::array<ScalarBuffer, numPhases> viscosity_;
std::array<ScalarBuffer, numPhases> relativePermeability_;
// totoal mole fractions for each component
// total mole fractions for each component
std::array<ScalarBuffer, numComponents> moleFractions_;
// mole fractions for each component in each phase
std::array<std::array<ScalarBuffer, numComponents>, numPhases> phaseMoleFractions_;