mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Pass RFT output via data::well
With this no cell data is used by the output code in opm-output
This commit is contained in:
parent
bbe2ae4a7b
commit
932527d772
@ -168,14 +168,36 @@ public:
|
||||
pressureTimesHydrocarbonVolume_.clear();
|
||||
}
|
||||
|
||||
// TODO: There seems to be an issue with mixing of RPTRST and RPTSCHED
|
||||
// keywords in restartConfig.
|
||||
// For now output basic fields for all ordinary steps
|
||||
outputRestart_ = false;
|
||||
if (substep)
|
||||
return;
|
||||
// Well RFT data
|
||||
if (!substep) {
|
||||
for ( const auto& well : simulator_.gridManager().schedule().getWells( reportStepNum )) {
|
||||
|
||||
outputRestart_ = true;
|
||||
// don't bother with wells not on this process
|
||||
const auto& defunct_well_names = simulator_.gridManager().defunctWellNames();
|
||||
if ( defunct_well_names.find(well->name()) != defunct_well_names.end() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !( well->getRFTActive( reportStepNum )
|
||||
|| well->getPLTActive( reportStepNum ) ) )
|
||||
continue;
|
||||
|
||||
for( const auto& completion : well->getCompletions( reportStepNum ) ) {
|
||||
const size_t i = size_t( completion.getI() );
|
||||
const size_t j = size_t( completion.getJ() );
|
||||
const size_t k = size_t( completion.getK() );
|
||||
const size_t index = simulator_.gridManager().eclState().getInputGrid().getGlobalIndex( i, j, k );
|
||||
|
||||
oilCompletionPressures_.emplace(std::make_pair(index, 0.0));
|
||||
waterCompletionSaturations_.emplace(std::make_pair(index, 0.0));
|
||||
gasCompletionSaturations_.emplace(std::make_pair(index, 0.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only provide restart on restart steps
|
||||
if (!restartConfig.getWriteRestartFile(reportStepNum) || substep)
|
||||
return;
|
||||
|
||||
// always output saturation of active phases
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
|
||||
@ -214,10 +236,6 @@ public:
|
||||
krnSwMdcGo_.resize(bufferSize,0.0);
|
||||
}
|
||||
|
||||
// Only provide restart on restart steps
|
||||
if (!restartConfig.getWriteRestartFile(reportStepNum) || substep)
|
||||
return;
|
||||
|
||||
if (FluidSystem::enableDissolvedGas() && rstKeywords["RSSAT"] > 0) {
|
||||
rstKeywords["RSSAT"] = 0;
|
||||
gasDissolutionFactor_.resize(bufferSize,0.0);
|
||||
@ -542,6 +560,17 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Adding Well RFT data
|
||||
if (oilCompletionPressures_.count(globalIdx) > 0) {
|
||||
oilCompletionPressures_[globalIdx] = Opm::getValue(fs.pressure(oilPhaseIdx));
|
||||
}
|
||||
if (waterCompletionSaturations_.count(globalIdx) > 0) {
|
||||
waterCompletionSaturations_[globalIdx] = Opm::getValue(fs.saturation(waterPhaseIdx));
|
||||
}
|
||||
if (gasCompletionSaturations_.count(globalIdx) > 0) {
|
||||
gasCompletionSaturations_[globalIdx] = Opm::getValue(fs.saturation(gasPhaseIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,6 +642,55 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void addRftDataToWells(Opm::data::Wells& wellDatas, size_t reportStepNum)
|
||||
{
|
||||
for ( const auto& well : simulator_.gridManager().schedule().getWells( reportStepNum )) {
|
||||
|
||||
// don't bother with wells not on this process
|
||||
const auto& defunct_well_names = simulator_.gridManager().defunctWellNames();
|
||||
if ( defunct_well_names.find(well->name()) != defunct_well_names.end() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//add data infrastructure for shut wells
|
||||
if (!wellDatas.count(well->name())){
|
||||
Opm::data::Well wellData;
|
||||
|
||||
if( !( well->getRFTActive( reportStepNum )
|
||||
|| well->getPLTActive( reportStepNum ) ) )
|
||||
continue;
|
||||
wellData.completions.resize(well->getCompletions( reportStepNum ).size());
|
||||
size_t count = 0;
|
||||
for( const auto& completion : well->getCompletions( reportStepNum ) ) {
|
||||
|
||||
const size_t i = size_t( completion.getI() );
|
||||
const size_t j = size_t( completion.getJ() );
|
||||
const size_t k = size_t( completion.getK() );
|
||||
|
||||
const size_t index = simulator_.gridManager().eclState().getInputGrid().getGlobalIndex( i, j, k );
|
||||
auto& completionData = wellData.completions[ count ];
|
||||
completionData.index = index;
|
||||
count++;
|
||||
}
|
||||
wellDatas.emplace( std::make_pair(well->name(),wellData) );
|
||||
}
|
||||
|
||||
Opm::data::Well& wellData = wellDatas.at(well->name());
|
||||
for (auto& completionData : wellData.completions) {
|
||||
const auto index = completionData.index;
|
||||
if (oilCompletionPressures_.count(index) > 0)
|
||||
completionData.cell_pressure = oilCompletionPressures_.at(index);
|
||||
if (waterCompletionSaturations_.count(index) > 0)
|
||||
completionData.cell_saturation_water = waterCompletionSaturations_.at(index);
|
||||
if (gasCompletionSaturations_.count(index) > 0)
|
||||
completionData.cell_saturation_gas = gasCompletionSaturations_.at(index);
|
||||
}
|
||||
}
|
||||
oilCompletionPressures_.clear();
|
||||
waterCompletionSaturations_.clear();
|
||||
gasCompletionSaturations_.clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Move all buffers to data::Solution.
|
||||
*/
|
||||
@ -969,11 +1047,6 @@ public:
|
||||
return blockValues_;
|
||||
}
|
||||
|
||||
const bool outputRestart() const {
|
||||
return outputRestart_;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool isIORank_() const
|
||||
@ -1232,7 +1305,6 @@ private:
|
||||
|
||||
const Simulator& simulator_;
|
||||
|
||||
bool outputRestart_;
|
||||
bool outputFipRestart_;
|
||||
bool computeFip_;
|
||||
|
||||
@ -1269,6 +1341,9 @@ private:
|
||||
ScalarBuffer pressureTimesPoreVolume_;
|
||||
ScalarBuffer pressureTimesHydrocarbonVolume_;
|
||||
std::map<std::pair<std::string, int>, double> blockValues_;
|
||||
std::map<size_t, Scalar> oilCompletionPressures_;
|
||||
std::map<size_t, Scalar> waterCompletionSaturations_;
|
||||
std::map<size_t, Scalar> gasCompletionSaturations_;
|
||||
};
|
||||
} // namespace Ewoms
|
||||
|
||||
|
@ -712,7 +712,7 @@ public:
|
||||
writeOutput(dw, t, false, totalSolverTime, nextstep, verbose);
|
||||
}
|
||||
|
||||
void writeOutput(const Opm::data::Wells& dw, Scalar t, bool substep, Scalar totalSolverTime, Scalar nextstep, bool verbose = true)
|
||||
void writeOutput(Opm::data::Wells& dw, Scalar t, bool substep, Scalar totalSolverTime, Scalar nextstep, bool verbose = true)
|
||||
{
|
||||
// use the generic code to prepare the output fields and to
|
||||
// write the desired VTK files.
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
/*!
|
||||
* \brief collect and pass data and pass it to eclIO writer
|
||||
*/
|
||||
void writeOutput(const Opm::data::Wells& localWellData, Scalar t, bool substep, Scalar totalSolverTime, Scalar nextstep)
|
||||
void writeOutput(Opm::data::Wells& localWellData, Scalar t, bool substep, Scalar totalSolverTime, Scalar nextstep)
|
||||
{
|
||||
#if !HAVE_OPM_OUTPUT
|
||||
throw std::runtime_error("opm-output must be available to write ECL output!");
|
||||
@ -173,9 +173,13 @@ public:
|
||||
|
||||
// collect all data to I/O rank and assign to sol
|
||||
Opm::data::Solution localCellData = {};
|
||||
if (eclOutputModule_.outputRestart())
|
||||
if (!substep)
|
||||
eclOutputModule_.assignToSolution(localCellData);
|
||||
|
||||
// add cell data to perforations for Rft output
|
||||
if (!substep)
|
||||
eclOutputModule_.addRftDataToWells(localWellData, episodeIdx);
|
||||
|
||||
if (collectToIORank_.isParallel())
|
||||
collectToIORank_.collect(localCellData, eclOutputModule_.getBlockValues(), localWellData);
|
||||
|
||||
@ -189,7 +193,7 @@ public:
|
||||
std::map<std::string, std::vector<double>> extraRestartData;
|
||||
|
||||
// Add suggested next timestep to extra data.
|
||||
if (eclOutputModule_.outputRestart())
|
||||
if (!substep)
|
||||
extraRestartData["OPMEXTRA"] = std::vector<double>(1, nextstep);
|
||||
|
||||
// Add TCPU
|
||||
|
Loading…
Reference in New Issue
Block a user