mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add TracerContainer, a container for tracer data output
start by moving data members into it
This commit is contained in:
parent
c015df56f9
commit
13fb52bf9e
@ -120,6 +120,7 @@ list (APPEND MAIN_SOURCE_FILES
|
|||||||
opm/simulators/flow/SimulatorReportBanners.cpp
|
opm/simulators/flow/SimulatorReportBanners.cpp
|
||||||
opm/simulators/flow/SimulatorSerializer.cpp
|
opm/simulators/flow/SimulatorSerializer.cpp
|
||||||
opm/simulators/flow/SolutionContainers.cpp
|
opm/simulators/flow/SolutionContainers.cpp
|
||||||
|
opm/simulators/flow/TracerContainer.cpp
|
||||||
opm/simulators/flow/Transmissibility.cpp
|
opm/simulators/flow/Transmissibility.cpp
|
||||||
opm/simulators/flow/ValidationFunctions.cpp
|
opm/simulators/flow/ValidationFunctions.cpp
|
||||||
opm/simulators/flow/equil/EquilibrationHelpers.cpp
|
opm/simulators/flow/equil/EquilibrationHelpers.cpp
|
||||||
@ -880,6 +881,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
|||||||
opm/simulators/flow/SolutionContainers.hpp
|
opm/simulators/flow/SolutionContainers.hpp
|
||||||
opm/simulators/flow/SubDomain.hpp
|
opm/simulators/flow/SubDomain.hpp
|
||||||
opm/simulators/flow/TTagFlowProblemTPFA.hpp
|
opm/simulators/flow/TTagFlowProblemTPFA.hpp
|
||||||
|
opm/simulators/flow/TracerContainer.hpp
|
||||||
opm/simulators/flow/TracerModel.hpp
|
opm/simulators/flow/TracerModel.hpp
|
||||||
opm/simulators/flow/Transmissibility.hpp
|
opm/simulators/flow/Transmissibility.hpp
|
||||||
opm/simulators/flow/Transmissibility_impl.hpp
|
opm/simulators/flow/Transmissibility_impl.hpp
|
||||||
|
@ -631,40 +631,40 @@ assignToSolution(data::Solution& sol)
|
|||||||
this->fipC_.outputRestart(sol);
|
this->fipC_.outputRestart(sol);
|
||||||
|
|
||||||
// Tracers
|
// Tracers
|
||||||
if (! this->freeTracerConcentrations_.empty()) {
|
if (! this->tracerC_.freeConcentrations_.empty()) {
|
||||||
const auto& tracers = this->eclState_.tracer();
|
const auto& tracers = this->eclState_.tracer();
|
||||||
for (auto tracerIdx = 0*tracers.size();
|
for (auto tracerIdx = 0*tracers.size();
|
||||||
tracerIdx < tracers.size(); ++tracerIdx)
|
tracerIdx < tracers.size(); ++tracerIdx)
|
||||||
{
|
{
|
||||||
sol.insert(tracers[tracerIdx].fname(),
|
sol.insert(tracers[tracerIdx].fname(),
|
||||||
UnitSystem::measure::identity,
|
UnitSystem::measure::identity,
|
||||||
std::move(freeTracerConcentrations_[tracerIdx]),
|
std::move(this->tracerC_.freeConcentrations_[tracerIdx]),
|
||||||
data::TargetType::RESTART_TRACER_SOLUTION);
|
data::TargetType::RESTART_TRACER_SOLUTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put freeTracerConcentrations container into a valid state. Otherwise
|
// Put freeTracerConcentrations container into a valid state. Otherwise
|
||||||
// we'll move from vectors that have already been moved from if we
|
// we'll move from vectors that have already been moved from if we
|
||||||
// get here and it's not a restart step.
|
// get here and it's not a restart step.
|
||||||
this->freeTracerConcentrations_.clear();
|
this->tracerC_.freeConcentrations_.clear();
|
||||||
}
|
}
|
||||||
if (! this->solTracerConcentrations_.empty()) {
|
if (! this->tracerC_.solConcentrations_.empty()) {
|
||||||
const auto& tracers = this->eclState_.tracer();
|
const auto& tracers = this->eclState_.tracer();
|
||||||
for (auto tracerIdx = 0*tracers.size();
|
for (auto tracerIdx = 0*tracers.size();
|
||||||
tracerIdx < tracers.size(); ++tracerIdx)
|
tracerIdx < tracers.size(); ++tracerIdx)
|
||||||
{
|
{
|
||||||
if (solTracerConcentrations_[tracerIdx].empty())
|
if (this->tracerC_.solConcentrations_[tracerIdx].empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sol.insert(tracers[tracerIdx].sname(),
|
sol.insert(tracers[tracerIdx].sname(),
|
||||||
UnitSystem::measure::identity,
|
UnitSystem::measure::identity,
|
||||||
std::move(solTracerConcentrations_[tracerIdx]),
|
std::move(this->tracerC_.solConcentrations_[tracerIdx]),
|
||||||
data::TargetType::RESTART_TRACER_SOLUTION);
|
data::TargetType::RESTART_TRACER_SOLUTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put solTracerConcentrations container into a valid state. Otherwise
|
// Put solTracerConcentrations container into a valid state. Otherwise
|
||||||
// we'll move from vectors that have already been moved from if we
|
// we'll move from vectors that have already been moved from if we
|
||||||
// get here and it's not a restart step.
|
// get here and it's not a restart step.
|
||||||
this->solTracerConcentrations_.clear();
|
this->tracerC_.solConcentrations_.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1221,16 +1221,16 @@ doAllocBuffers(const unsigned bufferSize,
|
|||||||
|
|
||||||
// tracers
|
// tracers
|
||||||
if (numTracers > 0) {
|
if (numTracers > 0) {
|
||||||
freeTracerConcentrations_.resize(numTracers);
|
tracerC_.freeConcentrations_.resize(numTracers);
|
||||||
for (unsigned tracerIdx = 0; tracerIdx < numTracers; ++tracerIdx)
|
for (unsigned tracerIdx = 0; tracerIdx < numTracers; ++tracerIdx)
|
||||||
{
|
{
|
||||||
freeTracerConcentrations_[tracerIdx].resize(bufferSize, 0.0);
|
tracerC_.freeConcentrations_[tracerIdx].resize(bufferSize, 0.0);
|
||||||
}
|
}
|
||||||
solTracerConcentrations_.resize(numTracers);
|
tracerC_.solConcentrations_.resize(numTracers);
|
||||||
for (unsigned tracerIdx = 0; tracerIdx < numTracers; ++tracerIdx)
|
for (unsigned tracerIdx = 0; tracerIdx < numTracers; ++tracerIdx)
|
||||||
{
|
{
|
||||||
if (enableSolTracers[tracerIdx])
|
if (enableSolTracers[tracerIdx])
|
||||||
solTracerConcentrations_[tracerIdx].resize(bufferSize, 0.0);
|
tracerC_.solConcentrations_[tracerIdx].resize(bufferSize, 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <opm/simulators/flow/MechContainer.hpp>
|
#include <opm/simulators/flow/MechContainer.hpp>
|
||||||
#include <opm/simulators/flow/MICPContainer.hpp>
|
#include <opm/simulators/flow/MICPContainer.hpp>
|
||||||
#include <opm/simulators/flow/RegionPhasePVAverage.hpp>
|
#include <opm/simulators/flow/RegionPhasePVAverage.hpp>
|
||||||
|
#include <opm/simulators/flow/TracerContainer.hpp>
|
||||||
|
|
||||||
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
||||||
|
|
||||||
@ -330,7 +331,7 @@ protected:
|
|||||||
const bool enablePCHysteresis = false,
|
const bool enablePCHysteresis = false,
|
||||||
const bool enableNonWettingHysteresis = false,
|
const bool enableNonWettingHysteresis = false,
|
||||||
const bool enableWettingHysteresis = false,
|
const bool enableWettingHysteresis = false,
|
||||||
unsigned numTracers = 0,
|
const unsigned numTracers = 0,
|
||||||
const std::vector<bool>& enableSolTracers = {},
|
const std::vector<bool>& enableSolTracers = {},
|
||||||
unsigned numOutputNnc = 0,
|
unsigned numOutputNnc = 0,
|
||||||
std::map<std::string, int> rstKeywords = {});
|
std::map<std::string, int> rstKeywords = {});
|
||||||
@ -467,8 +468,7 @@ protected:
|
|||||||
std::array<ScalarBuffer, numPhases> viscosity_;
|
std::array<ScalarBuffer, numPhases> viscosity_;
|
||||||
std::array<ScalarBuffer, numPhases> relativePermeability_;
|
std::array<ScalarBuffer, numPhases> relativePermeability_;
|
||||||
|
|
||||||
std::vector<ScalarBuffer> freeTracerConcentrations_;
|
TracerContainer<FluidSystem> tracerC_;
|
||||||
std::vector<ScalarBuffer> solTracerConcentrations_;
|
|
||||||
|
|
||||||
std::array<ScalarBuffer, numPhases> residual_;
|
std::array<ScalarBuffer, numPhases> residual_;
|
||||||
|
|
||||||
|
@ -647,21 +647,21 @@ public:
|
|||||||
|
|
||||||
// tracers
|
// tracers
|
||||||
const auto& tracerModel = simulator_.problem().tracerModel();
|
const auto& tracerModel = simulator_.problem().tracerModel();
|
||||||
if (! this->freeTracerConcentrations_.empty()) {
|
if (! this->tracerC_.freeConcentrations_.empty()) {
|
||||||
for (int tracerIdx = 0; tracerIdx < tracerModel.numTracers(); ++tracerIdx) {
|
for (int tracerIdx = 0; tracerIdx < tracerModel.numTracers(); ++tracerIdx) {
|
||||||
if (this->freeTracerConcentrations_[tracerIdx].empty()) {
|
if (this->tracerC_.freeConcentrations_[tracerIdx].empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this->freeTracerConcentrations_[tracerIdx][globalDofIdx] =
|
this->tracerC_.freeConcentrations_[tracerIdx][globalDofIdx] =
|
||||||
tracerModel.freeTracerConcentration(tracerIdx, globalDofIdx);
|
tracerModel.freeTracerConcentration(tracerIdx, globalDofIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! this->solTracerConcentrations_.empty()) {
|
if (! this->tracerC_.solConcentrations_.empty()) {
|
||||||
for (int tracerIdx = 0; tracerIdx < tracerModel.numTracers(); ++tracerIdx) {
|
for (int tracerIdx = 0; tracerIdx < tracerModel.numTracers(); ++tracerIdx) {
|
||||||
if (this->solTracerConcentrations_[tracerIdx].empty()) {
|
if (this->tracerC_.solConcentrations_[tracerIdx].empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this->solTracerConcentrations_[tracerIdx][globalDofIdx] =
|
this->tracerC_.solConcentrations_[tracerIdx][globalDofIdx] =
|
||||||
tracerModel.solTracerConcentration(tracerIdx, globalDofIdx);
|
tracerModel.solTracerConcentration(tracerIdx, globalDofIdx);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
28
opm/simulators/flow/TracerContainer.cpp
Normal file
28
opm/simulators/flow/TracerContainer.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// -*- 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/TracerContainer.hpp>
|
||||||
|
|
||||||
|
namespace Opm {
|
||||||
|
|
||||||
|
} // namespace Opm
|
46
opm/simulators/flow/TracerContainer.hpp
Normal file
46
opm/simulators/flow/TracerContainer.hpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// -*- 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_TRACER_CONTAINER_HPP
|
||||||
|
#define OPM_TRACER_CONTAINER_HPP
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Opm {
|
||||||
|
|
||||||
|
template<class FluidSystem>
|
||||||
|
class TracerContainer
|
||||||
|
{
|
||||||
|
using Scalar = typename FluidSystem::Scalar;
|
||||||
|
using ScalarBuffer = std::vector<Scalar>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::vector<ScalarBuffer> freeConcentrations_;
|
||||||
|
std::vector<ScalarBuffer> solConcentrations_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Opm
|
||||||
|
|
||||||
|
#endif // OPM_TRACER_CONTAINER_HPP
|
Loading…
Reference in New Issue
Block a user