mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add CompositionalContainer, a container for compositional data output
start by moving data members into it
This commit is contained in:
@@ -90,6 +90,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/simulators/flow/BlackoilModelParameters.cpp
|
||||
opm/simulators/flow/BlackoilModelConvergenceMonitor.cpp
|
||||
opm/simulators/flow/CollectDataOnIORank.cpp
|
||||
opm/simulators/flow/CompositionalContainer.cpp
|
||||
opm/simulators/flow/ConvergenceOutputConfiguration.cpp
|
||||
opm/simulators/flow/EclGenericWriter.cpp
|
||||
opm/simulators/flow/ExtboContainer.cpp
|
||||
@@ -821,6 +822,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/simulators/flow/BlackoilModelProperties.hpp
|
||||
opm/simulators/flow/CollectDataOnIORank.hpp
|
||||
opm/simulators/flow/CollectDataOnIORank_impl.hpp
|
||||
opm/simulators/flow/CompositionalContainer.hpp
|
||||
opm/simulators/flow/ConvergenceOutputConfiguration.hpp
|
||||
opm/simulators/flow/countGlobalCells.hpp
|
||||
opm/simulators/flow/CpGridVanguard.hpp
|
||||
|
||||
29
opm/simulators/flow/CompositionalContainer.cpp
Normal file
29
opm/simulators/flow/CompositionalContainer.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// -*- 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/CompositionalContainer.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
} // namespace Opm
|
||||
52
opm/simulators/flow/CompositionalContainer.hpp
Normal file
52
opm/simulators/flow/CompositionalContainer.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
// -*- 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_COMPOSITIONAL_CONTAINER_HPP
|
||||
#define OPM_COMPOSITIONAL_CONTAINER_HPP
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class FluidSystem>
|
||||
class CompositionalContainer
|
||||
{
|
||||
using Scalar = typename FluidSystem::Scalar;
|
||||
using ScalarBuffer = std::vector<Scalar>;
|
||||
|
||||
static constexpr int numComponents = FluidSystem::numComponents;
|
||||
static constexpr int numPhases = FluidSystem::numPhases;
|
||||
|
||||
public:
|
||||
// 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_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_COMPOSITIONAL_CONTAINER_HPP
|
||||
@@ -536,21 +536,21 @@ assignToSolution(data::Solution& sol)
|
||||
// ZMF
|
||||
for (int i = 0; i < numComponents; ++i) {
|
||||
const auto name = fmt::format("ZMF{}", i + 1); // Generate ZMF1, ZMF2, ...
|
||||
compositionalEntries.emplace_back(name, UnitSystem::measure::identity, moleFractions_[i]);
|
||||
compositionalEntries.emplace_back(name, UnitSystem::measure::identity, compC_.moleFractions_[i]);
|
||||
}
|
||||
|
||||
// XMF
|
||||
for (int i = 0; i < numComponents; ++i) {
|
||||
const auto name = fmt::format("XMF{}", i + 1); // Generate XMF1, XMF2, ...
|
||||
compositionalEntries.emplace_back(name, UnitSystem::measure::identity,
|
||||
phaseMoleFractions_[oilPhaseIdx][i]);
|
||||
compC_.phaseMoleFractions_[oilPhaseIdx][i]);
|
||||
}
|
||||
|
||||
// YMF
|
||||
for (int i = 0; i < numComponents; ++i) {
|
||||
const auto name = fmt::format("YMF{}", i + 1); // Generate YMF1, YMF2, ...
|
||||
compositionalEntries.emplace_back(name, UnitSystem::measure::identity,
|
||||
phaseMoleFractions_[gasPhaseIdx][i]);
|
||||
compC_.phaseMoleFractions_[gasPhaseIdx][i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1297,21 +1297,21 @@ doAllocBuffers(const unsigned bufferSize,
|
||||
if (rstKeywords["ZMF"] > 0) {
|
||||
rstKeywords["ZMF"] = 0;
|
||||
for (int i = 0; i < numComponents; ++i) {
|
||||
moleFractions_[i].resize(bufferSize, 0.0);
|
||||
compC_.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);
|
||||
compC_.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);
|
||||
compC_.phaseMoleFractions_[gasPhaseIdx][i].resize(bufferSize, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
#include <opm/output/eclipse/Inplace.hpp>
|
||||
|
||||
#include <opm/simulators/flow/CompositionalContainer.hpp>
|
||||
#include <opm/simulators/flow/ExtboContainer.hpp>
|
||||
#include <opm/simulators/flow/FIPContainer.hpp>
|
||||
#include <opm/simulators/flow/FlowsData.hpp>
|
||||
@@ -468,10 +469,7 @@ protected:
|
||||
std::array<ScalarBuffer, numPhases> viscosity_;
|
||||
std::array<ScalarBuffer, numPhases> relativePermeability_;
|
||||
|
||||
// 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_;
|
||||
CompositionalContainer<FluidSystem> compC_;
|
||||
std::vector<ScalarBuffer> freeTracerConcentrations_;
|
||||
std::vector<ScalarBuffer> solTracerConcentrations_;
|
||||
|
||||
|
||||
@@ -32,12 +32,16 @@
|
||||
#include <opm/simulators/utils/moduleVersion.hpp>
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/TimingMacros.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
|
||||
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilproperties.hh>
|
||||
#include <opm/models/common/multiphasebaseproperties.hh>
|
||||
#include <opm/models/utils/parametersystem.hpp>
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
@@ -188,19 +192,19 @@ public:
|
||||
}
|
||||
|
||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
||||
if (this->moleFractions_[compIdx].empty()) continue;
|
||||
if (this->compC_.moleFractions_[compIdx].empty()) continue;
|
||||
|
||||
this->moleFractions_[compIdx][globalDofIdx] = getValue(fs.moleFraction(compIdx));
|
||||
this->compC_.moleFractions_[compIdx][globalDofIdx] = getValue(fs.moleFraction(compIdx));
|
||||
}
|
||||
// XMF and YMF
|
||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
|
||||
if (this->phaseMoleFractions_[oilPhaseIdx][compIdx].empty()) continue;
|
||||
this->phaseMoleFractions_[oilPhaseIdx][compIdx][globalDofIdx] = getValue(fs.moleFraction(oilPhaseIdx, compIdx));
|
||||
if (this->compC_.phaseMoleFractions_[oilPhaseIdx][compIdx].empty()) continue;
|
||||
this->compC_.phaseMoleFractions_[oilPhaseIdx][compIdx][globalDofIdx] = getValue(fs.moleFraction(oilPhaseIdx, compIdx));
|
||||
}
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
||||
if (this->phaseMoleFractions_[gasPhaseIdx][compIdx].empty()) continue;
|
||||
this->phaseMoleFractions_[gasPhaseIdx][compIdx][globalDofIdx] = getValue(fs.moleFraction(gasPhaseIdx, compIdx));
|
||||
if (this->compC_.phaseMoleFractions_[gasPhaseIdx][compIdx].empty()) continue;
|
||||
this->compC_.phaseMoleFractions_[gasPhaseIdx][compIdx][globalDofIdx] = getValue(fs.moleFraction(gasPhaseIdx, compIdx));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user