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