mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2496 from akva2/tracers_from_state
Use tracers from EclipseState
This commit is contained in:
commit
54cd4f96f7
@ -28,7 +28,7 @@
|
||||
#ifndef EWOMS_ECL_TRACER_MODEL_HH
|
||||
#define EWOMS_ECL_TRACER_MODEL_HH
|
||||
|
||||
#include "tracervdtable.hh"
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/TracerVdTable.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilmodel.hh>
|
||||
|
||||
@ -95,15 +95,10 @@ public:
|
||||
*/
|
||||
void init()
|
||||
{
|
||||
const Opm::Deck& deck = simulator_.vanguard().deck();
|
||||
const auto& tracers = simulator_.vanguard().eclState().tracer();
|
||||
const auto& comm = simulator_.gridView().comm();
|
||||
|
||||
bool has;
|
||||
if (comm.rank() == 0)
|
||||
has = deck.hasKeyword("TRACERS");
|
||||
comm.broadcast(&has, 1, 0);
|
||||
|
||||
if (!has)
|
||||
if (tracers.size() == 0)
|
||||
return; // tracer treatment is supposed to be disabled
|
||||
|
||||
if (!EWOMS_GET_PARAM(TypeTag, bool, EnableTracerModel)) {
|
||||
@ -115,19 +110,16 @@ public:
|
||||
return; // Tracer transport must be enabled by the user
|
||||
}
|
||||
|
||||
if (!deck.hasKeyword("TRACER"))
|
||||
throw std::runtime_error("The deck does not contain the TRACER keyword");
|
||||
|
||||
if (simulator_.gridView().comm().size() > 1) {
|
||||
if (comm.size() > 1) {
|
||||
tracerNames_.resize(0);
|
||||
if (simulator_.gridView().comm().rank() == 0)
|
||||
if (comm.rank() == 0)
|
||||
std::cout << "Warning: The tracer model currently does not work for parallel runs\n"
|
||||
<< std::flush;
|
||||
return;
|
||||
}
|
||||
|
||||
// retrieve the number of tracers from the deck
|
||||
const int numTracers = deck.getKeyword("TRACER").size();
|
||||
const size_t numTracers = tracers.size();
|
||||
tracerNames_.resize(numTracers);
|
||||
tracerConcentration_.resize(numTracers);
|
||||
storageOfTimeIndex1_.resize(numTracers);
|
||||
@ -135,60 +127,44 @@ public:
|
||||
// the phase where the tracer is
|
||||
tracerPhaseIdx_.resize(numTracers);
|
||||
size_t numGridDof = simulator_.model().numGridDof();
|
||||
for (int tracerIdx = 0; tracerIdx < numTracers; ++tracerIdx) {
|
||||
const auto& tracerRecord = deck.getKeyword("TRACER").getRecord(tracerIdx);
|
||||
tracerNames_[tracerIdx] = tracerRecord.getItem("NAME").template get<std::string>(0);
|
||||
const std::string& fluidName = tracerRecord.getItem("FLUID").template get<std::string>(0);
|
||||
if (fluidName == "WAT")
|
||||
size_t tracerIdx = 0;
|
||||
for (const auto& tracer : tracers) {
|
||||
tracerNames_[tracerIdx] = tracer.name;
|
||||
if (tracer.phase == Phase::WATER)
|
||||
tracerPhaseIdx_[tracerIdx] = waterPhaseIdx;
|
||||
else if (fluidName == "OIL")
|
||||
else if (tracer.phase == Phase::OIL)
|
||||
tracerPhaseIdx_[tracerIdx] = oilPhaseIdx;
|
||||
else if (fluidName == "GAS")
|
||||
else if (tracer.phase == Phase::GAS)
|
||||
tracerPhaseIdx_[tracerIdx] = gasPhaseIdx;
|
||||
else
|
||||
throw std::invalid_argument("Tracer: invalid fluid name "
|
||||
+fluidName+" for "+tracerNames_[tracerIdx]);
|
||||
|
||||
tracerConcentration_[tracerIdx].resize(numGridDof);
|
||||
storageOfTimeIndex1_[tracerIdx].resize(numGridDof);
|
||||
std::string tmp = "TVDPF" +tracerNames_[tracerIdx];
|
||||
|
||||
|
||||
//TBLK keyword
|
||||
if (deck.hasKeyword("TBLKF" +tracerNames_[tracerIdx])){
|
||||
if (!tracer.concentration.empty()){
|
||||
const auto& cartMapper = simulator_.vanguard().cartesianIndexMapper();
|
||||
const auto& tblkData =
|
||||
deck.getKeyword("TBLKF"
|
||||
+tracerNames_
|
||||
[tracerIdx]).getRecord(0).getItem(0).getSIDoubleData();
|
||||
int tblkDatasize = tblkData.size();
|
||||
int tblkDatasize = tracer.concentration.size();
|
||||
if (tblkDatasize < simulator_.vanguard().cartesianSize()){
|
||||
throw std::runtime_error("Uninitialized tracer concentration (TBLKF) for tracer "
|
||||
+ tracerName(tracerIdx));
|
||||
throw std::runtime_error("Wrong size of TBLK for" + tracer.name);
|
||||
}
|
||||
for (size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx){
|
||||
int cartDofIdx = cartMapper.cartesianIndex(globalDofIdx);
|
||||
tracerConcentration_[tracerIdx][globalDofIdx] = tblkData[cartDofIdx];
|
||||
tracerConcentration_[tracerIdx][globalDofIdx] = tracer.concentration[cartDofIdx];
|
||||
}
|
||||
}
|
||||
//TVDPF keyword
|
||||
else if (deck.hasKeyword(tmp)){
|
||||
TracerVdTable dtable(deck.getKeyword(tmp).getRecord(0).getItem(0));
|
||||
else {
|
||||
const auto& eclGrid = simulator_.vanguard().eclState().getInputGrid();
|
||||
const auto& cartMapper = simulator_.vanguard().cartesianIndexMapper();
|
||||
|
||||
for (size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx){
|
||||
int cartDofIdx = cartMapper.cartesianIndex(globalDofIdx);
|
||||
const auto& center = eclGrid.getCellCenter(cartDofIdx);
|
||||
tracerConcentration_[tracerIdx][globalDofIdx]
|
||||
= dtable.evaluate("TRACER_CONCENTRATION", center[2]);
|
||||
tracerConcentration_[tracerIdx][globalDofIdx] = tracer.tvdpf.evaluate("TRACER_CONCENTRATION", center[2]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error("Uninitialized tracer concentration for tracer "
|
||||
+ tracerName(tracerIdx));
|
||||
}
|
||||
|
||||
++tracerIdx;
|
||||
}
|
||||
|
||||
// initial tracer concentration
|
||||
|
@ -1,65 +0,0 @@
|
||||
// -*- 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::TracerVdTable
|
||||
*/
|
||||
#ifndef EWOMS_TRACER_VD_TABLE_HH
|
||||
#define EWOMS_TRACER_VD_TABLE_HH
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
* \brief A class that contains tracer concentration vs depth table
|
||||
*/
|
||||
class TracerVdTable : public Opm::SimpleTable
|
||||
{
|
||||
public:
|
||||
TracerVdTable(const Opm::DeckItem& item)
|
||||
{
|
||||
this->m_schema.addColumn(Opm::ColumnSchema("DEPTH", Opm::Table::STRICTLY_INCREASING, Opm::Table::DEFAULT_NONE));
|
||||
this->m_schema.addColumn(Opm::ColumnSchema("TRACER_CONCENTRATION", Opm::Table::RANDOM, Opm::Table::DEFAULT_NONE));
|
||||
|
||||
Opm::SimpleTable::init(item);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Return the depth column
|
||||
*/
|
||||
const Opm::TableColumn& getDepthColumn() const
|
||||
{ return Opm::SimpleTable::getColumn(0); }
|
||||
|
||||
/*!
|
||||
* \brief Return the tracer concentration column
|
||||
*/
|
||||
const Opm::TableColumn& getTracerConcentration() const
|
||||
{ return Opm::SimpleTable::getColumn(1); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // TRACERVDTABLE_HH
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/TracerConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
|
||||
@ -426,6 +427,7 @@ TEST_FOR_TYPE(TableManager)
|
||||
TEST_FOR_TYPE(TableSchema)
|
||||
TEST_FOR_TYPE(ThresholdPressure)
|
||||
TEST_FOR_TYPE(TimeMap)
|
||||
TEST_FOR_TYPE(TracerConfig)
|
||||
TEST_FOR_TYPE(TransMult)
|
||||
TEST_FOR_TYPE(Tuning)
|
||||
TEST_FOR_TYPE(UDAValue)
|
||||
|
Loading…
Reference in New Issue
Block a user